added support for multiple xml input files
[libt2n] / codegen / main.cpp
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)