From 42c37ce8b11045cdfff4513200d1d2ebd327de61 Mon Sep 17 00:00:00 2001 From: sjunges Date: Sat, 17 Sep 2016 13:49:36 +0200 Subject: [PATCH] pgcl entry point update Former-commit-id: 0162363754419171ad7fb20dcc87854058f993de [formerly 28b889f64356aa9b7b2432392eb00b3f91de1de0] Former-commit-id: 7bdeda3ba33528435d4f20ad8e440c15727d9b1f --- src/storm-pgcl.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/storm-pgcl.cpp b/src/storm-pgcl.cpp index c756c5636..906402e8b 100644 --- a/src/storm-pgcl.cpp +++ b/src/storm-pgcl.cpp @@ -7,11 +7,15 @@ #include "src/exceptions/BaseException.h" #include "src/utility/macros.h" #include +#include "src/builder/ProgramGraphBuilder.h" +#include "src/builder/JaniProgramGraphBuilder.h" +#include "src/storage/jani/JSONExporter.h" #include "src/settings/modules/GeneralSettings.h" #include "src/settings/modules/PGCLSettings.h" #include "src/settings/modules/CoreSettings.h" #include "src/settings/modules/DebugSettings.h" +#include "src/settings/modules/JaniExportSettings.h" //#include "src/settings/modules/CounterexampleGeneratorSettings.h" //#include "src/settings/modules/CuddSettings.h" //#include "src/settings/modules/SylvanSettings.h" @@ -46,6 +50,17 @@ void initializeSettings() { //storm::settings::addModule(); //storm::settings::addModule(); storm::settings::addModule(); + storm::settings::addModule(); +} + +int handleJani(storm::jani::Model& model) { + + if(!storm::settings::getModule().isJaniFileSet()) { + // For now, we have to have a jani file + storm::jani::JsonExporter::toStream(model, std::cout); + } else { + storm::jani::JsonExporter::toFile(model, storm::settings::getModule().getJaniFilename()); + } } int main(const int argc, const char** argv) { @@ -59,13 +74,27 @@ int main(const int argc, const char** argv) { return -1; } - if(storm::settings::getModule().isPgclFileSet()) { - storm::pgcl::PgclProgram prog = storm::parser::PgclParser::parse(storm::settings::getModule().getPgclFilename()); - std::cout << prog << std::endl; + if(!storm::settings::getModule().isPgclFileSet()) { + return -1; + } + storm::pgcl::PgclProgram prog = storm::parser::PgclParser::parse(storm::settings::getModule().getPgclFilename()); + std::cout << prog << std::endl; + storm::ppg::ProgramGraph* progGraph = storm::builder::ProgramGraphBuilder::build(prog); + + progGraph->printInfo(std::cout); + if(storm::settings::getModule().isToJaniSet()) { + storm::builder::JaniProgramGraphBuilder builder; + storm::jani::Model* model = builder.build(*progGraph); + delete progGraph; + handleJani(*model); + delete model; + } else { + } + }catch (storm::exceptions::BaseException const& exception) { STORM_LOG_ERROR("An exception caused StoRM-PGCL to terminate. The message of the exception is: " << exception.what()); } catch (std::exception const& exception) {