From e1080e4ef5c8c1064e7debe40bf7579ed7fda4f8 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 18 Jan 2016 09:58:14 -0500 Subject: [PATCH] Rename 'lineno' to 'current_line_n'. This matches the convention used elsewhere in the library. In addition, make it consistently an unsigned int. --- include/deal.II/base/parameter_handler.h | 16 +++++++------- source/base/parameter_handler.cc | 28 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/deal.II/base/parameter_handler.h b/include/deal.II/base/parameter_handler.h index b69befc365..696075e610 100644 --- a/include/deal.II/base/parameter_handler.h +++ b/include/deal.II/base/parameter_handler.h @@ -1982,20 +1982,20 @@ private: std::string get_current_full_path (const std::string &name) const; /** - * Scan one line of input. input_filename and lineno are - * the name of the input file and the current number of the line presently - * scanned (for the logs if there are messages). Return false if - * line contained stuff that could not be understood, the uppermost - * subsection was to be left by an END or end statement, a - * value for a non-declared entry was given or the entry value did not match - * the regular expression. true otherwise. + * Scan one line of input. input_filename and current_line_n + * are the name of the input file and the current number of the line presently + * scanned (for the logs if there are messages). Return false if line + * contained stuff that could not be understood, the uppermost subsection was + * to be left by an END or end statement, a value for a + * non-declared entry was given or the entry value did not match the regular + * expression. true otherwise. * * The function modifies its argument, but also takes it by value, so the * caller's variable is not changed. */ bool scan_line (std::string line, const std::string &input_filename, - const unsigned int lineno); + const unsigned int current_line_n); friend class MultipleParameterLoop; }; diff --git a/source/base/parameter_handler.cc b/source/base/parameter_handler.cc index c2827a503a..df342b722b 100644 --- a/source/base/parameter_handler.cc +++ b/source/base/parameter_handler.cc @@ -1338,13 +1338,13 @@ bool ParameterHandler::read_input (std::istream &input, std::vector saved_path = subsection_path; std::string line; - int lineno=0; + unsigned int current_line_n = 0; bool status = true; while (getline (input, line)) { - ++lineno; - status &= scan_line (line, filename, lineno); + ++current_line_n; + status &= scan_line (line, filename, current_line_n); } if (status && (saved_path != subsection_path)) @@ -2559,7 +2559,7 @@ ParameterHandler::log_parameters_section (LogStream &out) bool ParameterHandler::scan_line (std::string line, const std::string &input_filename, - const unsigned int lineno) + const unsigned int current_line_n) { // if there is a comment, delete it if (line.find('#') != std::string::npos) @@ -2588,7 +2588,7 @@ ParameterHandler::scan_line (std::string line, // check whether subsection exists if (!entries->get_child_optional (get_current_full_path(subsection))) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: There is no such subsection to be entered: " << demangle(get_current_full_path(subsection)) << std::endl; @@ -2615,7 +2615,7 @@ ParameterHandler::scan_line (std::string line, if (line.size()>0) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: invalid content after 'end'!" << std::endl; return false; @@ -2623,7 +2623,7 @@ ParameterHandler::scan_line (std::string line, if (subsection_path.size() == 0) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: There is no subsection to leave here!" << std::endl; return false; @@ -2646,7 +2646,7 @@ ParameterHandler::scan_line (std::string line, std::string::size_type pos = line.find("="); if (pos == std::string::npos) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: invalid format of set expression!" << std::endl; return false; @@ -2663,7 +2663,7 @@ ParameterHandler::scan_line (std::string line, { if (entries->get(path + path_separator + "deprecation_status") == "true") { - std::cerr << "Warning in line <" << lineno + std::cerr << "Warning in line <" << current_line_n << "> of file <" << input_filename << ">: You are using the deprecated spelling <" << entry_name @@ -2689,7 +2689,7 @@ ParameterHandler::scan_line (std::string line, = entries->get (path + path_separator + "pattern"); if (!patterns[pattern_index]->match(entry_value)) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">:" << std::endl << " The entry value" << std::endl @@ -2709,7 +2709,7 @@ ParameterHandler::scan_line (std::string line, } else { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: No such entry was declared:" << std::endl << " " << entry_name << std::endl @@ -2735,7 +2735,7 @@ ParameterHandler::scan_line (std::string line, // the remainder must then be a filename if (line.size() == 0) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << "> is an include statement but does not name a file!" << std::endl; @@ -2746,7 +2746,7 @@ ParameterHandler::scan_line (std::string line, std::ifstream input (line.c_str()); if (!input) { - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << "> is an include statement but the file <" << line << "> could not be opened!" @@ -2759,7 +2759,7 @@ ParameterHandler::scan_line (std::string line, } // this line matched nothing known - std::cerr << "Line <" << lineno + std::cerr << "Line <" << current_line_n << "> of file <" << input_filename << ">: This line matched nothing known ('set' or 'subsection' missing!?):" << std::endl << " " << line << std::endl; -- 2.39.5