Browse Source

make storm compile again without xerces, also make storm-gspn target compile

Former-commit-id: a88f362a03 [formerly 8b11dd390c]
Former-commit-id: 874722dc99
tempestpy_adaptions
sjunges 8 years ago
parent
commit
e2324c92c0
  1. 4
      src/adapters/XercesAdapter.h
  2. 5
      src/parser/GreatSpnEditorProjectParser.cpp
  3. 3
      src/parser/GreatSpnEditorProjectParser.h
  4. 6
      src/parser/GspnParser.cpp
  5. 4
      src/parser/PnmlParser.cpp
  6. 5
      src/parser/PnmlParser.h
  7. 12
      src/storm-gspn.cpp

4
src/adapters/XercesAdapter.h

@ -1,6 +1,7 @@
#pragma once #pragma once
#include "storm-config.h"
#ifdef USE_XERCES
#include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/XMLString.hpp> #include <xercesc/util/XMLString.hpp>
@ -40,3 +41,4 @@ namespace storm {
} }
} }
} }
#endif

5
src/parser/GreatSpnEditorProjectParser.cpp

@ -1,5 +1,5 @@
#include "GreatSpnEditorProjectParser.h" #include "GreatSpnEditorProjectParser.h"
#ifdef USE_XERCES
#include <iostream> #include <iostream>
@ -339,5 +339,4 @@ namespace storm {
} }
} }
#endif

3
src/parser/GreatSpnEditorProjectParser.h

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "storm-config.h"
#ifdef USE_XERCES
#include <string> #include <string>
#include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/parsers/XercesDOMParser.hpp>
@ -40,3 +42,4 @@ namespace storm {
}; };
} }
} }
#endif

6
src/parser/GspnParser.cpp

@ -1,5 +1,5 @@
#include "GspnParser.h" #include "GspnParser.h"
#include "storm-config.h"
#include "src/adapters/XercesAdapter.h" #include "src/adapters/XercesAdapter.h"
#include "src/exceptions/UnexpectedException.h" #include "src/exceptions/UnexpectedException.h"
@ -13,6 +13,7 @@ namespace storm {
namespace parser { namespace parser {
storm::gspn::GSPN* GspnParser::parse(std::string const& filename) { storm::gspn::GSPN* GspnParser::parse(std::string const& filename) {
#ifdef USE_XERCES
// initialize xercesc // initialize xercesc
try { try {
xercesc::XMLPlatformUtils::Initialize(); xercesc::XMLPlatformUtils::Initialize();
@ -79,6 +80,9 @@ namespace storm {
delete parser; delete parser;
delete errHandler; delete errHandler;
xercesc::XMLPlatformUtils::Terminate(); xercesc::XMLPlatformUtils::Terminate();
#else
STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Storm is not compiled with XML support");
#endif
} }
} }
} }

4
src/parser/PnmlParser.cpp

@ -1,5 +1,6 @@
#include "src/parser/PnmlParser.h"
#include "src/parser/PnmlParser.h"
#ifdef USE_XERCES
#include <iostream> #include <iostream>
#include "src/adapters/XercesAdapter.h" #include "src/adapters/XercesAdapter.h"
@ -442,3 +443,4 @@ namespace storm {
} }
} }
#endif

5
src/parser/PnmlParser.h

@ -1,7 +1,8 @@
#pragma once #pragma once
#include "storm-config.h"
#ifdef USE_XERCES
#include <string> #include <string>
#include <xercesc/parsers/XercesDOMParser.hpp> #include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/XMLString.hpp> #include <xercesc/util/XMLString.hpp>
@ -140,3 +141,5 @@ namespace storm {
}; };
} }
} }
#endif

12
src/storm-gspn.cpp

@ -12,7 +12,7 @@
#include "src/storage/expressions/ExpressionManager.h" #include "src/storage/expressions/ExpressionManager.h"
#include "src/storage/jani/Model.h" #include "src/storage/jani/Model.h"
#include "src/storage/jani/JsonExporter.h"
#include "src/storage/jani/JSONExporter.h"
#include "src/builder/JaniGSPNBuilder.h" #include "src/builder/JaniGSPNBuilder.h"
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
@ -67,7 +67,7 @@ void handleJani(storm::gspn::GSPN const& gspn) {
std::shared_ptr<storm::expressions::ExpressionManager> exprManager(new storm::expressions::ExpressionManager()); std::shared_ptr<storm::expressions::ExpressionManager> exprManager(new storm::expressions::ExpressionManager());
storm::builder::JaniGSPNBuilder builder(gspn, exprManager); storm::builder::JaniGSPNBuilder builder(gspn, exprManager);
storm::jani::Model* model = builder.build(); storm::jani::Model* model = builder.build();
storm::jani::JsonExporter::toFile(*model, storm::settings::getModule<storm::settings::modules::JaniExportSettings>().getJaniFilename());
storm::jani::JsonExporter::toFile(*model, {}, storm::settings::getModule<storm::settings::modules::JaniExportSettings>().getJaniFilename());
delete model; delete model;
} }
@ -90,24 +90,24 @@ int main(const int argc, const char **argv) {
auto parser = storm::parser::GspnParser(); auto parser = storm::parser::GspnParser();
auto gspn = parser.parse(storm::settings::getModule<storm::settings::modules::GSPNSettings>().getGspnFilename()); auto gspn = parser.parse(storm::settings::getModule<storm::settings::modules::GSPNSettings>().getGspnFilename());
if (!gspn.isValid()) {
if (!gspn->isValid()) {
STORM_LOG_ERROR("The gspn is not valid."); STORM_LOG_ERROR("The gspn is not valid.");
} }
if(storm::settings::getModule<storm::settings::modules::GSPNSettings>().isCapacitiesFileSet()) { if(storm::settings::getModule<storm::settings::modules::GSPNSettings>().isCapacitiesFileSet()) {
auto capacities = parseCapacitiesList(storm::settings::getModule<storm::settings::modules::GSPNSettings>().getCapacitiesFilename()); auto capacities = parseCapacitiesList(storm::settings::getModule<storm::settings::modules::GSPNSettings>().getCapacitiesFilename());
gspn.setCapacities(capacities);
gspn->setCapacities(capacities);
} }
if(storm::settings::getModule<storm::settings::modules::GSPNExportSettings>().isWriteToDotSet()) { if(storm::settings::getModule<storm::settings::modules::GSPNExportSettings>().isWriteToDotSet()) {
std::ofstream file; std::ofstream file;
file.open(storm::settings::getModule<storm::settings::modules::GSPNExportSettings>().getWriteToDotFilename()); file.open(storm::settings::getModule<storm::settings::modules::GSPNExportSettings>().getWriteToDotFilename());
gspn.writeDotToStream(file);
gspn->writeDotToStream(file);
} }
if(storm::settings::getModule<storm::settings::modules::JaniExportSettings>().isJaniFileSet()) { if(storm::settings::getModule<storm::settings::modules::JaniExportSettings>().isJaniFileSet()) {
handleJani(gspn);
handleJani(*gspn);
} }

Loading…
Cancel
Save