Allow generation of build time data files in out-of-source builds. Also fix generation of data file for devices/mem24 subfolder

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/16/head
Michele Calgaro 7 months ago
parent 1c22ae157c
commit ac3f001423
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1,2 +0,0 @@
add_subdirectory( actions )
add_subdirectory( app )

@ -1 +0,0 @@
tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/piklab/icons )

@ -1 +0,0 @@
tde_install_icons( DESTINATION ${ICON_INSTALL_DIR} )

@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libcoff.la
libcoff_la_LDFLAGS = $(all_libraries) libcoff_la_LDFLAGS = $(all_libraries)
libcoff_la_SOURCES = coff.cpp gpdis.cpp gpopcode.cpp disassembler.cpp \ libcoff_la_SOURCES = coff.cpp gpdis.cpp gpopcode.cpp disassembler.cpp \
coff_data.cpp text_coff.cpp cdb_parser.cpp coff_archive.cpp coff_object.cpp coff_data.cpp text_coff.cpp cdb_parser.cpp coff_archive.cpp coff_object.cpp
libcoff_la_DEPENDENCIES = $(srcdir)/coff_data.cpp libcoff_la_DEPENDENCIES = coff_data.cpp
noinst_DATA = coff.xml noinst_DATA = coff.xml
$(srcdir)/coff_data.cpp: ../xml/xml_coff_parser coff.xml coff_data.cpp: ../xml/xml_coff_parser coff.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_coff_parser cd $(abs_builddir) && ./../xml/xml_coff_parser $(srcdir)
CLEANFILES = coff_data.cpp CLEANFILES = coff_data.cpp

@ -21,7 +21,7 @@ namespace Coff
class XmlToData : public ExtXmlToData<Data> class XmlToData : public ExtXmlToData<Data>
{ {
public: public:
XmlToData() : ExtXmlToData<Data>("coff", "Coff") {} XmlToData(const TQString &folder) : ExtXmlToData<Data>(folder, "coff", "Coff") {}
private: private:
TQMap<uint, bool> _ids; TQMap<uint, bool> _ids;

@ -18,6 +18,9 @@ namespace Mem24
class XmlToData : public Device::XmlToData<Data> class XmlToData : public Device::XmlToData<Data>
{ {
public:
XmlToData(const TQString &folder) : Device::XmlToData<Data>(folder) {}
private: private:
virtual uint nbOutputFiles(uint) const { return 1; } virtual uint nbOutputFiles(uint) const { return 1; }
virtual bool isIncluded(uint, uint) const { return true; } virtual bool isIncluded(uint, uint) const { return true; }

@ -8,5 +8,5 @@ libmem24xml_la_DEPENDENCIES = mem24_data.cpp
include deps.mak include deps.mak
mem24_data.cpp: ../xml/mem24_xml_to_data $(noinst_DATA) mem24_data.cpp: ../xml/mem24_xml_to_data $(noinst_DATA)
../xml/mem24_xml_to_data cd $(abs_builddir) && ./../xml/mem24_xml_to_data $(srcdir)
CLEANFILES = mem24_data.cpp CLEANFILES = mem24_data.cpp

@ -6,6 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
***************************************************************************/ ***************************************************************************/
#include <tqdir.h>
#include <tqfile.h> #include <tqfile.h>
#include <tqregexp.h> #include <tqregexp.h>
@ -18,6 +19,9 @@ namespace Pic
{ {
class XmlToData : public Device::XmlToData<Data> class XmlToData : public Device::XmlToData<Data>
{ {
public:
XmlToData(const TQString &folder) : Device::XmlToData<Data>(folder) {}
private: private:
virtual TQString namespaceName() const { return "Pic"; } virtual TQString namespaceName() const { return "Pic"; }
@ -673,8 +677,13 @@ void processRegistersFile(const TQString &filename, TQStringList &devices)
void processRegisters() void processRegisters()
{ {
TQStringList devices; TQStringList devices;
processRegistersFile("registers/registers.xml", devices); TQDir xmlFilesDir;
processRegistersFile("registers/registers_missing.xml", devices); if (!xmlFolder.isEmpty())
{
xmlFilesDir.setPath(xmlFolder + "/registers");
}
processRegistersFile(xmlFilesDir.absFilePath("registers.xml"), devices);
processRegistersFile(xmlFilesDir.absFilePath("registers_missing.xml"), devices);
// check if we miss any register description // check if we miss any register description
TQMap<TQString, Device::Data *>::const_iterator it = _map.begin(); TQMap<TQString, Device::Data *>::const_iterator it = _map.begin();

@ -3,10 +3,10 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpicxml.la noinst_LTLIBRARIES = libpicxml.la
libpicxml_la_SOURCES = pic_data.cpp libpicxml_la_SOURCES = pic_data.cpp
libpicxml_la_DEPENDENCIES = $(srcdir)/pic_data.cpp libpicxml_la_DEPENDENCIES = pic_data.cpp
include deps.mak include deps.mak
noinst_DATA += registers/registers.xml registers/registers_missing.xml noinst_DATA += registers/registers.xml registers/registers_missing.xml
$(srcdir)/pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA) pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA)
cd $(srcdir) && $(abs_builddir)/../xml/pic_xml_to_data cd $(abs_builddir) && ./../xml/pic_xml_to_data $(srcdir)
CLEANFILES = pic_data.cpp CLEANFILES = pic_data.cpp

@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libdirectprog.la
libdirectprog_la_SOURCES = direct_pic.cpp direct_baseline.cpp direct_16.cpp \ libdirectprog_la_SOURCES = direct_pic.cpp direct_baseline.cpp direct_16.cpp \
direct_16F.cpp direct_18.cpp direct_18F.cpp direct_prog.cpp direct_prog_config.cpp \ direct_16F.cpp direct_18.cpp direct_18F.cpp direct_prog.cpp direct_prog_config.cpp \
direct_data.cpp direct_mem24.cpp direct.cpp direct_data.cpp direct_mem24.cpp direct.cpp
libdirectprog_la_DEPENDENCIES = $(srcdir)/direct_data.cpp libdirectprog_la_DEPENDENCIES = direct_data.cpp
noinst_DATA = direct.xml noinst_DATA = direct.xml
$(srcdir)/direct_data.cpp: ../xml/xml_direct_parser direct.xml direct_data.cpp: ../xml/xml_direct_parser direct.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_direct_parser cd $(abs_builddir) && ./../xml/xml_direct_parser $(srcdir)
CLEANFILES = direct_data.cpp CLEANFILES = direct_data.cpp

@ -15,7 +15,7 @@ namespace Direct
class XmlToData : public ::Programmer::XmlToData<Data> class XmlToData : public ::Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : ::Programmer::XmlToData<Data>("direct", "Direct") {} XmlToData(const TQString &folder) : ::Programmer::XmlToData<Data>(folder, "direct", "Direct") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libicd1.la noinst_LTLIBRARIES = libicd1.la
libicd1_la_SOURCES = icd1.cpp icd1_prog.cpp icd1_serial.cpp icd1_data.cpp libicd1_la_SOURCES = icd1.cpp icd1_prog.cpp icd1_serial.cpp icd1_data.cpp
libicd1_la_DEPENDENCIES = $(srcdir)/icd1_data.cpp libicd1_la_DEPENDENCIES = icd1_data.cpp
noinst_DATA = icd1.xml noinst_DATA = icd1.xml
$(srcdir)/icd1_data.cpp: ../xml/xml_icd1_parser icd1.xml icd1_data.cpp: ../xml/xml_icd1_parser icd1.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_icd1_parser cd $(abs_builddir) && ./../xml/xml_icd1_parser $(srcdir)
CLEANFILES = icd1_data.cpp CLEANFILES = icd1_data.cpp

@ -16,7 +16,7 @@ namespace Icd1
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("icd1", "Icd1") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "icd1", "Icd1") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libicd2.la
libicd2_la_SOURCES = microchip.cpp icd2.cpp icd2_prog.cpp icd2_serial.cpp \ libicd2_la_SOURCES = microchip.cpp icd2.cpp icd2_prog.cpp icd2_serial.cpp \
icd2_usb.cpp icd2_usb_firmware.cpp icd2_data.cpp icd2_debug.cpp icd.cpp \ icd2_usb.cpp icd2_usb_firmware.cpp icd2_data.cpp icd2_debug.cpp icd.cpp \
icd_prog.cpp icd2_debug_specific.cpp icd_prog.cpp icd2_debug_specific.cpp
libicd2_la_DEPENDENCIES = $(srcdir)/icd2_data.cpp libicd2_la_DEPENDENCIES = icd2_data.cpp
noinst_DATA = icd2.xml noinst_DATA = icd2.xml
$(srcdir)/icd2_data.cpp: ../xml/xml_icd2_parser icd2.xml icd2_data.cpp: ../xml/xml_icd2_parser icd2.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_icd2_parser cd $(abs_builddir) && ./../xml/xml_icd2_parser $(srcdir)
CLEANFILES = icd2_data.cpp CLEANFILES = icd2_data.cpp

@ -16,7 +16,7 @@ namespace Icd2
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("icd2", "Icd2") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "icd2", "Icd2") {}
private: private:
virtual uint familyIndex(const TQString &family) const; virtual uint familyIndex(const TQString &family) const;

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpicdembootloader.la noinst_LTLIBRARIES = libpicdembootloader.la
libpicdembootloader_la_SOURCES = picdem_bootloader_data.cpp picdem_bootloader.cpp picdem_bootloader_prog.cpp libpicdembootloader_la_SOURCES = picdem_bootloader_data.cpp picdem_bootloader.cpp picdem_bootloader_prog.cpp
libpicdembootloader_la_DEPENDENCIES = $(srcdir)/picdem_bootloader_data.cpp libpicdembootloader_la_DEPENDENCIES = picdem_bootloader_data.cpp
noinst_DATA = picdem_bootloader.xml noinst_DATA = picdem_bootloader.xml
$(srcdir)/picdem_bootloader_data.cpp: ../xml/xml_picdem_bootloader_parser picdem_bootloader.xml picdem_bootloader_data.cpp: ../xml/xml_picdem_bootloader_parser picdem_bootloader.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_picdem_bootloader_parser cd $(abs_builddir) && ./../xml/xml_picdem_bootloader_parser $(srcdir)
CLEANFILES = picdem_bootloader_data.cpp CLEANFILES = picdem_bootloader_data.cpp

@ -19,7 +19,7 @@ namespace PicdemBootloader
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("picdem_bootloader", "PicdemBootloader") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "picdem_bootloader", "PicdemBootloader") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpickit1.la noinst_LTLIBRARIES = libpickit1.la
libpickit1_la_SOURCES = pickit1.cpp pickit1_prog.cpp pickit1_data.cpp libpickit1_la_SOURCES = pickit1.cpp pickit1_prog.cpp pickit1_data.cpp
libpickit1_la_DEPENDENCIES = $(srcdir)/pickit1_data.cpp libpickit1_la_DEPENDENCIES = pickit1_data.cpp
noinst_DATA = pickit1.xml noinst_DATA = pickit1.xml
$(srcdir)/pickit1_data.cpp: ../xml/xml_pickit1_parser pickit1.xml pickit1_data.cpp: ../xml/xml_pickit1_parser pickit1.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit1_parser cd $(abs_builddir) && ./../xml/xml_pickit1_parser $(srcdir)
CLEANFILES = pickit1_data.cpp CLEANFILES = pickit1_data.cpp

@ -15,7 +15,7 @@ namespace Pickit1
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("pickit1", "Pickit1") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "pickit1", "Pickit1") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -4,9 +4,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpickit2.la noinst_LTLIBRARIES = libpickit2.la
libpickit2_la_SOURCES = pickit2_data.cpp pickit.cpp pickit_prog.cpp \ libpickit2_la_SOURCES = pickit2_data.cpp pickit.cpp pickit_prog.cpp \
pickit2.cpp pickit2_prog.cpp pickit2.cpp pickit2_prog.cpp
libpickit2_la_DEPENDENCIES = $(srcdir)/pickit2_data.cpp libpickit2_la_DEPENDENCIES = pickit2_data.cpp
noinst_DATA = pickit2.xml noinst_DATA = pickit2.xml
$(srcdir)/pickit2_data.cpp: ../xml/xml_pickit2_parser pickit2.xml pickit2_data.cpp: ../xml/xml_pickit2_parser pickit2.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit2_parser cd $(abs_builddir) && ./../xml/xml_pickit2_parser $(srcdir)
CLEANFILES = pickit2_data.cpp CLEANFILES = pickit2_data.cpp

@ -15,7 +15,7 @@ namespace Pickit2
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("pickit2", "Pickit2") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "pickit2", "Pickit2") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpickit2bootloader.la noinst_LTLIBRARIES = libpickit2bootloader.la
libpickit2bootloader_la_SOURCES = pickit2_bootloader_data.cpp pickit2_bootloader_prog.cpp pickit2_bootloader.cpp libpickit2bootloader_la_SOURCES = pickit2_bootloader_data.cpp pickit2_bootloader_prog.cpp pickit2_bootloader.cpp
libpickit2bootloader_la_DEPENDENCIES = $(srcdir)/pickit2_bootloader_data.cpp libpickit2bootloader_la_DEPENDENCIES = pickit2_bootloader_data.cpp
noinst_DATA = pickit2_bootloader.xml noinst_DATA = pickit2_bootloader.xml
$(srcdir)/pickit2_bootloader_data.cpp: ../xml/xml_pickit2_bootloader_parser pickit2_bootloader.xml pickit2_bootloader_data.cpp: ../xml/xml_pickit2_bootloader_parser pickit2_bootloader.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit2_bootloader_parser cd $(abs_builddir) && ./../xml/xml_pickit2_bootloader_parser $(srcdir)
CLEANFILES = pickit2_bootloader_data.cpp CLEANFILES = pickit2_bootloader_data.cpp

@ -19,7 +19,7 @@ namespace Pickit2Bootloader
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("pickit2_bootloader", "Pickit2Bootloader") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "pickit2_bootloader", "Pickit2Bootloader") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libpsp.la noinst_LTLIBRARIES = libpsp.la
libpsp_la_SOURCES = psp_prog.cpp psp_serial.cpp psp_data.cpp psp.cpp libpsp_la_SOURCES = psp_prog.cpp psp_serial.cpp psp_data.cpp psp.cpp
libpsp_la_DEPENDENCIES = $(srcdir)/psp_data.cpp libpsp_la_DEPENDENCIES = psp_data.cpp
noinst_DATA = psp.xml noinst_DATA = psp.xml
$(srcdir)/psp_data.cpp: ../xml/xml_psp_parser psp.xml psp_data.cpp: ../xml/xml_psp_parser psp.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_psp_parser cd $(abs_builddir) && ./../xml/xml_psp_parser $(srcdir)
CLEANFILES = psp_data.cpp CLEANFILES = psp_data.cpp

@ -16,7 +16,7 @@ namespace Psp
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("psp", "Psp") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "psp", "Psp") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -3,9 +3,9 @@ METASOURCES = AUTO
noinst_LTLIBRARIES = libtblbootloader.la noinst_LTLIBRARIES = libtblbootloader.la
libtblbootloader_la_SOURCES = tbl_bootloader_data.cpp tbl_bootloader.cpp tbl_bootloader_prog.cpp libtblbootloader_la_SOURCES = tbl_bootloader_data.cpp tbl_bootloader.cpp tbl_bootloader_prog.cpp
libtblbootloader_la_DEPENDENCIES = $(srcdir)/tbl_bootloader_data.cpp libtblbootloader_la_DEPENDENCIES = tbl_bootloader_data.cpp
noinst_DATA = tbl_bootloader.xml noinst_DATA = tbl_bootloader.xml
$(srcdir)/tbl_bootloader_data.cpp: ../xml/xml_tbl_bootloader_parser tbl_bootloader.xml tbl_bootloader_data.cpp: ../xml/xml_tbl_bootloader_parser tbl_bootloader.xml
cd $(srcdir) && $(abs_builddir)/../xml/xml_tbl_bootloader_parser cd $(abs_builddir) && ./../xml/xml_tbl_bootloader_parser $(srcdir)
CLEANFILES = tbl_bootloader_data.cpp CLEANFILES = tbl_bootloader_data.cpp

@ -19,7 +19,7 @@ namespace TinyBootloader
class XmlToData : public Programmer::XmlToData<Data> class XmlToData : public Programmer::XmlToData<Data>
{ {
public: public:
XmlToData() : Programmer::XmlToData<Data>("tbl_bootloader", "TinyBootloader") {} XmlToData(const TQString &folder) : Programmer::XmlToData<Data>(folder, "tbl_bootloader", "TinyBootloader") {}
private: private:
virtual void parseData(TQDomElement element, Data &data); virtual void parseData(TQDomElement element, Data &data);

@ -241,10 +241,16 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element)
void Device::XmlToDataBase::parse() void Device::XmlToDataBase::parse()
{ {
// process device files // process device files
TQStringList files = TQDir::current().entryList("*.xml"); TQStringList files;
TQDir xmlFilesDir;
if (!xmlFolder.isEmpty())
{
xmlFilesDir.setPath(xmlFolder);
}
files = xmlFilesDir.entryList("*.xml");
for (uint i=0; i<uint(files.count()); i++) { for (uint i=0; i<uint(files.count()); i++) {
_data = 0; _data = 0;
TQDomDocument doc = parseFile(files[i]); TQDomDocument doc = parseFile(xmlFilesDir.absFilePath(files[i]));
TQDomElement root = doc.documentElement(); TQDomElement root = doc.documentElement();
if ( root.nodeName()!="device" ) tqFatal("root node should be \"device\""); if ( root.nodeName()!="device" ) tqFatal("root node should be \"device\"");
processDevice(root); processDevice(root);

@ -23,7 +23,7 @@ namespace Device
class XmlToDataBase : public ::XmlToData class XmlToDataBase : public ::XmlToData
{ {
public: public:
XmlToDataBase() : _data(0) {} XmlToDataBase(const TQString &folder) : XmlToData(folder), _data(0) {}
protected: protected:
mutable Data *_data; mutable Data *_data;
@ -49,6 +49,7 @@ template <class DataType>
class XmlToData : public XmlToDataBase, public DataStreamer<DataType> class XmlToData : public XmlToDataBase, public DataStreamer<DataType>
{ {
public: public:
XmlToData(const TQString &folder) : XmlToDataBase(folder) {}
virtual Device::Data *createData() const { return new DataType; } virtual Device::Data *createData() const { return new DataType; }
DataType *data() { return static_cast<DataType *>(_data); } DataType *data() { return static_cast<DataType *>(_data); }
const DataType *data() const { return static_cast<DataType *>(_data); } const DataType *data() const { return static_cast<DataType *>(_data); }

@ -9,6 +9,7 @@
#ifndef PROG_XML_TO_DATA_H #ifndef PROG_XML_TO_DATA_H
#define PROG_XML_TO_DATA_H #define PROG_XML_TO_DATA_H
#include <tqdir.h>
#include <tqfile.h> #include <tqfile.h>
#include <tqtextstream.h> #include <tqtextstream.h>
#include <tqmap.h> #include <tqmap.h>
@ -21,8 +22,8 @@ template <class Data>
class ExtXmlToData : public ::XmlToData class ExtXmlToData : public ::XmlToData
{ {
public: public:
ExtXmlToData(const TQString &basename, const TQString &namespac) ExtXmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
: _basename(basename), _namespace(namespac) {} : ::XmlToData(folder), _basename(basename), _namespace(namespac) {}
protected: protected:
TQString _basename, _namespace; TQString _basename, _namespace;
@ -85,7 +86,12 @@ void ExtXmlToData<Data>::parseDevice(TQDomElement element)
template <class Data> template <class Data>
void ExtXmlToData<Data>::parse() void ExtXmlToData<Data>::parse()
{ {
TQDomDocument doc = parseFile(_basename + ".xml"); TQDir xmlFilesDir;
if (!xmlFolder.isEmpty())
{
xmlFilesDir.setPath(xmlFolder);
}
TQDomDocument doc = parseFile(xmlFilesDir.absFilePath(_basename + ".xml"));
TQDomElement root = doc.documentElement(); TQDomElement root = doc.documentElement();
if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\""); if ( root.nodeName()!="type" ) tqFatal("Root node should be \"type\"");
if ( root.attribute("name")!=_basename ) tqFatal(TQString("Root node name is not \"%1\"").arg(_basename)); if ( root.attribute("name")!=_basename ) tqFatal(TQString("Root node name is not \"%1\"").arg(_basename));
@ -186,8 +192,8 @@ template <class Data>
class XmlToData : public ExtXmlToData<Data> class XmlToData : public ExtXmlToData<Data>
{ {
public: public:
XmlToData(const TQString &basename, const TQString &namespac) XmlToData(const TQString &folder, const TQString &basename, const TQString &namespac)
: ExtXmlToData<Data>(basename, namespac) {} : ExtXmlToData<Data>(folder, basename, namespac) {}
protected: protected:
virtual void outputFunctions(TQTextStream &s) const; virtual void outputFunctions(TQTextStream &s) const;

@ -10,13 +10,14 @@
#define XML_TO_DATA_H #define XML_TO_DATA_H
#include "common/global/global.h" #include "common/global/global.h"
# include <tqdom.h>
#include <tqdom.h>
#include <tqstringlist.h> #include <tqstringlist.h>
class XmlToData class XmlToData
{ {
public: public:
XmlToData() {} XmlToData(const TQString &folder) : xmlFolder(folder) {}
virtual ~XmlToData() {} virtual ~XmlToData() {}
void process(); void process();
@ -30,12 +31,19 @@ protected:
const TQString &attribute, const TQString &value) const; const TQString &attribute, const TQString &value) const;
void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const; void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const;
TQDomDocument parseFile(const TQString &filename) const; TQDomDocument parseFile(const TQString &filename) const;
TQString xmlFolder;
}; };
#define XML_MAIN(_type) \ #define XML_MAIN(_type) \
int main(int, char **) \ int main(int argc, char **argv) \
{ \ { \
_type dx; \ TQString xmlFolder = TQString::null; \
if (argc > 1) \
{ \
xmlFolder = argv[1]; \
} \
_type dx(xmlFolder); \
dx.process(); \ dx.process(); \
return 0; \ return 0; \
} }

Loading…
Cancel
Save