#include <tools/solidityUpgrade/SourceUpgrade.h>
#include <libsolutil/CommonIO.h>
#include <libsolutil/AnsiColorized.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/exception/all.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <queue>
#include <regex>
#if defined(_WIN32)
#include <windows.h>
#endif
using namespace solidity;
using namespace std;
namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace
{
void setupTerminal()
{
#if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hOut == INVALID_HANDLE_VALUE)
return;
DWORD dwMode = 0;
if (!GetConsoleMode(hOut, &dwMode))
return;
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(hOut, dwMode))
return;
#endif
}
}
int main(int argc, char** argv)
{
setupTerminal();
tools::SourceUpgrade upgrade;
if (!upgrade.parseArguments(argc, argv))
return 1;
upgrade.printPrologue();
try
{
if (!upgrade.processInput())
return 1;
}
catch (boost::exception const& _exception)
{
cerr << "Exception while processing input: " << boost::diagnostic_information(_exception) << endl;
}
catch (...)
{
cerr << "Unknown exception while processing input: " << boost::current_exception_diagnostic_information() << endl;
}
return 0;
}