2016-05-20 15:29:24 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
|
|
|
|
#include <plasp/sas/Description.h>
|
2016-05-21 02:43:07 +02:00
|
|
|
#include <plasp/sas/TranslatorASP.h>
|
2016-05-20 15:29:24 +02:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
namespace po = boost::program_options;
|
|
|
|
|
|
|
|
po::options_description description("Allowed options");
|
|
|
|
description.add_options()
|
|
|
|
("help,h", "display this help message")
|
|
|
|
("input,i", po::value<std::string>(), "SAS input file");
|
|
|
|
|
|
|
|
po::positional_options_description positionalOptionsDescription;
|
|
|
|
positionalOptionsDescription.add("input", -1);
|
|
|
|
|
|
|
|
po::variables_map variablesMap;
|
|
|
|
po::store(po::command_line_parser(argc, argv)
|
|
|
|
.options(description)
|
|
|
|
.positional(positionalOptionsDescription)
|
|
|
|
.run(),
|
|
|
|
variablesMap);
|
|
|
|
po::notify(variablesMap);
|
|
|
|
|
|
|
|
if (variablesMap.count("help"))
|
|
|
|
{
|
|
|
|
std::cout << description;
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!variablesMap.count("input"))
|
|
|
|
{
|
|
|
|
std::cerr << "Error: No input file specified" << std::endl;
|
|
|
|
std::cout << description;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2016-05-20 16:16:56 +02:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const auto sasDescription = plasp::sas::Description::fromFile(variablesMap["input"].as<std::string>());
|
2016-05-21 02:43:07 +02:00
|
|
|
const auto sasTranslator = plasp::sas::TranslatorASP(sasDescription);
|
|
|
|
sasTranslator.translate(std::cout);
|
2016-05-20 16:16:56 +02:00
|
|
|
}
|
|
|
|
catch (const std::exception &e)
|
|
|
|
{
|
|
|
|
std::cerr << "Error: " << e.what() << std::endl;
|
|
|
|
}
|
2016-05-20 15:29:24 +02:00
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|