diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bde12ab44..c70bd136f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,7 +56,7 @@ list(REMOVE_ITEM STORM_LIB_SOURCES ${STORM_SOURCES_CLI}) set(STORM_LIB_HEADERS ${STORM_HEADERS}) list(REMOVE_ITEM STORM_LIB_HEADERS ${STORM_HEADERS_CLI}) set(STORM_MAIN_SOURCES ${STORM_SOURCES_CLI} ${STORM_MAIN_FILE}) -set(STORM_DFT_MAIN_SOURCES ${STORM_DFT_MAIN_FILE}) +set(STORM_DFT_MAIN_SOURCES ${STORM_SOURCES_CLI} ${STORM_DFT_MAIN_FILE}) set(STORM_MAIN_HEADERS ${STORM_HEADERS_CLI}) # Group the headers and sources diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 08ebd74fc..6b517e410 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -41,9 +41,9 @@ namespace storm { return (GetCurrentDir(temp, 512 - 1) ? std::string(temp) : std::string("")); } - void printHeader(const int argc, const char* argv[]) { - std::cout << "StoRM" << std::endl; - std::cout << "--------" << std::endl << std::endl; + void printHeader(const std::string name, const int argc, const char* argv[]) { + std::cout << name << std::endl; + std::cout << "---------------" << std::endl << std::endl; std::cout << storm::utility::StormVersion::longVersionString() << std::endl; diff --git a/src/cli/cli.h b/src/cli/cli.h index 896b7bee2..db2ab11bf 100644 --- a/src/cli/cli.h +++ b/src/cli/cli.h @@ -6,23 +6,22 @@ namespace storm { namespace cli { - std::string getCurrentWorkingDirectory(); + std::string getCurrentWorkingDirectory(); - void printHeader(const int argc, const char* argv[]); + void printHeader(std::string name, const int argc, const char* argv[]); - void printUsage(); + void printUsage(); + + /*! + * Parses the given command line arguments. + * + * @param argc The argc argument of main(). + * @param argv The argv argument of main(). + * @return True iff the program should continue to run after parsing the options. + */ + bool parseOptions(const int argc, const char* argv[]); - /*! - * Parses the given command line arguments. - * - * @param argc The argc argument of main(). - * @param argv The argv argument of main(). - * @return True iff the program should continue to run after parsing the options. - */ - bool parseOptions(const int argc, const char* argv[]); - - - void processOptions(); + void processOptions(); } } diff --git a/src/settings/SettingsManager.cpp b/src/settings/SettingsManager.cpp index a7dc0d029..97209c43d 100644 --- a/src/settings/SettingsManager.cpp +++ b/src/settings/SettingsManager.cpp @@ -34,20 +34,6 @@ namespace storm { namespace settings { SettingsManager::SettingsManager() : modules(), longNameToOptions(), shortNameToOptions(), moduleOptions() { - // Register all known settings modules. - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); - storm::settings::addModule(); } SettingsManager::~SettingsManager() { @@ -59,6 +45,12 @@ namespace storm { return settingsManager; } + void SettingsManager::setName(std::string const& name, std::string const& executableName) { + this->name = name; + this->executableName = executableName; + } + + void SettingsManager::setFromCommandLine(int const argc, char const * const argv[]) { // We convert the arguments to a vector of strings and strip off the first element since it refers to the // name of the program. @@ -169,7 +161,7 @@ namespace storm { } void SettingsManager::printHelp(std::string const& hint) const { - STORM_PRINT("usage: storm [options]" << std::endl << std::endl); + STORM_PRINT("usage: " << executableName << " [options]" << std::endl << std::endl); if (hint == "all") { // Find longest option name. diff --git a/src/settings/SettingsManager.h b/src/settings/SettingsManager.h index 92dc83cf1..5fe7c82dc 100644 --- a/src/settings/SettingsManager.h +++ b/src/settings/SettingsManager.h @@ -102,6 +102,12 @@ namespace storm { * @return The only existing instance of a settings manager */ static SettingsManager& manager(); + /*! + * Sets the name of the tool. + * @param name Name of the tool. + * @param executableName Filename of the executable. + */ + void setName(std::string const& name, std::string const& executableName); /*! * Adds a new module with the given name. If the module could not be successfully added, an exception is @@ -139,6 +145,10 @@ namespace storm { */ virtual ~SettingsManager(); + // The name of the tool + std::string name; + std::string executableName; + // The registered modules. std::vector moduleNames; std::unordered_map> modules; diff --git a/src/storm.cpp b/src/storm.cpp index 3b060120b..b665d48a6 100644 --- a/src/storm.cpp +++ b/src/storm.cpp @@ -3,13 +3,55 @@ #include "src/utility/macros.h" #include "src/cli/cli.h" #include "src/utility/initialize.h" + +#include "src/settings/modules/GeneralSettings.h" +#include "src/settings/modules/DebugSettings.h" +#include "src/settings/modules/CounterexampleGeneratorSettings.h" +#include "src/settings/modules/CuddSettings.h" +#include "src/settings/modules/SylvanSettings.h" +#include "src/settings/modules/GmmxxEquationSolverSettings.h" +#include "src/settings/modules/NativeEquationSolverSettings.h" +#include "src/settings/modules/BisimulationSettings.h" +#include "src/settings/modules/GlpkSettings.h" +#include "src/settings/modules/GurobiSettings.h" +#include "src/settings/modules/TopologicalValueIterationEquationSolverSettings.h" +#include "src/settings/modules/ParametricSettings.h" +#include "src/settings/modules/SparseDtmcEliminationModelCheckerSettings.h" + + +/*! + * Initialize the settings manager. + */ +void initializeSettings() { + storm::settings::mutableManager().setName("SToRM", "storm"); + + // Register all known settings modules. + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); + storm::settings::addModule(); +} + + + /*! * Main entry point of the executable storm. */ int main(const int argc, const char** argv) { + try { storm::utility::setUp(); - storm::cli::printHeader(argc, argv); + storm::cli::printHeader("SToRM", argc, argv); + initializeSettings(); bool optionsCorrect = storm::cli::parseOptions(argc, argv); if (!optionsCorrect) { return -1;