From c2b7e8a5a7bc98bcf5e03b32eefaa664442c26fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 27 Sep 2009 19:17:22 +0200 Subject: Add option file for the CLI compiler itself --- cli/cli.cxx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'cli/cli.cxx') diff --git a/cli/cli.cxx b/cli/cli.cxx index 9b2495d..eaf15f7 100644 --- a/cli/cli.cxx +++ b/cli/cli.cxx @@ -7,6 +7,7 @@ #include #include +#include "options.hxx" #include "parser.hxx" #include "generator.hxx" @@ -14,7 +15,7 @@ using namespace std; int main (int argc, char* argv[]) { - if (argc != 2) + if (argc < 2) { cerr << "usage: " << argv[0] << " file.cli" << endl; return 1; @@ -22,7 +23,16 @@ int main (int argc, char* argv[]) try { - semantics::path path (argv[1]); + int end; + options ops (argc, argv, end); + + if (end == argc) + { + cerr << "error: no input file specified" << endl; + return 1; + } + + semantics::path path (argv[end]); ifstream ifs (path.string ().c_str ()); if (!ifs.is_open ()) @@ -37,7 +47,12 @@ int main (int argc, char* argv[]) auto_ptr unit (p.parse (ifs, path)); generator g; - g.generate (*unit, path); + g.generate (ops, *unit, path); + } + catch (cli::exception const& e) + { + cerr << e << endl; + return 1; } catch (semantics::invalid_path const& e) { -- cgit v1.1