author | ecalot
<ecalot> 2006-06-24 02:41:23 UTC |
committer | ecalot
<ecalot> 2006-06-24 02:41:23 UTC |
parent | ac7924d2dce39459d5102ad46de66607266b1943 |
PR/doc/changelog.txt | +1 | -2 |
PR/doc/readme.coders.txt | +1 | -1 |
PR/doc/readme.txt | +1 | -1 |
PR/src/addons/cpp/xml.h | +5 | -5 |
PR/src/include/compress.h | +0 | -8 |
PR/src/include/other.h | +2 | -2 |
PR/src/include/sound.h | +9 | -9 |
PR/src/include/types.h | +6 | -6 |
PR/src/lib/formats/bmp.c | +7 | -7 |
PR/src/lib/formats/pal.c | +2 | -2 |
PR/src/lib/layers/stringflag.c | +1 | -1 |
PR/src/lib/object/object.c | +14 | -16 |
PR/src/lib/object/other/binary.c | +2 | -2 |
PR/src/lib/object/sound/sound_common.c | +5 | -5 |
PR/src/ports/winfiles/pr.dev | +12 | -12 |
diff --git a/PR/doc/changelog.txt b/PR/doc/changelog.txt index 8d87b9c..13f5b43 100644 --- a/PR/doc/changelog.txt +++ b/PR/doc/changelog.txt @@ -1,9 +1,8 @@ -Princed Resources v1.2 +Princed Resources v1.3 (c) Copyright 2003-2006, Princed Development Team http://www.princed.com.ar This program is open source under the GNU General Public License terms - 1) Change Log Legend: + Format discovery first implementation diff --git a/PR/doc/readme.coders.txt b/PR/doc/readme.coders.txt index 270cf73..b5404b1 100644 --- a/PR/doc/readme.coders.txt +++ b/PR/doc/readme.coders.txt @@ -1,4 +1,4 @@ -Princed Resources V1.0 +Princed Resources V1.3 (c) Copyright 2003, 2004, 2005, 2006 - Princed Development Team http://www.princed.com.ar This program is open source under the GNU General Public License terms diff --git a/PR/doc/readme.txt b/PR/doc/readme.txt index 5cc23cd..0b437e2 100644 --- a/PR/doc/readme.txt +++ b/PR/doc/readme.txt @@ -1,4 +1,4 @@ -Princed Resources v1.1 +Princed Resources v1.3 (c) Copyright 2003 - 2006 - Princed Development Team http://www.princed.com.ar This program is open source under the GNU General Public License terms diff --git a/PR/src/addons/cpp/xml.h b/PR/src/addons/cpp/xml.h index 964f9f5..29519d2 100644 --- a/PR/src/addons/cpp/xml.h +++ b/PR/src/addons/cpp/xml.h @@ -1,5 +1,5 @@ -#ifndef _XML_H_ -#define _XML_H_ +#ifndef _PR_XML_H_ +#define _PR_XML_H_ /* types */ @@ -18,13 +18,13 @@ class Xml { void optimize(TagReference t); void optimize(); // POST: all TagReferences becomes invalid - + int getTag (TagReference t, char** tag, char** desc, char** path, char** file, char** type, char** name, char** palette, char** value, char** version, char** number,char** colors); int setTag (TagReference t, const char* tag, const char* desc, const char* path, const char* file, const char* type, const char* name, const char* palette, const char* value, const char* version, const char* number,const char* colors); - - + + private: void* structure; diff --git a/PR/src/include/compress.h b/PR/src/include/compress.h index 3ab4234..7bbf31c 100644 --- a/PR/src/include/compress.h +++ b/PR/src/include/compress.h @@ -44,12 +44,6 @@ compress.h: Princed Resources : Compression headers #define COMPRESS_WORKING_ALGORITHMS 5 -/* -#define COMPRESS_RESULT_FATAL PR_RESULT_COMPRESS_RESULT_FATAL -#define COMPRESS_RESULT_WARNING PR_RESULT_COMPRESS_RESULT_WARNING -#define COMPRESS_RESULT_SUCCESS PR_RESULT_SUCCESS -*/ - /* Prototypes */ #define cLevel(a) if (compressionLevel>=a) @@ -57,8 +51,6 @@ compress.h: Princed Resources : Compression headers #define setHigh compressionHigher=1 #define unsetHigh compressionHigher=0 -/* private declarations */ - /***************************************************************\ | Internal compression prototypes | \***************************************************************/ diff --git a/PR/src/include/other.h b/PR/src/include/other.h index 499b94f..4b843fb 100644 --- a/PR/src/include/other.h +++ b/PR/src/include/other.h @@ -37,8 +37,8 @@ other.h: Princed Resources : Other objects headers void* objectBinaryCreate(tBinary c, int *error); int objectBinaryWrite(void* o, const char* file, int optionflag, const char* backupExtension); -void* objBinaryRead(const char* file,int *result); -int objBinarySet(void* o,tResource* res); +void* objectOtherBinaryRead(const char* file,int *result); +int objectOtherBinarySet(void* o,tResource* res); /* TODO: move to level.h */ diff --git a/PR/src/include/sound.h b/PR/src/include/sound.h index c5f1eb5..73ea623 100644 --- a/PR/src/include/sound.h +++ b/PR/src/include/sound.h @@ -43,24 +43,24 @@ sound.h: Princed Resources : void* objSoundCreate(tBinary c, int *error); -int objWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension); +int objectSoundWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension); #define objectSoundWaveCreate(a,b) objSoundCreate(a,b) #define objectSoundMidiCreate(a,b) objSoundCreate(a,b) #define objectSoundPcspeakerCreate(a,b) objSoundCreate(a,b) -/*#define objWaveRead(a,b,c,d,e) objSoundRead(a,readWav,b,c,d,e)*/ +/*#define objectSoundWaveRead(a,b,c,d,e) objSoundRead(a,readWav,b,c,d,e)*/ /*void* objSoundRead(const char* file, int read(const char* file, tBinary* c, int *pchannels, long *psamplerate, long *pbps), int *result);*/ -void* objWaveRead(const char* file, int *result); -#define objMidiRead(a,b) objBinaryRead(a,b) -#define objPcspeakerRead(a,b) objBinaryRead(a,b) +void* objectSoundWaveRead(const char* file, int *result); +#define objectSoundMidiRead(a,b) objectOtherBinaryRead(a,b) +#define objectSoundPcspeakerRead(a,b) objectOtherBinaryRead(a,b) -int objWaveSet(void* o,tResource* res); -int objPcspeakerSet(void* o,tResource* res); -int objMidiSet(void* o,tResource* res); +int objectSoundWaveSet(void* o,tResource* res); +int objectSoundPcspeakerSet(void* o,tResource* res); +int objectSoundMidiSet(void* o,tResource* res); -#define objMidiWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) +#define objectSoundMidiWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) #define objectSoundPcspeakerWrite(a,b,c,d) objectBinaryWrite(a,b,c,d) #endif diff --git a/PR/src/include/types.h b/PR/src/include/types.h index 8ec0b56..0ef12d4 100644 --- a/PR/src/include/types.h +++ b/PR/src/include/types.h @@ -38,16 +38,16 @@ types.h: Princed Resources : Common types #include "common.h" /* tResourceType */ /* types */ -typedef struct { - tResourceType type; - void* obj; -}tObject; +typedef struct { + tResourceType type; + void* obj; +} tObject; typedef struct { int value; char index[5]; unsigned int order; -}tResourceId; +} tResourceId; typedef struct { tResourceId id; @@ -63,6 +63,6 @@ typedef struct { const char* datfile; const char* datAuthor; unsigned long flags; -}tResource; +} tResource; #endif diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c index 72ccb8c..c28625a 100644 --- a/PR/src/lib/formats/bmp.c +++ b/PR/src/lib/formats/bmp.c @@ -108,7 +108,7 @@ int mWriteBmp(const char* file,const unsigned char* data, int w, int h, int bits } writeCloseOk(bitmap,optionflag,backupExtension); - return PR_RESULT_SUCCESS; + return PR_RESULT_SUCCESS; } int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbits, int *pcolors, tColor** colorArray, int *plineWidth) { @@ -127,7 +127,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit unsigned short int width=0; bitmap=fopen(file,"rb"); - if (!bitmap) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!bitmap) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* Read headers */ /* file header */ @@ -137,7 +137,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit ok=ok&&freadlong(&aux ,bitmap); ok=ok&&(!aux); ok=ok&&freadlong(&offset ,bitmap); - + /* info header */ ok=ok&&freadlong(&aux ,bitmap); ok=ok&&(aux==40); @@ -154,7 +154,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit ok=ok&&freadlong(&colours ,bitmap); /* Number of colours (junk) */ ok=ok&&(colours<1000); ok=ok&&freadlong(&aux ,bitmap); /* Important colours (junk) */ - + /* Verify */ *plineWidth=(width*bits+7)/8; /* Note: only works in bits=1,2,4,8 */ lineSerialization=(-*plineWidth)&3; @@ -180,7 +180,7 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit ok=ok&&fread(*data+height**plineWidth,*plineWidth,1,bitmap); if (lineSerialization) ok=ok&&fread(&aux,lineSerialization,1,bitmap); } - + #if 0 /* Validate if there is header and if it starts in BM */ ok = size>50; @@ -228,9 +228,9 @@ int readBmp(const char* file, unsigned char** data, int *ph, int *pw, int *pbit free(*data); return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: use a bad format code */ } - + *pbits = bits; *pcolors = colours; - return PR_RESULT_SUCCESS; + return PR_RESULT_SUCCESS; } diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c index d5974f2..eece13b 100644 --- a/PR/src/lib/formats/pal.c +++ b/PR/src/lib/formats/pal.c @@ -65,7 +65,7 @@ int writePal(const char* file, int colors, const tColor* colorArray, int optionf /* save JASC palette */ writeCloseOk(fd,optionflag,backupExtension); - return PR_RESULT_SUCCESS; + return PR_RESULT_SUCCESS; } int readPal(const char* file,tColor* *colorArray,int *colors) { @@ -76,7 +76,7 @@ int readPal(const char* file,tColor* *colorArray,int *colors) { int b; fd=fopen(file,"rb"); - if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; + if (!fd) return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; /* TODO: do the reading */ if (fscanf(fd,"JASC-PAL\n0100\n%d\n",colors)!=1) diff --git a/PR/src/lib/layers/stringflag.c b/PR/src/lib/layers/stringflag.c index c7f9504..6d53580 100644 --- a/PR/src/lib/layers/stringflag.c +++ b/PR/src/lib/layers/stringflag.c @@ -58,7 +58,7 @@ unsigned long parseflag(const char* stringflag) { return result; } -#define DEBUG_STRINGS +/*#define DEBUG_STRINGS*/ #ifdef DEBUG_STRINGS int main(int a,char** b) { diff --git a/PR/src/lib/object/object.c b/PR/src/lib/object/object.c index 2150ca5..b1f7d6a 100644 --- a/PR/src/lib/object/object.c +++ b/PR/src/lib/object/object.c @@ -88,7 +88,7 @@ tObject objectCreate(tResource* r, int* error) { o.obj=objectImage256Create(r->content,error); break; default: -printf("Exception: Unhooked type %d\n",o.type); +fprintf(stderr,"Exception: Unhooked type %d\n",o.type); *error=PR_RESULT_SUCCESS; /* NOTE: change to 1 to detect unhooked types */ o.obj=NULL; break; @@ -121,10 +121,10 @@ int objectWrite(tObject o, const char* file, int optionflag, const char* backupE error=objectSoundPcspeakerWrite(o.obj,file,optionflag,backupExtension); break; case eResTypeSoundMidi: /* save midi file */ - error=objMidiWrite(o.obj,file,optionflag,backupExtension); + error=objectSoundMidiWrite(o.obj,file,optionflag,backupExtension); break; case eResTypeSoundWave: /* save wav file */ - error=objWaveWrite(o.obj,file,optionflag,backupExtension); + error=objectSoundWaveWrite(o.obj,file,optionflag,backupExtension); break; case eResTypeImage2: /* save image */ error=objectImage2Write(o.obj,file,optionflag,backupExtension); @@ -136,7 +136,7 @@ int objectWrite(tObject o, const char* file, int optionflag, const char* backupE error=objectImage256Write(o.obj,file,optionflag,backupExtension); break; default: -printf("Warning: Couldn't write unhooked type %d\n",o.type); +fprintf(stderr,"Exception: Couldn't write unhooked type %d\n",o.type); break; } @@ -168,8 +168,8 @@ int objectGetColors(tObject object) { return PAL_COLORS_eResTypePalettePop1_Mono; case eResTypeNone: return 256; - case eResTypeImage16: case eResTypeImage2: + case eResTypeImage16: case eResTypeImage256: return objectImageGetColorCount(object.obj); default: @@ -201,23 +201,22 @@ void objectSet(tObject o,int *result,tResource* res) { *result=objectImage16Set(o.obj,res); break; case eResTypeSoundWave: - *result=objWaveSet(o.obj,res); + *result=objectSoundWaveSet(o.obj,res); break; case eResTypeSoundMidi: - *result=objMidiSet(o.obj,res); + *result=objectSoundMidiSet(o.obj,res); break; case eResTypeSoundPcspeaker: - *result=objPcspeakerSet(o.obj,res); + *result=objectSoundPcspeakerSet(o.obj,res); break; case eResTypePalettePop1_16: *result=objectPalettePop1_16Set(o.obj,res); break; case eResTypeOtherBinary: default: - *result=objBinarySet(o.obj,res); + *result=objectOtherBinarySet(o.obj,res); break; } - } /* Format detection function (private function, not in header file) */ @@ -226,30 +225,29 @@ tObject objectRead(const char* file,tResource* res,int *result) { tObject o; switch (res->type) { case eResTypeLevelPop1: - /*o.obj=objLevelRead(file,res.content,result); TODO */ + /*o.obj=objectLevelPop1Read(file,res.content,result); TODO */ break; case eResTypeImage16: o.obj=objectImage16Read(file,*res->palette,result); break; case eResTypeSoundWave: - o.obj=objWaveRead(file,result); + o.obj=objectSoundWaveRead(file,result); break; case eResTypeSoundMidi: - o.obj=objMidiRead(file,result); + o.obj=objectSoundMidiRead(file,result); break; case eResTypeSoundPcspeaker: - o.obj=objPcspeakerRead(file,result); + o.obj=objectSoundPcspeakerRead(file,result); break; case eResTypePalettePop1_16: o.obj=objectPalettePop1_16Read(file,result); break; case eResTypeOtherBinary: default: - o.obj=objBinaryRead(file,result); + o.obj=objectOtherBinaryRead(file,result); break; } o.type=res->type; return o; } - diff --git a/PR/src/lib/object/other/binary.c b/PR/src/lib/object/other/binary.c index c9a472d..de74973 100644 --- a/PR/src/lib/object/other/binary.c +++ b/PR/src/lib/object/other/binary.c @@ -61,7 +61,7 @@ int objectBinaryWrite(void* o, const char* file, int optionflag, const char* bac return writeData(b->data,0,file,b->size,optionflag,backupExtension)?PR_RESULT_SUCCESS:PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS; } -void* objBinaryRead(const char* file,int *result) { +void* objectOtherBinaryRead(const char* file,int *result) { tBinary o=mLoadFileArray(file); if (o.size<0) { *result=o.size; @@ -70,7 +70,7 @@ void* objBinaryRead(const char* file,int *result) { return objectBinaryCreate(o,result); /* TODO: isCopy=0 */ } -int objBinarySet(void* o,tResource* res) { +int objectOtherBinarySet(void* o,tResource* res) { tBinary* bin=o; res->content=*bin; mWriteFileInDatFile(res); diff --git a/PR/src/lib/object/sound/sound_common.c b/PR/src/lib/object/sound/sound_common.c index 775684b..36913c5 100644 --- a/PR/src/lib/object/sound/sound_common.c +++ b/PR/src/lib/object/sound/sound_common.c @@ -61,7 +61,7 @@ int objSoundWrite(void* o, const char* file, int write(const char* file,tBinary* return write(file,(tBinary*)o,optionflag,backupExtension); } -int objWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension) { +int objectSoundWaveWrite(void* o, const char* file, int optionflag, const char* backupExtension) { return writeWav(file,(tBinary*)o,optionflag,backupExtension); } @@ -71,7 +71,7 @@ int objWaveWrite(void* o, const char* file, int optionflag, const char* backupEx return (void*)o; }*/ -void* objWaveRead(const char* file, int *result) { +void* objectSoundWaveRead(const char* file, int *result) { int channels; long samplerate; long bps; @@ -93,7 +93,7 @@ void* objWaveRead(const char* file, int *result) { } /* TODO: factorize */ -int objWaveSet(void* o,tResource* res) { +int objectSoundWaveSet(void* o,tResource* res) { tBinary* wave=o; res->content.size=wave->size+1; res->content.data=malloc(wave->size+1); @@ -103,7 +103,7 @@ int objWaveSet(void* o,tResource* res) { return PR_RESULT_SUCCESS; } -int objMidiSet(void* o,tResource* res) { +int objectSoundMidiSet(void* o,tResource* res) { tBinary* midi=o; res->content.size=midi->size+1; res->content.data=malloc(midi->size+1); @@ -113,7 +113,7 @@ int objMidiSet(void* o,tResource* res) { return PR_RESULT_SUCCESS; } -int objPcspeakerSet(void* o,tResource* res) { +int objectSoundPcspeakerSet(void* o,tResource* res) { tBinary* pcspeaker=o; res->content.size=pcspeaker->size+1; res->content.data=malloc(pcspeaker->size+1); diff --git a/PR/src/ports/winfiles/pr.dev b/PR/src/ports/winfiles/pr.dev index 235980b..b5d9138 100644 --- a/PR/src/ports/winfiles/pr.dev +++ b/PR/src/ports/winfiles/pr.dev @@ -1,7 +1,7 @@ [Project] FileName=pr.dev Name=pr -UnitCount=94 +UnitCount=95 Type=1 Ver=1 ObjFiles= @@ -20,7 +20,7 @@ ObjectOutput=..\..\..\src\.obj OverrideOutput=0 OverrideOutputName=pr.exe HostApplication= -Folders=doc,src,src/console,src/includes,src/lib,src/lib/actions,src/lib/compression,src/lib/formats,src/lib/layers,src/lib/object,src/lib/object/image,src/lib/object/level,src/lib/object/other,src/lib/object/palette,src/lib/object/sound,src/lib/xml,src/ports +Folders=doc,src,src/console,src/includes,src/includes/lang,src/lib,src/lib/actions,src/lib/compression,src/lib/formats,src/lib/layers,src/lib/object,src/lib/object/image,src/lib/object/level,src/lib/object/other,src/lib/object/palette,src/lib/object/sound,src/lib/xml,src/ports CommandLine= UseCustomMakefile=0 CustomMakefile= @@ -142,7 +142,7 @@ BuildCmd= [Unit12] FileName=..\..\include\ee.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -152,7 +152,7 @@ BuildCmd= [Unit13] FileName=..\..\include\en.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -162,7 +162,7 @@ BuildCmd= [Unit14] FileName=..\..\include\es.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -272,7 +272,7 @@ BuildCmd= [Unit25] FileName=..\..\include\nl.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -282,7 +282,7 @@ BuildCmd= [Unit26] FileName=..\..\include\no.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -352,7 +352,7 @@ BuildCmd= [Unit33] FileName=..\..\include\pl.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -392,7 +392,7 @@ BuildCmd= [Unit37] FileName=..\..\include\pt.lang.pr.h CompileCpp=0 -Folder=src/includes +Folder=src/includes/lang Compile=1 Link=1 Priority=1000 @@ -933,7 +933,7 @@ BuildCmd= Major=1 Minor=3 Release=0 -Build=43 +Build=51 LanguageID=2057 CharsetID=1252 CompanyName=Princed development team @@ -967,8 +967,8 @@ BuildCmd= CompileCpp=0 [Unit95] -FileName=..\..\lib\object\object.c -Folder=src/lib/object +FileName=..\..\lib\layers\stringflag.c +Folder=src/lib/layers Compile=1 Link=1 Priority=1000