summaryrefslogtreecommitdiff
path: root/cli/header.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-09-27 18:20:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-09-27 18:20:49 +0200
commit4b1e037fb0f763cd3e3401d71b66269440d75dbf (patch)
tree68d16506b8c7410c0e0fd34358249ebf4929f395 /cli/header.cxx
parentb5e7ac58b0e44a7903808d622f5af97c07171281 (diff)
Generate parsing constructors and parsing code
Also generate some runtime support code such exceptions, value parsers, etc.
Diffstat (limited to 'cli/header.cxx')
-rw-r--r--cli/header.cxx64
1 files changed, 61 insertions, 3 deletions
diff --git a/cli/header.cxx b/cli/header.cxx
index c248690..8033b7f 100644
--- a/cli/header.cxx
+++ b/cli/header.cxx
@@ -25,6 +25,8 @@ namespace
}
};
+ //
+ //
struct option_data: traversal::option, context
{
option_data (context& c) : context (c) {}
@@ -62,9 +64,61 @@ namespace
<< "public:" << endl
<< endl;
+ // c-tors
+ //
+ string um ("::cli::unknown_mode");
+
+ os << name << " (int argc," << endl
+ << "char** argv," << endl
+ << um << " option = " << um << "::fail," << endl
+ << um << " argument = " << um << "::stop);"
+ << endl;
+
+ os << name << " (int start," << endl
+ << "int argc," << endl
+ << "char** argv," << endl
+ << um << " option = " << um << "::fail," << endl
+ << um << " argument = " << um << "::stop);"
+ << endl;
+
+ os << name << " (int argc," << endl
+ << "char** argv," << endl
+ << "int& end," << endl
+ << um << " option = " << um << "::fail," << endl
+ << um << " argument = " << um << "::stop);"
+ << endl;
+
+ os << name << " (int start," << endl
+ << "int argc," << endl
+ << "char** argv," << endl
+ << "int& end," << endl
+ << um << " option = " << um << "::fail," << endl
+ << um << " argument = " << um << "::stop);"
+ << endl;
+
+ //
+ //
+ os << "// Option accessors." << endl
+ << "//" << endl
+ << "public:" << endl
+ << endl;
+
names (c, names_option_);
- os << "private:" << endl;
+ // _parse()
+ //
+ os << "private:" << endl
+ << "int" << endl
+ << "_parse (int start," << endl
+ << "int argc," << endl
+ << "char** argv," << endl
+ << um << " option," << endl
+ << um << " argument);"
+ << endl;
+
+ // Data members.
+ //
+ os << "public:" << endl; //@@ tmp
names (c, names_option_data_);
@@ -101,11 +155,15 @@ generate_header (context& ctx)
includes includes (ctx);
traversal::names unit_names;
namespace_ ns (ctx);
- traversal::names ns_names;
class_ cl (ctx);
unit >> includes;
- unit >> unit_names >> ns >> ns_names >> ns;
+ unit >> unit_names >> ns;
+ unit_names >> cl;
+
+ traversal::names ns_names;
+
+ ns >> ns_names >> ns;
ns_names >> cl;
unit.dispatch (ctx.unit);