Difference for src/colvarparse.C from version 1.9 to 1.10

version 1.9version 1.10
Line 1
Line 1
 /// -*- c++ -*- 
  
 #include <sstream> #include <sstream>
 #include <iostream> #include <iostream>
Line 17
Line 17
  
 // definition of single-value keyword parsers // definition of single-value keyword parsers
  
 #define _get_keyval_scalar_string_(TYPE)                                \ template<typename TYPE> bool colvarparse::_get_keyval_scalar_(std::string const &conf,
                                                                         \                                                               char const *key,
   bool colvarparse::get_keyval(std::string const &conf,                 \                                                               TYPE &value,
                                char const *key,                         \                                                               TYPE const &def_value,
                                TYPE &value,                             \                                                               Parse_Mode const parse_mode)
                                TYPE const &def_value,                   \ {
                                Parse_Mode const parse_mode)             \   std::string data;
   {                                                                     \   bool b_found = false, b_found_any = false;
     std::string data;                                                   \   size_t save_pos = 0, found_count = 0;
     bool b_found = false, b_found_any = false;                          \ 
     size_t save_pos = 0, found_count = 0;                               \   do {
                                                                         \     std::string data_this = "";
     do {                                                                \     b_found = key_lookup(conf, key, data_this, save_pos);
       std::string data_this = "";                                       \     if (b_found) {
       b_found = key_lookup(conf, key, data_this, save_pos);             \       if (!b_found_any)
       if (b_found) {                                                    \         b_found_any = true;
         if (!b_found_any)                                               \       found_count++;
           b_found_any = true;                                           \       data = data_this;
         found_count++;                                                  \ 
         data = data_this;                                               \ 
       }                                                                 \ 
     } while (b_found);                                                  \ 
                                                                         \ 
     if (found_count > 1)                                                \ 
       cvm::log("Warning: found more than one instance of \""+           \ 
                std::string(key)+"\".\n");                               \ 
                                                                         \ 
     if (data.size()) {                                                  \ 
       std::istringstream is(data);                                      \ 
       TYPE x(def_value);                                                \ 
       if (is >> x) {                                                    \ 
         value = x;                                                      \ 
       } else {                                                          \ 
         cvm::error("Error: in parsing \""+                              \ 
                    std::string(key)+"\".\n", INPUT_ERROR);              \ 
       }                                                                 \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = "+                           \ 
                  cvm::to_str(value)+"\n");                              \ 
       }                                                                 \ 
     } else {                                                            \ 
                                                                         \ 
       if (b_found_any) {                                                \ 
         cvm::error("Error: improper or missing value "                  \ 
                    "for \""+std::string(key)+"\".\n", INPUT_ERROR);     \ 
       }                                                                 \ 
       value = def_value;                                                \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = \""+                         \ 
                  cvm::to_str(def_value)+"\" [default]\n");              \ 
       }                                                                 \ 
     }                                                                   \ 
                                                                         \ 
     return b_found_any;                                                 \ 
   } 
  
  
 #define _get_keyval_scalar_(TYPE)                                       \ 
                                                                         \ 
   bool colvarparse::get_keyval(std::string const &conf,                 \ 
                                char const *key,                         \ 
                                TYPE &value,                             \ 
                                TYPE const &def_value,                   \ 
                                Parse_Mode const parse_mode)             \ 
   {                                                                     \ 
     std::string data;                                                   \ 
     bool b_found = false, b_found_any = false;                          \ 
     size_t save_pos = 0, found_count = 0;                               \ 
                                                                         \ 
     do {                                                                \ 
       std::string data_this = "";                                       \ 
       b_found = key_lookup(conf, key, data_this, save_pos);             \ 
       if (b_found) {                                                    \ 
         if (!b_found_any)                                               \ 
           b_found_any = true;                                           \ 
         found_count++;                                                  \ 
         data = data_this;                                               \ 
       }                                                                 \ 
     } while (b_found);                                                  \ 
                                                                         \ 
     if (found_count > 1)                                                \ 
       cvm::log("Warning: found more than one instance of \""+           \ 
                std::string(key)+"\".\n");                               \ 
                                                                         \ 
     if (data.size()) {                                                  \ 
       std::istringstream is(data);                                      \ 
       size_t data_count = 0;                                            \ 
       TYPE x(def_value);                                                \ 
       while (is >> x) {                                                 \ 
         value = x;                                                      \ 
         data_count++;                                                   \ 
       }                                                                 \ 
       if (data_count == 0)                                              \ 
         cvm::fatal_error("Error: in parsing \""+                        \ 
                          std::string(key)+"\".\n");                     \ 
       if (data_count > 1) {                                             \ 
         cvm::error("Error: multiple values "                            \ 
                    "are not allowed for keyword \""+                    \ 
                    std::string(key)+"\".\n", INPUT_ERROR);              \ 
       }                                                                 \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = "+                           \ 
                  cvm::to_str(value)+"\n");                              \ 
       }                                                                 \ 
     } else {                                                            \ 
                                                                         \ 
       if (b_found_any) {                                                \ 
         cvm::error("Error: improper or missing value "                  \ 
                    "for \""+std::string(key)+"\".\n", INPUT_ERROR);     \ 
       }                                                                 \ 
       value = def_value;                                                \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = "+                           \ 
                  cvm::to_str(def_value)+" [default]\n");                \ 
       }                                                                 \ 
     }                                                                   \ 
                                                                         \ 
     return b_found_any;                                                 \ 
   } 
  
  
 // definition of multiple-value keyword parsers 
  
 #define _get_keyval_vector_(TYPE)                                       \ 
                                                                         \ 
   bool colvarparse::get_keyval(std::string const &conf,                 \ 
                                char const *key,                         \ 
                                std::vector<TYPE> &values,               \ 
                                std::vector<TYPE> const &def_values,     \ 
                                Parse_Mode const parse_mode)             \ 
   {                                                                     \ 
     std::string data;                                                   \ 
     bool b_found = false, b_found_any = false;                          \ 
     size_t save_pos = 0, found_count = 0;                               \ 
                                                                         \ 
     do {                                                                \ 
       std::string data_this = "";                                       \ 
       b_found = key_lookup(conf, key, data_this, save_pos);             \ 
       if (b_found) {                                                    \ 
         if (!b_found_any)                                               \ 
           b_found_any = true;                                           \ 
         found_count++;                                                  \ 
         data = data_this;                                               \ 
       }                                                                 \ 
     } while (b_found);                                                  \ 
                                                                         \ 
     if (found_count > 1)                                                \ 
       cvm::log("Warning: found more than one instance of \""+           \ 
                std::string(key)+"\".\n");                               \ 
                                                                         \ 
     if (data.size()) {                                                  \ 
       std::istringstream is(data);                                      \ 
                                                                         \ 
       if (values.size() == 0) {                                         \ 
                                                                         \ 
         std::vector<TYPE> x;                                            \ 
         if (def_values.size())                                          \ 
           x = def_values;                                               \ 
         else                                                            \ 
           x.assign(1, TYPE());                                          \ 
                                                                         \ 
         for (size_t i = 0;                                              \ 
              ( is >> x[ ((i<x.size()) ? i : x.size()-1) ] );            \ 
              i++) {                                                     \ 
           values.push_back(x[ ((i<x.size()) ? i : x.size()-1) ]);       \ 
         }                                                               \ 
                                                                         \ 
       } else {                                                          \ 
                                                                         \ 
         size_t i = 0;                                                   \ 
         for ( ; i < values.size(); i++) {                               \ 
           TYPE x(values[i]);                                            \ 
           if (is >> x) {                                                \ 
             values[i] = x;                                              \ 
           } else {                                                      \ 
             cvm::error("Error: in parsing \""+                          \ 
                        std::string(key)+"\".\n", INPUT_ERROR);          \ 
           }                                                             \ 
         }                                                               \ 
       }                                                                 \ 
                                                                         \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = "+                           \ 
                  cvm::to_str(values)+"\n");                             \ 
       }                                                                 \ 
                                                                         \ 
     } else {                                                            \ 
                                                                         \ 
       if (b_found_any) {                                                \ 
         cvm::error("Error: improper or missing values for \""+          \ 
                    std::string(key)+"\".\n", INPUT_ERROR);              \ 
       }                                                                 \ 
                                                                         \ 
       for (size_t i = 0; i < values.size(); i++)                        \ 
         values[i] = def_values[ (i > def_values.size()) ? 0 : i ];      \ 
                                                                         \ 
       if (parse_mode != parse_silent) {                                 \ 
         cvm::log("# "+std::string(key)+" = "+                           \ 
                  cvm::to_str(def_values)+" [default]\n");               \ 
       }                                                                 \ 
     }                                                                   \ 
                                                                         \ 
     return b_found_any;                                                 \ 
   }   }
    } while (b_found);
  
    if (found_count > 1)
      cvm::log("Warning: found more than one instance of \""+
               std::string(key)+"\".\n");
  
 // single-value keyword parsers   if (data.size()) {
      std::istringstream is(data);
      TYPE x(def_value);
      if (is >> x) {
        value = x;
      } else {
        cvm::error("Error: in parsing \""+
                   std::string(key)+"\".\n", INPUT_ERROR);
      }
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = "+
                 cvm::to_str(value)+"\n");
      }
    } else {
  
      if (b_found_any) {
        cvm::error("Error: improper or missing value "
                   "for \""+std::string(key)+"\".\n", INPUT_ERROR);
      }
      value = def_value;
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = "+
                 cvm::to_str(def_value)+" [default]\n");
      }
    }
  
 _get_keyval_scalar_(int);   return b_found_any;
 _get_keyval_scalar_(size_t); }
 _get_keyval_scalar_(long); 
 _get_keyval_scalar_string_(std::string); 
 _get_keyval_scalar_(cvm::real); bool colvarparse::_get_keyval_scalar_string_(std::string const &conf,
 _get_keyval_scalar_(cvm::rvector);                                              char const *key,
 _get_keyval_scalar_(cvm::quaternion);                                              std::string &value,
 _get_keyval_scalar_(colvarvalue);                                              std::string const &def_value,
                                               Parse_Mode const parse_mode)
  {
    std::string data;
    bool b_found = false, b_found_any = false;
    size_t save_pos = 0, found_count = 0;
  
    do {
      std::string data_this = "";
      b_found = key_lookup(conf, key, data_this, save_pos);
      if (b_found) {
        if (!b_found_any)
          b_found_any = true;
        found_count++;
        data = data_this;
      }
    } while (b_found);
  
    if (found_count > 1)
      cvm::log("Warning: found more than one instance of \""+
               std::string(key)+"\".\n");
  
    if (data.size()) {
      std::istringstream is(data);
      size_t data_count = 0;
      std::string x(def_value);
      while (is >> x) {
        value = x;
        data_count++;
      }
      if (data_count == 0)
        cvm::error("Error: in parsing \""+
                   std::string(key)+"\".\n", INPUT_ERROR);
      if (data_count > 1) {
        cvm::error("Error: multiple values "
                   "are not allowed for keyword \""+
                   std::string(key)+"\".\n", INPUT_ERROR);
      }
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = \""+
                 cvm::to_str(value)+"\"\n");
      }
    } else {
  
      if (b_found_any) {
        cvm::error("Error: improper or missing value "
                   "for \""+std::string(key)+"\".\n", INPUT_ERROR);
      }
      value = def_value;
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = \""+
                 cvm::to_str(def_value)+"\" [default]\n");
      }
    }
  
    return b_found_any;
  }
  
  
 // multiple-value keyword parsers // multiple-value keyword parsers
  
 _get_keyval_vector_(int); template<typename TYPE> bool colvarparse::_get_keyval_vector_(std::string const &conf,
 _get_keyval_vector_(size_t);                                                               char const *key,
 _get_keyval_vector_(long);                                                               std::vector<TYPE> &values,
 _get_keyval_vector_(std::string);                                                               std::vector<TYPE> const &def_values,
 _get_keyval_vector_(cvm::real);                                                               Parse_Mode const parse_mode)
 _get_keyval_vector_(cvm::rvector); {
 _get_keyval_vector_(cvm::quaternion);   std::string data;
 _get_keyval_vector_(colvarvalue);   bool b_found = false, b_found_any = false;
    size_t save_pos = 0, found_count = 0;
  
    do {
      std::string data_this = "";
      b_found = key_lookup(conf, key, data_this, save_pos);
      if (b_found) {
        if (!b_found_any)
          b_found_any = true;
        found_count++;
        data = data_this;
      }
    } while (b_found);
  
    if (found_count > 1)
      cvm::log("Warning: found more than one instance of \""+
               std::string(key)+"\".\n");
  
    if (data.size()) {
      std::istringstream is(data);
  
      if (values.size() == 0) {
  
        std::vector<TYPE> x;
        if (def_values.size())
          x = def_values;
        else
          x.assign(1, TYPE());
  
        for (size_t i = 0;
             ( is >> x[ ((i<x.size()) ? i : x.size()-1) ] );
             i++) {
          values.push_back(x[ ((i<x.size()) ? i : x.size()-1) ]);
        }
  
      } else {
  
        size_t i = 0;
        for ( ; i < values.size(); i++) {
          TYPE x(values[i]);
          if (is >> x) {
            values[i] = x;
          } else {
            cvm::error("Error: in parsing \""+
                       std::string(key)+"\".\n", INPUT_ERROR);
          }
        }
      }
  
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = "+
                 cvm::to_str(values)+"\n");
      }
  
    } else {
  
      if (b_found_any) {
        cvm::error("Error: improper or missing values for \""+
                   std::string(key)+"\".\n", INPUT_ERROR);
      }
  
      for (size_t i = 0; i < values.size(); i++)
        values[i] = def_values[ (i > def_values.size()) ? 0 : i ];
  
      if (parse_mode != parse_silent) {
        cvm::log("# "+std::string(key)+" = "+
                 cvm::to_str(def_values)+" [default]\n");
      }
    }
  
    return b_found_any;
  }
  
  
  // single-value keyword parsers
  
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               int &value,
                               int const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<int>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               size_t &value,
                               size_t const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<size_t>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               long &value,
                               long const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<long>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::string &value,
                               std::string const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_string_(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               cvm::real &value,
                               cvm::real const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<cvm::real>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               cvm::rvector &value,
                               cvm::rvector const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<cvm::rvector>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               cvm::quaternion &value,
                               cvm::quaternion const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<cvm::quaternion>(conf, key, value, def_value, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               colvarvalue &value,
                               colvarvalue const &def_value,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_scalar_<colvarvalue>(conf, key, value, def_value, parse_mode);
  }
  
  
 bool colvarparse::get_keyval(std::string const &conf, bool colvarparse::get_keyval(std::string const &conf,
Line 283
Line 328
                 (data == std::string("false")) ) {                 (data == std::string("false")) ) {
       value = false;       value = false;
     } else     } else
       cvm::fatal_error("Error: boolean values only are allowed "       cvm::error("Error: boolean values only are allowed "
                        "for \""+std::string(key)+"\".\n");                  "for \""+std::string(key)+"\".\n", INPUT_ERROR);
     if (parse_mode != parse_silent) {     if (parse_mode != parse_silent) {
       cvm::log("# "+std::string(key)+" = "+       cvm::log("# "+std::string(key)+" = "+
                (value ? "on" : "off")+"\n");                (value ? "on" : "off")+"\n");
Line 309
Line 354
 } }
  
  
  // multiple-value keyword parsers
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<int> &values,
                               std::vector<int> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<int>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<size_t> &values,
                               std::vector<size_t> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<size_t>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<long> &values,
                               std::vector<long> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<long>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<std::string> &values,
                               std::vector<std::string> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<std::string>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<cvm::real> &values,
                               std::vector<cvm::real> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<cvm::real>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<cvm::rvector> &values,
                               std::vector<cvm::rvector> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<cvm::rvector>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<cvm::quaternion> &values,
                               std::vector<cvm::quaternion> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<cvm::quaternion>(conf, key, values, def_values, parse_mode);
  }
  
  bool colvarparse::get_keyval(std::string const &conf,
                               char const *key,
                               std::vector<colvarvalue> &values,
                               std::vector<colvarvalue> const &def_values,
                               Parse_Mode const parse_mode)
  {
    return _get_keyval_vector_<colvarvalue>(conf, key, values, def_values, parse_mode);
  }
  
  
 void colvarparse::add_keyword(char const *key) void colvarparse::add_keyword(char const *key)
 { {
   for (std::list<std::string>::iterator ki = allowed_keywords.begin();   for (std::list<std::string>::iterator ki = allowed_keywords.begin();
Line 398
Line 518
       }       }
     }     }
     if (!found_keyword) {     if (!found_keyword) {
       cvm::log("Error: keyword \""+uk+"\" is not supported, "       cvm::error("Error: keyword \""+uk+"\" is not supported, "
                "or not recognized in this context.\n");                  "or not recognized in this context.\n", INPUT_ERROR);
       cvm::set_error_bits(INPUT_ERROR);       return INPUT_ERROR;
       return COLVARS_ERROR; 
     }     }
   }   }
  
Line 429
Line 548
                              std::string &data,                              std::string &data,
                              size_t &save_pos)                              size_t &save_pos)
 { {
    if (cvm::debug()) {
      cvm::log("Looking for the keyword \""+std::string(key_in)+"\" and its value.\n");
    }
  
   // add this keyword to the register (in its camelCase version)   // add this keyword to the register (in its camelCase version)
   add_keyword(key_in);   add_keyword(key_in);
  
Line 449
Line 572
   // start from the first occurrence of key   // start from the first occurrence of key
   size_t pos = conf_lower.find(key, save_pos);   size_t pos = conf_lower.find(key, save_pos);
  
   // iterate over all instances until it finds the isolated keyword   // iterate over all instances of the substring until it finds it as isolated keyword
   while (true) {   while (true) {
  
     if (pos == std::string::npos) {     if (pos == std::string::npos) {
       // no valid instance of the keyword has been found       // no valid instance of the keyword has been found
        if (cvm::debug()) {
          cvm::log("Keyword \""+std::string(key_in)+"\" not found.\n");
        }
       return false;       return false;
     }     }
  
Line 506
Line 632
   size_t data_begin = (to_lower_cppstr(line)).find(key) + key.size();   size_t data_begin = (to_lower_cppstr(line)).find(key) + key.size();
   data_begin = line.find_first_not_of(white_space, data_begin+1);   data_begin = line.find_first_not_of(white_space, data_begin+1);
  
   //   size_t data_begin_absolute = data_begin + line_begin; 
   //   size_t data_end_absolute   = data_begin; 
  
   if (data_begin != std::string::npos) {   if (data_begin != std::string::npos) {
  
     size_t data_end = line.find_last_not_of(white_space) + 1;     size_t data_end = line.find_last_not_of(white_space) + 1;
     data_end = (data_end == std::string::npos) ? line.size() : data_end;     data_end = (data_end == std::string::npos) ? line.size() : data_end;
     //     data_end_absolute = data_end + line_begin; 
  
     if (line.find('{', data_begin) != std::string::npos) {     size_t brace = line.find('{', data_begin);  // look for an opening brace
      size_t brace_last = brace;
  
       size_t brace_count = 1;     if (brace != std::string::npos) {
       size_t brace = line.find('{', data_begin);  // start from the first opening brace 
        // find the matching closing brace
  
        if (cvm::debug()) {
          cvm::log("Multi-line value, config is now \""+line+"\".\n");
        }
  
        int brace_count = 1;
  
       while (brace_count > 0) {       while (brace_count > 0) {
  
         // find the matching closing brace         brace = line.find_first_of("{}", brace_last+1);
          // find all braces within this line
          while (brace < std::string::npos) {
            brace_last = brace;
            if (line[brace] == '{') brace_count++;
            if (line[brace] == '}') brace_count--;
            if (brace_count == 0) {
              data_end = brace+1;
              break;
            }
         brace = line.find_first_of("{}", brace+1);         brace = line.find_first_of("{}", brace+1);
         while (brace == std::string::npos) {         }
  
          if (brace_count == 0) {
            data_end = brace+1;
            break;
          }
  
          if (brace == std::string::npos) {
  
           // add a new line           // add a new line
           if (line_end >= conf.size()) {           if (line_end >= conf.size()) {
             cvm::fatal_error("Parse error: reached the end while "             cvm::error("Parse error: reached the end while "
                              "looking for closing brace; until now "                              "looking for closing brace; until now "
                              "the following was parsed: \"\n"+                              "the following was parsed: \"\n"+
                              line+"\".\n");                        line+"\".\n", INPUT_ERROR);
             return false;             return false;
           }           }
           size_t const old_end = line.size(); 
           //           data_end_absolute += old_end+1; 
  
           line_begin = line_end;           line_begin = line_end;
           nl = conf.find('\n', line_begin+1);           nl = conf.find('\n', line_begin+1);
Line 544
Line 689
             line_end = nl;             line_end = nl;
           line.append(conf, line_begin, (line_end-line_begin));           line.append(conf, line_begin, (line_end-line_begin));
  
           brace = line.find_first_of("{}", old_end);           if (cvm::debug()) {
              cvm::log("Added a new line, config is now \""+line+"\".\n");
            }
         }         }
  
         if (line[brace] == '{') brace_count++;         if (brace_count < 0) {
         if (line[brace] == '}') brace_count--;           cvm::error("Error: found closing brace without opening brace.\n", INPUT_ERROR);
          }
       }       }
  
       // set data_begin after the opening brace       // strip the leading and trailing braces
       data_begin = line.find_first_of('{', data_begin) + 1;       data_begin = line.find_first_of('{') + 1;
       data_begin = line.find_first_not_of(white_space,       data_begin = line.find_first_not_of(white_space,
                                           data_begin);                                           data_begin);
       // set data_end before the closing brace 
       data_end = brace; 
       data_end = line.find_last_not_of(white_space+"}", 
                                        data_end) + 1; 
       //       data_end_absolute = line_end; 
  
       if (data_end > line.size())       data_end = line.find_last_of('}', line.size()) - 1;
         data_end = line.size();       data_end = line.find_last_not_of(white_space,
                                         data_end) + 1;
     }     }
  
     data.append(line, data_begin, (data_end-data_begin));     data.append(line, data_begin, (data_end-data_begin));
  
      if (cvm::debug()) {
        cvm::log("Keyword value = \""+data+"\".\n");
      }
  
     if (data.size() && save_delimiters) {     if (data.size() && save_delimiters) {
       data_begin_pos.push_back(conf.find(data, pos+key.size()));       data_begin_pos.push_back(conf.find(data, pos+key.size()));
       data_end_pos.push_back(data_begin_pos.back()+data.size());       data_end_pos.push_back(data_begin_pos.back()+data.size());
       //       std::cerr << "key = " << key << ", data = \"" 
       //                 << data << "\", data_begin, data_end = " 
       //                 << data_begin_pos.back() << ", " << data_end_pos.back() 
       //                 << "\n"; 
     }     }
   }   }
  


Legend:
Removed in v.1.9 
changed lines
 Added in v.1.10



Made by using version 1.53 of cvs2html