From 2bc006daa59995085626b3e9c0754823bf9d95a5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 29 Jun 2011 14:08:29 +0200 Subject: Add --include-regex and --include-regex-trace options This requires libcutl update. --- odb/generator.cxx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'odb/generator.cxx') diff --git a/odb/generator.cxx b/odb/generator.cxx index 60f8e2a..7fa6d6a 100644 --- a/odb/generator.cxx +++ b/odb/generator.cxx @@ -232,13 +232,7 @@ generate (options const& ops, semantics::unit& unit, path const& p) // Include settings. // - bool br (ops.include_with_brackets ()); - string ip (ops.include_prefix ()); string gp (ops.guard_prefix ()); - - if (!ip.empty () && ip[ip.size () - 1] != '/') - ip.append ("/"); - if (!gp.empty () && gp[gp.size () - 1] != '_') gp.append ("_"); @@ -275,8 +269,7 @@ generate (options const& ops, semantics::unit& unit, path const& p) << "// End prologue." << endl << endl; - hxx << "#include " << (br ? '<' : '"') << ip << file << - (br ? '>' : '"') << endl + hxx << "#include " << ctx->process_include_path (file.string ()) << endl << endl; include::generate (); @@ -297,8 +290,7 @@ generate (options const& ops, semantics::unit& unit, path const& p) } } - hxx << "#include " << (br ? '<' : '"') << ip << ixx_name << - (br ? '>' : '"') << endl + hxx << "#include " << ctx->process_include_path (ixx_name) << endl << endl; // Copy epilogue. @@ -375,8 +367,7 @@ generate (options const& ops, semantics::unit& unit, path const& p) << "// End prologue." << endl << endl; - cxx << "#include " << (br ? '<' : '"') << ip << hxx_name << - (br ? '>' : '"') << endl + cxx << "#include " << ctx->process_include_path (hxx_name) << endl << endl; switch (ops.database ()) @@ -444,6 +435,12 @@ generate (options const& ops, semantics::unit& unit, path const& p) // throw failed (); } + catch (const re::format& e) + { + cerr << "error: invalid regex: '" << e.regex () << "': " << + e.description () << endl; + throw failed (); + } catch (semantics::invalid_path const& e) { cerr << "error: '" << e.path () << "' is not a valid filesystem path" -- cgit v1.1