author | ecalot
<ecalot> 2006-01-07 20:41:16 UTC |
committer | ecalot
<ecalot> 2006-01-07 20:41:16 UTC |
parent | 6b0f99163cc4a4477eb19eb5be109a669fdeb3a4 |
PR/src/include/classify.h | +4 | -4 |
PR/src/include/common.h | +9 | -4 |
PR/src/include/en.lang.pr.h | +36 | -33 |
PR/src/include/filedir.h | +5 | -5 |
PR/src/include/idlist.h | +2 | -2 |
PR/src/include/parse.h | +4 | -3 |
PR/src/include/search.h | +3 | -3 |
PR/src/include/stringformat.h | +8 | -9 |
PR/src/include/unknown.h | +2 | -2 |
diff --git a/PR/src/include/classify.h b/PR/src/include/classify.h index 07fe3b4..87193c7 100644 --- a/PR/src/include/classify.h +++ b/PR/src/include/classify.h @@ -19,8 +19,8 @@ */ /* -tasks.h: Princed Resources : Other DAT file handling tasks headers -\xaf\xaf\xaf\xaf\xaf\xaf\xaf +classify.h: Princed Resources : Other DAT file handling tasks headers +\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf\xaf Copyright 2003 Princed Development Team Created: 24 Aug 2003 @@ -31,8 +31,8 @@ tasks.h: Princed Resources : Other DAT file handling tasks headers DO NOT remove this copyright notice */ -#ifndef _TASKS_H_ -#define _TASKS_H_ +#ifndef _CLASSIFY_H_ +#define _CLASSIFY_H_ /* Return values may be: diff --git a/PR/src/include/common.h b/PR/src/include/common.h index ba39e47..df2306e 100644 --- a/PR/src/include/common.h +++ b/PR/src/include/common.h @@ -66,7 +66,7 @@ common.h: Princed Resources : Defines and prototypes common to all PR code #define PR_URL "http://www.princed.com.ar" #define PR_VERSION "v1.2-dev" -#define PR_COPY "(c) Copyright 2003 - 2006 Princed Development Team" +#define PR_COPY "(c) Copyright 2003-2006 Princed Development Team" /***************************************************************\ | Other defines | @@ -195,7 +195,8 @@ PARSING_OPTRAW\ #define hasFlag(a) (optionflag&(a)) #define setFlag(a) optionflag|=(a) -#define PR_RESULT_ERR_EXTRACTION -1 +#define PR_RESULT_ERR_COMMAND_LINE_SYNTAX -17 +#define PR_RESULT_ERR_EXTRACTION -18 #define PR_RESULT_ERR_FILE_DAT_NOT_OPEN_NOTFOUND -2 #define PR_RESULT_ERR_FILE_DAT_NOT_OPEN_WASDIR -3 #define PR_RESULT_ERR_FILE_DAT_NOT_READ_ACCESS -4 @@ -206,11 +207,15 @@ PARSING_OPTRAW\ #define PR_RESULT_ERR_FILE_NOT_WRITE_ACCESS -9 #define PR_RESULT_ERR_INVALID_DAT -10 #define PR_RESULT_ERR_MEMORY -11 +#define PR_RESULT_ERR_XML_ALREADY_OPEN -15 #define PR_RESULT_ERR_XML_ATTR -12 #define PR_RESULT_ERR_XML_FILE -13 -#define PR_RESULT_ERR_XML_PARSING -14 -#define PR_RESULT_ERR_XML_ALREADY_OPEN -15 #define PR_RESULT_ERR_XML_NOT_OPEN -16 +#define PR_RESULT_ERR_XML_PARSING -14 +#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_HELP_SHOWN -1 #define PR_RESULT_SUCCESS 0 #endif diff --git a/PR/src/include/en.lang.pr.h b/PR/src/include/en.lang.pr.h index f344cde..60c9ff1 100644 --- a/PR/src/include/en.lang.pr.h +++ b/PR/src/include/en.lang.pr.h @@ -74,8 +74,6 @@ pr.h: Princed Resources : English language strings #define PR_TEXT_EXPORT_ERROR "'%s' has errors, aborting...\n" #define PR_TEXT_EXPORT_BMP_WARN "Warning: Extracted file may be corrupt\n" -#define PR_TEXT_ERROR_IMPORT_NORECURSE "Recursive flag must not be set when you import files\n" -#define PR_TEXT_ERROR_NO_FILES_SEL "No files selected\n" #define PR_TEXT_ERROR_ONE_DIR "You may select one directory to export all dat files or specifiy dat files.\nBoth actions are not allowed.\n" #define PR_TEXT_ERROR_XML_FILE "Error, check the xml file\n" @@ -85,7 +83,7 @@ pr.h: Princed Resources : English language strings #define PR_TEXT_ERRORS {\ "Success",\ - "Extraction error",\ + NULL, /* help shown */\ "Dat file not found",\ "Expected dat file, but a directory was given",\ "DAT file reading permission denied",\ @@ -99,44 +97,50 @@ pr.h: Princed Resources : English language strings "XML parsing attribute error",\ "Cannot open XML file",\ "XML parsing error",\ - "-15","-16","-17","-18","-19","-20"} + "XML file already open",\ + "XML file cannot be open",\ + "Input line syntax error",\ + "Extraction error",\ + "-19",\ + "You may select one directory to export all dat files or specify dat files; both actions are not allowed",\ + "Recursive flag must not be set when you import files",\ + "No files selected", /* should never happen because default is "." */\ + "-23"} + #define PR_TEXT_TYPES {\ -NULL,\ -"Levels file",\ -"Graphic DAT file without palette",\ -"Waves/Digital sound file",\ -"Midis file",\ -"Valid DAT file with undefined content",\ -"Graphic DAT file",\ -"Internal PC Speaker dat file",\ -NULL,NULL,NULL,\ -"invalid Pop2 dat file",\ -"Pop2 level file",\ -"Pop2 graphic dat file",\ -"Pop2 wav dat file",\ -"Pop2 midi dat file",\ -"Pop2 valid dat file",\ -"Pop2 graphic dat file"} + NULL,\ + "Levels file",\ + "Graphic DAT file without palette",\ + "Waves/Digital sound file",\ + "Midis file",\ + "Valid DAT file with undefined content",\ + "Graphic DAT file",\ + "Internal PC Speaker dat file",\ + NULL,NULL,NULL,\ + "invalid Pop2 dat file",\ + "Pop2 level file",\ + "Pop2 graphic dat file",\ + "Pop2 wav dat file",\ + "Pop2 midi dat file",\ + "Pop2 valid dat file",\ + "Pop2 graphic dat file"} #define PR_TEXT_IMPORT_ARRAY {\ -"File successfully imported",\ -"DAT file not found or invalid in partial importation",\ -"DAT File couldn't be open",\ -"XML Parseing error",\ -"No memory",\ -"XML Attribute not recognized",\ -"XML File not found"} + "File successfully imported",\ + "DAT file not found or invalid in partial importation",\ + "DAT File couldn't be open",\ + "XML Parseing error",\ + "No memory",\ + "XML Attribute not recognized",\ + "XML File not found"} /***************************************************************\ | Command Line options information | \***************************************************************/ -#ifndef PR_IGNORE_RAW_OPTION -#define PARSING_RAW " -r, --raw uses raw format\n" -#else -#define PARSING_RAW "" -#endif +#define PARSING_RAW " -w, --raw uses raw format\n" + #define PARSING_HELP_BEGIN "Usage: \n\ pr [OPTIONS] [-x[EXPORTDIR]|-m[IMPORTDIR]|-c] [DATFILEPATH[ ...]]\n\ pr --help\n\ @@ -189,4 +193,3 @@ NULL,NULL,NULL,\ #define PR_TXT_XML "Resources.xml edition" #define PR_TXT_TRANSLATION "" #define PR_TXT_ABOUT_TRANSLATOR "" - diff --git a/PR/src/include/filedir.h b/PR/src/include/filedir.h index bdfa69c..332d55d 100644 --- a/PR/src/include/filedir.h +++ b/PR/src/include/filedir.h @@ -40,20 +40,20 @@ filedir.h: Princed Resources : xml handling functions header file /* types */ typedef struct tFileDir { - char* file; - struct tFileDir* next; + char* file; + struct tFileDir* next; }tFileDir; typedef struct { - tFileDir filenames; - tFileDir options; + tFileDir filenames; + tFileDir options; }tFileDir2; /* prototypes */ void fileDirClearOptions(tFileDir2* list1); void fileDirAddOption(tFileDir2* list1, const char* option); -int fileDirGetFiles(tFileDir2* list1,tFileDir2* files,int hasExportFlag,int notHasRecursiveFlag,const char* resfile,int givenDatFilename); +int fileDirGetFiles(tFileDir2* list1,tFileDir2* files,int hasExportFlag,int notHasRecursiveFlag,const char* resfile,int givenDatFilename); char* fileDirGetFile(tFileDir2* files,char** datfile); #endif diff --git a/PR/src/include/idlist.h b/PR/src/include/idlist.h index 44884ee..82d0429 100644 --- a/PR/src/include/idlist.h +++ b/PR/src/include/idlist.h @@ -39,9 +39,9 @@ idlist.h: Princed Resources : Resource id list headers #define PARSING_MAX_TOKEN_SIZE 200 -void parseGivenPath(char* path); +int parseGivenPath(char* path); int partialListActive(); -int isInThePartialList(const char* vFile, tResourceId id); +int isInThePartialList(const char* vFile, tResourceId id); void freePartialList(); #endif diff --git a/PR/src/include/parse.h b/PR/src/include/parse.h index 8011a11..6df1ad7 100644 --- a/PR/src/include/parse.h +++ b/PR/src/include/parse.h @@ -31,13 +31,14 @@ parse.h: Princed Resources : xml handling functions headers DO NOT remove this copyright notice */ -#ifndef _XMLPARSE_H_ -#define _XMLPARSE_H_ +#ifndef _PARSE_H_ +#define _PARSE_H_ +#include "pr.h" const char* getExtDesc(int type); +tTag* getTagStructure(); #ifdef IGNOREVERIFYDATTYPES -#include "pr.h" void showTag(int n,tTag* t); #endif diff --git a/PR/src/include/search.h b/PR/src/include/search.h index dbcbbb9..687db63 100644 --- a/PR/src/include/search.h +++ b/PR/src/include/search.h @@ -35,8 +35,8 @@ search.h: Princed Resources : xml handling functions header file | I M P L E M E N T A T I O N | \***************************************************************/ -#ifndef _XMLSEARCH_H_ -#define _XMLSEARCH_H_ +#ifndef _SEARCH_H_ +#define _SEARCH_H_ /* Includes */ #include "common.h" /* tTag */ @@ -70,7 +70,7 @@ typedef struct tPassCompare { const tTag* tag; }tPassCompare; -int getOrder(const char* order); +int getOrder(const char* order); #endif diff --git a/PR/src/include/stringformat.h b/PR/src/include/stringformat.h index ce5672f..e394427 100644 --- a/PR/src/include/stringformat.h +++ b/PR/src/include/stringformat.h @@ -36,20 +36,19 @@ 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* 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: - * %v - the value - * %i - the 4-chars index name + * %% - a % sign * %I - the human-like index name - * %t - the item type (image, wave, etc) + * %d - the description * %e - the extension (bmp, wav, etc) + * %i - the 4-chars index name + * %m - the name of the item * %n - the number of the item typed in %t * %o - the order number (in case the index and values are the same) - * %d - the description - * %% - a % sign + * %t - the item type (image, wave, etc) + * %v - the value * - * TODO: add name - * * Modifiers: (TODO: truncate flag) * %5i - the index truncated to 5 bytes or the index size, whatever comes first * %05i - the same, but in case the index is sized less than 5 it's filled with spaces @@ -59,7 +58,7 @@ const char* parseformat(const char* format,long value,const char* index, const c * Examples: * "%i%05v.%e" for shap25001.bmp * "%t%02n.%e" for image01.bmp - * + * * Limitations: * The generated string size has a limit, in case it is reached, a NULL pointer will be returned */ diff --git a/PR/src/include/unknown.h b/PR/src/include/unknown.h index d9313fd..5c855c1 100644 --- a/PR/src/include/unknown.h +++ b/PR/src/include/unknown.h @@ -43,14 +43,14 @@ unknown.h: Princed Resources : Unknown.xml generator headers #include "reslist.h" #include "tree.h" /* tTreeStatus */ -typedef struct { +typedef struct { char* backupExtension; char* currentDat; FILE* fd; tTreeStatus status; tTag* tree; unsigned int optionflag; - unsigned int typeCount[RES_TYPECOUNT]; /* initialized in 0 */ + unsigned int typeCount[RES_TYPECOUNT]; } tUnknownFile; /* Resources extras */