command line options
authorJens Thiele <jens.thiele@intra2net.com>
Mon, 20 Nov 2006 15:28:02 +0000 (15:28 +0000)
committerJens Thiele <jens.thiele@intra2net.com>
Mon, 20 Nov 2006 15:28:02 +0000 (15:28 +0000)
codegen/main.cpp

index 84718fe..052be02 100644 (file)
@@ -10,8 +10,6 @@ void print_indentation(unsigned int indentation)
          std::cout << " ";
 }
 
-
-
 //! get child element by id
 /*!
   \return pointer to element having id or null on error
@@ -176,7 +174,6 @@ protected:
      void visit_node(const xmlpp::Element* root, const xmlpp::Node* node = NULL, unsigned int indentation = 0)
          {
               if (!node) node=root;
-              std::cout << std::endl; //Separate nodes by an empty line.
          
               const xmlpp::ContentNode* nodeContent = dynamic_cast<const xmlpp::ContentNode*>(node);
               const xmlpp::TextNode* nodeText = dynamic_cast<const xmlpp::TextNode*>(node);
@@ -189,13 +186,14 @@ protected:
 
               if(!nodeText && !nodeComment && !nodename.empty()) //Let's not say "name: text".
               {
-                   print_indentation(indentation);
+                    //   print_indentation(indentation);
                    //    std::cout << "Node name = " << node->get_name() << std::endl;
                    //    std::cout << "Node name = " << nodename << std::endl;
                    if (node->get_name() == "Function") {
                         parse_function(root, node);
                    }
               }
+#if 0
               else if(nodeText) //Let's say when it's text. - e.g. let's say what that white space is.
               {
                    print_indentation(indentation);
@@ -242,7 +240,7 @@ protected:
       
                    }
               }
-  
+#endif
               if(!nodeContent)
               {
                    //Recurse through child nodes:
@@ -465,11 +463,12 @@ struct cpp_file : public std::ofstream
 int
 main(int argc, char* argv[])
 {
-     std::string filepath;
-     if(argc > 1 )
-         filepath = argv[1]; //Allow the user to specify a different XML file to parse.
-     else
-         filepath = "example.xml";
+     if (argc != 3) {
+         std::cerr << "Usage: " << argv[0] << " gccxml-file outputprefix" << std::endl;
+         return 1;
+     }
+     std::string filepath(argv[1]);
+     std::string prefix(argv[2]);
   
      Parser parser(filepath);
      std::list<t2n_procedure> procedures(parser.get_procedures());
@@ -483,7 +482,6 @@ main(int argc, char* argv[])
      for (std::set<std::string>::const_iterator it=groups.begin();it!=groups.end();++it)
          std::cerr << *it << std::endl;
 
-     std::string prefix("test_");
      std::string common_hpp_fname(prefix+"common.hxx");
      std::string common_cpp_fname(prefix+"common.cpp");
      std::string client_hpp_fname(prefix+"client.hxx");