From ac3f0014232619edc41865f6e42e6510bdd8acc6 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 6 May 2024 18:26:24 +0900 Subject: [PATCH] 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 --- icons/CMakeLists.txt | 2 -- icons/actions/CMakeLists.txt | 1 - icons/app/CMakeLists.txt | 1 - src/coff/base/Makefile.am | 6 +++--- src/coff/xml/xml_coff_parser.cpp | 2 +- src/devices/mem24/xml/mem24_xml_to_data.cpp | 3 +++ src/devices/mem24/xml_data/Makefile.am | 2 +- src/devices/pic/xml/pic_xml_to_data.cpp | 13 +++++++++++-- src/devices/pic/xml_data/Makefile.am | 6 +++--- src/progs/direct/base/Makefile.am | 6 +++--- src/progs/direct/xml/xml_direct_parser.cpp | 2 +- src/progs/icd1/base/Makefile.am | 6 +++--- src/progs/icd1/xml/xml_icd1_parser.cpp | 2 +- src/progs/icd2/base/Makefile.am | 6 +++--- src/progs/icd2/xml/xml_icd2_parser.cpp | 2 +- src/progs/picdem_bootloader/base/Makefile.am | 6 +++--- .../xml/xml_picdem_bootloader_parser.cpp | 2 +- src/progs/pickit1/base/Makefile.am | 6 +++--- src/progs/pickit1/xml/xml_pickit1_parser.cpp | 2 +- src/progs/pickit2/base/Makefile.am | 6 +++--- src/progs/pickit2/xml/xml_pickit2_parser.cpp | 2 +- src/progs/pickit2_bootloader/base/Makefile.am | 6 +++--- .../xml/xml_pickit2_bootloader_parser.cpp | 2 +- src/progs/psp/base/Makefile.am | 6 +++--- src/progs/psp/xml/xml_psp_parser.cpp | 2 +- src/progs/tbl_bootloader/base/Makefile.am | 6 +++--- .../xml/xml_tbl_bootloader_parser.cpp | 2 +- src/xml_to_data/device_xml_to_data.cpp | 10 ++++++++-- src/xml_to_data/device_xml_to_data.h | 3 ++- src/xml_to_data/prog_xml_to_data.h | 16 +++++++++++----- src/xml_to_data/xml_to_data.h | 16 ++++++++++++---- 31 files changed, 91 insertions(+), 62 deletions(-) delete mode 100644 icons/CMakeLists.txt delete mode 100644 icons/actions/CMakeLists.txt delete mode 100644 icons/app/CMakeLists.txt diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt deleted file mode 100644 index 61ab0a8..0000000 --- a/icons/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory( actions ) -add_subdirectory( app ) diff --git a/icons/actions/CMakeLists.txt b/icons/actions/CMakeLists.txt deleted file mode 100644 index f79769c..0000000 --- a/icons/actions/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/piklab/icons ) diff --git a/icons/app/CMakeLists.txt b/icons/app/CMakeLists.txt deleted file mode 100644 index 5cca3c6..0000000 --- a/icons/app/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -tde_install_icons( DESTINATION ${ICON_INSTALL_DIR} ) diff --git a/src/coff/base/Makefile.am b/src/coff/base/Makefile.am index 83ca6dd..399bf12 100644 --- a/src/coff/base/Makefile.am +++ b/src/coff/base/Makefile.am @@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libcoff.la libcoff_la_LDFLAGS = $(all_libraries) 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 -libcoff_la_DEPENDENCIES = $(srcdir)/coff_data.cpp +libcoff_la_DEPENDENCIES = coff_data.cpp noinst_DATA = coff.xml -$(srcdir)/coff_data.cpp: ../xml/xml_coff_parser coff.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_coff_parser +coff_data.cpp: ../xml/xml_coff_parser coff.xml + cd $(abs_builddir) && ./../xml/xml_coff_parser $(srcdir) CLEANFILES = coff_data.cpp diff --git a/src/coff/xml/xml_coff_parser.cpp b/src/coff/xml/xml_coff_parser.cpp index 9b915bf..862aeeb 100644 --- a/src/coff/xml/xml_coff_parser.cpp +++ b/src/coff/xml/xml_coff_parser.cpp @@ -21,7 +21,7 @@ namespace Coff class XmlToData : public ExtXmlToData { public: - XmlToData() : ExtXmlToData("coff", "Coff") {} + XmlToData(const TQString &folder) : ExtXmlToData(folder, "coff", "Coff") {} private: TQMap _ids; diff --git a/src/devices/mem24/xml/mem24_xml_to_data.cpp b/src/devices/mem24/xml/mem24_xml_to_data.cpp index d2a4da5..43f3ba5 100644 --- a/src/devices/mem24/xml/mem24_xml_to_data.cpp +++ b/src/devices/mem24/xml/mem24_xml_to_data.cpp @@ -18,6 +18,9 @@ namespace Mem24 class XmlToData : public Device::XmlToData { +public: + XmlToData(const TQString &folder) : Device::XmlToData(folder) {} + private: virtual uint nbOutputFiles(uint) const { return 1; } virtual bool isIncluded(uint, uint) const { return true; } diff --git a/src/devices/mem24/xml_data/Makefile.am b/src/devices/mem24/xml_data/Makefile.am index 42cacaa..1b42fae 100644 --- a/src/devices/mem24/xml_data/Makefile.am +++ b/src/devices/mem24/xml_data/Makefile.am @@ -8,5 +8,5 @@ libmem24xml_la_DEPENDENCIES = mem24_data.cpp include deps.mak 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 diff --git a/src/devices/pic/xml/pic_xml_to_data.cpp b/src/devices/pic/xml/pic_xml_to_data.cpp index 7cb573e..2419b46 100644 --- a/src/devices/pic/xml/pic_xml_to_data.cpp +++ b/src/devices/pic/xml/pic_xml_to_data.cpp @@ -6,6 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ +#include #include #include @@ -18,6 +19,9 @@ namespace Pic { class XmlToData : public Device::XmlToData { +public: + XmlToData(const TQString &folder) : Device::XmlToData(folder) {} + private: virtual TQString namespaceName() const { return "Pic"; } @@ -673,8 +677,13 @@ void processRegistersFile(const TQString &filename, TQStringList &devices) void processRegisters() { TQStringList devices; - processRegistersFile("registers/registers.xml", devices); - processRegistersFile("registers/registers_missing.xml", devices); + TQDir xmlFilesDir; + 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 TQMap::const_iterator it = _map.begin(); diff --git a/src/devices/pic/xml_data/Makefile.am b/src/devices/pic/xml_data/Makefile.am index e5bd5c4..97496a4 100644 --- a/src/devices/pic/xml_data/Makefile.am +++ b/src/devices/pic/xml_data/Makefile.am @@ -3,10 +3,10 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpicxml.la libpicxml_la_SOURCES = pic_data.cpp -libpicxml_la_DEPENDENCIES = $(srcdir)/pic_data.cpp +libpicxml_la_DEPENDENCIES = pic_data.cpp include deps.mak noinst_DATA += registers/registers.xml registers/registers_missing.xml -$(srcdir)/pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA) - cd $(srcdir) && $(abs_builddir)/../xml/pic_xml_to_data +pic_data.cpp: ../xml/pic_xml_to_data $(noinst_DATA) + cd $(abs_builddir) && ./../xml/pic_xml_to_data $(srcdir) CLEANFILES = pic_data.cpp diff --git a/src/progs/direct/base/Makefile.am b/src/progs/direct/base/Makefile.am index fe2c47c..680fb31 100644 --- a/src/progs/direct/base/Makefile.am +++ b/src/progs/direct/base/Makefile.am @@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libdirectprog.la 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_data.cpp direct_mem24.cpp direct.cpp -libdirectprog_la_DEPENDENCIES = $(srcdir)/direct_data.cpp +libdirectprog_la_DEPENDENCIES = direct_data.cpp noinst_DATA = direct.xml -$(srcdir)/direct_data.cpp: ../xml/xml_direct_parser direct.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_direct_parser +direct_data.cpp: ../xml/xml_direct_parser direct.xml + cd $(abs_builddir) && ./../xml/xml_direct_parser $(srcdir) CLEANFILES = direct_data.cpp diff --git a/src/progs/direct/xml/xml_direct_parser.cpp b/src/progs/direct/xml/xml_direct_parser.cpp index 2625f9e..728845f 100644 --- a/src/progs/direct/xml/xml_direct_parser.cpp +++ b/src/progs/direct/xml/xml_direct_parser.cpp @@ -15,7 +15,7 @@ namespace Direct class XmlToData : public ::Programmer::XmlToData { public: - XmlToData() : ::Programmer::XmlToData("direct", "Direct") {} + XmlToData(const TQString &folder) : ::Programmer::XmlToData(folder, "direct", "Direct") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/icd1/base/Makefile.am b/src/progs/icd1/base/Makefile.am index d289cc6..bd74b6a 100644 --- a/src/progs/icd1/base/Makefile.am +++ b/src/progs/icd1/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libicd1.la 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 -$(srcdir)/icd1_data.cpp: ../xml/xml_icd1_parser icd1.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_icd1_parser +icd1_data.cpp: ../xml/xml_icd1_parser icd1.xml + cd $(abs_builddir) && ./../xml/xml_icd1_parser $(srcdir) CLEANFILES = icd1_data.cpp diff --git a/src/progs/icd1/xml/xml_icd1_parser.cpp b/src/progs/icd1/xml/xml_icd1_parser.cpp index 90d9495..8174ecd 100644 --- a/src/progs/icd1/xml/xml_icd1_parser.cpp +++ b/src/progs/icd1/xml/xml_icd1_parser.cpp @@ -16,7 +16,7 @@ namespace Icd1 class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("icd1", "Icd1") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "icd1", "Icd1") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/icd2/base/Makefile.am b/src/progs/icd2/base/Makefile.am index d6c850b..610a7a9 100644 --- a/src/progs/icd2/base/Makefile.am +++ b/src/progs/icd2/base/Makefile.am @@ -5,9 +5,9 @@ noinst_LTLIBRARIES = libicd2.la 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 \ icd_prog.cpp icd2_debug_specific.cpp -libicd2_la_DEPENDENCIES = $(srcdir)/icd2_data.cpp +libicd2_la_DEPENDENCIES = icd2_data.cpp noinst_DATA = icd2.xml -$(srcdir)/icd2_data.cpp: ../xml/xml_icd2_parser icd2.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_icd2_parser +icd2_data.cpp: ../xml/xml_icd2_parser icd2.xml + cd $(abs_builddir) && ./../xml/xml_icd2_parser $(srcdir) CLEANFILES = icd2_data.cpp diff --git a/src/progs/icd2/xml/xml_icd2_parser.cpp b/src/progs/icd2/xml/xml_icd2_parser.cpp index c2af113..6ce6909 100644 --- a/src/progs/icd2/xml/xml_icd2_parser.cpp +++ b/src/progs/icd2/xml/xml_icd2_parser.cpp @@ -16,7 +16,7 @@ namespace Icd2 class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("icd2", "Icd2") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "icd2", "Icd2") {} private: virtual uint familyIndex(const TQString &family) const; diff --git a/src/progs/picdem_bootloader/base/Makefile.am b/src/progs/picdem_bootloader/base/Makefile.am index b8e4ae7..e76e21a 100644 --- a/src/progs/picdem_bootloader/base/Makefile.am +++ b/src/progs/picdem_bootloader/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpicdembootloader.la 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 -$(srcdir)/picdem_bootloader_data.cpp: ../xml/xml_picdem_bootloader_parser picdem_bootloader.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_picdem_bootloader_parser +picdem_bootloader_data.cpp: ../xml/xml_picdem_bootloader_parser picdem_bootloader.xml + cd $(abs_builddir) && ./../xml/xml_picdem_bootloader_parser $(srcdir) CLEANFILES = picdem_bootloader_data.cpp diff --git a/src/progs/picdem_bootloader/xml/xml_picdem_bootloader_parser.cpp b/src/progs/picdem_bootloader/xml/xml_picdem_bootloader_parser.cpp index 2562f1d..f79e454 100644 --- a/src/progs/picdem_bootloader/xml/xml_picdem_bootloader_parser.cpp +++ b/src/progs/picdem_bootloader/xml/xml_picdem_bootloader_parser.cpp @@ -19,7 +19,7 @@ namespace PicdemBootloader class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("picdem_bootloader", "PicdemBootloader") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "picdem_bootloader", "PicdemBootloader") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/pickit1/base/Makefile.am b/src/progs/pickit1/base/Makefile.am index b56cb72..2ae3747 100644 --- a/src/progs/pickit1/base/Makefile.am +++ b/src/progs/pickit1/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpickit1.la 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 -$(srcdir)/pickit1_data.cpp: ../xml/xml_pickit1_parser pickit1.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit1_parser +pickit1_data.cpp: ../xml/xml_pickit1_parser pickit1.xml + cd $(abs_builddir) && ./../xml/xml_pickit1_parser $(srcdir) CLEANFILES = pickit1_data.cpp diff --git a/src/progs/pickit1/xml/xml_pickit1_parser.cpp b/src/progs/pickit1/xml/xml_pickit1_parser.cpp index 1fd09cf..9179652 100644 --- a/src/progs/pickit1/xml/xml_pickit1_parser.cpp +++ b/src/progs/pickit1/xml/xml_pickit1_parser.cpp @@ -15,7 +15,7 @@ namespace Pickit1 class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("pickit1", "Pickit1") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "pickit1", "Pickit1") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/pickit2/base/Makefile.am b/src/progs/pickit2/base/Makefile.am index 4ff664e..adfdfb5 100644 --- a/src/progs/pickit2/base/Makefile.am +++ b/src/progs/pickit2/base/Makefile.am @@ -4,9 +4,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpickit2.la libpickit2_la_SOURCES = pickit2_data.cpp pickit.cpp pickit_prog.cpp \ pickit2.cpp pickit2_prog.cpp -libpickit2_la_DEPENDENCIES = $(srcdir)/pickit2_data.cpp +libpickit2_la_DEPENDENCIES = pickit2_data.cpp noinst_DATA = pickit2.xml -$(srcdir)/pickit2_data.cpp: ../xml/xml_pickit2_parser pickit2.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit2_parser +pickit2_data.cpp: ../xml/xml_pickit2_parser pickit2.xml + cd $(abs_builddir) && ./../xml/xml_pickit2_parser $(srcdir) CLEANFILES = pickit2_data.cpp diff --git a/src/progs/pickit2/xml/xml_pickit2_parser.cpp b/src/progs/pickit2/xml/xml_pickit2_parser.cpp index fb0543a..464dee9 100644 --- a/src/progs/pickit2/xml/xml_pickit2_parser.cpp +++ b/src/progs/pickit2/xml/xml_pickit2_parser.cpp @@ -15,7 +15,7 @@ namespace Pickit2 class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("pickit2", "Pickit2") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "pickit2", "Pickit2") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/pickit2_bootloader/base/Makefile.am b/src/progs/pickit2_bootloader/base/Makefile.am index 514882a..ed36216 100644 --- a/src/progs/pickit2_bootloader/base/Makefile.am +++ b/src/progs/pickit2_bootloader/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpickit2bootloader.la 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 -$(srcdir)/pickit2_bootloader_data.cpp: ../xml/xml_pickit2_bootloader_parser pickit2_bootloader.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_pickit2_bootloader_parser +pickit2_bootloader_data.cpp: ../xml/xml_pickit2_bootloader_parser pickit2_bootloader.xml + cd $(abs_builddir) && ./../xml/xml_pickit2_bootloader_parser $(srcdir) CLEANFILES = pickit2_bootloader_data.cpp diff --git a/src/progs/pickit2_bootloader/xml/xml_pickit2_bootloader_parser.cpp b/src/progs/pickit2_bootloader/xml/xml_pickit2_bootloader_parser.cpp index 00c33ed..022f2a1 100644 --- a/src/progs/pickit2_bootloader/xml/xml_pickit2_bootloader_parser.cpp +++ b/src/progs/pickit2_bootloader/xml/xml_pickit2_bootloader_parser.cpp @@ -19,7 +19,7 @@ namespace Pickit2Bootloader class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("pickit2_bootloader", "Pickit2Bootloader") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "pickit2_bootloader", "Pickit2Bootloader") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/psp/base/Makefile.am b/src/progs/psp/base/Makefile.am index 4264171..ed73590 100644 --- a/src/progs/psp/base/Makefile.am +++ b/src/progs/psp/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libpsp.la 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 -$(srcdir)/psp_data.cpp: ../xml/xml_psp_parser psp.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_psp_parser +psp_data.cpp: ../xml/xml_psp_parser psp.xml + cd $(abs_builddir) && ./../xml/xml_psp_parser $(srcdir) CLEANFILES = psp_data.cpp diff --git a/src/progs/psp/xml/xml_psp_parser.cpp b/src/progs/psp/xml/xml_psp_parser.cpp index d2d4aff..5c53973 100644 --- a/src/progs/psp/xml/xml_psp_parser.cpp +++ b/src/progs/psp/xml/xml_psp_parser.cpp @@ -16,7 +16,7 @@ namespace Psp class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("psp", "Psp") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "psp", "Psp") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/progs/tbl_bootloader/base/Makefile.am b/src/progs/tbl_bootloader/base/Makefile.am index cd3cb7c..e2d557b 100644 --- a/src/progs/tbl_bootloader/base/Makefile.am +++ b/src/progs/tbl_bootloader/base/Makefile.am @@ -3,9 +3,9 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libtblbootloader.la 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 -$(srcdir)/tbl_bootloader_data.cpp: ../xml/xml_tbl_bootloader_parser tbl_bootloader.xml - cd $(srcdir) && $(abs_builddir)/../xml/xml_tbl_bootloader_parser +tbl_bootloader_data.cpp: ../xml/xml_tbl_bootloader_parser tbl_bootloader.xml + cd $(abs_builddir) && ./../xml/xml_tbl_bootloader_parser $(srcdir) CLEANFILES = tbl_bootloader_data.cpp diff --git a/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp b/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp index eb3087d..f0ffd4e 100644 --- a/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp +++ b/src/progs/tbl_bootloader/xml/xml_tbl_bootloader_parser.cpp @@ -19,7 +19,7 @@ namespace TinyBootloader class XmlToData : public Programmer::XmlToData { public: - XmlToData() : Programmer::XmlToData("tbl_bootloader", "TinyBootloader") {} + XmlToData(const TQString &folder) : Programmer::XmlToData(folder, "tbl_bootloader", "TinyBootloader") {} private: virtual void parseData(TQDomElement element, Data &data); diff --git a/src/xml_to_data/device_xml_to_data.cpp b/src/xml_to_data/device_xml_to_data.cpp index 5ad40a5..84d177f 100644 --- a/src/xml_to_data/device_xml_to_data.cpp +++ b/src/xml_to_data/device_xml_to_data.cpp @@ -241,10 +241,16 @@ Device::Package Device::XmlToDataBase::processPackage(TQDomElement element) void Device::XmlToDataBase::parse() { // 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 class XmlToData : public XmlToDataBase, public DataStreamer { public: + XmlToData(const TQString &folder) : XmlToDataBase(folder) {} virtual Device::Data *createData() const { return new DataType; } DataType *data() { return static_cast(_data); } const DataType *data() const { return static_cast(_data); } diff --git a/src/xml_to_data/prog_xml_to_data.h b/src/xml_to_data/prog_xml_to_data.h index bcca9da..b977359 100644 --- a/src/xml_to_data/prog_xml_to_data.h +++ b/src/xml_to_data/prog_xml_to_data.h @@ -9,6 +9,7 @@ #ifndef PROG_XML_TO_DATA_H #define PROG_XML_TO_DATA_H +#include #include #include #include @@ -21,8 +22,8 @@ template class ExtXmlToData : public ::XmlToData { public: - ExtXmlToData(const TQString &basename, const TQString &namespac) - : _basename(basename), _namespace(namespac) {} + ExtXmlToData(const TQString &folder, const TQString &basename, const TQString &namespac) + : ::XmlToData(folder), _basename(basename), _namespace(namespac) {} protected: TQString _basename, _namespace; @@ -85,7 +86,12 @@ void ExtXmlToData::parseDevice(TQDomElement element) template void ExtXmlToData::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(); 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)); @@ -186,8 +192,8 @@ template class XmlToData : public ExtXmlToData { public: - XmlToData(const TQString &basename, const TQString &namespac) - : ExtXmlToData(basename, namespac) {} + XmlToData(const TQString &folder, const TQString &basename, const TQString &namespac) + : ExtXmlToData(folder, basename, namespac) {} protected: virtual void outputFunctions(TQTextStream &s) const; diff --git a/src/xml_to_data/xml_to_data.h b/src/xml_to_data/xml_to_data.h index 1b45ea6..2d91640 100644 --- a/src/xml_to_data/xml_to_data.h +++ b/src/xml_to_data/xml_to_data.h @@ -10,13 +10,14 @@ #define XML_TO_DATA_H #include "common/global/global.h" -# include + +#include #include class XmlToData { public: - XmlToData() {} + XmlToData(const TQString &folder) : xmlFolder(folder) {} virtual ~XmlToData() {} void process(); @@ -30,12 +31,19 @@ protected: const TQString &attribute, const TQString &value) const; void checkTagNames(TQDomElement element, const TQString &tag, const TQStringList &names) const; TQDomDocument parseFile(const TQString &filename) const; + + TQString xmlFolder; }; #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(); \ return 0; \ }