From b42d9a345e2b02a1b17fa61b22117fbf7b187a31 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 11 May 2012 11:19:04 +0200 Subject: Add support for -I option Now quote-included ("") option files are searched for relative to the including file while bracket-included (<>) ones are search in the directories specified with -I. --- cli/cli.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'cli/cli.cxx') diff --git a/cli/cli.cxx b/cli/cli.cxx index b8314e6..c0b1142 100644 --- a/cli/cli.cxx +++ b/cli/cli.cxx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file +#include +#include #include // std::auto_ptr #include #include @@ -65,6 +67,19 @@ main (int argc, char* argv[]) return 1; } + // Extract include search paths. + // + parser::paths include_paths; + for (vector::const_iterator i (ops.include_path ().begin ()); + i != ops.include_path ().end (); ++i) + { + // Invalid path exception is handled below. + // + include_paths.push_back (semantics::path (*i)); + } + + // Open the input file. + // file = scan.next (); semantics::path path (file); @@ -77,7 +92,9 @@ main (int argc, char* argv[]) ifs.exceptions (ifstream::failbit | ifstream::badbit); - parser p; + // Parse and generate. + // + parser p (include_paths); auto_ptr unit (p.parse (ifs, path)); generator g; -- cgit v1.1