From f0e9e309d8a4c32448d113deccd1ea94df5d644e Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 24 May 1998 21:10:47 +0000 Subject: [PATCH] Small changes and bug fixes/work arounds. git-svn-id: https://svn.dealii.org/trunk@345 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/parameter_handler.cc | 28 +++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/deal.II/base/source/parameter_handler.cc b/deal.II/base/source/parameter_handler.cc index 53a329c944..2ac99bae69 100644 --- a/deal.II/base/source/parameter_handler.cc +++ b/deal.II/base/source/parameter_handler.cc @@ -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('=')); -- 2.39.5