Browse Source

Function renaming

tempestpy_adaptions
Lanchid 12 years ago
parent
commit
383f34e745
  1. 2
      src/parser/AtomicPropositionLabelingParser.cpp
  2. 8
      src/parser/DeterministicSparseTransitionParser.cpp
  3. 5
      src/parser/Parser.cpp
  4. 2
      src/parser/Parser.h

2
src/parser/AtomicPropositionLabelingParser.cpp

@ -177,7 +177,7 @@ AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t n
buf += cnt;
}
}
buf = skipWS(buf);
buf = trimWhitespaces(buf);
}
}
}

8
src/parser/DeterministicSparseTransitionParser.cpp

@ -54,7 +54,7 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fas
}
buf += 7; // skip "STATES "
if (strtol(buf, &buf, 10) == 0) return 0;
buf = skipWS(buf);
buf = trimWhitespaces(buf);
if (strncmp(buf, "TRANSITIONS ", 12) != 0) {
LOG4CPLUS_ERROR(logger, "Expected \"TRANSITIONS\" but got \"" << std::string(buf, 0, 16) << "\".");
return 0;
@ -90,7 +90,7 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fas
return 0;
}
if (row == col) non_zero--;
buf = skipWS(tmp);
buf = trimWhitespaces(tmp);
}
return non_zero;
@ -145,7 +145,7 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st
*/
buf += 7; // skip "STATES "
checked_strtol(buf, &buf);
buf = skipWS(buf);
buf = trimWhitespaces(buf);
buf += 12; // skip "TRANSITIONS "
checked_strtol(buf, &buf);
@ -179,7 +179,7 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st
val = strtod(buf, &buf);
this->matrix->addNextValue(row,col,val);
buf = skipWS(buf);
buf = trimWhitespaces(buf);
}
/*

5
src/parser/Parser.cpp

@ -34,7 +34,10 @@ uint_fast64_t mrmc::parser::Parser::checked_strtol(const char* str, char** end)
* @param buf String buffer
* @return pointer to first non-whitespace character
*/
char* mrmc::parser::Parser::skipWS(char* buf) {
char* mrmc::parser::Parser::trimWhitespaces(char* buf) {
/*TODO: Maybe use memcpy to copy all the stuff from the first non-whitespace char
* to the position of the buffer, so we don't have to keep track of 2 pointers.
*/
while ((*buf == ' ') || (*buf == '\t') || (*buf == '\n') || (*buf == '\r')) buf++;
return buf;
}

2
src/parser/Parser.h

@ -106,7 +106,7 @@ namespace parser {
/*!
* @brief Skips common whitespaces in a string.
*/
char* skipWS(char* buf);
char* trimWhitespaces(char* buf);
};
} // namespace parser

Loading…
Cancel
Save