added support for multiple xml input files
authorJens Thiele <jens.thiele@intra2net.com>
Mon, 27 Nov 2006 15:40:00 +0000 (15:40 +0000)
committerJens Thiele <jens.thiele@intra2net.com>
Mon, 27 Nov 2006 15:40:00 +0000 (15:40 +0000)
codegen/main.cpp
example-codegen/Makefile.am
example-codegen/TODO

index e3ce124..ee70fb1 100644 (file)
@@ -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<std::string> xmlfiles;
+         for (unsigned i=3;i<argc;++i)
+           xmlfiles.push_back(argv[i]);
+
          std::string prefix=group+"_";
          std::list<std::string> 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<t2n_procedure> procedures(parser.get_procedures());
+         std::list<t2n_procedure> procedures;
+         for (std::list<std::string>::iterator it=xmlfiles.begin();it!=xmlfiles.end();++it) {
+           Parser parser(*it, group);
+           const std::list<t2n_procedure> &p(parser.get_procedures());
+           std::copy(p.begin(), p.end(), std::back_inserter(procedures));
+         }
 
          std::cerr << "Procedures:" << std::endl;
          for (std::list<t2n_procedure>::const_iterator it=procedures.begin();it!=procedures.end();++it)
index 7a73932..4318ca6 100644 (file)
@@ -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?
index 8fb6a7d..6eca4c7 100644 (file)
@@ -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