From: Jens Thiele Date: Mon, 27 Nov 2006 15:40:00 +0000 (+0000) Subject: added support for multiple xml input files X-Git-Tag: v0.2~88 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=0cfa3fb24104428b6e6d8881b1f94fcad825c7ef added support for multiple xml input files --- diff --git a/codegen/main.cpp b/codegen/main.cpp index e3ce124..ee70fb1 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -533,15 +533,18 @@ struct RemoveGenerated int main(int argc, char* argv[]) { - if (argc != 4) { - std::cerr << "Usage: " << argv[0] << " export-file gccxml-file default-group" << std::endl; + if (argc < 4) { + std::cerr << "Usage: " << argv[0] << " export-file default-group gccxml-file1 gccxml-file2 ... " << std::endl; return 1; } try{ std::string exportfile(argv[1]); - std::string xmlfile(argv[2]); - std::string group(argv[3]); + std::string group(argv[2]); + std::list xmlfiles; + for (unsigned i=3;i includes(get_includes(exportfile)); remove_if(includes.begin(), includes.end(), RemoveGenerated(prefix)); @@ -549,8 +552,12 @@ main(int argc, char* argv[]) //paste_includes(std::cerr, includes); - Parser parser(xmlfile, group); - std::list procedures(parser.get_procedures()); + std::list procedures; + for (std::list::iterator it=xmlfiles.begin();it!=xmlfiles.end();++it) { + Parser parser(*it, group); + const std::list &p(parser.get_procedures()); + std::copy(p.begin(), p.end(), std::back_inserter(procedures)); + } std::cerr << "Procedures:" << std::endl; for (std::list::const_iterator it=procedures.begin();it!=procedures.end();++it) diff --git a/example-codegen/Makefile.am b/example-codegen/Makefile.am index 7a73932..4318ca6 100644 --- a/example-codegen/Makefile.am +++ b/example-codegen/Makefile.am @@ -4,6 +4,9 @@ LDADD = $(top_builddir)/src/libt2n.la @BOOST_SERIALIZATION_LIB@ @BOOST_LDFLAGS@ CMDGROUPS = default other +# unfortunately we can't set those from variables +# because they are parsed by automake + libdefault_la_SOURCES = default_client.cpp libother_la_SOURCES = other_client.cpp noinst_LTLIBRARIES = libdefault.la libother.la @@ -31,7 +34,7 @@ codegen.stamp: $(CMDGROUPS:%=%.cpp) $(top_builddir)/codegen/codegen # todo use tmp file for xml file for i in $(CMDGROUPS); do \ gccxml $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $${i}.cpp -fxml=$${i}.xml; \ - $(top_builddir)/codegen/codegen $${i}.cpp $${i}.xml $${i}; \ + $(top_builddir)/codegen/codegen $${i}.cpp $${i} $${i}.xml; \ done; touch $@ # assuming we have gnu make? diff --git a/example-codegen/TODO b/example-codegen/TODO index 8fb6a7d..6eca4c7 100644 --- a/example-codegen/TODO +++ b/example-codegen/TODO @@ -9,5 +9,7 @@ both solutions only work if the include paths used during compilation of a progr at the moment we use the second solution -- perhaps generate header containing only declarations of server functions - (hmm this conflicts with the current include file handling) +- make distcheck +- .pc file +- make install (in this example the "other" client lib would have to install foo.hxx) +- test using valgrind