Example #1
0
void
verify_line(char *expected_line)
{
	if (!line_is(expected_line))
		file_error("Expected '%s' rather than '%s'", expected_line,
			top_file_ptr->line_buf);
}
Example #2
0
bool
verify_line(char *expected_line)
{
	if (!line_is(expected_line)) {
		bad_line(expected_line);
		return(false);
	}
	return(true);
}
Example #3
0
int colvarparse::check_keywords(std::string &conf, char const *key)
{
  if (cvm::debug())
    cvm::log("Configuration string for \""+std::string(key)+
             "\": \"\n"+conf+"\".\n");

  strip_values(conf);
  // after stripping, the config string has either empty lines, or
  // lines beginning with a keyword

  std::string line;
  std::istringstream is(conf);
  while (std::getline(is, line)) {
    if (line.size() == 0)
      continue;
    if (line.find_first_not_of(white_space) ==
        std::string::npos)
      continue;

    std::string uk;
    std::istringstream line_is(line);
    line_is >> uk;
    // if (cvm::debug())
    //   cvm::log ("Checking the validity of \""+uk+"\" from line:\n" + line);
    uk = to_lower_cppstr(uk);

    bool found_keyword = false;
    for (std::list<std::string>::iterator ki = allowed_keywords.begin();
         ki != allowed_keywords.end(); ki++) {
      if (uk == *ki) {
        found_keyword = true;
        break;
      }
    }
    if (!found_keyword) {
      cvm::log("Error: keyword \""+uk+"\" is not supported, "
               "or not recognized in this context.\n");
      cvm::set_error_bits(INPUT_ERROR);
      return COLVARS_ERROR;
    }
  }

  clear_keyword_registry();

  return COLVARS_OK;
}