From: Jens Thiele Date: Mon, 20 Nov 2006 15:28:02 +0000 (+0000) Subject: command line options X-Git-Tag: v0.2~118 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=f8b78aa868d052ca41fd2c72f5ade1a697418626 command line options --- diff --git a/codegen/main.cpp b/codegen/main.cpp index 84718fe..052be02 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -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(node); const xmlpp::TextNode* nodeText = dynamic_cast(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 procedures(parser.get_procedures()); @@ -483,7 +482,6 @@ main(int argc, char* argv[]) for (std::set::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");