git » fp-git.git » commit 5dffd1a

o Abstracted dat

author ecalot
2004-03-21 23:47:17 UTC
committer ecalot
2004-03-21 23:47:17 UTC
parent 807350f04355d5f61efd149865a5bdc3c1f2f5df

o Abstracted dat
o Abstracted language support
o Renamed xml to xmlparse

PR/src/include/dat.h +59 -0
PR/src/include/english.h +171 -0
PR/src/include/parse.h +62 -0
PR/src/include/spanish.h +167 -0

diff --git a/PR/src/include/dat.h b/PR/src/include/dat.h
new file mode 100644
index 0000000..6369379
--- /dev/null
+++ b/PR/src/include/dat.h
@@ -0,0 +1,59 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program 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
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    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
+*/
+
+/*
+dat.h: Princed Resources : DAT library headers
+\xaf\xaf\xaf\xaf\xaf
+ Copyright 2004 Princed Development Team
+  Created: 15 Mar 2004
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.00 (2004-Mar-15)
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+#ifndef _DAT_H_
+#define _DAT_H_
+
+#include "resources.h"
+
+/* DAT reading and writing primitives primitives */
+int mRWBeginDatFile(const char* vFile, unsigned short int *numberOfItems, int optionflag);
+#define mRWCloseDatFile(dontSave) \
+mReadCloseDatFile();\
+mWriteCloseDatFile(r,dontSave,optionflag,backupExtension)
+
+
+/* DAT reading primitives */
+int  mReadBeginDatFile(unsigned short int *numberOfItems,const char* vFile);
+int  mReadGetFileInDatFile(int indexNumber,unsigned char* *data,unsigned long  int *size);
+int  mReadInitResource(tResource** res,const unsigned char* data,long size);
+void mReadCloseDatFile();
+
+/* DAT writing primitives */
+int  mWriteBeginDatFile(const char* vFile, int optionflag);
+void mWriteSetFileInDatFile(unsigned char* data, int size);
+void mWriteSetFileInDatFileIgnoreChecksum(unsigned char* data,int size);
+void mWriteInitResource(tResource** res);
+void mWriteCloseDatFile(tResource* r[],int dontSave,int optionflag, const char* backupExtension);
+
+#endif
diff --git a/PR/src/include/english.h b/PR/src/include/english.h
new file mode 100644
index 0000000..db26172
--- /dev/null
+++ b/PR/src/include/english.h
@@ -0,0 +1,171 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program 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
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    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
+*/
+
+/*
+pr.h: Princed Resources : English language strings
+\xaf\xaf\xaf\xaf
+ Copyright 2003 Princed Development Team
+  Created: 18 Feb 2004
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.00 (2004-Feb-18)
+
+  Language: English
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+/***************************************************************\
+|                           Text Defines                        |
+\***************************************************************/
+
+#define PR_ABOUT                  "Princed resources (PR) "PR_VERSION" "OS"\n"PR_COPY"\n"PR_URL"\n\n"
+
+#define PR_CGI_TEXT1              "Content-Type:text/html\n\nRunning as a cgi\n"
+#define PR_CGI_TEXT2              "Result: %02d type\n"
+
+#define PR_TEXT_RESULT            "Result: %s (%d)\n"
+#define PR_TEXT_RESULT_ERR        "Result: %d files with errors\n"
+
+#define PR_TEXT_FILE_NOT_FOUND    "Result: File or directory '%s' not found\n"
+
+#define PR_TEXT_SCANNING_CURRENT  "Scanning dat files in current directory\n"
+#define PR_TEXT_SCANNING_GIVEN    "Scanning dat files in given directory\n"
+
+#define PR_TEXT_IMPORTING_CURRENT "Importing all valid dat files from the current directory\n"
+#define PR_TEXT_IMPORTING_GIVEN   "Importing all valid files from given directory\n"
+
+#define PR_TEXT_TASK_COMPILE      "Importing '%s' from '%s'\n"
+#define PR_TEXT_TASK_CLASSIFY     "Classifying '%s'\n"
+#define PR_TEXT_TASK_EXTRACT      "Exporting '%s' to '%s'\n"
+
+#define PR_TEXT_DISK_PROCESSING   "Processing '%s'...\n"
+#define PR_TEXT_DISK_REPLACE      "File %s already exists. Replace? [Yes/no/all]:"
+#define PR_DISK_REPLACE_NO        'N'
+#define PR_DISK_REPLACE_ALL       'A'
+
+#define PR_TEXT_IMPORT_NOT_OPEN   "'%s' not open, skipped\n"
+#define PR_TEXT_IMPORT_SUCCESS    "'%s' successfully imported\n"
+#define PR_TEXT_IMPORT_ERRORS     "'%s' has errors, skipped\n"
+#define PR_TEXT_IMPORT_DONE       "Importing done, %d files imported ok, %d files with error\n"
+
+#define PR_TEXT_EXPORT_WORKING    "'%s' successfully exported\n"
+#define PR_TEXT_EXPORT_ERROR      "'%s' has errors, aborting...\n"
+#define PR_TEXT_EXPORT_BMP_WARN   "Warning: Extracted file may be corrupt\n"
+
+/***************************************************************\
+|                        Text Output Arrays                     |
+\***************************************************************/
+
+#define PR_TEXT_EXPORT_ARRAY {\
+"Ok",\
+"Error accessing a file",\
+"Memory error in extraction",\
+"Invalid DAT file",\
+"XML Parsing error",\
+"Memory error in parsing",\
+"XML Attribute not recognized",\
+"XML File not found"}
+
+#define PR_TEXT_CLASSIFY_ARRAY {\
+"Memory error",\
+"File not found or no access error",\
+"Not a valid DAT file",\
+"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",\
+"","","",\
+"Pop2 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"}
+
+/***************************************************************\
+|                 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_HELP_BEGIN "Usage: \n\
+  pr [-x[EXPORTDIR]|-i[IMPORTDIR]|-d] [DATFILEPATH]\n\
+  pr [OPTIONS] [DATFILEPATH]\n\
+\n\
+  Mandatory arguments to long options are mandatory for short options too.\n\
+\n"
+#define PARSING_HELP_PART1 "\
+   -i, -c, --import[=DIRNAME] imports from DIRNAME into given dat file\n\
+   -d, --classify             returns the dat file type\n\
+   -x, -e, --export[=DIRNAME] exports given dat file into DIRNAME\n\
+\n"
+#define PARSING_HELP_PART2 "\
+   -a, --setauthor=NAME       sets your name in extracted plv files\n\
+   -b, --backup[=EXTENSION]   backup your files\n\
+   -f, --force                rewrites your files without prompting\n\
+   -g, --cgi                  run as CGI and output mime headers\n\
+   -h, -?, --help             display this help and exit\n\
+   -s, --resource=RESFILE     uses an user-specific resource xml file\n\
+"PARSING_RAW
+
+#define PARSING_HELP_PART3 "\
+   -R, --recursive            searches for all dat files (only if DATFILEPATH\n\
+                              is not a dat file)\n\
+   -t, --datfile=DATFILE      specifies a dat file to read resources\n\
+                              different than the original file\n\
+       --unknown              generate the unknown file without performing\n\
+                              any extraction\n\
+   -v, --verbose              explain what is being done\n\
+       --version              output version information and exit\n\
+\n"
+
+#define PARSING_ABOUT "Authors: \n\
+   Coding & main routines\n\
+    Enrique Calot\n\
+\n\
+   Coding assistant\n\
+    Santiago Zamora\n\
+\n\
+   Graphic compression algorithms\n\
+    Tammo Jan Dijkema\n\
+    Enrique Calot\n\
+\n\
+   Graphic format development\n\
+    Tammo Jan Dijkema\n\
+    Anke Balderer\n\
+\n\
+   MID Sound format development\n\
+    Christian Lundheim\n\
+\n\
+   Resources.xml edition\n\
+    Steven Fayers\n\
+\n"
diff --git a/PR/src/include/parse.h b/PR/src/include/parse.h
new file mode 100644
index 0000000..9035800
--- /dev/null
+++ b/PR/src/include/parse.h
@@ -0,0 +1,62 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program 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
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    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
+*/
+
+/*
+xmlparse.h: Princed Resources : xml handling functions headers
+\xaf\xaf\xaf\xaf\xaf
+ Copyright 2003 Princed Development Team
+  Created: 23 Oct 2003
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.01 (2003-Oct-25)
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+#ifndef _XMLPARSE_H_
+#define _XMLPARSE_H_
+
+int equalsIgnoreCase(const char s1[],const char s2[]);
+
+typedef struct tTag {
+	struct tTag* child;
+	struct tTag* next;
+	char* tag;
+	char* desc;
+	char* path;
+	char* file;
+	char* itemtype;
+	char* name;
+	char* palette;
+	char* type;
+	char* value;
+	char* version;
+	char* number;
+}tTag;
+
+/* Constants */
+#define MAX_VALUE_SIZE 3000
+
+/* Prototypes */
+void  freeTagStructure (tTag* structure);
+tTag* parseXmlFile     (const char* vFile,int* error);
+
+#endif
diff --git a/PR/src/include/spanish.h b/PR/src/include/spanish.h
new file mode 100644
index 0000000..9b3ccb3
--- /dev/null
+++ b/PR/src/include/spanish.h
@@ -0,0 +1,167 @@
+/*  Princed V3 - Prince of Persia Level Editor for PC Version
+    Copyright (C) 2003 Princed Development Team
+
+    This program 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
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    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
+*/
+
+/*
+pr.h: Princed Resources : Spanish language strings
+\xaf\xaf\xaf\xaf
+ Copyright 2003 Princed Development Team
+  Created: 18 Feb 2004
+
+  Author: Enrique Calot <ecalot.cod@princed.com.ar>
+  Version: 1.00 (2004-Feb-18)
+
+  Language: Spanish
+
+ Note:
+  DO NOT remove this copyright notice
+*/
+
+/***************************************************************\
+|                           Text Defines                        |
+\***************************************************************/
+
+#define PR_ABOUT                  "Princed resources (PR) "PR_VERSION" "OS"\n(c) Copyright 2003 - Princed Development Team\n"PR_URL"\n\n"
+
+#define PR_CGI_TEXT1              "Content-Type:text/html\n\nCorriendo como cgi\n"
+#define PR_CGI_TEXT2              "Result: %02d type\n"
+
+#define PR_TEXT_RESULT            "Resultado: %s (%d)\n"
+#define PR_TEXT_RESULT_ERR        "Resultado: %d archivos con errores\n"
+
+#define PR_TEXT_FILE_NOT_FOUND    "Resultado: Archivo o directorio '%s' no encontrado\n"
+
+#define PR_TEXT_SCANNING_CURRENT  "Buscando archivos dat en el directorio actual\n"
+#define PR_TEXT_SCANNING_GIVEN    "Buscando archivos dat en el directorio dado\n"
+
+#define PR_TEXT_IMPORTING_CURRENT "Importando todos los archivos dat validos del directorio actual\n"
+#define PR_TEXT_IMPORTING_GIVEN   "Importando todos los archivos dat validos del directorio dado\n"
+
+#define PR_TEXT_TASK_COMPILE      "Compilando '%s' desde '%s'\n"
+#define PR_TEXT_TASK_CLASSIFY     "Clasificando '%s'\n"
+#define PR_TEXT_TASK_EXTRACT      "Extrayendo '%s' a '%s'\n"
+
+#define PR_TEXT_DISK_PROCESSING   "Procesando '%s'...\n"
+#define PR_TEXT_DISK_REPLACE      "El archivo %s ya existia. Reemplazar? [Si/no/todos]:"
+#define PR_DISK_REPLACE_NO        'N'
+#define PR_DISK_REPLACE_ALL       'T'
+
+#define PR_TEXT_IMPORT_NOT_OPEN   "'%s' no abierto, ignorado\n"
+#define PR_TEXT_IMPORT_SUCCESS    "'%s' importado exitosamente\n"
+#define PR_TEXT_IMPORT_ERRORS     "'%s' tiene errores, ignorado\n"
+#define PR_TEXT_IMPORT_DONE       "Compilacion terminada, %d archivos correctos, %d archivos con errores\n"
+
+#define PR_TEXT_EXPORT_WORKING    "'%s' exportado exitosamente\n"
+#define PR_TEXT_EXPORT_ERROR      "'%s' tiene errores, abortando...\n"
+#define PR_TEXT_EXPORT_BMP_WARN   "Advertencia: El archivo exportado puede estar corrompido\n"
+
+
+/***************************************************************\
+|                        Text Output Arrays                     |
+\***************************************************************/
+
+#define PR_TEXT_EXPORT_ARRAY {\
+"Correcto",\
+"Error al acceder un archivo",\
+"Error de memoria en la extraccion",\
+"Archivo DAT invalido",\
+"Error de codificacion en el XML",\
+"Error de memoria en la lectura del XML",\
+"Atributo XML no reconocido",\
+"Archivo XML no encontrado"}
+
+#define PR_TEXT_CLASSIFY_ARRAY {\
+"Error de memoria",\
+"Archivo no encontrado no acceso denegado",\
+"No es un archivo DAT del POP1 valido",\
+"Archivo de niveles",\
+"Archivo de graficos con una imagen en la primera entrada (poco comun)",\
+"Archivo de sonido digital",\
+"Archivo de sonido midi",\
+"Archivo DAT valido con contenido indefinido",\
+"Archivo de graficos con una paleta en la primera entrada (comun)",\
+"Archivo de sonido del parlante de la PC",\
+"","","",\
+"Archivo del POP2"}
+
+#define PR_TEXT_IMPORT_ARRAY {\
+"Archivo compilado exitosamente",\
+"El archivo DAT no pudo ser abierto para su escritura",\
+"Error de codificacion XML",\
+"Sin memoria",\
+"Atributo XML no reconocido",\
+"Archivo XML no encontrado"}
+
+/***************************************************************\
+|                 Command Line options information              |
+\***************************************************************/
+
+#ifndef PR_IGNORE_RAW_OPTION
+#define PARSING_RAW "   -r, --raw                  utiliza el formato crudo\n"
+#else
+#define PARSING_RAW ""
+#endif
+#define PARSING_HELP "Utilizacion: \n\
+  pr [-x[EXTRACTDIR]|-c[COMPILEDIR]|-d] [DATFILEPATH]\n\
+  pr [OPTIONS] [DATFILEPATH]\n\
+\n\
+  Los argumentos obligatorios para las opciones largas lo son tambien\n\
+  para las opciones cortas.\n\
+\n\
+   -i, -c, --import[=DIRNAME] importa desde DIRNAME al directorio dado\n\
+   -d, --classify             retorna el tipo del archivo dat\n\
+   -x, -e, --export[=DIRNAME] extrae el archivo dat en DIRNAME\n\
+\n\
+   -a, --setauthor=NAME       setea un nombre de autor en los archivos plv\n\
+                              extraidos\n\
+   -b, --backup[=EXTENSION]   realiza copias de seguridad\n\
+   -f, --force                reescribe los archivos sin preguntar\n\
+   -g, --cgi                  corre en modo CGI e imprime encabezados mime\n\
+   -h, -?, --help             muestra este texto y sale\n\
+   -s, --resource=RESFILE     utiliza el archivo xml de recursos especificado\n\
+"PARSING_RAW"\
+   -R, --recursive            busca todos los archivos dat en subdirectorios\n\
+                              (solo si DATFILEPATH no es un archivo dat)\n\
+   -t, --datfile=DATFILE      especifica un archivo para leer recursos\n\
+                              distintos al archivo original\n\
+       --unknown              genera el archivo de items desconocidos sin\n\
+                              realizar extraccion alguna\n\
+   -v, --verbose              explica lo que se esta haciendo\n\
+       --version              impreme informacion de la version y sale\n\
+\n"
+
+#define PARSING_ABOUT "Autores: \n\
+   Codinficacion & rutinas principales\n\
+    Enrique Calot\n\
+    Santiago Zamora\n\
+\n\
+   Algoritmos de compresion de graficos\n\
+    Tammo Jan Dijkema\n\
+    Enrique Calot\n\
+\n\
+   Investigacion del formato grafico\n\
+    Tammo Jan Dijkema\n\
+    Anke Balderer\n\
+\n\
+   Investigacion del formato de sonido MID\n\
+    Christian Lundheim\n\
+\n\
+   Edicion de resources.xml\n\
+    Steven Fayers\n\
+\n"