cosmetic changes
[libt2n] / codegen / main.cpp
index a76baa7..cd483b6 100644 (file)
@@ -226,6 +226,20 @@ std::ostream &operator<<(std::ostream &o, const t2n_procedure &f) {
      return o;
 }
 
+std::pair<std::string, unsigned>
+get_file_and_line(const xmlpp::Element* root, const xmlpp::Element* element)
+{
+  return std::pair<std::string, unsigned>(get_file(root, element->get_attribute("file")->get_value()),
+                                         boost::lexical_cast<unsigned>(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<std::string, unsigned> fl(get_file_and_line(root,element));
+  return std::string(fl.first)+":"+boost::lexical_cast<std::string>(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<unsigned>(element->get_attribute("line")->get_value())-1,
+                        std::pair<std::string, unsigned> 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) << ":\texport procedure: " << f << std::endl;
          m_procedures.push_back(f);
      }
 
@@ -540,7 +555,7 @@ main(int argc, char* argv[])
              std::copy(p.begin(), p.end(), std::back_inserter(procedures));
          }
 
-         std::cerr << "Procedures:" << std::endl;
+         std::cerr << "All procedures:" << std::endl;
          for (std::list<t2n_procedure>::const_iterator it=procedures.begin();it!=procedures.end();++it)
               std::cerr << *it << ";" << std::endl;