]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Rename 'lineno' to 'current_line_n'.
authorDavid Wells <wellsd2@rpi.edu>
Mon, 18 Jan 2016 14:58:14 +0000 (09:58 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Tue, 19 Jan 2016 02:12:18 +0000 (21:12 -0500)
This matches the convention used elsewhere in the library. In addition,
make it consistently an unsigned int.

include/deal.II/base/parameter_handler.h
source/base/parameter_handler.cc

index b69befc36533916737cbbfbd6887256dbcef46eb..696075e610c5e3ed3794370e247ce3f0eecb52be 100644 (file)
@@ -1982,20 +1982,20 @@ private:
   std::string get_current_full_path (const std::string &name) const;
 
   /**
-   * Scan one line of input. <tt>input_filename</tt> and <tt>lineno</tt> are
-   * the name of the input file and the current number of the line presently
-   * scanned (for the logs if there are messages). Return <tt>false</tt> if
-   * line contained stuff that could not be understood, the uppermost
-   * subsection was to be left by an <tt>END</tt> or <tt>end</tt> statement, a
-   * value for a non-declared entry was given or the entry value did not match
-   * the regular expression. <tt>true</tt> otherwise.
+   * Scan one line of input. <tt>input_filename</tt> and <tt>current_line_n</tt>
+   * are the name of the input file and the current number of the line presently
+   * scanned (for the logs if there are messages). Return <tt>false</tt> if line
+   * contained stuff that could not be understood, the uppermost subsection was
+   * to be left by an <tt>END</tt> or <tt>end</tt> statement, a value for a
+   * non-declared entry was given or the entry value did not match the regular
+   * expression. <tt>true</tt> 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;
 };
index c2827a503a774327ff9b69be8a9eb40ad82b4154..df342b722bfe73fc9a959c9a0c0f339df8adef8f 100644 (file)
@@ -1338,13 +1338,13 @@ bool ParameterHandler::read_input (std::istream &input,
   std::vector<std::string> 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<std::string>(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<unsigned int> (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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.