]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Small changes and bug fixes/work arounds.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 24 May 1998 21:10:47 +0000 (21:10 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 24 May 1998 21:10:47 +0000 (21:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@345 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/parameter_handler.cc

index 53a329c944e93f122333a15c0618d07c7ee334d4..2ac99bae69edbff27e5a6a19bf2e40c6ed22760a 100644 (file)
@@ -491,15 +491,16 @@ bool ParameterHandler::scan_line (string line, const unsigned int lineno) {
                                   // now every existing whitespace
                                   // should be exactly one ' ';
                                   // if at end or beginning: delete
-  if ((line.length() != 0) && (line[0] == ' '))  line.erase (line[0]);
+  if ((line.length() != 0) && (line[0] == ' '))  line.erase (0, 1);
                                   // if line is now empty: leave
   if (line.length() == 0) return true;
 
-  if (line[line.length()-1] == ' ')  line.erase (line[line.size()-1]);
+  if (line[line.length()-1] == ' ')
+    line.erase (line.size()-1, 1);
 
                                   // enter subsection
-  if ((line.find ("SUBSECTION") != string::npos) ||
-      (line.find ("subsection") != string::npos))
+  if ((line.find ("SUBSECTION ") == 0) ||
+      (line.find ("subsection ") == 0))
     {
                                       // delete this prefix
       line.erase (0, string("subsection").length()+1);
@@ -523,28 +524,29 @@ bool ParameterHandler::scan_line (string line, const unsigned int lineno) {
       return true;
     };
   
-
                                   // exit subsection
-  if ((line.find ("END") != string::npos) ||
-      (line.find ("end") != string::npos))
+  if ((line.find ("END") == 0) ||
+      (line.find ("end") == 0))
     if (subsection_path.size() == 0) 
       {
-       cerr << "Line " << lineno << ": There is no subsection to leave here!" << endl;
+       cerr << "Line " << lineno
+            << ": There is no subsection to leave here!" << endl;
        return false;
       }
     else
       return leave_subsection ();
 
-
                                   // regular entry
-  if ((line.find ("SET") != string::npos) ||
-      (line.find ("set") != string::npos)) 
+  if ((line.find ("SET ") == 0) ||
+      (line.find ("set ") == 0)) 
     {
                                       // erase "set" statement and eliminate
                                       // spaces around the '='
       line.erase (0, 4);
-      line.replace (line.find(" ="), 2, "=");
-      line.replace (line.find("= "), 2, "=");
+      if (line.find(" =") != string::npos)
+       line.replace (line.find(" ="), 2, "=");
+      if (line.find("= ") != string::npos)
+       line.replace (line.find("= "), 2, "=");
 
                                       // extract entry name and value
       string entry_name  (line, 0, line.find('='));

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.