aboutsummaryrefslogtreecommitdiff
path: root/xsde/xsde.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsde/xsde.cxx')
-rw-r--r--xsde/xsde.cxx417
1 files changed, 121 insertions, 296 deletions
diff --git a/xsde/xsde.cxx b/xsde/xsde.cxx
index eb3f9f3..9d05a70 100644
--- a/xsde/xsde.cxx
+++ b/xsde/xsde.cxx
@@ -4,7 +4,8 @@
// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
#include <vector>
-#include <memory> // std::auto_ptr
+#include <memory> // std::auto_ptr
+#include <cstddef> // std::size_t
#include <iostream>
#include <boost/filesystem/fstream.hpp>
@@ -18,12 +19,6 @@
#include <cult/containers/map.hxx>
#include <cult/containers/vector.hxx>
-#include <cult/cli/exceptions.hxx>
-#include <cult/cli/file-arguments.hxx>
-#include <cult/cli/options.hxx>
-#include <cult/cli/options-spec.hxx>
-#include <cult/cli/options-parser.hxx>
-
#include <xsd-frontend/parser.hxx>
#include <xsd-frontend/transformations/anonymous.hxx>
#include <xsd-frontend/transformations/enum-synthesis.hxx>
@@ -33,8 +28,9 @@
#include <type-map/type-map.hxx>
-#include <xsde.hxx>
-#include <options.hxx>
+#include <cxx/parser/options.hxx>
+#include <cxx/serializer/options.hxx>
+#include <cxx/hybrid/options.hxx>
#include <cxx/parser/generator.hxx>
#include <cxx/serializer/generator.hxx>
@@ -42,87 +38,19 @@
#include <processing/inheritance/processor.hxx>
+#include <xsde.hxx>
+#include <types.hxx>
+#include <options.hxx>
+
#include "../libxsde/xsde/cxx/version.hxx"
using namespace Cult::Types;
-typedef Cult::Containers::Vector<NarrowString> NarrowStrings;
-
namespace SemanticGraph = XSDFrontend::SemanticGraph;
namespace Transformations = XSDFrontend::Transformations;
using namespace std;
-namespace CLI
-{
- using namespace Cult::CLI;
-
- typedef Char const Key[];
-
- extern Key help = "help";
- extern Key version = "version";
- extern Key proprietary_license = "proprietary-license";
-
- typedef Cult::CLI::Options
- <
- help, Boolean,
- version, Boolean,
- proprietary_license, Boolean
- >
- HelpOptions;
-
- struct HelpOptionsSpec: Cult::CLI::OptionsSpec<HelpOptions> {};
-
-
- extern Key disable_warning = "disable-warning";
- extern Key sloc_limit = "sloc-limit";
- extern Key preserve_anonymous = "preserve-anonymous";
- extern Key anonymous_regex = "anonymous-regex";
- extern Key anonymous_regex_trace = "anonymous-regex-trace";
- extern Key location_map = "location-map";
- extern Key location_regex = "location-regex";
- extern Key location_regex_trace = "location-regex-trace";
- extern Key file_per_type = "file-per-type";
- extern Key type_file_regex = "type-file-regex";
- extern Key type_file_regex_trace = "type-file-regex-trace";
- extern Key schema_file_regex = "schema-file-regex";
- extern Key schema_file_regex_trace = "schema-file-regex-trace";
- extern Key fat_type_file = "fat-type-file";
- extern Key file_list = "file-list";
- extern Key file_list_prologue = "file-list-prologue";
- extern Key file_list_epilogue = "file-list-epilogue";
- extern Key file_list_delim = "file-list-delim";
- extern Key disable_multi_import = "disable-multi-import"; // Undocumented.
- extern Key disable_full_check = "disable-full-check"; // Undocumented.
-
- typedef Cult::CLI::Options
- <
- disable_warning, Cult::Containers::Vector<NarrowString>,
- sloc_limit, UnsignedLong,
- preserve_anonymous, Boolean,
- anonymous_regex, NarrowStrings,
- anonymous_regex_trace, Boolean,
- location_map, NarrowStrings,
- location_regex, NarrowStrings,
- location_regex_trace, Boolean,
- file_per_type, Boolean,
- type_file_regex, NarrowStrings,
- type_file_regex_trace, Boolean,
- schema_file_regex, NarrowStrings,
- schema_file_regex_trace, Boolean,
- fat_type_file, Boolean,
- file_list, NarrowString,
- file_list_prologue, NarrowString,
- file_list_epilogue, NarrowString,
- file_list_delim, NarrowString,
- disable_multi_import, Boolean,
- disable_full_check, Boolean
- >
- CommonOptions;
-
- struct CommonOptionsSpec: Cult::CLI::OptionsSpec<CommonOptions> {};
-}
-
//
//
struct LocationTranslator: XSDFrontend::LocationTranslator
@@ -222,20 +150,14 @@ main (Int argc, Char* argv[])
try
{
- CLI::FileArguments args (argc, argv, "--options-file");
-
- CLI::HelpOptions help_ops (
- CLI::parse (CLI::HelpOptionsSpec (), args, CLI::UnknownMode::stop));
+ cli::argv_file_scanner args (argc, argv, "--options-file");
+ help_options help_ops (args, cli::unknown_mode::stop);
NarrowString cmd;
+ if (args.more ())
+ cmd = args.next ();
- if (args.size () > 1)
- {
- cmd = args[1];
- args.erase (1);
- }
-
- if (help_ops.value<CLI::version> () || cmd == "version")
+ if (help_ops.version () || cmd == "version")
{
std::wostream& o (wcout);
@@ -243,17 +165,15 @@ main (Int argc, Char* argv[])
"for embedded systems " << XSDE_STR_VERSION << endl
<< "Copyright (c) 2005-2011 Code Synthesis Tools CC" << endl;
- if (!help_ops.value<CLI::proprietary_license> () &&
- cmd == "version")
+ if (!help_ops.proprietary_license () && cmd == "version")
{
// Parse the options after the command to detect trailing
// --proprietary-license.
//
- help_ops = CLI::parse (
- CLI::HelpOptionsSpec (), args, CLI::UnknownMode::stop);
+ help_ops = help_options (args, cli::unknown_mode::stop);
}
- if (help_ops.value<CLI::proprietary_license> ())
+ if (help_ops.proprietary_license ())
{
o << "The compiler was invoked in the Proprietary License mode. You "
<< "should have\nreceived a proprietary license from Code Synthesis "
@@ -269,17 +189,17 @@ main (Int argc, Char* argv[])
return 0;
}
- if (help_ops.value<CLI::help> () || cmd == "help")
+ if (help_ops.help () || cmd == "help")
{
std::wostream& o (wcout);
- if (cmd == "help" && args.size () > 1)
+ if (cmd == "help" && args.more ())
{
- NarrowString arg (args[1]);
+ NarrowString arg (args.next ());
if (arg == "cxx-parser")
{
- o << "Usage: " << args[0] << " cxx-parser [options] file [file ...]"
+ o << "Usage: " << argv[0] << " cxx-parser [options] file [file ...]"
<< endl
<< "Options:" << endl;
@@ -287,7 +207,7 @@ main (Int argc, Char* argv[])
}
else if (arg == "cxx-serializer")
{
- o << "Usage: " << args[0] << " cxx-serializer [options] file " <<
+ o << "Usage: " << argv[0] << " cxx-serializer [options] file " <<
"[file ...]" << endl
<< "Options:" << endl;
@@ -295,7 +215,7 @@ main (Int argc, Char* argv[])
}
else if (arg == "cxx-hybrid")
{
- o << "Usage: " << args[0] << " cxx-hybrid [options] file " <<
+ o << "Usage: " << argv[0] << " cxx-hybrid [options] file " <<
"[file ...]" << endl
<< "Options:" << endl;
@@ -304,7 +224,7 @@ main (Int argc, Char* argv[])
else
{
e << "error: unknown command '" << arg.c_str () << "'" << endl
- << "info: try '" << args[0] << " help' for the list of commands"
+ << "info: try '" << argv[0] << " help' for the list of commands"
<< endl;
return 1;
@@ -316,7 +236,7 @@ main (Int argc, Char* argv[])
}
else
{
- o << "Usage: " << args[0] << " <cmd> ..." << endl
+ o << "Usage: " << argv[0] << " <cmd> ..." << endl
<< "Commands:" << endl;
o << " help Print usage information and exit. Use\n"
@@ -342,7 +262,7 @@ main (Int argc, Char* argv[])
if (cmd.empty ())
{
e << "error: no command specified" << endl
- << "info: try '" << args[0] << " help' for usage information" << endl;
+ << "info: try '" << argv[0] << " help' for usage information" << endl;
return 1;
}
@@ -350,7 +270,7 @@ main (Int argc, Char* argv[])
if (cmd != "cxx-parser" && cmd != "cxx-serializer" && cmd != "cxx-hybrid")
{
e << "error: unknown command '" << cmd.c_str () << "'" << endl
- << "info: try '" << args[0] << " help' for the list of commands"
+ << "info: try '" << argv[0] << " help' for the list of commands"
<< endl;
return 1;
@@ -359,84 +279,55 @@ main (Int argc, Char* argv[])
// We need to parse command line options before we can get to
// the arguments.
//
- CLI::CommonOptionsSpec common_spec;
- common_spec.option<CLI::file_list_delim> ().default_value ("\n");
+ auto_ptr<CXX::Parser::options> p_ops (
+ cmd == "cxx-parser" ? new CXX::Parser::options (args) : 0);
+
+ auto_ptr<CXX::Serializer::options> s_ops (
+ cmd == "cxx-serializer" ? new CXX::Serializer::options (args) : 0);
- CLI::CommonOptions common_ops (
- CLI::parse (
- common_spec,
- args,
- CLI::UnknownMode::skip,
- CLI::UnknownMode::skip));
+ auto_ptr<CXX::Hybrid::options> h_ops (
+ cmd == "cxx-hybrid" ? new CXX::Hybrid::options (args) : 0);
+ CXX::options& common_ops (
+ cmd == "cxx-parser"
+ ? static_cast<CXX::options&> (*p_ops)
+ : cmd == "cxx-serializer"
+ ? static_cast<CXX::options&> (*s_ops)
+ : static_cast<CXX::options&> (*h_ops));
+
+ // Disabled warnings.
+ //
WarningSet disabled_w;
{
- typedef Cult::Containers::Vector<NarrowString> Warnings;
- Warnings const& w (common_ops.value<CLI::disable_warning> ());
+ NarrowStrings const& w (common_ops.disable_warning ());
- for (Warnings::ConstIterator i (w.begin ()); i != w.end (); ++i)
+ for (NarrowStrings::const_iterator i (w.begin ()); i != w.end (); ++i)
disabled_w.insert (*i);
}
Boolean disabled_w_all (disabled_w.find ("all") != disabled_w.end ());
- Evptr<CXX::Parser::CLI::Options> p_ops;
- Evptr<CXX::Serializer::CLI::Options> s_ops;
- Evptr<CXX::Hybrid::CLI::Options> h_ops;
-
- Boolean show_sloc (false);
-
- if (cmd == "cxx-parser")
- {
- p_ops = new CXX::Parser::CLI::Options (
- CLI::parse (CXX::Parser::Generator::options_spec (), args));
-
- show_sloc = p_ops->value<CXX::Parser::CLI::show_sloc> ();
- }
- else if (cmd == "cxx-serializer")
- {
- s_ops = new CXX::Serializer::CLI::Options (
- CLI::parse (CXX::Serializer::Generator::options_spec (), args));
+ // Collect all the files to compile in a vector.
+ //
+ NarrowStrings files;
- show_sloc = s_ops->value<CXX::Serializer::CLI::show_sloc> ();
- }
- else if (cmd == "cxx-hybrid")
- {
- h_ops = new CXX::Hybrid::CLI::Options (
- CLI::parse (CXX::Hybrid::Generator::options_spec (), args));
+ while (args.more ())
+ files.push_back (args.next ());
- show_sloc = h_ops->value<CXX::Hybrid::CLI::show_sloc> ();
- }
-
- if (args.size () < 2)
+ if (files.empty ())
{
e << "error: no input file specified" << endl;
return 1;
}
- Boolean fpt (common_ops.value<CLI::file_per_type> ());
+ Boolean fpt (common_ops.file_per_type ());
// Generate/extern XML Schema checks.
//
if (cmd == "cxx-parser" || cmd == "cxx-serializer" || cmd == "cxx-hybrid")
{
- Boolean gen (false), use (false);
-
- if (cmd == "cxx-parser")
- {
- gen = p_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
- use = p_ops->value<CXX::Parser::CLI::extern_xml_schema> ();
- }
- else if (cmd == "cxx-serializer")
- {
- gen = s_ops->value<CXX::Serializer::CLI::generate_xml_schema> ();
- use = s_ops->value<CXX::Serializer::CLI::extern_xml_schema> ();
- }
- else if (cmd == "cxx-hybrid")
- {
- gen = h_ops->value<CXX::Hybrid::CLI::generate_xml_schema> ();
- use = h_ops->value<CXX::Hybrid::CLI::extern_xml_schema> ();
- }
+ bool gen (common_ops.generate_xml_schema ());
+ bool use (common_ops.extern_xml_schema ());
// Things get complicated when we are compiling several schemas at
// once (non-file-per-type mode) and use the --generate-xml-schema/
@@ -447,7 +338,7 @@ main (Int argc, Char* argv[])
//
if (!fpt)
{
- if (args.size () > 2 && gen && !use)
+ if (files.size () > 1 && gen && !use)
{
e << "error: --extern-xml-schema is required when compiling more "
<< "than one schema and --generate-xml-schema is specified"
@@ -456,7 +347,7 @@ main (Int argc, Char* argv[])
return 1;
}
- if (args.size () == 2 && gen && use)
+ if (files.size () == 1 && gen && use)
{
e << "error: --generate-xml-schema and --extern-xml-schema are "
<< "mutually exclusive when compiling a single schema" << endl;
@@ -494,37 +385,37 @@ main (Int argc, Char* argv[])
//
FileList file_list;
AutoUnlinks unlinks;
- UnsignedLong sloc (0);
+ size_t sloc (0);
LocationTranslator loc_translator (
- common_ops.value<CLI::location_map> (),
- common_ops.value<CLI::location_regex> (),
- common_ops.value<CLI::location_regex_trace> ());
+ common_ops.location_map (),
+ common_ops.location_regex (),
+ common_ops.location_regex_trace ());
AnonymousNameTranslator anon_translator (
- common_ops.value<CLI::anonymous_regex> (),
- common_ops.value<CLI::anonymous_regex_trace> ());
+ common_ops.anonymous_regex (),
+ common_ops.anonymous_regex_trace ());
Boolean gen_hybrid (cmd == "cxx-hybrid");
Boolean gen_parser (
cmd == "cxx-parser" ||
- (gen_hybrid && h_ops->value<CXX::Hybrid::CLI::generate_parser> ()));
+ (gen_hybrid && h_ops->generate_parser ()));
Boolean gen_serializer (
cmd == "cxx-serializer" ||
- (gen_hybrid && h_ops->value<CXX::Hybrid::CLI::generate_serializer> ()));
+ (gen_hybrid && h_ops->generate_serializer ()));
Boolean poly_aggr (
gen_hybrid &&
- h_ops->value<CXX::Hybrid::CLI::generate_polymorphic> () &&
- h_ops->value<CXX::Hybrid::CLI::generate_aggregate> ());
+ h_ops->generate_polymorphic () &&
+ h_ops->generate_aggregate ());
if (!fpt)
{
// File-per-schema compilation mode.
//
- for (Size i (1); i < args.size (); ++i)
+ for (size_t i (0); i < files.size (); ++i)
{
// Parse schema.
//
@@ -533,8 +424,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
true,
- !common_ops.value<CLI::disable_multi_import> (),
- !common_ops.value<CLI::disable_full_check> (),
+ !common_ops.disable_multi_import (),
+ !common_ops.disable_full_check (),
loc_translator,
disabled_w);
@@ -542,11 +433,11 @@ main (Int argc, Char* argv[])
try
{
- tu = SemanticGraph::Path (args[i], boost::filesystem::native);
+ tu = SemanticGraph::Path (files[i], boost::filesystem::native);
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[i] << "' is not a valid "
+ e << "error: '" << files[i].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
}
@@ -557,57 +448,15 @@ main (Int argc, Char* argv[])
// will need to rely on the presence of the --extern-xml-schema
// to tell us which (fake) schema file corresponds to XML Schema.
//
- Boolean gen_xml_schema (false);
+ bool gen_xml_schema (common_ops.generate_xml_schema ());
NarrowString xml_schema_file;
- if (cmd == "cxx-parser" ||
- cmd == "cxx-serializer" ||
- cmd == "cxx-hybrid")
+ if (gen_xml_schema)
{
- if (cmd == "cxx-parser")
- {
- gen_xml_schema =
- p_ops->value<CXX::Parser::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- p_ops->value<CXX::Parser::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
- }
- else if (cmd == "cxx-serializer")
- {
- gen_xml_schema =
- s_ops->value<CXX::Serializer::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- s_ops->value<CXX::Serializer::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
- }
- else if (cmd == "cxx-hybrid")
+ if (xml_schema_file = common_ops.extern_xml_schema ())
{
- gen_xml_schema =
- h_ops->value<CXX::Hybrid::CLI::generate_xml_schema> ();
-
- if (gen_xml_schema)
- {
- if (xml_schema_file =
- h_ops->value<CXX::Hybrid::CLI::extern_xml_schema> ())
- {
- if (tu.native_file_string () != xml_schema_file)
- gen_xml_schema = false;
- }
- }
+ if (tu.native_file_string () != xml_schema_file)
+ gen_xml_schema = false;
}
}
@@ -620,21 +469,21 @@ main (Int argc, Char* argv[])
if (multi)
{
- Size ai (1);
paths.push_back (tu);
+ Size ai (0);
try
{
- for (; ai < args.size (); ++ai)
+ for (; ai < files.size (); ++ai)
{
- if (ai != i && args[ai] != xml_schema_file)
+ if (ai != i && files[ai] != xml_schema_file)
paths.push_back (
- SemanticGraph::Path (args[ai], boost::filesystem::native));
+ SemanticGraph::Path (files[ai], boost::filesystem::native));
}
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[ai] << "' is not a valid "
+ e << "error: '" << files[ai].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
}
@@ -642,10 +491,8 @@ main (Int argc, Char* argv[])
// Also include additional schemas that may be specified with
// the --polymorphic-schema option.
//
- NarrowStrings const& extra_files (
- h_ops->value<CXX::Hybrid::CLI::polymorphic_schema> ());
-
- NarrowStrings::ConstIterator i (extra_files.begin ());
+ NarrowStrings const& extra_files (h_ops->polymorphic_schema ());
+ NarrowStrings::const_iterator i (extra_files.begin ());
try
{
@@ -662,8 +509,7 @@ main (Int argc, Char* argv[])
return 1;
}
-
- if (args.size () <= 1)
+ if (paths.size () == 1)
multi = false;
}
@@ -679,7 +525,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -789,11 +635,11 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
+ if (gen_parser && !p_ops.get ())
p_ops = CXX::Hybrid::Generator::parser_options (
*h_ops, *root, b->path ());
- if (gen_serializer && !s_ops)
+ if (gen_serializer && !s_ops.get ())
s_ops = CXX::Hybrid::Generator::serializer_options (
*h_ops, *root, b->path ());
@@ -836,11 +682,10 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
- p_ops = CXX::Hybrid::Generator::parser_options (
- *h_ops, *root, tu);
+ if (gen_parser && !p_ops.get ())
+ p_ops = CXX::Hybrid::Generator::parser_options (*h_ops, *root, tu);
- if (gen_serializer && !s_ops)
+ if (gen_serializer && !s_ops.get ())
s_ops = CXX::Hybrid::Generator::serializer_options (
*h_ops, *root, tu);
}
@@ -970,16 +815,16 @@ main (Int argc, Char* argv[])
//
SemanticGraph::Paths paths;
- for (Size i (1); i < args.size (); ++i)
+ for (Size i (0); i < files.size (); ++i)
{
try
{
paths.push_back (
- SemanticGraph::Path (args[i], boost::filesystem::native));
+ SemanticGraph::Path (files[i], boost::filesystem::native));
}
catch (SemanticGraph::InvalidPath const&)
{
- e << "error: '" << args[i] << "' is not a valid "
+ e << "error: '" << files[i].c_str () << "' is not a valid "
<< "filesystem path" << endl;
return 1;
@@ -987,10 +832,8 @@ main (Int argc, Char* argv[])
}
if (paths.size () > 1 &&
- ((cmd == "cxx-parser" &&
- p_ops->value<CXX::Parser::CLI::generate_test_driver> ()) ||
- (cmd == "cxx-serializer" &&
- s_ops->value<CXX::Serializer::CLI::generate_test_driver> ())))
+ ((cmd == "cxx-parser" && p_ops->generate_test_driver ()) ||
+ (cmd == "cxx-serializer" && s_ops->generate_test_driver ())))
{
e << "info: generating test driver for the first schema only: '" <<
paths[0] << "'" << endl;
@@ -998,8 +841,8 @@ main (Int argc, Char* argv[])
XSDFrontend::Parser parser (
cmd != "cxx-hybrid",
- !common_ops.value<CLI::disable_multi_import> (),
- !common_ops.value<CLI::disable_full_check> (),
+ !common_ops.disable_multi_import (),
+ !common_ops.disable_full_check (),
loc_translator,
disabled_w);
@@ -1007,7 +850,7 @@ main (Int argc, Char* argv[])
// Morph anonymous types.
//
- if (!common_ops.value<CLI::preserve_anonymous> ())
+ if (!common_ops.preserve_anonymous ())
{
try
{
@@ -1071,14 +914,14 @@ main (Int argc, Char* argv[])
typedef std::vector<SemanticGraph::Schema*> Schemas;
SchemaPerTypeTranslator type_translator (
- common_ops.value<CLI::type_file_regex> (),
- common_ops.value<CLI::type_file_regex_trace> (),
- common_ops.value<CLI::schema_file_regex> (),
- common_ops.value<CLI::schema_file_regex_trace> ());
+ common_ops.type_file_regex (),
+ common_ops.type_file_regex_trace (),
+ common_ops.schema_file_regex (),
+ common_ops.schema_file_regex_trace ());
Transformations::SchemaPerType trans (
type_translator,
- common_ops.value<CLI::fat_type_file> (),
+ common_ops.fat_type_file (),
gen_hybrid ? "fixed" : 0);
Schemas schemas (trans.transform (*schema));
@@ -1097,13 +940,11 @@ main (Int argc, Char* argv[])
// Create parser/serializer options (we need a schema, any
// schema to do this).
//
- if (gen_parser && !p_ops)
- p_ops = CXX::Hybrid::Generator::parser_options (
- *h_ops, s, path);
+ if (gen_parser && !p_ops.get ())
+ p_ops = CXX::Hybrid::Generator::parser_options (*h_ops, s, path);
- if (gen_serializer && !s_ops)
- s_ops = CXX::Hybrid::Generator::serializer_options (
- *h_ops, s, path);
+ if (gen_serializer && !s_ops.get ())
+ s_ops = CXX::Hybrid::Generator::serializer_options (*h_ops, s, path);
TypeMap::Namespaces parser_type_map, serializer_type_map;
@@ -1229,7 +1070,7 @@ main (Int argc, Char* argv[])
// See if we need to produce the file list.
//
- if (NarrowString fl = common_ops.value<CLI::file_list> ())
+ if (NarrowString fl = common_ops.file_list ())
{
typedef boost::filesystem::ofstream OutputFileStream;
@@ -1246,10 +1087,10 @@ main (Int argc, Char* argv[])
return 1;
}
- NarrowString d (common_ops.value<CLI::file_list_delim> ());
+ NarrowString d (common_ops.file_list_delim ());
expand_nl (d);
- if (NarrowString p = common_ops.value<CLI::file_list_prologue> ())
+ if (NarrowString p = common_ops.file_list_prologue ())
{
expand_nl (p);
ofs << p;
@@ -1264,7 +1105,7 @@ main (Int argc, Char* argv[])
ofs << d;
}
- if (NarrowString e = common_ops.value<CLI::file_list_epilogue> ())
+ if (NarrowString e = common_ops.file_list_epilogue ())
{
expand_nl (e);
ofs << e;
@@ -1278,10 +1119,10 @@ main (Int argc, Char* argv[])
}
}
- if (show_sloc)
+ if (common_ops.show_sloc ())
e << "total: " << sloc << endl;
- if (UnsignedLong sloc_limit = common_ops.value<CLI::sloc_limit> ())
+ if (size_t sloc_limit = common_ops.sloc_limit ())
{
if (sloc_limit < sloc)
{
@@ -1316,26 +1157,10 @@ main (Int argc, Char* argv[])
{
// Diagnostic has already been issued.
}
- catch (CLI::UnexpectedOption const& e)
+ catch (cli::exception const& ex)
{
- wcerr << "error: unknown option '" << e.option ().c_str () << "'" << endl
- << "info: try '" << argv[0] << " help' for usage information"
- << endl;
- }
- catch (CLI::OptionFormat const& e)
- {
- wcerr << "error: value for option '" << e.option ().c_str ()
- << "' is invalid or missing" << endl
- << "info: try '" << argv[0] << " help' for usage information"
- << endl;
- }
- catch (CLI::OptionFile const& e)
- {
- if (e.value ())
- wcerr << "error: " << e.value ().c_str () << ": "
- << e.description ().c_str () << endl;
- else
- wcerr << "error: missing --options-file argument" << endl;
+ wcerr << ex << endl;
+ wcerr << "try '" << argv[0] << " help' for usage information" << endl;
}
return 1;
@@ -1352,7 +1177,7 @@ LocationTranslator (NarrowStrings const& map,
{
// Map.
//
- for (NarrowStrings::ConstIterator i (map.begin ()); i != map.end (); ++i)
+ for (NarrowStrings::const_iterator i (map.begin ()); i != map.end (); ++i)
{
// Split the string in two parts at the last '='.
//
@@ -1371,7 +1196,7 @@ LocationTranslator (NarrowStrings const& map,
// Regex.
//
- for (NarrowStrings::ConstIterator i (regex.begin ()); i != regex.end (); ++i)
+ for (NarrowStrings::const_iterator i (regex.begin ()); i != regex.end (); ++i)
{
try
{
@@ -1447,7 +1272,7 @@ AnonymousNameTranslator::
AnonymousNameTranslator (NarrowStrings const& regex, Boolean trace)
: trace_ (trace)
{
- for (NarrowStrings::ConstIterator i (regex.begin ()); i != regex.end (); ++i)
+ for (NarrowStrings::const_iterator i (regex.begin ()); i != regex.end (); ++i)
{
try
{
@@ -1509,7 +1334,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex,
Boolean schema_trace)
: type_trace_ (type_trace), schema_trace_ (schema_trace)
{
- for (NarrowStrings::ConstIterator i (type_regex.begin ());
+ for (NarrowStrings::const_iterator i (type_regex.begin ());
i != type_regex.end (); ++i)
{
try
@@ -1525,7 +1350,7 @@ SchemaPerTypeTranslator (NarrowStrings const& type_regex,
}
}
- for (NarrowStrings::ConstIterator i (schema_regex.begin ());
+ for (NarrowStrings::const_iterator i (schema_regex.begin ());
i != schema_regex.end (); ++i)
{
try