author | ecalot
<ecalot> 2006-01-08 18:35:40 UTC |
committer | ecalot
<ecalot> 2006-01-08 18:35:40 UTC |
parent | 75718f1ffc17b5683bd6178528e87b7967906637 |
PR/src/addons/python/python.c | +2 | -2 |
PR/src/console/filedir.c | +10 | -10 |
PR/src/console/main.c | +7 | -3 |
PR/src/include/autodetect.h | +2 | -2 |
PR/src/include/classify.h | +17 | -19 |
PR/src/include/common.h | +2 | -2 |
PR/src/include/compress.h | +20 | -21 |
PR/src/include/dat.h | +3 | -4 |
PR/src/include/disk.h | +3 | -3 |
PR/src/include/export.h | +1 | -1 |
PR/src/include/filedir.h | +3 | -3 |
PR/src/include/idlist.h | +0 | -2 |
PR/src/include/image.h | +20 | -21 |
PR/src/include/import.h | +2 | -2 |
PR/src/include/memory.h | +2 | -2 |
PR/src/include/parse.h | +2 | -2 |
PR/src/include/plv.h | +15 | -15 |
PR/src/include/pr.h | +2 | -2 |
PR/src/include/reslist.h | +4 | -2 |
PR/src/include/resourcematch.h | +4 | -4 |
PR/src/include/search.h | +4 | -4 |
PR/src/include/stringformat.h | +3 | -2 |
PR/src/include/translate.h | +4 | -4 |
PR/src/include/tree.h | +1 | -1 |
PR/src/include/types.h | +4 | -2 |
PR/src/lib/actions/classify.c | +16 | -16 |
PR/src/lib/actions/export.c | +6 | -6 |
PR/src/lib/actions/import.c | +6 | -6 |
PR/src/lib/compression/lzg_compress.c | +20 | -19 |
PR/src/lib/compression/lzg_decompress.c | +13 | -13 |
PR/src/lib/compression/rle_compress.c | +3 | -3 |
PR/src/lib/compression/rle_decompress.c | +4 | -4 |
PR/src/lib/compression/rlev_decompress.c | +4 | -4 |
PR/src/lib/formats/bmp.c | +7 | -6 |
PR/src/lib/formats/mid.c | +1 | -1 |
PR/src/lib/formats/pal.c | +3 | -3 |
PR/src/lib/formats/plv.c | +1 | -1 |
PR/src/lib/formats/wav.c | +1 | -1 |
PR/src/lib/layers/autodetect.c | +2 | -2 |
PR/src/lib/layers/dat.c | +22 | -23 |
PR/src/lib/layers/disk.c | +9 | -9 |
PR/src/lib/layers/idlist.c | +15 | -14 |
PR/src/lib/layers/list.c | +1 | -1 |
PR/src/lib/layers/memory.c | +1 | -1 |
PR/src/lib/layers/reslist.c | +4 | -2 |
PR/src/lib/layers/stringformat.c | +10 | -10 |
PR/src/lib/object/image/image16.c | +33 | -33 |
PR/src/lib/object/image/image2.c | +33 | -33 |
PR/src/lib/object/image/image256.c | +33 | -33 |
PR/src/lib/object/image/image_common.c | +33 | -33 |
PR/src/lib/pr.c | +77 | -77 |
PR/src/lib/xml/parse.c | +11 | -11 |
PR/src/lib/xml/search.c | +5 | -5 |
PR/src/lib/xml/translate.c | +2 | -2 |
PR/src/lib/xml/tree.c | +9 | -10 |
PR/src/lib/xml/unknown.c | +3 | -3 |
diff --git a/PR/src/addons/python/python.c b/PR/src/addons/python/python.c index f8c054f..852b581 100644 --- a/PR/src/addons/python/python.c +++ b/PR/src/addons/python/python.c @@ -20,9 +20,9 @@ /* python.c: Princed Resources : PR Python interface -¯¯¯¯¯¯¯¯ +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team - Created: (check cvs history) + Created: (check CVS history) Author: Enrique Calot <ecalot.cod@princed.com.ar> Version: 1.00 diff --git a/PR/src/console/filedir.c b/PR/src/console/filedir.c index 3810c9b..4d5766c 100644 --- a/PR/src/console/filedir.c +++ b/PR/src/console/filedir.c @@ -19,8 +19,8 @@ */ /* -filedir.c: Princed Resources : read command line file arguments and generate a file list -\xaf\xaf\xaf\xaf\xaf\xaf +filedir.c: Princed Resources : Read command line file arguments and generate a file list +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 19 Mar 2005 @@ -127,7 +127,7 @@ void addFileToListTag(const tTag* t,void* pass2) { addFileToList(t->file,pass2); } -/* Search all files in the xml tree and returns them */ +/* Search all files in the XML tree and returns them */ int listAllDatFiles(const char* vResFile, const char* directory, const char* opt, tFileDir2* list) { /* Declare error variable */ tPassListAndDir pass; @@ -138,10 +138,10 @@ int listAllDatFiles(const char* vResFile, const char* directory, const char* opt pass.opt=opt; pass.list=list; - /* Generate xml structure if doesn't exist */ + /* Generate XML structure if doesn't exist */ if ((error=parseStructure(vResFile,&structure))) return error; - /* Use the xml structure to Generate the file list */ + /* Use the XML structure to Generate the file list */ workTree(structure,&pass,addFileToListTag); /* All done */ @@ -149,7 +149,7 @@ int listAllDatFiles(const char* vResFile, const char* directory, const char* opt return PR_RESULT_SUCCESS; } -/* layer 2, module check if a file is in the xml */ +/* layer 2, module check if a file is in the XML */ typedef struct { const char* file; int result; @@ -169,10 +169,10 @@ int isADatFile(const char* vResFile, const char* file) { pass.file=getFileNameFromPath(file); pass.result=0; - /* Generate xml structure if doesn't exist */ + /* Generate XML structure if doesn't exist */ if ((error=parseStructure(vResFile,&structure))) return error; - /* Use the xml structure to Generate the file list */ + /* Use the XML structure to Generate the file list */ workTree(structure,&pass,checkIfFileExists); /* All done */ @@ -198,11 +198,11 @@ int fileDirGetFilesImport(tFileDir2* list1,tFileDir2* files,const char* resfile, /* a not found file may become either a directory or a file depending on the res file */ if (type==eNotFound) { - /* first check if the dat type was given by the -t option */ + /* first check if the DAT type was given by the -t option */ if (given) { type=eFile; } else { - /* if the dat type wasn't given by the -t option let's use all the files in the XML */ + /* if the DAT type wasn't given by the -t option let's use all the files in the XML */ int isdat; isdat=isADatFile(resfile,file); if (isdat<0) parseError=isdat; diff --git a/PR/src/console/main.c b/PR/src/console/main.c index cd60e98..8de4b5d 100644 --- a/PR/src/console/main.c +++ b/PR/src/console/main.c @@ -19,8 +19,13 @@ */ /* -main.c: PR console program parsing routine -\xaf\xaf\xaf\xaf +main.c: PR console program parsing and IDE +\xaf\xaf\xaf\xaf\xaf\xaf + Copyright 2004 Princed Development Team + Created: See CVS + + Author: Enrique Calot <ecalot.cod@princed.com.ar> + Version: 1.00 Note: DO NOT remove this copyright notice @@ -154,7 +159,6 @@ int main (int argc, char **argv) { } while (c!=-1); outputStream=stdout; - /*c=0;*/ /* At least one of these options must be selected, if not, the user needs help! */ if (!(optimizeXmlFile||hasFlag(import_flag|export_flag|classify_flag))) setFlag(help_flag); diff --git a/PR/src/include/autodetect.h b/PR/src/include/autodetect.h index 2a4de01..a6d74a1 100644 --- a/PR/src/include/autodetect.h +++ b/PR/src/include/autodetect.h @@ -19,8 +19,8 @@ */ /* -autodetect.h: Princed Resources : Resource autodetection headers -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +autodetect.h: Princed Resources : Resource automatic detection headers +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 diff --git a/PR/src/include/classify.h b/PR/src/include/classify.h index 87193c7..6584bc1 100644 --- a/PR/src/include/classify.h +++ b/PR/src/include/classify.h @@ -19,7 +19,7 @@ */ /* -classify.h: Princed Resources : Other DAT file handling tasks headers +classify.h: Princed Resources : DAT file classify routine headers \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -35,25 +35,23 @@ classify.h: Princed Resources : Other DAT file handling tasks headers #define _CLASSIFY_H_ /* - Return values may be: - -2 Memory error - -1 File not found or no access error - - 00 Not a valid POP1 DAT file - - 01 Levels file - 02 Graphic file with an image in the first valid entry (not common) - 03 Waves/Digital sound file - 04 Midis file - 05 Valid DAT file with Undefined content - 06 Graphic file with a palette in the first valid entry (common) - 07 PC Speaker dat file - - 11 Pop2 dat files -*/ + * Return values may be: + * -2 Memory error + * -1 File not found or no access error + * + * 00 Not a valid POP1 DAT file + * + * 01 Levels file + * 02 Graphic file with an image in the first valid entry (not common) + * 03 Waves/Digital sound file + * 04 Midis file + * 05 Valid DAT file with Undefined content + * 06 Graphic file with a palette in the first valid entry (common) + * 07 PC Speaker DAT file + * + * 11 Pop2 DAT files + */ int prVerifyDatType(const char* vFiledat); -void compareFiles(const char* vModified,const char* vOriginal); - #endif diff --git a/PR/src/include/common.h b/PR/src/include/common.h index df2306e..7cbcd94 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -20,7 +20,7 @@ /* common.h: Princed Resources : Defines and prototypes common to all PR code -\xaf\xaf\xaf\xaf +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -215,8 +215,8 @@ PARSING_OPTRAW\ #define PR_RESULT_FD_IMPORT_FROM_MORE_THAN_ONE_DIR -20 #define PR_RESULT_FD_IMPORT_RECURSIVE -21 #define PR_RESULT_FD_NO_FILES_SELECTED -22 +#define PR_RESULT_ERR_WRONG_PRIMITIVE_CALL -19 #define PR_RESULT_HELP_SHOWN -1 #define PR_RESULT_SUCCESS 0 #endif - diff --git a/PR/src/include/compress.h b/PR/src/include/compress.h index 36d9724..fd0c3b0 100644 --- a/PR/src/include/compress.h +++ b/PR/src/include/compress.h @@ -19,7 +19,7 @@ */ /* -compress.c: Princed Resources : Image Compressor headers +compress.h: Princed Resources : Image compression headers \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -58,35 +58,34 @@ typedef struct { }tImage; #define DEFAULT_PALETTE \ -"\x00\x00\x00"\ -"\x00\x00\xa0"\ -"\x00\xa7\x00"\ -"\x00\xa7\xa0"\ -"\xa0\x00\x00"\ -"\xa0\x00\xa0"\ -"\xa0\x50\x00"\ -"\xa0\xa7\xa0"\ -"\x50\x50\x50"\ -"\x50\x50\xff"\ -"\x50\xf8\x50"\ -"\x50\xf8\xff"\ -"\xff\x50\x50"\ -"\xff\x50\xff"\ -"\xff\xf8\x50"\ -"\xff\xff\xff" + "\x00\x00\x00"\ + "\x00\x00\xa0"\ + "\x00\xa7\x00"\ + "\x00\xa7\xa0"\ + "\xa0\x00\x00"\ + "\xa0\x00\xa0"\ + "\xa0\x50\x00"\ + "\xa0\xa7\xa0"\ + "\x50\x50\x50"\ + "\x50\x50\xff"\ + "\x50\xf8\x50"\ + "\x50\xf8\xff"\ + "\xff\x50\x50"\ + "\xff\x50\xff"\ + "\xff\xf8\x50"\ + "\xff\xff\xff" /* Prototypes */ int mCompressGraphic(unsigned char** a,tImage* i, int* size); -int mExpandGraphic(const unsigned char* array,tImage *image, int size); +int mExpandGraphic (const unsigned char* array,tImage *image, int size); #define cLevel(a) if (compressionLevel>=a) -#define cHigh if (compressionHigher) -#define setHigh compressionHigher=1 +#define cHigh if (compressionHigher) +#define setHigh compressionHigher=1 #define unsetHigh compressionHigher=0 #define getCarry(a) ((a)>>6) #define getAlgor(a) a&0x4F #endif - diff --git a/PR/src/include/dat.h b/PR/src/include/dat.h index 5b16522..a994dfb 100644 --- a/PR/src/include/dat.h +++ b/PR/src/include/dat.h @@ -19,7 +19,7 @@ */ /* -dat.h: Princed Resources : DAT library headers +dat.h: Princed Resources : DAT format library headers \xaf\xaf\xaf\xaf\xaf Copyright 2004 Princed Development Team Created: 15 Mar 2004 @@ -52,7 +52,7 @@ int checkSum(const unsigned char* data,int size); #ifdef PR_DAT_INCLUDE_DATREAD #ifdef PR_DAT_INCLUDE_DATWRITE -/* DAT reading and writing primitives primitives */ +/* DAT reading and writing primitives */ int mRWBeginDatFile(const char* vFile, unsigned short int *numberOfItems, int optionflag); #define mRWCloseDatFile(dontSave) \ mReadCloseDatFile();\ @@ -64,8 +64,7 @@ mWriteCloseDatFile(dontSave,optionflag,backupExtension) /* DAT reading primitives */ int mReadBeginDatFile(unsigned short int *numberOfItems,const char* vFile); int mReadFileInDatFile(tResource* res, int k); -int mReadFileInDatFileId(tResource* res); -/*int mReadInitResource(tResource** res,const unsigned char* data,long size);*/ +int mReadFileInDatFileId(tResource* res); void mReadCloseDatFile(); #endif diff --git a/PR/src/include/disk.h b/PR/src/include/disk.h index a20f7b4..856727f 100644 --- a/PR/src/include/disk.h +++ b/PR/src/include/disk.h @@ -19,7 +19,7 @@ */ /* -disk.h: Princed Resources : Disk Access & File handling functions headers +disk.h: Princed Resources : Disk Access & File handling prototypes \xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 29 Oct 2003 @@ -49,9 +49,9 @@ disk.h: Princed Resources : Disk Access & File handling functions headers /* Path defines */ #ifndef WIN32 - #define DIR_SEPARATOR '/' + #define DIR_SEPARATOR '/' #else - #define DIR_SEPARATOR '\\' + #define DIR_SEPARATOR '\\' #endif typedef enum {eFile,eDirectory,eNotFound}whatIs; diff --git a/PR/src/include/export.h b/PR/src/include/export.h index fdefe5a..bd73d9d 100644 --- a/PR/src/include/export.h +++ b/PR/src/include/export.h @@ -19,7 +19,7 @@ */ /* -export.h: Princed Resources : DAT Extractor headers +export.h: Princed Resources : DAT extraction prototypes \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 diff --git a/PR/src/include/filedir.h b/PR/src/include/filedir.h index 332d55d..e5ae6ad 100644 --- a/PR/src/include/filedir.h +++ b/PR/src/include/filedir.h @@ -15,12 +15,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - The authors of this program may be contacted at http:/forum.princed.com.ar + The authors of this program may be contacted at http://forum.princed.com.ar */ /* -filedir.h: Princed Resources : xml handling functions header file -\xaf\xaf\xaf\xaf\xaf +filedir.h: Princed Resources : File list layer for console IDE prototypes +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 23 Oct 2003 diff --git a/PR/src/include/idlist.h b/PR/src/include/idlist.h index 82d0429..03ea25e 100644 --- a/PR/src/include/idlist.h +++ b/PR/src/include/idlist.h @@ -37,8 +37,6 @@ idlist.h: Princed Resources : Resource id list headers /* Includes */ #include "reslist.h" /* tResourceId */ -#define PARSING_MAX_TOKEN_SIZE 200 - int parseGivenPath(char* path); int partialListActive(); int isInThePartialList(const char* vFile, tResourceId id); diff --git a/PR/src/include/image.h b/PR/src/include/image.h index 36d9724..fd0c3b0 100644 --- a/PR/src/include/image.h +++ b/PR/src/include/image.h @@ -19,7 +19,7 @@ */ /* -compress.c: Princed Resources : Image Compressor headers +compress.h: Princed Resources : Image compression headers \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -58,35 +58,34 @@ typedef struct { }tImage; #define DEFAULT_PALETTE \ -"\x00\x00\x00"\ -"\x00\x00\xa0"\ -"\x00\xa7\x00"\ -"\x00\xa7\xa0"\ -"\xa0\x00\x00"\ -"\xa0\x00\xa0"\ -"\xa0\x50\x00"\ -"\xa0\xa7\xa0"\ -"\x50\x50\x50"\ -"\x50\x50\xff"\ -"\x50\xf8\x50"\ -"\x50\xf8\xff"\ -"\xff\x50\x50"\ -"\xff\x50\xff"\ -"\xff\xf8\x50"\ -"\xff\xff\xff" + "\x00\x00\x00"\ + "\x00\x00\xa0"\ + "\x00\xa7\x00"\ + "\x00\xa7\xa0"\ + "\xa0\x00\x00"\ + "\xa0\x00\xa0"\ + "\xa0\x50\x00"\ + "\xa0\xa7\xa0"\ + "\x50\x50\x50"\ + "\x50\x50\xff"\ + "\x50\xf8\x50"\ + "\x50\xf8\xff"\ + "\xff\x50\x50"\ + "\xff\x50\xff"\ + "\xff\xf8\x50"\ + "\xff\xff\xff" /* Prototypes */ int mCompressGraphic(unsigned char** a,tImage* i, int* size); -int mExpandGraphic(const unsigned char* array,tImage *image, int size); +int mExpandGraphic (const unsigned char* array,tImage *image, int size); #define cLevel(a) if (compressionLevel>=a) -#define cHigh if (compressionHigher) -#define setHigh compressionHigher=1 +#define cHigh if (compressionHigher) +#define setHigh compressionHigher=1 #define unsetHigh compressionHigher=0 #define getCarry(a) ((a)>>6) #define getAlgor(a) a&0x4F #endif - diff --git a/PR/src/include/import.h b/PR/src/include/import.h index f964092..16f049f 100644 --- a/PR/src/include/import.h +++ b/PR/src/include/import.h @@ -19,8 +19,8 @@ */ /* -import.h: Princed Resources : DAT Compiler headers -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +import.h: Princed Resources : DAT importation prototypes +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 diff --git a/PR/src/include/memory.h b/PR/src/include/memory.h index aa99dbe..5f3d3c0 100644 --- a/PR/src/include/memory.h +++ b/PR/src/include/memory.h @@ -19,7 +19,7 @@ */ /* -memory.h: Princed Resources : Memory handling & comparission headers +memory.h: Princed Resources : Memory handling & comparison prototypes \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 20 Dec 2003 @@ -40,7 +40,7 @@ memory.h: Princed Resources : Memory handling & comparission headers char* strallocandcopy(const char* text); #define freeAllocation(m) if ((m)!=NULL) free(m) -/* equalsIgnoreCase is built in unless we are in the BSD standars that is taken from string.h */ +/* equalsIgnoreCase is built in unless we are in the BSD standards that is taken from string.h */ #ifdef __USE_BSD #include <string.h> #define IGNORE_EQUALS diff --git a/PR/src/include/parse.h b/PR/src/include/parse.h index 6df1ad7..f561983 100644 --- a/PR/src/include/parse.h +++ b/PR/src/include/parse.h @@ -19,8 +19,8 @@ */ /* -parse.h: Princed Resources : xml handling functions headers -\xaf\xaf\xaf\xaf\xaf +parse.h: Princed Resources : XML parsing prototypes +\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 23 Oct 2003 diff --git a/PR/src/include/plv.h b/PR/src/include/plv.h index dd646ce..779c887 100644 --- a/PR/src/include/plv.h +++ b/PR/src/include/plv.h @@ -43,21 +43,21 @@ plv.h: Princed Resources : PLV prince level files support headers #define _PLV_H_ /* - PLV 1 SPECS: - bytes offset description content - 7 0 HAS FILE TAG OF 8 LETTERS "POP_LVL" - 1 7 POP VERS 0x01 - 1 8 PLV VERS 0x01 - 1 9 LEV NUM - 4 10 FIELD-PAIR ( NAME / CONTENT ) COUNT - 4 14 BLOCK 1: LEVEL SIZE (B1) 2306 (including the checksum) - B1 18 BLOCK 1: LEVEL CODE - 4 18+B1 BLOCK 2: USER DATA SIZE VALUE IN BYTES (B2) - B2 22+B1 BLOCK 2: LEVEL CODE NEXT, REST OF FILE - - Total size of file B1+B2+22. - All values are unsigned and in the intel x86 architecture -*/ + * PLV 1 SPECS: + * bytes offset description content + * 7 0 HAS FILE TAG OF 8 LETTERS "POP_LVL" + * 1 7 POP VERS 0x01 + * 1 8 PLV VERS 0x01 + * 1 9 LEV NUM + * 4 10 FIELD-PAIR ( NAME / CONTENT ) COUNT + * 4 14 BLOCK 1: LEVEL SIZE (B1) 2306 (including the checksum) + * B1 18 BLOCK 1: LEVEL CODE + * 4 18+B1 BLOCK 2: USER DATA SIZE VALUE IN BYTES (B2) + * B2 22+B1 BLOCK 2: LEVEL CODE NEXT, REST OF FILE + * + * Total size of file B1+B2+22. + * All values are unsigned and in the Intel x86 architecture + */ #include "reslist.h" #include "common.h" /* for PR_VERSION */ diff --git a/PR/src/include/pr.h b/PR/src/include/pr.h index 6fc935a..f5bb5a9 100644 --- a/PR/src/include/pr.h +++ b/PR/src/include/pr.h @@ -19,7 +19,7 @@ */ /* -pr.h: Princed Resources : Main header prototypes and definitions +pr.h: Princed Resources : Main library header prototypes and definitions \xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -102,7 +102,7 @@ int prImportDatOpt(const char* vDatFile, const char* vDirName, void prSetOutput (FILE* output); void setCompressionLevel (int cl); -/* Xml parsing functions */ +/* XML parsing functions */ tTag* resourceTreeGetChild(tTag* whereAmI); tTag* resourceTreeGetNext (tTag* whereAmI); int resourceTreeGetInfo (tTag* whereAmI, char** tag, char** desc, char** path, char** file, char** type, char** name, char** palette, char** value, char** version, char** number); diff --git a/PR/src/include/reslist.h b/PR/src/include/reslist.h index c43393c..a6c2358 100644 --- a/PR/src/include/reslist.h +++ b/PR/src/include/reslist.h @@ -19,7 +19,7 @@ */ /* -reslist.h: Princed Resources : Resource list +reslist.h: Princed Resources : Resource list prototypes \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 05 Jun 2005 @@ -60,7 +60,9 @@ typedef struct { unsigned long flags; }tResource; -/* void printr(const tResource* record); * for debug purposes */ +#ifdef DEBUG_RESPRINT +void printr(const tResource* record); /* for debug purposes */ +#endif #define resourceListStartIteration(l) list_firstCursor(l) #define resourceListDrop(r) list_drop(r) diff --git a/PR/src/include/resourcematch.h b/PR/src/include/resourcematch.h index 310421e..5eec063 100644 --- a/PR/src/include/resourcematch.h +++ b/PR/src/include/resourcematch.h @@ -20,7 +20,7 @@ /* resourcematch.h: Princed Resources : Partial list matching abstract layer headers -¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 18 Dec 2005 @@ -37,7 +37,7 @@ resourcematch.h: Princed Resources : Partial list matching abstract layer header #include "reslist.h" /* tResourceId*/ -typedef struct resourceMatch { +typedef struct { int flag; int value; int order; @@ -46,8 +46,8 @@ typedef struct resourceMatch { } tResourceMatch; void freeRM(tResourceMatch *r); -int initRM(const char* text, tResourceMatch *r); -int runRM(const tResourceMatch *r, const char* path, const tResourceId *id); +int initRM(const char* text, tResourceMatch *r); +int runRM (const tResourceMatch *r, const char* path, const tResourceId *id); #endif diff --git a/PR/src/include/search.h b/PR/src/include/search.h index 687db63..5f2f32e 100644 --- a/PR/src/include/search.h +++ b/PR/src/include/search.h @@ -15,12 +15,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - The authors of this program may be contacted at http:/forum.princed.com.ar + The authors of this program may be contacted at http://forum.princed.com.ar */ /* -search.h: Princed Resources : xml handling functions header file -\xaf\xaf\xaf\xaf\xaf +search.h: Princed Resources : Abstract XML tree searching prototypes +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 23 Oct 2003 @@ -42,7 +42,7 @@ search.h: Princed Resources : xml handling functions header file #include "common.h" /* tTag */ #include "reslist.h" -/* parse xml file */ +/* parse XML file */ int parseFile(const char* vFile, const char* datFile, tResourceList *r); /****************************************************************\ diff --git a/PR/src/include/stringformat.h b/PR/src/include/stringformat.h index e394427..d307c5e 100644 --- a/PR/src/include/stringformat.h +++ b/PR/src/include/stringformat.h @@ -19,8 +19,8 @@ */ /* -stringformat.c: Princed Resources : format string parsing header -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +stringformat.h: Princed Resources : Format string parsing header +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 17 Dec 2005 @@ -37,6 +37,7 @@ stringformat.c: Princed Resources : format string parsing header #define isNumber(k) ('0'<=(k) && (k)<='9') const char* parseformat(const char* format,long value,const char* index, const char* type, const char* extension, long numberOfThisType, int order, const char* desc,const char* name); + /* This function parses format in this way: * %% - a % sign * %I - the human-like index name diff --git a/PR/src/include/translate.h b/PR/src/include/translate.h index 0a008fc..6c314ba 100644 --- a/PR/src/include/translate.h +++ b/PR/src/include/translate.h @@ -19,8 +19,8 @@ */ /* -translate.c: Princed Resources : array translating resources -\xaf\xaf\xaf\xaf\xaf\xaf\xaf +translate.h: Princed Resources : Array translating resources prototypes +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 16 Dec 2005 @@ -35,10 +35,10 @@ translate.c: Princed Resources : array translating resources #define _TRANSLATE_H_ #define TRANS_ARRAY_INDEX_INT {\ -"pop1", "cust", "fram", "palc", "pals", "palt", "piec", "scr", "shap", "shpl", "strl", "snd", "seqs", "txt4"} + "pop1", "cust", "fram", "palc", "pals", "palt", "piec", "scr", "shap", "shpl", "strl", "snd", "seqs", "txt4"} #define TRANS_ARRAY_INDEX_EXT {\ -"pop 1","custom", "frame", "cga palette", "svga palette", "tga palette", "piece", "screen", "shape", "shape palette", "string", "sound", "sequence", "text4"} + "pop 1","custom", "frame", "cga palette", "svga palette", "tga palette", "piece", "screen", "shape", "shape palette", "string", "sound", "sequence", "text4"} #define TRANS_ARRAY_INDEX_SIZ 13 diff --git a/PR/src/include/tree.h b/PR/src/include/tree.h index b30c8b8..b950c6d 100644 --- a/PR/src/include/tree.h +++ b/PR/src/include/tree.h @@ -19,7 +19,7 @@ */ /* -tree.h: Princed Resources : Unknown.xml generator headers +tree.h: Princed Resources : Special XML tree prototypes \xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 diff --git a/PR/src/include/types.h b/PR/src/include/types.h index c43393c..a6c2358 100644 --- a/PR/src/include/types.h +++ b/PR/src/include/types.h @@ -19,7 +19,7 @@ */ /* -reslist.h: Princed Resources : Resource list +reslist.h: Princed Resources : Resource list prototypes \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 05 Jun 2005 @@ -60,7 +60,9 @@ typedef struct { unsigned long flags; }tResource; -/* void printr(const tResource* record); * for debug purposes */ +#ifdef DEBUG_RESPRINT +void printr(const tResource* record); /* for debug purposes */ +#endif #define resourceListStartIteration(l) list_firstCursor(l) #define resourceListDrop(r) list_drop(r) diff --git a/PR/src/lib/actions/classify.c b/PR/src/lib/actions/classify.c index 4fbf8b3..b5f6955 100644 --- a/PR/src/lib/actions/classify.c +++ b/PR/src/lib/actions/classify.c @@ -19,7 +19,7 @@ */ /* -tasks.c: Princed Resources : Classify a DAT file +tasks.c: Princed Resources : File classify routines \xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -77,44 +77,44 @@ typedef struct { int prClassify(const char* fileName) { int result; - /* 1) check if it is a dat file */ + /* 1) check if it is a DAT file */ result=prClassifyDat(fileName); - if (!result) { /* it's not a dat file*/ + if (!result) { /* it's not a DAT file*/ long int fileSize; unsigned char* fileData; - + /* let's get it's content and see what it is */ fileSize=mLoadFileArray(fileName,&fileData); if (fileSize<=0) return fileSize; - - /* 2) let's compare the size with a .sav size */ + + /* 2) let's compare the size with a .SAV size */ if (fileSize==8) { int framesLeft; /* check that the frames (seconds/12) are in the range [0*12,60*12) */ framesLeft=fileData[2]|fileData[3]<<8; if (framesLeft<60*12) - result=30; /* sav file */ + result=30; /* SAV file */ } - - /* 3) let's compare the size with a .hof size */ + + /* 3) let's compare the size with a .HOF size */ if (fileSize==176) { int records; /* check that the number of stored records are 6 or less */ records=fileData[0]|fileData[1]<<8; if (records<=6) { - result=31; /* hof file */ + result=31; /* HOF file */ while (records) { int framesLeft; /* wrong seconds left format for this record will invalidate the whole file */ framesLeft=fileData[29*records-2]|fileData[29*records-1]<<8; - if (framesLeft>=60*12) result=0; + if (framesLeft>=60*12) result=0; records--; } } } - /* 4) as the last resource, check if it is an exe file */ + /* 4) as the last resource, check if it is an EXE file */ if (!result && fileSize>2 && fileData[0]=='M' && fileData[1]=='Z') { static tExeClassification x[]={ /* install.pdm : 41 */ {717181985,4233}, @@ -123,8 +123,8 @@ int prClassify(const char* fileName) { }; unsigned long checkSum=0; int i; - result=40; /* generic exe file */ - /* Now I'll try to recognize some known exe files */ + result=40; /* generic EXE file */ + /* Now I'll try to recognize some known EXE files */ /* calculate checksum */ for (i=0;i<fileSize;i++) { checkSum+=fileData[i]<<((3-(i%4))*8); @@ -138,10 +138,10 @@ int prClassify(const char* fileName) { break; } } - + free(fileData); } - + return result; } diff --git a/PR/src/lib/actions/export.c b/PR/src/lib/actions/export.c index 6a7d637..829b76a 100644 --- a/PR/src/lib/actions/export.c +++ b/PR/src/lib/actions/export.c @@ -64,7 +64,7 @@ extern FILE* outputStream; \***************************************************************/ /* - Extracts a dat file + Extracts a DAT file For parameter documentation, see pr.c */ @@ -87,7 +87,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti paletteBuffer=resourceListCreate(1); /* initialize the default palette */ memcpy(image.pal,DEFAULT_PALETTE,SIZE_OF_PALETTE); - + /* main loop */ for (indexNumber=0;ok&&(indexNumber<numberOfItems);indexNumber++) { @@ -95,13 +95,13 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti if (res.id.value==0xFFFF) continue; /* Tammo Jan Bug fix */ /* add to res more information from the resource list */ resourceListAddInfo(r,&res); - + if (isInThePartialList(res.path,res.id)) { /* If the resource was specified do the tasks */ - if ((!res.type)&&(!hasFlag(raw_flag))) res.type=verifyHeader(res.data,res.size); + if ((!res.type)&&(!hasFlag(raw_flag))) res.type=verifyHeader(res.data,res.size); if (!(hasFlag(unknown_flag))) { /* If unknown flag is set do nothing but generate the unknown.xml file */ if (hasFlag(raw_flag)) res.type=0; /* If "extract as raw" is set, type is 0 */ - /* get save file name (if unknown document is in the xml) */ + /* get save file name (if unknown document is in the XML) */ getFileName(vFileext,vDirExt,&res,vFiledat,vDatFileName,optionflag,backupExtension,format); switch (res.type) { @@ -158,7 +158,7 @@ int extract(const char* vFiledat,const char* vDirExt, tResourceList* r, int opti } if (ok) count++; } else { - /* if the dat file is unknown, add it in the xml */ + /* if the DAT file is unknown, add it in the XML */ getFileName(vFileext,vDirExt,&res,vFiledat,vDatFileName,optionflag,backupExtension,format); } } diff --git a/PR/src/lib/actions/import.c b/PR/src/lib/actions/import.c index 0ac99cc..8b74a53 100644 --- a/PR/src/lib/actions/import.c +++ b/PR/src/lib/actions/import.c @@ -19,7 +19,7 @@ */ /* -import.c: Princed Resources : DAT Compiler +import.c: Princed Resources : DAT Importer \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -110,7 +110,7 @@ int fullCompile(const char* vFiledat, const char* vDirExt, tResourceList* r, int if (hasFlag(raw_flag)) newRes.type=0; /* compile from raw */ getFileName(vFileext,vDirExt,res,vFiledat,vDatFileName,optionflag,backupExtension,NULL); - /* the file is in the archive, so i'll add it to the main dat body */ + /* the file is in the archive, so I'll add it to the main DAT body */ if ((newRes.size=(mLoadFileArray(vFileext,&newRes.data)))>0) { if (!mAddCompiledFileToDatFile(&newRes,vFileext)) { if (hasFlag(verbose_flag)) fprintf(outputStream,PR_TEXT_IMPORT_ERRORS,getFileNameFromPath(vFileext)); @@ -167,10 +167,10 @@ int partialCompile(const char* vFiledat, const char* vDirExt, tResourceList* r, if ((!res.type)&&(!hasFlag(raw_flag))) res.type=verifyHeader(res.data,res.size); if (hasFlag(raw_flag)) res.type=0; /* If "extract as raw" is set, type is 0 */ - /* get save file name (if unknown document is in the xml) */ + /* get save file name (if unknown document is in the XML) */ getFileName(vFileext,vDirExt,&res,vFiledat,vDatFileName,optionflag,backupExtension,NULL); - /* the file is in the partial list, so i'll import */ + /* the file is in the partial list, so I'll import */ if ((newRes.size=mLoadFileArray(vFileext,&newRes.data))>0) { newRes.id=res.id; newRes.type=res.type; @@ -187,12 +187,12 @@ int partialCompile(const char* vFiledat, const char* vDirExt, tResourceList* r, errors++; } } else { - /* the file wasn't in the partial list, so I'll re-copy it from the open dat file */ + /* the file wasn't in the partial list, so I'll re-copy it from the open DAT file */ mWriteFileInDatFileIgnoreChecksum(&res); } } - /* Close dat file */ + /* Close DAT file */ mRWCloseDatFile(0); if (hasFlag(verbose_flag)) fprintf(outputStream,PR_TEXT_IMPORT_DONE,ok,errors); diff --git a/PR/src/lib/compression/lzg_compress.c b/PR/src/lib/compression/lzg_compress.c index 8a85d19..a273cdc 100644 --- a/PR/src/lib/compression/lzg_compress.c +++ b/PR/src/lib/compression/lzg_compress.c @@ -1,20 +1,20 @@ -/* +/* * LZG compression - * - * ---------------------------------------------------------------------------- - * - * Authors: + * + * ---------------------------------------------------------------------------- + * + * Authors: * Enrique Calot <ecalot.cod@princed.com.ar> * Diego Essaya <dessaya@fi.uba.ar> - * + * * Research: Tammo Jan Dijkemma, Anke Balderer, Enrique Calot * * ---------------------------------------------------------------------------- * * Copyright (C) 2004, 2005 the Princed Team - * + * * This file is part of the Princed project. - * + * * Princed is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -33,7 +33,7 @@ /* * Modus operandi of the compression algorithm * ------------------------------------------- - * + * * For each input byte we take a window containing the 1023 previous bytes. * If the window goes out of bounds (ie, when the current input byte is * before position 1024), we consider it filled with zeros. @@ -43,7 +43,7 @@ * input start current input byte * |--------------------------------| * window size=1023 - * + * * The algorithm works as follows: * * While there is unread input data: @@ -87,14 +87,14 @@ void *memrchr2(unsigned char *s, int c, size_t n) { /* Window size */ #define WIN_SIZE 1024 -/* A repetition pattern must have a length of at least MIN_PATTERN_SIZE +/* A repetition pattern must have a length of at least MIN_PATTERN_SIZE * to be accepted (ie, to be worth for compressing) */ #define MIN_PATTERN_SIZE 3 #define MAX_PATTERN_SIZE 66 /* search the longest pattern in the window that matches the first bytes * of the input */ -void search_best_pattern(unsigned char *input, int inputSize, +void search_best_pattern(unsigned char *input, int inputSize, unsigned char **best_pattern, int *best_pattern_len) { unsigned char *pattern; @@ -110,10 +110,11 @@ void search_best_pattern(unsigned char *input, int inputSize, unsigned char *wc = pattern + 1; pattern_len = 1; - while ( (ic < (input + inputSize)) && - (*ic == *wc) && - pattern_len < MAX_PATTERN_SIZE) - { + while ( + (ic < (input + inputSize)) && + (*ic == *wc) && + pattern_len < MAX_PATTERN_SIZE + ) { ic++; wc++; pattern_len++; /* increase until the pattern is different */ } @@ -165,14 +166,14 @@ void addPattern(unsigned char *input, int iCursor, unsigned char *pattern, int pattern_len) { int loc = (pattern - input) + WIN_SIZE - MAX_PATTERN_SIZE; - output[oCursor] = + output[oCursor] = (((pattern_len - MIN_PATTERN_SIZE) << 2) & 0xfc) + ((loc & 0x0300) >> 8); output[oCursor + 1] = (loc & 0x00FF); } /* Compress using the LZG algorithm */ /* Assume output has been allocated and the size is very big */ -void compressLzg(const unsigned char* input2, int inputSize, +void compressLzg(const unsigned char* input2, int inputSize, unsigned char* output, int *outputSize) { int iCursor = 0, oCursor = 0; @@ -188,7 +189,7 @@ void compressLzg(const unsigned char* input2, int inputSize, unsigned char *best_pattern; int best_pattern_len; - search_best_pattern(input + iCursor, inputSize - iCursor, + search_best_pattern(input + iCursor, inputSize - iCursor, &best_pattern, &best_pattern_len); if (best_pattern_len < MIN_PATTERN_SIZE) diff --git a/PR/src/lib/compression/lzg_decompress.c b/PR/src/lib/compression/lzg_decompress.c index 6109f3a..ede171a 100644 --- a/PR/src/lib/compression/lzg_decompress.c +++ b/PR/src/lib/compression/lzg_decompress.c @@ -1,19 +1,19 @@ -/* +/* * LZG extraction - * - * ---------------------------------------------------------------------------- - * - * Authors: + * + * ---------------------------------------------------------------------------- + * + * Authors: * Enrique Calot <ecalot.cod@princed.com.ar> - * + * * Research: Tammo Jan Dijkemma, Anke Balderer, Enrique Calot * * ---------------------------------------------------------------------------- * * Copyright (C) 2004, 2005 the Princed Team - * + * * This file is part of the Princed project. - * + * * Princed is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -44,7 +44,7 @@ unsigned char popBit(unsigned char *byte) { } /* Expands LZ Groody algorithm. This is the core of PR */ -int expandLzg(const unsigned char* input, int inputSize, +int expandLzg(const unsigned char* input, int inputSize, unsigned char** output2, int *outputSize) { int oCursor=0, iCursor=0; @@ -72,11 +72,11 @@ int expandLzg(const unsigned char* input, int inputSize, */ loc= 66 + ((input[iCursor] & 0x03 /*00000011*/) <<8) + input[iCursor+1]; rep= 3 + ((input[iCursor] & 0xfc /*11111100*/) >>2); - + iCursor+=2; /* move the cursor 2 bytes ahead */ - + loc=(oCursor-loc)&0x3ff; /* this is the real loc number (allways positive!) */ - + while (rep--) { /* repeat pattern in output */ output[oCursor]=output[oCursor-loc]; @@ -85,7 +85,7 @@ int expandLzg(const unsigned char* input, int inputSize, } } } - + /* ignore the first 1024 bytes */ *outputSize=oCursor-LZG_WINDOW_SIZE; *output2=malloc(*outputSize); diff --git a/PR/src/lib/compression/rle_compress.c b/PR/src/lib/compression/rle_compress.c index f289db6..85019db 100644 --- a/PR/src/lib/compression/rle_compress.c +++ b/PR/src/lib/compression/rle_compress.c @@ -19,7 +19,7 @@ */ /* -compress.c: Princed Resources : Image Compression Library +rle_compress.c: Princed Resources : Image Compression Library \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003, 2004 Princed Development Team Created: 24 Aug 2003 @@ -35,7 +35,7 @@ compress.c: Princed Resources : Image Compression Library #include <stdio.h> /* Compress using the Run Length Encoding algorithm */ -void compressRle(const unsigned char* input, int inputSize, +void compressRle(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize) { /* Declare pointers */ unsigned char* cursorData = output; @@ -79,7 +79,7 @@ void compressRle(const unsigned char* input, int inputSize, cursorData++; } } - /* Write the last char + /* Write the last char if ((*counter)>0) { *(cursorData++)=0; *(cursorData)= ||||||| 0xff ||||| *(cursorPix); ||||||| diff --git a/PR/src/lib/compression/rle_decompress.c b/PR/src/lib/compression/rle_decompress.c index cc3d1ab..d2b6395 100644 --- a/PR/src/lib/compression/rle_decompress.c +++ b/PR/src/lib/compression/rle_decompress.c @@ -19,8 +19,8 @@ */ /* -compress.c: Princed Resources : Image Compression Library -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +rle_uncompress.c: Princed Resources : Image Compression Library +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003, 2004 Princed Development Team Created: 24 Aug 2003 @@ -37,14 +37,14 @@ compress.c: Princed Resources : Image Compression Library #include "compress.h" /* Expands RLE algorithm */ -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize) { register signed char rep=1; int oCursor=0; int iCursor=0; /* reserve memory */ - if ((*output=malloc(40000))==NULL) return COMPRESS_RESULT_FATAL; + if ((*output=malloc(40000))==NULL) return COMPRESS_RESULT_FATAL; /* main loop */ while (iCursor<inputSize) { diff --git a/PR/src/lib/compression/rlev_decompress.c b/PR/src/lib/compression/rlev_decompress.c index cc3d1ab..d2b6395 100644 --- a/PR/src/lib/compression/rlev_decompress.c +++ b/PR/src/lib/compression/rlev_decompress.c @@ -19,8 +19,8 @@ */ /* -compress.c: Princed Resources : Image Compression Library -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +rle_uncompress.c: Princed Resources : Image Compression Library +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003, 2004 Princed Development Team Created: 24 Aug 2003 @@ -37,14 +37,14 @@ compress.c: Princed Resources : Image Compression Library #include "compress.h" /* Expands RLE algorithm */ -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize) { register signed char rep=1; int oCursor=0; int iCursor=0; /* reserve memory */ - if ((*output=malloc(40000))==NULL) return COMPRESS_RESULT_FATAL; + if ((*output=malloc(40000))==NULL) return COMPRESS_RESULT_FATAL; /* main loop */ while (iCursor<inputSize) { diff --git a/PR/src/lib/formats/bmp.c b/PR/src/lib/formats/bmp.c index e71f0ce..47c0232 100644 --- a/PR/src/lib/formats/bmp.c +++ b/PR/src/lib/formats/bmp.c @@ -45,12 +45,13 @@ extern FILE* outputStream; int mFormatExportBmp(const unsigned char* data, const char *vFileext,unsigned long int size,tImage image,int optionflag, const char* backupExtension) { /* - This function will expand the data into an image structure, - then the bitmap structure will be saved to disk + * This function will expand the data into an image structure, + * then the bitmap structure will be saved to disk + * + * Note: The old structure is passed by parameters in order to + * keep the right palette. + */ - Note: The old structure is passed by paremeters in order to - keep the right palette. - */ int result; /* Expand graphic and check results */ @@ -196,7 +197,7 @@ int mReadBitMap(tImage* image,unsigned char* data, int size) { /* if validations==wrong */ if (!ok) { freeAllocation(image->pix); - return 0; /* false: this is not a valid bmp file format or memory too low */ + return 0; /* false: this is not a valid BMP file format or memory too low */ } /* Serialize bitmap-->raw array */ diff --git a/PR/src/lib/formats/mid.c b/PR/src/lib/formats/mid.c index a0fc41f..f104e96 100644 --- a/PR/src/lib/formats/mid.c +++ b/PR/src/lib/formats/mid.c @@ -48,7 +48,7 @@ int mFormatImportMid(tResource *res) { unsigned char* file; file=malloc(res->size+1); - file[0]=(unsigned char)((res->type==4)?2:0); /* Now should be 0x02: First character must be a 0x01 (wav type in dat) */ + file[0]=(unsigned char)((res->type==4)?2:0); /* Now should be 0x02: First character must be a 0x01 (wav type in DAT) */ memcpy(file+1,res->data,res->size); res->size++; free(res->data); diff --git a/PR/src/lib/formats/pal.c b/PR/src/lib/formats/pal.c index 05d965a..aa89820 100644 --- a/PR/src/lib/formats/pal.c +++ b/PR/src/lib/formats/pal.c @@ -40,7 +40,7 @@ pal.c: Princed Resources : JASC PAL files support #include "dat.h" /***************************************************************\ -| Jasc Palette handling functions | +| JASC Palette handling functions | \***************************************************************/ static const char* enter="\r\n"; @@ -99,7 +99,7 @@ int mFormatImportPal(tResource *res,const char* vFile) { /* check size */ if ((res->size)<130) return 0; /* false */ - /* verify jasc pal header */ + /* verify JASC pal header */ while (palh[i]==(res->data)[i++]); if (i!=sizeof(palh)) return 0; /* false: palette differs with headers */ @@ -126,7 +126,7 @@ int mFormatImportPal(tResource *res,const char* vFile) { data2=strtok((char*)(res->data)+sizeof(palh)-1,enter); while (k--) { if (!sscanf(data2,"%d %d %d",&r,&g,&b)) return 0; /* false */ - /* Those lines mean a loss of data (palette colors are saved in the nearest multiple of 4) */ + /* Those lines mean a loss of data (palette colours are saved in the nearest multiple of 4) */ *(pal2++)=(unsigned char)((r+2)>>2); *(pal2++)=(unsigned char)((g+2)>>2); *(pal2++)=(unsigned char)((b+2)>>2); diff --git a/PR/src/lib/formats/plv.c b/PR/src/lib/formats/plv.c index 0a6dadb..86f73ce 100644 --- a/PR/src/lib/formats/plv.c +++ b/PR/src/lib/formats/plv.c @@ -46,7 +46,7 @@ plv.c: Princed Resources : PLV prince level files support #include <string.h> #include <time.h> -/* Private function to get the currect date/time */ +/* Private function to get the current date/time */ char* getDate() { /* Code taken from RDR 1.4.1a coded by Enrique Calot */ diff --git a/PR/src/lib/formats/wav.c b/PR/src/lib/formats/wav.c index fc37373..db5578a 100644 --- a/PR/src/lib/formats/wav.c +++ b/PR/src/lib/formats/wav.c @@ -69,7 +69,7 @@ int mFormatImportWav(tResource *res) { if (res->size<=i) return 0; /* false */ res->size-=(--i); while ((i==4||i==5||i==6||i==7||i==40||i==41||i==42||i==43||((res->data)[i]==wav[i]))&&(i--)); - (res->data)[sizeof(wav)-1]=1; /* First character must be a 0x01 (wav type in dat) */ + (res->data)[sizeof(wav)-1]=1; /* First character must be a 0x01 (wav type in DAT) */ res->data+=sizeof(wav)-1; if (i==-1) mWriteFileInDatFile(res); res->data=posAux; diff --git a/PR/src/lib/layers/autodetect.c b/PR/src/lib/layers/autodetect.c index f3aae6e..8fc60cf 100644 --- a/PR/src/lib/layers/autodetect.c +++ b/PR/src/lib/layers/autodetect.c @@ -19,8 +19,8 @@ */ /* -autodetect.c: Princed Resources : Autodetect resource types -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +autodetect.c: Princed Resources : Automatic detection resource types +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 diff --git a/PR/src/lib/layers/dat.c b/PR/src/lib/layers/dat.c index f84046a..ca1269b 100644 --- a/PR/src/lib/layers/dat.c +++ b/PR/src/lib/layers/dat.c @@ -19,7 +19,7 @@ */ /* -dat.c: Princed Resources : DAT library +dat.c: Princed Resources : DAT format library implementation \xaf\xaf\xaf\xaf\xaf Copyright 2004,2005 Princed Development Team Created: 15 Mar 2004 @@ -88,7 +88,7 @@ int checkSum(const unsigned char* data,int size) { #define dat_readCursorGetOffset(r) (array2long(r.currentRecord+2)) #define dat_readCursorGetSize(r) (array2short(r.currentRecord+6)) #define dat_readCursorGetFlags(r) ((r.popVersion==pop1)?(1<<24):(r.currentRecord[8]<<16|r.currentRecord[9]<<8|r.currentRecord[10])) -#define dat_readCursorGetVersion(r) (r.popVersion) +#define dat_readCursorGetVersion(r) (r.popVersion) void rememberIndex(char* to, const char* from) { int i=4; @@ -219,7 +219,7 @@ int dat_cursorMove(tIndexCursor* r,int pos) { } pos-=itemCount; } - return 0; /* false: we had read all the master index and we didn't read the pos */ + return 0; /* false: we had read all the master index and we didn't read the "pos" value */ } } @@ -365,10 +365,10 @@ int mReadBeginDatFile(unsigned short int *numberOfItems,const char* vFiledat){ indexOffset=array2long(readDatFile); indexSize=array2short(readDatFile+4); - /* verify dat format: the index offset belongs to the file and the file size is the index size plus the index offset */ + /* verify DAT format: the index offset belongs to the file and the file size is the index size plus the index offset */ if ((indexOffset>readDatFileSize)&&((indexOffset+indexSize)!=readDatFileSize)) { free(readDatFile); - return PR_RESULT_ERR_INVALID_DAT; /* this is not a valid prince dat file */ + return PR_RESULT_ERR_INVALID_DAT; /* this is not a valid prince DAT file */ } /* create cursor */ @@ -418,14 +418,14 @@ tResourceList resIndex; int mWriteBeginDatFile(const char* vFile, int optionflag) { /* - Opens safely a dat file for writing mode and - reserves space for the headers - - Return Values: - 1 Ok - 0 File couldn't be open - - */ + * Opens safely a DAT file for writing mode and + * reserves space for the headers + * + * Return Values: + * PR_RESULT_SUCCESS Ok + * PR_RESULT_ERR_FILE_DAT_NOT_WRITE_ACCESS File couldn't be open + * + */ if (writeOpen(vFile,&writeDatFile,optionflag|backup_flag)) { short fill=0; resIndex=resourceListCreate(1); @@ -459,7 +459,7 @@ void dat_write(const tResource* res,unsigned char checksum) { void mWriteFileInDatFileIgnoreChecksum(const tResource* res) { tResource aux; - /* set up virtual resource aux */ + /* set up virtual resource auxiliary */ aux=*res; /* drop the checksum */ @@ -472,9 +472,9 @@ void mWriteFileInDatFileIgnoreChecksum(const tResource* res) { void mWriteFileInDatFile(const tResource* res) { /* - Adds a data resource to a dat file keeping - abstractly the checksum verifications - */ + * Adds a data resource to a DAT file keeping + * abstractly the checksum verifications + */ /* Declare variables */ int k = res->size; @@ -491,8 +491,8 @@ void mWriteFileInDatFile(const tResource* res) { void mWriteCloseDatFile(int dontSave,int optionflag, const char* backupExtension) { /* - Closes a dat file filling the index and other structures - */ + * Closes a DAT file filling the index and other structures + */ unsigned short int totalItems=0; unsigned short int size2=2; unsigned long int size1=ftell(writeDatFile); @@ -508,7 +508,6 @@ void mWriteCloseDatFile(int dontSave,int optionflag, const char* backupExtension if (!strncmp(res->id.index,textPop1,4)) { /* POP1 */ do { totalItems++; - /*printf("Adding item id (%s,%d)\n",res->id.index,res->id.value);*/ fwriteshort(&(res->id.value),writeDatFile); fwritelong(&(res->offset),writeDatFile); fwriteshort(&(res->size),writeDatFile); @@ -552,7 +551,7 @@ void mWriteCloseDatFile(int dontSave,int optionflag, const char* backupExtension numberOfSlaveItems=0; /* return to the end of the file to keep writing */ fseek(writeDatFile,0,SEEK_END); - slaveCountPos=ftell(writeDatFile); /* remember the juni (II) place */ + slaveCountPos=ftell(writeDatFile); /* remember the junk (II) place */ fwriteshort(&numberOfSlaveItems,writeDatFile); /* junk (II) */ strncpy(index,res->id.index,5); @@ -561,7 +560,7 @@ void mWriteCloseDatFile(int dontSave,int optionflag, const char* backupExtension fwriteshort(&(res->id.value),writeDatFile); fwritelong(&(res->offset),writeDatFile); fwriteshort(&(res->size),writeDatFile); - /* this is the flag writen in endian safe */ + /* this is the flag written in endian-safe */ v=(res->flags>>16)&&0xff; fwritechar(&v,writeDatFile); v=(res->flags>>8)&&0xff; @@ -591,7 +590,7 @@ void mWriteCloseDatFile(int dontSave,int optionflag, const char* backupExtension /* Closes the file and flushes the buffer */ writeClose(writeDatFile,dontSave,optionflag,backupExtension); - /* drops the index list */ + /* Drops the index list */ resourceListDrop(&resIndex); } #endif diff --git a/PR/src/lib/layers/disk.c b/PR/src/lib/layers/disk.c index 5fba858..25931a9 100644 --- a/PR/src/lib/layers/disk.c +++ b/PR/src/lib/layers/disk.c @@ -52,12 +52,12 @@ disk.c: Princed Resources : Disk Access & File handling functions #endif #ifndef WIN32 - #define defmkdir(a) mkdir (a,(mode_t)0755) - /* Recursive directory scanning needs <dirent> for posix or "direntwin" for windows */ + #define defmkdir(a) mkdir (a,(mode_t)0755) + /* Recursive directory scanning needs <dirent> for POSIX or "direntwin" for windows */ #ifdef DISK_DIR_SCANING #include <dirent.h> #endif - /* Terminal manipulation for unix (to avoid the enter after selecting an option) */ + /* Terminal manipulation for UNIX (to avoid the enter after selecting an option) */ #ifdef DISK_TERM_MANIPULATION #include <termios.h> #include <unistd.h> @@ -65,8 +65,8 @@ disk.c: Princed Resources : Disk Access & File handling functions #endif #define osIndepGetCharacter() getchar() #else - #include <direct.h> /* mkdir */ - #define defmkdir(a) mkdir (a) + #include <direct.h> /* mkdir */ + #define defmkdir(a) mkdir (a) #ifdef DISK_DIR_SCANING #include "direntwin.h" #endif @@ -415,7 +415,7 @@ int mLoadFileArray(const char* vFile,unsigned char** array) { f=isDir(file); if (f==eDirectory) return PR_RESULT_ERR_FILE_NOT_OPEN_WASDIR; if (f==eNotFound) return PR_RESULT_ERR_FILE_NOT_OPEN_NOTFOUND; - + /* Open the file */ if ((fp=fopen(file,"rb"))==NULL) { return PR_RESULT_ERR_FILE_NOT_READ_ACCESS; @@ -470,10 +470,10 @@ whatIs isDir(const char *path) { int recurseDirectory(const char* path,int recursive, void* pass, void (*function)(const char*,void*)) { /* - Search for all .dat files in the directory + Search for all .DAT files in the directory if recursive flag is set search over the subdirectories if verbose flag is set shows some messages in the screen - when .dat files are found it runs prMain form each of them + when .DAT files are found it runs prMain form each of them */ /* Declare variables */ @@ -504,7 +504,7 @@ int recurseDirectory(const char* path,int recursive, void* pass, void (*function memcpy(recursivePath+sizeOfPath+1,directoryStructure->d_name,sizeOfFile+1); if (isDir(recursivePath)==eDirectory&&recursive) { - /* Only recurse if we are in a directory and recursive is true */ + /* Only recourse if we are in a directory and recursive is true */ recurseDirectory(recursivePath,recursive,pass,function); } else { function(recursivePath,pass); diff --git a/PR/src/lib/layers/idlist.c b/PR/src/lib/layers/idlist.c index 821a2e5..e96a0bc 100644 --- a/PR/src/lib/layers/idlist.c +++ b/PR/src/lib/layers/idlist.c @@ -19,7 +19,7 @@ */ /* -idlist.c: Princed Resources : Partial Id list +idlist.c: Princed Resources : Partial Id list routines \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -62,7 +62,7 @@ int partialListActive() { int parseGivenPath(char* path) { /* * format: \([^@]*\)/(@\([0-9]\+\)?\(:[a-z ]*\)?\(#[a-z0-9]\+\)\)? - * where: \1 is the dat filename, \2 is the partical list whole match if exists, + * where: \1 is the DAT filename, \2 is the partial list whole match if exists, * \3 is the resource id, \4 is the index name and \5 is the order * examples: rID Ind Ord Restricted to * datfile.dat@111:shape#first --> 111 shap 0 * @@ -78,12 +78,13 @@ int parseGivenPath(char* path) { * datfile.dat@#785 --> * * 785 * * datfile.dat@/a.bmp --> * * * a.bmp * datfile.dat@/img*.bmp --> * * * img*.bmp - - PRE: partialList.list was not allocated - POST: - partialList.count=0 and partialList.list=NULL if all resources - path was trimed in the "@" - */ + * + * PRE: + * partialList.list was not allocated + * POST: + * partialList.count=0 and partialList.list=NULL if all resources + * path was trimmed in the "@" + */ int i; int separator=0; @@ -92,11 +93,11 @@ int parseGivenPath(char* path) { int error=0; /* Check if the variable wasn't initialized before */ - if (partialList.count!=0) return -2; + if (partialList.count!=0) return PR_RESULT_ERR_WRONG_PRIMITIVE_CALL; partialList.list=NULL; /* Validates the NULL path */ - if (path==NULL) return 0; + if (path==NULL) return PR_RESULT_SUCCESS; /* Erase the last "/" if exists. */ if (path) { @@ -111,9 +112,9 @@ int parseGivenPath(char* path) { while (path[separator]&&path[separator]!='@') separator++; /* If no separation */ - if (!path[separator]) return 0; /* There was no separator */ + if (!path[separator]) return PR_RESULT_SUCCESS; /* There was no separator */ - /* Count values, separate them with '\0' and alloc memory */ + /* Count values, separate them with '\0' and allocate memory */ partialList.count=1; path[separator]=0; /* Trim the path to the separator */ i=++separator; @@ -134,9 +135,9 @@ int parseGivenPath(char* path) { } if (error) { for (i=0;i<j-1;i++) freeRM(partialList.list+i); - return -1; + return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; } - return 0; + return PR_RESULT_SUCCESS; } int isInThePartialList(const char* vFile, tResourceId id) { diff --git a/PR/src/lib/layers/list.c b/PR/src/lib/layers/list.c index 2fd2520..30d7b2a 100644 --- a/PR/src/lib/layers/list.c +++ b/PR/src/lib/layers/list.c @@ -19,7 +19,7 @@ */ /* -list.c: Princed Resources : Ordered Read-Only list implementarion +list.c: Princed Resources : Order-optimized list implementation \xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 04 Jun 2005 diff --git a/PR/src/lib/layers/memory.c b/PR/src/lib/layers/memory.c index c33d5b0..f9814b4 100644 --- a/PR/src/lib/layers/memory.c +++ b/PR/src/lib/layers/memory.c @@ -19,7 +19,7 @@ */ /* -memory.c: Princed Resources : Memory handling +memory.c: Princed Resources : Memory handling and comparing routines \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 20 Dec 2003 diff --git a/PR/src/lib/layers/reslist.c b/PR/src/lib/layers/reslist.c index 6d7a3b1..7db1ba1 100644 --- a/PR/src/lib/layers/reslist.c +++ b/PR/src/lib/layers/reslist.c @@ -19,7 +19,7 @@ */ /* -reslist.c: Princed Resources : Ordered Read-Only list implementarion +reslist.c: Princed Resources : Resource list layer implementation \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 04 Jun 2005 @@ -89,6 +89,7 @@ void resourceListAdd(tResourceList* r,tResource* res) { list_insert(r,res); } +#ifdef DEBUG_RESPRINT void printr(const tResource* record) { printf("id=(%d,%s,%d)\n",record->id.value,record->id.index,record->id.order); printf("palette=(%d,%s)\n",record->palette.value,record->palette.index); @@ -106,6 +107,7 @@ void resourceListDebugPrint(tResourceList* r) { } list_firstCursor(r); } +#endif void resourceListAddInfo(tResourceList* r,tResource* res) { if (!list_moveCursor(r,res)) { @@ -117,7 +119,7 @@ void resourceListAddInfo(tResourceList* r,tResource* res) { memset(res->palette.index,0,5); res->number=0; res->type=0; - } else { + } else { const tResource* resInfo=list_getCursor(r); /* copy only the list information */ res->path=resInfo->path; diff --git a/PR/src/lib/layers/stringformat.c b/PR/src/lib/layers/stringformat.c index 48ba1dc..022e4f6 100644 --- a/PR/src/lib/layers/stringformat.c +++ b/PR/src/lib/layers/stringformat.c @@ -19,8 +19,8 @@ */ /* -stringformat.c: Princed Resources : format string parsing feature -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +stringformat.c: Princed Resources : Format string parsing feature routines +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 4 Jul 2005 @@ -178,15 +178,15 @@ const char* parseformat(const char* format,long value,const char* index, const c #ifdef DEBUG_STRINGS int main(int a,char** b) { -printf("%s\n", parseformat( -b[1], -233, -"shap", -"image", -"bmp", - 5,0,"hey man!" + printf("%s\n", parseformat( + b[1], + 233, + "shap", + "image", + "bmp", + 5,0,"hey man!" )); -return 0; + return 0; } #endif diff --git a/PR/src/lib/object/image/image16.c b/PR/src/lib/object/image/image16.c index c457ffc..44a74c6 100644 --- a/PR/src/lib/object/image/image16.c +++ b/PR/src/lib/object/image/image16.c @@ -49,13 +49,13 @@ compress.c: Princed Resources : Image Compression Library * * So the possible compression algorithm variants are: * RAW, RLE, RLEt, LZG, LZGt, LZG+, LZGt+ - * - * It is known that LZG+ allways compresses better or equal than LZG + * + * It is known that LZG+ always compresses better or equal than LZG * * Depending on the compression level, the compressor will compress with * all the algorithms specified and keep only the smaller result using * the following table - * + * * Level Algorithms * 1 RAW * 2 RAW, RLE @@ -67,18 +67,18 @@ compress.c: Princed Resources : Image Compression Library * * The default level used in PR will be 3. * - * In images with big enthropy that generates DAT files bigger than 64kb, using + * In images with big entropy that generates DAT files bigger than 64kb, using * a better compression is a must. The POP1 DAT file format has this limitation * and the only way to get through with it is improving the compression. * * For testing DAT files that are not for distribution compression 3 is highly - * recomended because is much faster and you perform compressions more often. - * + * recommended because is much faster and you perform compressions more often. + * * When you release a DAT file a compression level 7 is the best you can use. * You'll have to wait some time to get the importing, but the decompression * is as faster as the decompression in other levels. The game supports it and * decompresses the files very fast. Another advantage is that it is better to - * distribute smaller dat files. + * distribute smaller DAT files. * */ @@ -91,15 +91,15 @@ compress.c: Princed Resources : Image Compression Library \***************************************************************/ /* compress and sets the bytes */ -void compressLzg(const unsigned char* input, int inputSize, +void compressLzg(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -void compressRle(const unsigned char* input, int inputSize, +void compressRle(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -/* uncompress and allocates output */ -int expandLzg(const unsigned char* input, int inputSize, +/* decompress and allocates output */ +int expandLzg(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); /***************************************************************\ @@ -126,7 +126,7 @@ void transposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[transpose(cursor,image->widthInBytes,image->height)]=image->pix[cursor]; free(image->pix); image->pix=outputaux; @@ -136,7 +136,7 @@ void antiTransposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[cursor]=image->pix[transpose(cursor,image->widthInBytes,image->height)]; free(image->pix); image->pix=outputaux; @@ -147,20 +147,20 @@ void antiTransposeImage(tImage* image,int size) { \***************************************************************/ /* - Header info: - 1 byte - checksum char checksum - 2 bytes - height short int height - 2 bytes - width short int width - 1 byte - 00 (char)0 - 1 byte - compression type unsigned char compressionType -*/ + * Header info: + * 1 byte - checksum char checksum + * 2 bytes - height short int height + * 2 bytes - width short int width + * 1 byte - 00 (char)0 + * 1 byte - compression type unsigned char compressionType + */ /* Expands an array into an image */ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) { /* - Reads data and extracts tImage - returns the next image address or -1 in case of error - */ + * Reads data and extracts tImage + * returns the next image address or -1 in case of error + */ int imageSizeInBytes; int result; @@ -184,7 +184,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) return COMPRESS_RESULT_FATAL #define checkResult if (result==COMPRESS_RESULT_FATAL)\ return COMPRESS_RESULT_FATAL - + switch (getAlgor(image->type)) { case COMPRESS_RAW: /* No Compression Algorithm */ if ((image->pix=getMemory(dataSizeInBytes))==NULL) return COMPRESS_RESULT_FATAL; @@ -237,10 +237,10 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { */ /* Forward compression */ - + /* COMPRESS_RAW * The allocation size is the image size. - * The algorithm is hardcoded. + * The algorithm is hard-coded. * There is no need to code a transposed version because * we have no compression to improve. */ @@ -249,22 +249,22 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { memcpy(compressed[COMPRESS_RAW],image->pix,imageSizeInBytes); /* COMPRESS_RLE_LR - * If all the uncompressed data has a big enthropy, there + * If all the uncompressed data has a big entropy, there * will be a control byte for a block of 127 bytes. * The allocation size has a maximum value of the image * size plus a byte each 127 bytes. * This is accoted by 2*n+50 */ cLevel(2) { - compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); + compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); compressRle( image->pix,imageSizeInBytes, compressed[COMPRESS_RLE_LR],&(compressedSize[COMPRESS_RLE_LR]) ); max_alg++; } - /* COMPRESS_LZG_LR - * If all the uncompressed data has a big enthropy, there + /* COMPRESS_LZG_LR + * If all the uncompressed data has a big entropy, there * will be a maskbyte for a block of 8 bytes. * The allocation size has a maximum value of the image * size plus a byte in 8. @@ -292,7 +292,7 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { * The following algorithms will be the same as above, but * using the image matrix transposed. */ - cLevel(3) + cLevel(3) antiTransposeImage(image,imageSizeInBytes); /* COMPRESS_RLE_UD */ @@ -353,6 +353,6 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { /* Free all compression attempts */ for (i=COMPRESS_RAW;i<max_alg;i++) free(compressed[i]); - return 1; + return 1; /* true */ } diff --git a/PR/src/lib/object/image/image2.c b/PR/src/lib/object/image/image2.c index c457ffc..44a74c6 100644 --- a/PR/src/lib/object/image/image2.c +++ b/PR/src/lib/object/image/image2.c @@ -49,13 +49,13 @@ compress.c: Princed Resources : Image Compression Library * * So the possible compression algorithm variants are: * RAW, RLE, RLEt, LZG, LZGt, LZG+, LZGt+ - * - * It is known that LZG+ allways compresses better or equal than LZG + * + * It is known that LZG+ always compresses better or equal than LZG * * Depending on the compression level, the compressor will compress with * all the algorithms specified and keep only the smaller result using * the following table - * + * * Level Algorithms * 1 RAW * 2 RAW, RLE @@ -67,18 +67,18 @@ compress.c: Princed Resources : Image Compression Library * * The default level used in PR will be 3. * - * In images with big enthropy that generates DAT files bigger than 64kb, using + * In images with big entropy that generates DAT files bigger than 64kb, using * a better compression is a must. The POP1 DAT file format has this limitation * and the only way to get through with it is improving the compression. * * For testing DAT files that are not for distribution compression 3 is highly - * recomended because is much faster and you perform compressions more often. - * + * recommended because is much faster and you perform compressions more often. + * * When you release a DAT file a compression level 7 is the best you can use. * You'll have to wait some time to get the importing, but the decompression * is as faster as the decompression in other levels. The game supports it and * decompresses the files very fast. Another advantage is that it is better to - * distribute smaller dat files. + * distribute smaller DAT files. * */ @@ -91,15 +91,15 @@ compress.c: Princed Resources : Image Compression Library \***************************************************************/ /* compress and sets the bytes */ -void compressLzg(const unsigned char* input, int inputSize, +void compressLzg(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -void compressRle(const unsigned char* input, int inputSize, +void compressRle(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -/* uncompress and allocates output */ -int expandLzg(const unsigned char* input, int inputSize, +/* decompress and allocates output */ +int expandLzg(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); /***************************************************************\ @@ -126,7 +126,7 @@ void transposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[transpose(cursor,image->widthInBytes,image->height)]=image->pix[cursor]; free(image->pix); image->pix=outputaux; @@ -136,7 +136,7 @@ void antiTransposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[cursor]=image->pix[transpose(cursor,image->widthInBytes,image->height)]; free(image->pix); image->pix=outputaux; @@ -147,20 +147,20 @@ void antiTransposeImage(tImage* image,int size) { \***************************************************************/ /* - Header info: - 1 byte - checksum char checksum - 2 bytes - height short int height - 2 bytes - width short int width - 1 byte - 00 (char)0 - 1 byte - compression type unsigned char compressionType -*/ + * Header info: + * 1 byte - checksum char checksum + * 2 bytes - height short int height + * 2 bytes - width short int width + * 1 byte - 00 (char)0 + * 1 byte - compression type unsigned char compressionType + */ /* Expands an array into an image */ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) { /* - Reads data and extracts tImage - returns the next image address or -1 in case of error - */ + * Reads data and extracts tImage + * returns the next image address or -1 in case of error + */ int imageSizeInBytes; int result; @@ -184,7 +184,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) return COMPRESS_RESULT_FATAL #define checkResult if (result==COMPRESS_RESULT_FATAL)\ return COMPRESS_RESULT_FATAL - + switch (getAlgor(image->type)) { case COMPRESS_RAW: /* No Compression Algorithm */ if ((image->pix=getMemory(dataSizeInBytes))==NULL) return COMPRESS_RESULT_FATAL; @@ -237,10 +237,10 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { */ /* Forward compression */ - + /* COMPRESS_RAW * The allocation size is the image size. - * The algorithm is hardcoded. + * The algorithm is hard-coded. * There is no need to code a transposed version because * we have no compression to improve. */ @@ -249,22 +249,22 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { memcpy(compressed[COMPRESS_RAW],image->pix,imageSizeInBytes); /* COMPRESS_RLE_LR - * If all the uncompressed data has a big enthropy, there + * If all the uncompressed data has a big entropy, there * will be a control byte for a block of 127 bytes. * The allocation size has a maximum value of the image * size plus a byte each 127 bytes. * This is accoted by 2*n+50 */ cLevel(2) { - compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); + compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); compressRle( image->pix,imageSizeInBytes, compressed[COMPRESS_RLE_LR],&(compressedSize[COMPRESS_RLE_LR]) ); max_alg++; } - /* COMPRESS_LZG_LR - * If all the uncompressed data has a big enthropy, there + /* COMPRESS_LZG_LR + * If all the uncompressed data has a big entropy, there * will be a maskbyte for a block of 8 bytes. * The allocation size has a maximum value of the image * size plus a byte in 8. @@ -292,7 +292,7 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { * The following algorithms will be the same as above, but * using the image matrix transposed. */ - cLevel(3) + cLevel(3) antiTransposeImage(image,imageSizeInBytes); /* COMPRESS_RLE_UD */ @@ -353,6 +353,6 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { /* Free all compression attempts */ for (i=COMPRESS_RAW;i<max_alg;i++) free(compressed[i]); - return 1; + return 1; /* true */ } diff --git a/PR/src/lib/object/image/image256.c b/PR/src/lib/object/image/image256.c index c457ffc..44a74c6 100644 --- a/PR/src/lib/object/image/image256.c +++ b/PR/src/lib/object/image/image256.c @@ -49,13 +49,13 @@ compress.c: Princed Resources : Image Compression Library * * So the possible compression algorithm variants are: * RAW, RLE, RLEt, LZG, LZGt, LZG+, LZGt+ - * - * It is known that LZG+ allways compresses better or equal than LZG + * + * It is known that LZG+ always compresses better or equal than LZG * * Depending on the compression level, the compressor will compress with * all the algorithms specified and keep only the smaller result using * the following table - * + * * Level Algorithms * 1 RAW * 2 RAW, RLE @@ -67,18 +67,18 @@ compress.c: Princed Resources : Image Compression Library * * The default level used in PR will be 3. * - * In images with big enthropy that generates DAT files bigger than 64kb, using + * In images with big entropy that generates DAT files bigger than 64kb, using * a better compression is a must. The POP1 DAT file format has this limitation * and the only way to get through with it is improving the compression. * * For testing DAT files that are not for distribution compression 3 is highly - * recomended because is much faster and you perform compressions more often. - * + * recommended because is much faster and you perform compressions more often. + * * When you release a DAT file a compression level 7 is the best you can use. * You'll have to wait some time to get the importing, but the decompression * is as faster as the decompression in other levels. The game supports it and * decompresses the files very fast. Another advantage is that it is better to - * distribute smaller dat files. + * distribute smaller DAT files. * */ @@ -91,15 +91,15 @@ compress.c: Princed Resources : Image Compression Library \***************************************************************/ /* compress and sets the bytes */ -void compressLzg(const unsigned char* input, int inputSize, +void compressLzg(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -void compressRle(const unsigned char* input, int inputSize, +void compressRle(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -/* uncompress and allocates output */ -int expandLzg(const unsigned char* input, int inputSize, +/* decompress and allocates output */ +int expandLzg(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); /***************************************************************\ @@ -126,7 +126,7 @@ void transposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[transpose(cursor,image->widthInBytes,image->height)]=image->pix[cursor]; free(image->pix); image->pix=outputaux; @@ -136,7 +136,7 @@ void antiTransposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[cursor]=image->pix[transpose(cursor,image->widthInBytes,image->height)]; free(image->pix); image->pix=outputaux; @@ -147,20 +147,20 @@ void antiTransposeImage(tImage* image,int size) { \***************************************************************/ /* - Header info: - 1 byte - checksum char checksum - 2 bytes - height short int height - 2 bytes - width short int width - 1 byte - 00 (char)0 - 1 byte - compression type unsigned char compressionType -*/ + * Header info: + * 1 byte - checksum char checksum + * 2 bytes - height short int height + * 2 bytes - width short int width + * 1 byte - 00 (char)0 + * 1 byte - compression type unsigned char compressionType + */ /* Expands an array into an image */ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) { /* - Reads data and extracts tImage - returns the next image address or -1 in case of error - */ + * Reads data and extracts tImage + * returns the next image address or -1 in case of error + */ int imageSizeInBytes; int result; @@ -184,7 +184,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) return COMPRESS_RESULT_FATAL #define checkResult if (result==COMPRESS_RESULT_FATAL)\ return COMPRESS_RESULT_FATAL - + switch (getAlgor(image->type)) { case COMPRESS_RAW: /* No Compression Algorithm */ if ((image->pix=getMemory(dataSizeInBytes))==NULL) return COMPRESS_RESULT_FATAL; @@ -237,10 +237,10 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { */ /* Forward compression */ - + /* COMPRESS_RAW * The allocation size is the image size. - * The algorithm is hardcoded. + * The algorithm is hard-coded. * There is no need to code a transposed version because * we have no compression to improve. */ @@ -249,22 +249,22 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { memcpy(compressed[COMPRESS_RAW],image->pix,imageSizeInBytes); /* COMPRESS_RLE_LR - * If all the uncompressed data has a big enthropy, there + * If all the uncompressed data has a big entropy, there * will be a control byte for a block of 127 bytes. * The allocation size has a maximum value of the image * size plus a byte each 127 bytes. * This is accoted by 2*n+50 */ cLevel(2) { - compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); + compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); compressRle( image->pix,imageSizeInBytes, compressed[COMPRESS_RLE_LR],&(compressedSize[COMPRESS_RLE_LR]) ); max_alg++; } - /* COMPRESS_LZG_LR - * If all the uncompressed data has a big enthropy, there + /* COMPRESS_LZG_LR + * If all the uncompressed data has a big entropy, there * will be a maskbyte for a block of 8 bytes. * The allocation size has a maximum value of the image * size plus a byte in 8. @@ -292,7 +292,7 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { * The following algorithms will be the same as above, but * using the image matrix transposed. */ - cLevel(3) + cLevel(3) antiTransposeImage(image,imageSizeInBytes); /* COMPRESS_RLE_UD */ @@ -353,6 +353,6 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { /* Free all compression attempts */ for (i=COMPRESS_RAW;i<max_alg;i++) free(compressed[i]); - return 1; + return 1; /* true */ } diff --git a/PR/src/lib/object/image/image_common.c b/PR/src/lib/object/image/image_common.c index c457ffc..44a74c6 100644 --- a/PR/src/lib/object/image/image_common.c +++ b/PR/src/lib/object/image/image_common.c @@ -49,13 +49,13 @@ compress.c: Princed Resources : Image Compression Library * * So the possible compression algorithm variants are: * RAW, RLE, RLEt, LZG, LZGt, LZG+, LZGt+ - * - * It is known that LZG+ allways compresses better or equal than LZG + * + * It is known that LZG+ always compresses better or equal than LZG * * Depending on the compression level, the compressor will compress with * all the algorithms specified and keep only the smaller result using * the following table - * + * * Level Algorithms * 1 RAW * 2 RAW, RLE @@ -67,18 +67,18 @@ compress.c: Princed Resources : Image Compression Library * * The default level used in PR will be 3. * - * In images with big enthropy that generates DAT files bigger than 64kb, using + * In images with big entropy that generates DAT files bigger than 64kb, using * a better compression is a must. The POP1 DAT file format has this limitation * and the only way to get through with it is improving the compression. * * For testing DAT files that are not for distribution compression 3 is highly - * recomended because is much faster and you perform compressions more often. - * + * recommended because is much faster and you perform compressions more often. + * * When you release a DAT file a compression level 7 is the best you can use. * You'll have to wait some time to get the importing, but the decompression * is as faster as the decompression in other levels. The game supports it and * decompresses the files very fast. Another advantage is that it is better to - * distribute smaller dat files. + * distribute smaller DAT files. * */ @@ -91,15 +91,15 @@ compress.c: Princed Resources : Image Compression Library \***************************************************************/ /* compress and sets the bytes */ -void compressLzg(const unsigned char* input, int inputSize, +void compressLzg(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -void compressRle(const unsigned char* input, int inputSize, +void compressRle(const unsigned char* input, int inputSize, unsigned char* output, int *outputSize); -/* uncompress and allocates output */ -int expandLzg(const unsigned char* input, int inputSize, +/* decompress and allocates output */ +int expandLzg(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); -int expandRle(const unsigned char* input, int inputSize, +int expandRle(const unsigned char* input, int inputSize, unsigned char** output, int *outputSize); /***************************************************************\ @@ -126,7 +126,7 @@ void transposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[transpose(cursor,image->widthInBytes,image->height)]=image->pix[cursor]; free(image->pix); image->pix=outputaux; @@ -136,7 +136,7 @@ void antiTransposeImage(tImage* image,int size) { unsigned char* outputaux=getMemory(size); int cursor; - for (cursor=0;cursor<size;cursor++) + for (cursor=0;cursor<size;cursor++) outputaux[cursor]=image->pix[transpose(cursor,image->widthInBytes,image->height)]; free(image->pix); image->pix=outputaux; @@ -147,20 +147,20 @@ void antiTransposeImage(tImage* image,int size) { \***************************************************************/ /* - Header info: - 1 byte - checksum char checksum - 2 bytes - height short int height - 2 bytes - width short int width - 1 byte - 00 (char)0 - 1 byte - compression type unsigned char compressionType -*/ + * Header info: + * 1 byte - checksum char checksum + * 2 bytes - height short int height + * 2 bytes - width short int width + * 1 byte - 00 (char)0 + * 1 byte - compression type unsigned char compressionType + */ /* Expands an array into an image */ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) { /* - Reads data and extracts tImage - returns the next image address or -1 in case of error - */ + * Reads data and extracts tImage + * returns the next image address or -1 in case of error + */ int imageSizeInBytes; int result; @@ -184,7 +184,7 @@ int mExpandGraphic(const unsigned char* data,tImage *image, int dataSizeInBytes) return COMPRESS_RESULT_FATAL #define checkResult if (result==COMPRESS_RESULT_FATAL)\ return COMPRESS_RESULT_FATAL - + switch (getAlgor(image->type)) { case COMPRESS_RAW: /* No Compression Algorithm */ if ((image->pix=getMemory(dataSizeInBytes))==NULL) return COMPRESS_RESULT_FATAL; @@ -237,10 +237,10 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { */ /* Forward compression */ - + /* COMPRESS_RAW * The allocation size is the image size. - * The algorithm is hardcoded. + * The algorithm is hard-coded. * There is no need to code a transposed version because * we have no compression to improve. */ @@ -249,22 +249,22 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { memcpy(compressed[COMPRESS_RAW],image->pix,imageSizeInBytes); /* COMPRESS_RLE_LR - * If all the uncompressed data has a big enthropy, there + * If all the uncompressed data has a big entropy, there * will be a control byte for a block of 127 bytes. * The allocation size has a maximum value of the image * size plus a byte each 127 bytes. * This is accoted by 2*n+50 */ cLevel(2) { - compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); + compressed[COMPRESS_RLE_LR]=getMemory((2*imageSizeInBytes+50)); compressRle( image->pix,imageSizeInBytes, compressed[COMPRESS_RLE_LR],&(compressedSize[COMPRESS_RLE_LR]) ); max_alg++; } - /* COMPRESS_LZG_LR - * If all the uncompressed data has a big enthropy, there + /* COMPRESS_LZG_LR + * If all the uncompressed data has a big entropy, there * will be a maskbyte for a block of 8 bytes. * The allocation size has a maximum value of the image * size plus a byte in 8. @@ -292,7 +292,7 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { * The following algorithms will be the same as above, but * using the image matrix transposed. */ - cLevel(3) + cLevel(3) antiTransposeImage(image,imageSizeInBytes); /* COMPRESS_RLE_UD */ @@ -353,6 +353,6 @@ int mCompressGraphic(unsigned char* *data,tImage* image, int* dataSizeInBytes) { /* Free all compression attempts */ for (i=COMPRESS_RAW;i<max_alg;i++) free(compressed[i]); - return 1; + return 1; /* true */ } diff --git a/PR/src/lib/pr.c b/PR/src/lib/pr.c index fcb2be7..f7bf35a 100644 --- a/PR/src/lib/pr.c +++ b/PR/src/lib/pr.c @@ -63,7 +63,7 @@ pr.c: Main source file for Princed Resources library #include "memory.h" /* getMemory, free */ #include "unknown.h" -#include "search.h" /* parse */ +#include "search.h" /* parse */ /***************************************************************\ | Main working functions | @@ -82,45 +82,45 @@ int prExportDat(const char* vDatFile, const char* vDirName, const char* vResFile int prExportDatOpt(const char* vDatFile, const char* vDirName, const char* vResFile,int opt,const char* vDatFileName,const char* datAuthor, const char* backupExtension,const char* format) { /* - Arguments: - char* vDatFile - full Path to the dat file - char* vDirName - full Path to the extracting folder - (doesn't need to exist) - char* vResFile - full Path to the resources XML file - NULL is the default file resources.xml - char opt - program options, see below - char* vDatFileName - name of the file to be extracted - NULL means predict it from vDatFile - const char* datAuthor - Author's name when extracting PLV's, - NULL is default - const char* backupExtension - - If backup_flag is set, the string to attach - to the backup files - const char* format - - Sets the format the unknown files will be created. - See stringformat.c documentation. - - Options: - unknown_flag - generate the unknown file without performing - any extraction - raw_flag - uses raw format - verbose_flag - explain what is being done - recursive_flag - searches for all dat files (only if vDatFile - is not a dat file and vDatFileName is NULL) - force_flag - default option, you cannot disable it, - so please make a backup of your files - backup_flag - backup your files - - Return values: - 00 Ok - -1 Error accessing the file DAT - -2 Memory error in extraction - -3 Invalid DAT file - -4 XML Parse error - -5 Memory error in parsing - -6 XML Attribute not recognized - -7 XML File not found - */ + * Arguments: + * char* vDatFile - full Path to the DAT file + * char* vDirName - full Path to the extracting folder + * (doesn't need to exist) + * char* vResFile - full Path to the resources XML file + * NULL is the default file resources.xml + * char opt - program options, see below + * char* vDatFileName - name of the file to be extracted + * NULL means predict it from vDatFile + * const char* datAuthor - Author's name when extracting PLV's, + * NULL is default + * const char* backupExtension + * - If backup_flag is set, the string to attach + * to the backup files + * const char* format + * - Sets the format the unknown files will be created. + * See stringformat.c documentation. + * + * Options: + * unknown_flag - generate the unknown file without performing + * any extraction + * raw_flag - uses raw format + * verbose_flag - explain what is being done + * recursive_flag - searches for all DAT files (only if vDatFile + * is not a DAT file and vDatFileName is NULL) + * force_flag - default option, you cannot disable it, + * so please make a backup of your files + * backup_flag - backup your files + * + * Return values: + * 00 Ok + * -1 Error accessing the file DAT + * -2 Memory error in extraction + * -3 Invalid DAT file + * -4 XML Parse error + * -5 Memory error in parsing + * -6 XML Attribute not recognized + * -7 XML File not found + */ /* Declare variables */ tResourceList r; @@ -135,7 +135,7 @@ int prExportDatOpt(const char* vDatFile, const char* vDirName, const char* vResF if (parseGivenPath(currentDatFile)) return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; - if (vDatFileName==NULL) { /* if no special dat file was specified, a path parsed will be used */ + if (vDatFileName==NULL) { /* if no special DAT file was specified, a path parsed will be used */ aux=getFileNameFromPath(currentDatFile); } else { aux=vDatFileName; @@ -163,40 +163,40 @@ int prImportDat(const char* vDatFile, const char* vDirName, const char* vResFile int prImportDatOpt(const char* vDatFile, const char* vDirName, const char* vResFile,int opt,const char* vDatFileName, const char* backupExtension) { /* - Arguments: - char* vDatFile - full Path to the dat file; - if file use it, if directory, perform it for - all files - char* vDirName - full Path to the extracting folder - (doesn't need to exist) - char* vResFile - full Path to the resources XML file - (resources.xml by default) - char opt - program options, see below - char *vDatFileName - name of the file to be extracted - NULL means predict it from vDatFile - const char* backupExtension - - If backup_flag is set, the string to attach - to the backup files - - Options: - raw_flag - uses raw format - verbose_flag - explain what is being done - recursive_flag - searches for all dat files (only if vDatFile - is not a dat file and vDatFileName is NULL) - force_flag - If not set and the file exists it will prompt - for action - backup_flag - backup your files - - Return values: - -1 DAT File couldn't be open for writing - -2 DAT file not found or invalid in partial importation - -3 XML Parse error - -4 No memory - -5 XML Attribute not recognized - -6 XML File not found - 00 File successfully imported - positive number: number of missing files - */ + * Arguments: + * char* vDatFile - full Path to the DAT file; + * if file use it, if directory, perform it for + * all files + * char* vDirName - full Path to the extracting folder + * (doesn't need to exist) + * char* vResFile - full Path to the resources XML file + * (resources.xml by default) + * char opt - program options, see below + * char *vDatFileName - name of the file to be extracted + * NULL means predict it from vDatFile + * const char* backupExtension + * - If backup_flag is set, the string to attach + * to the backup files + * + * Options: + * raw_flag - uses raw format + * verbose_flag - explain what is being done + * recursive_flag - searches for all DAT files (only if vDatFile + * is not a DAT file and vDatFileName is NULL) + * force_flag - If not set and the file exists it will prompt + * for action + * backup_flag - backup your files + * + * Return values: + * -1 DAT File couldn't be open for writing + * -2 DAT file not found or invalid in partial importation + * -3 XML Parse error + * -4 No memory + * -5 XML Attribute not recognized + * -6 XML File not found + * 00 File successfully imported + * positive number: number of missing files + */ /* Declare variables */ tResourceList r; @@ -211,7 +211,7 @@ int prImportDatOpt(const char* vDatFile, const char* vDirName, const char* vResF if (parseGivenPath(currentDatFile)) return PR_RESULT_ERR_COMMAND_LINE_SYNTAX; - if (vDatFileName==NULL) { /* if no special dat file was specified, a path parsed will be used */ + if (vDatFileName==NULL) { /* if no special DAT file was specified, a path parsed will be used */ aux=getFileNameFromPath(currentDatFile); } else { aux=vDatFileName; @@ -231,7 +231,7 @@ int prImportDatOpt(const char* vDatFile, const char* vDirName, const char* vResF return a; } -/* When compiling in Unix SO libraries */ +/* When compiling in UNIX SO libraries */ #ifndef WIN32 void start() {} #endif diff --git a/PR/src/lib/xml/parse.c b/PR/src/lib/xml/parse.c index 3f81723..d137b98 100644 --- a/PR/src/lib/xml/parse.c +++ b/PR/src/lib/xml/parse.c @@ -19,7 +19,7 @@ */ /* -parse.c: Princed Resources : xml parsing functions +parse.c: Princed Resources : XML parsing functions \xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 23 Oct 2003 @@ -143,7 +143,7 @@ int attribFill(char* attr,char* val, tTag* t) { } FillAttr(t->desc,"desc"); - FillAttr(t->path,"external"); /* external is a path alias for old compatibilities */ + FillAttr(t->path,"external"); /* external is a path alias for old compatibility */ FillAttr(t->path,"path"); FillAttr(t->file,"file"); FillAttr(t->type,"type"); @@ -347,7 +347,7 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) { * PR_RESULT_ERR_XML_ATTR Attribute not recognized * PR_RESULT_ERR_MEMORY No memory * PR_RESULT_ERR_XML_PARSING Parse error - * PR_RESULT_SUCCESS If the tag was parsed succesfully + * PR_RESULT_SUCCESS If the tag was parsed successfully */ tTag* tag; @@ -362,7 +362,7 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) { if ((*error)<0) {freeTagStructure(tag);return NULL;} /* Fatal error */ /* (*error) is - * XML_TAG_CLOSE If tag is closed in the same openning + * XML_TAG_CLOSE If tag is closed in the same opening * XML_TAG_OPEN If tag remains open */ if ((*error)==XML_TAG_CLOSE) { @@ -371,7 +371,7 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) { } /* In case there are some empty attributes, they may be inherited */ - /* BEGIN specific xml tag inheritance */ + /* BEGIN specific XML tag inheritance */ { int x; char* str; @@ -402,7 +402,7 @@ tTag* makeTree(char** p,char* name, int* error,tTag* father) { tag->path=str; } } - /* END specific xml tag inheritance */ + /* END specific XML tag inheritance */ /* Parse Child tags */ while (1) { (*error)=getNextTag(p, &value); @@ -488,13 +488,13 @@ tTag* parseXmlFile(const char* vFile,int* error) { *error=PR_RESULT_ERR_XML_FILE; /* File not open */ return NULL; } - /* bugfix moved to loadArray */ l[size-1]=0; /* The last character must be an end of line (the > is forbiden) */ + /* bug fix moved to loadArray */ l[size-1]=0; /* The last character must be an end of line (the > is forbidden) */ p=l; *error=getNextTag(&p, &value); if ((*error)<0) { free(l); - return NULL; /* Fatal error will stop the execusion of the parsing */ + return NULL; /* Fatal error will stop the execution of the parsing */ } father=getTagStructure(); @@ -513,7 +513,7 @@ tTag* parseXmlFile(const char* vFile,int* error) { if (*error<0) { freeTagStructure(tag); free(father); - return NULL; /* Fatal error will stop the execusion of the parsing */ + return NULL; /* Fatal error will stop the execution of the parsing */ } if (*error==XML_WAS_EOD) { /* XML_WAS_EOD means end of document */ *error=PR_RESULT_SUCCESS; @@ -533,12 +533,12 @@ static int xmlStructureError=0; /* cache parsed structure. If null is passed the default name will be used */ int parseStructure(const char* vFile,tTag** structure) { - /* Resources input xml tree. Private+abstract variable */ + /* Resources input XML tree. Private+abstract variable */ static const char defaultXmlFile[]=RES_XML_RESOURC_XML; if (vFile==NULL) vFile=defaultXmlFile; - /* Generate xml structure if doesn't exist */ + /* Generate XML structure if doesn't exist */ if (strcmp(lastFile,vFile)) { /* if the file is different than the cached file */ freeParsedStructure(&xmlStructure); diff --git a/PR/src/lib/xml/search.c b/PR/src/lib/xml/search.c index 857fdf0..00bcacf 100644 --- a/PR/src/lib/xml/search.c +++ b/PR/src/lib/xml/search.c @@ -19,7 +19,7 @@ */ /* -search.c: Princed Resources : specific xml handling functions +search.c: Princed Resources : Specific XML handling functions \xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 23 Oct 2003 @@ -45,7 +45,7 @@ search.c: Princed Resources : specific xml handling functions #include "translate.h" /* to translate indexes */ /***************************************************************\ -| Filtering xml structure to tResourceList | +| Filtering XML structure to tResourceList | \***************************************************************/ /* parse file */ @@ -55,10 +55,10 @@ int parseFile(const char* vFile, const char* datFile, tResourceList *rlist) { tPassWork pass; tTag* structure; - /* Generate xml structure if doesn't exist */ + /* Generate XML structure if doesn't exist */ if ((error=parseStructure(vFile,&structure))) return error; - /* Use the xml structure to Generate the resource structure of the file */ + /* Use the XML structure to Generate the resource structure of the file */ pass.datFile=datFile; pass.rlist=rlist; workTree(structure,&pass,workTag); @@ -113,7 +113,7 @@ void workTag(const tTag* t,void* pass) { char* end; /* Skipping conditions */ - if (!equalsIgnoreCase(t->file,datFile)) return; /* If it doesn't belong to the given dat file */ + if (!equalsIgnoreCase(t->file,datFile)) return; /* If it doesn't belong to the given DAT file */ if (!t->value) return; /* If there was not number id */ if (!t->index) return; /* If there was not index id */ if (!equalsIgnoreCase(t->tag,"item")) return; /* If the tag isn't an item */ diff --git a/PR/src/lib/xml/translate.c b/PR/src/lib/xml/translate.c index 293d679..e305f94 100644 --- a/PR/src/lib/xml/translate.c +++ b/PR/src/lib/xml/translate.c @@ -19,8 +19,8 @@ */ /* -translate.c: Princed Resources : array translating resources -\xaf\xaf\xaf\xaf\xaf\xaf\xaf +translate.c: Princed Resources : Array translating resources +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 16 Dec 2005 diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c index cd41ab6..bf67815 100644 --- a/PR/src/lib/xml/tree.c +++ b/PR/src/lib/xml/tree.c @@ -19,7 +19,7 @@ */ /* -tree.c: Princed Resources : Tree handling routines +tree.c: Princed Resources : Specific XML tree handling routines \xaf\xaf\xaf\xaf\xaf\xaf Copyright 2005 Princed Development Team Created: 28 Dec 2005 @@ -49,8 +49,8 @@ tree.c: Princed Resources : Tree handling routines \***************************************************************/ #define XML_HEADER \ - "<!DOCTYPE resources SYSTEM \"http://www.princed.com.ar/standards/xml/resources/std1.dtd\">\n"\ - "<?xml version=\"1.0\" ?>\n" + "<!DOCTYPE resources SYSTEM \"http://www.princed.com.ar/standards/XML/resources/std1.dtd\">\n"\ + "<?XML version=\"1.0\" ?>\n" /***************************************************************\ | Common factor tree reducing routines | @@ -60,14 +60,14 @@ tree.c: Princed Resources : Tree handling routines * Affected attributes: only fully inheritable * PRE: inheritances are shown in the tree, so if the parent has * file="a", then the son comes with file="a" except that other - * file was explicity specified for the child. NULL is never shown + * file was explicitly specified for the child. NULL is never shown * after a non-NULL parent. * - * POST: if the folder has n childs and there are n/2 equal attributes + * POST: if the folder has n children and there are n/2 equal attributes * then those attributes comes to the parent. * - * if the folder has n childs and there are at most 10/n different attributes - * we can say that there is a ratio of 10 items per atribute or more. + * if the folder has n children and there are at most 10/n different attributes + * we can say that there is a ratio of 10 items per attribute or more. * If that happens for at least one attribute, the attribute with the highest * ratio will be partitioned that way: * if an attribute value is present in 3 or more items, all items goes @@ -190,7 +190,6 @@ void test() { tTag tr[100]; int i; for (i=0;i<6800;i++) ((char*)tr)[i]=0; -/* memset(tr,0,100*sizeof(tTag*));*/ tr[0].child=&(tr[1]); @@ -291,7 +290,7 @@ void unknown_item(int value,const char* index,const char* path,const char* type, } /***************************************************************\ -| Memory tree --> xml | +| Memory tree --> XML | \***************************************************************/ void generateXML(int n,/*const*/ tTag* t,FILE* outputStream) { @@ -361,7 +360,7 @@ void rec_tree(tTag* *t,const char* file) { *t=aux->child; /* the children are now replacing his parent */ if ((*t)->next) { for(aux2=*t;aux2->next;aux2=aux2->next); /* go to the last child */ - aux2->next=aux->next; /* and set the next siebling as the parent next siebling */ + aux2->next=aux->next; /* and set the next sibling as the parent next sibling */ } aux->child=NULL; } else { diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c index 0e53cc9..93a2fa3 100644 --- a/PR/src/lib/xml/unknown.c +++ b/PR/src/lib/xml/unknown.c @@ -19,8 +19,8 @@ */ /* -unknown.c: Princed Resources : Unknown resources handler -\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf +unknown.c: Princed Resources : Unknown resources handler implementation +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -137,7 +137,7 @@ int unknownLogStop () { } } - /* generate the xml file */ + /* generate the XML file */ generateXML(0,unknownFile.tree,unknownFile.fd); /* it's time to free the tree */