Browse Source

a few more style issues

tempestpy_adaptions
gereon 12 years ago
parent
commit
989c0a51ea
  1. 38
      src/parser/AtomicPropositionLabelingParser.cpp
  2. 2
      src/utility/CommandLine.cpp

38
src/parser/AtomicPropositionLabelingParser.cpp

@ -7,20 +7,22 @@
#include "src/parser/AtomicPropositionLabelingParser.h" #include "src/parser/AtomicPropositionLabelingParser.h"
#include "src/exceptions/WrongFileFormatException.h"
#include "src/exceptions/FileIoException.h"
#include <errno.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <locale.h>
#include "src/utility/OsDetection.h"
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <string>
#include <clocale> #include <clocale>
#include <iostream> #include <iostream>
#include <errno.h>
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <locale.h>
#include "src/exceptions/WrongFileFormatException.h"
#include "src/exceptions/FileIoException.h"
#include "src/utility/OsDetection.h"
#include "log4cplus/logger.h" #include "log4cplus/logger.h"
#include "log4cplus/loggingmacros.h" #include "log4cplus/loggingmacros.h"
@ -40,16 +42,15 @@ namespace parser {
*/ */
AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t node_count, AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t node_count,
std::string const & filename) std::string const & filename)
: labeling(nullptr)
{
: labeling(nullptr) {
/* /*
* open file
* Open file.
*/ */
MappedFile file(filename.c_str()); MappedFile file(filename.c_str());
char* buf = file.data; char* buf = file.data;
/* /*
* first run: obtain number of propositions
* First run: obtain number of propositions.
*/ */
char separator[] = " \r\n\t"; char separator[] = " \r\n\t";
bool foundDecl = false, foundEnd = false; bool foundDecl = false, foundEnd = false;
@ -57,7 +58,7 @@ AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t n
{ {
size_t cnt = 0; size_t cnt = 0;
/* /*
* iterate over tokens until we hit #END or end of file
* Iterate over tokens until we hit #END or end of file.
*/ */
while(buf[0] != '\0') { while(buf[0] != '\0') {
buf += cnt; buf += cnt;
@ -71,13 +72,14 @@ AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t n
if (strncmp(buf, "#DECLARATION", cnt) == 0) { if (strncmp(buf, "#DECLARATION", cnt) == 0) {
foundDecl = true; foundDecl = true;
continue; continue;
}
else if (strncmp(buf, "#END", cnt) == 0) {
} else if (strncmp(buf, "#END", cnt) == 0) {
foundEnd = true; foundEnd = true;
break; break;
} }
proposition_count++; proposition_count++;
} else buf++; // next char is separator, one step forward
} else {
buf++; // next char is separator, one step forward
}
} }
/* /*
@ -129,7 +131,9 @@ AtomicPropositionLabelingParser::AtomicPropositionLabelingParser(uint_fast64_t n
strncpy(proposition, buf, cnt); strncpy(proposition, buf, cnt);
proposition[cnt] = '\0'; proposition[cnt] = '\0';
this->labeling->addAtomicProposition(proposition); this->labeling->addAtomicProposition(proposition);
} else cnt = 1; // next char is separator, one step forward
} else {
cnt = 1; // next char is separator, one step forward
}
} while (cnt > 0); } while (cnt > 0);
/* /*
* Right here, the buf pointer is still pointing to our last token, * Right here, the buf pointer is still pointing to our last token,

2
src/utility/CommandLine.cpp

@ -8,7 +8,6 @@
#include <ostream> #include <ostream>
namespace storm { namespace storm {
namespace utility { namespace utility {
void printSeparationLine(std::ostream& out) { void printSeparationLine(std::ostream& out) {
@ -16,5 +15,4 @@ void printSeparationLine(std::ostream& out) {
} }
} // namespace utility } // namespace utility
} // namespace storm } // namespace storm
Loading…
Cancel
Save