From: Jens Thiele Date: Wed, 20 Dec 2006 10:36:42 +0000 (+0000) Subject: nicer output X-Git-Tag: v0.2~16 X-Git-Url: http://developer.intra2net.com/git/?p=libt2n;a=commitdiff_plain;h=3b7c93a8beb79498d2116969ff9c873fbe56d157 nicer output --- diff --git a/codegen/main.cpp b/codegen/main.cpp index a76baa7..fe400b2 100644 --- a/codegen/main.cpp +++ b/codegen/main.cpp @@ -226,6 +226,20 @@ std::ostream &operator<<(std::ostream &o, const t2n_procedure &f) { return o; } +std::pair +get_file_and_line(const xmlpp::Element* root, const xmlpp::Element* element) +{ + return std::pair(get_file(root, element->get_attribute("file")->get_value()), + boost::lexical_cast(element->get_attribute("line")->get_value())-1); +} + +std::string +get_file_and_line_as_string(const xmlpp::Element* root, const xmlpp::Element* element) +{ + std::pair fl(get_file_and_line(root,element)); + return std::string(fl.first)+":"+boost::lexical_cast(fl.second); +} + class Parser { public: @@ -284,13 +298,14 @@ protected: if (f.args.back().second.name.empty()) { assert(element->get_attribute("file")); assert(element->get_attribute("line")); - throw parse_error(get_file(root, element->get_attribute("file")->get_value()), - boost::lexical_cast(element->get_attribute("line")->get_value())-1, + std::pair file_and_line(get_file_and_line(root, element)); + throw parse_error(file_and_line.first, + file_and_line.second, std::string("type of parameter `")+f.args.back().first+"' not (yet?) supported"); } } } - std::cerr << "Found function: " << f << std::endl; + std::cerr << get_file_and_line_as_string(root, element) << ": found procedure: " << f << std::endl; m_procedures.push_back(f); }