summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-10-04 09:00:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-10-04 09:00:19 +0200
commitbeab8baab8a7f727f5ba65ecbd7e11decea18112 (patch)
treeac06c0ee6e7e92e3853f717e47143d3f3d5d49ff /cli
parent0f637644070c796d4a1561dc38dceb1de15cd577 (diff)
Add --suppress-inline option
Diffstat (limited to 'cli')
-rw-r--r--cli/context.cxx9
-rw-r--r--cli/context.hxx6
-rw-r--r--cli/generator.cxx10
-rw-r--r--cli/options.cli1
-rw-r--r--cli/options.cxx35
-rw-r--r--cli/options.hxx6
-rw-r--r--cli/options.ixx31
7 files changed, 61 insertions, 37 deletions
diff --git a/cli/context.cxx b/cli/context.cxx
index bc7ff0f..1af10e8 100644
--- a/cli/context.cxx
+++ b/cli/context.cxx
@@ -10,17 +10,15 @@
using namespace std;
context::
-context (std::ostream& os_,
- semantics::cli_unit& unit_)
+context (ostream& os_, semantics::cli_unit& unit_, options_type const& ops)
: data_ (new (shared) data),
os (os_),
unit (unit_),
+ options (ops),
inl (data_->inl_),
reserved_name_map (data_->reserved_name_map_)
{
- //@@ --generate-inline
- //
- if (false)
+ if (!options.suppress_inline ())
inl = "inline ";
}
@@ -29,6 +27,7 @@ context (context& c)
: data_ (c.data_),
os (c.os),
unit (c.unit),
+ options (c.options),
inl (c.inl),
reserved_name_map (c.reserved_name_map)
{
diff --git a/cli/context.hxx b/cli/context.hxx
index ae490c9..8063f59 100644
--- a/cli/context.hxx
+++ b/cli/context.hxx
@@ -13,6 +13,7 @@
#include <cutl/shared-ptr.hxx>
+#include "options.hxx"
#include "semantics.hxx"
#include "traversal.hxx"
@@ -23,6 +24,7 @@ class context
public:
typedef std::size_t size_t;
typedef std::string string;
+ typedef ::options options_type;
private:
struct data;
@@ -31,6 +33,7 @@ private:
public:
std::ostream& os;
semantics::cli_unit& unit;
+ options_type const& options;
string& inl;
@@ -65,8 +68,7 @@ public:
}
public:
- context (std::ostream&,
- semantics::cli_unit&);
+ context (std::ostream&, semantics::cli_unit&, options_type const&);
context (context&);
diff --git a/cli/generator.cxx b/cli/generator.cxx
index 0142201..6c766e4 100644
--- a/cli/generator.cxx
+++ b/cli/generator.cxx
@@ -75,7 +75,7 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p)
{
try
{
- bool inl (false);
+ bool inl (!ops.suppress_inline ());
string hxx_suffix (".hxx");
string ixx_suffix (".ixx");
@@ -104,7 +104,7 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p)
// Process names.
//
{
- context ctx (cerr, unit);
+ context ctx (cerr, unit, ops);
process_names (ctx);
}
@@ -167,7 +167,7 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p)
//
{
cxx_filter filt (hxx);
- context ctx (hxx, unit);
+ context ctx (hxx, unit, ops);
string guard (make_guard (hxx_name, "", ctx));
@@ -193,7 +193,7 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p)
if (inl)
{
cxx_filter filt (ixx);
- context ctx (ixx, unit);
+ context ctx (ixx, unit, ops);
generate_inline (ctx);
}
@@ -201,7 +201,7 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p)
//
{
cxx_filter filt (cxx);
- context ctx (cxx, unit);
+ context ctx (cxx, unit, ops);
cxx << "#include \"" << hxx_name << "\"" << endl
<< endl;
diff --git a/cli/options.cli b/cli/options.cli
index e7024fb..3b78646 100644
--- a/cli/options.cli
+++ b/cli/options.cli
@@ -15,4 +15,5 @@ class options
bool --help;
bool --version;
std::string --output-dir;
+ bool --suppress-inline;
};
diff --git a/cli/options.cxx b/cli/options.cxx
index 6aba013..c2ad4fd 100644
--- a/cli/options.cxx
+++ b/cli/options.cxx
@@ -4,27 +4,6 @@
#include "options.hxx"
-// options
-//
-
-bool const& options::
-help () const
-{
- return help_;
-}
-
-bool const& options::
-version () const
-{
- return version_;
-}
-
-std::string const& options::
-output_dir () const
-{
- return output_dir_;
-}
-
#include <string>
#include <vector>
#include <ostream>
@@ -188,7 +167,8 @@ options (int argc,
::cli::unknown_mode arg)
: help_ (),
version_ (),
- output_dir_ ()
+ output_dir_ (),
+ suppress_inline_ ()
{
_parse (1, argc, argv, opt, arg);
}
@@ -201,7 +181,8 @@ options (int start,
::cli::unknown_mode arg)
: help_ (),
version_ (),
- output_dir_ ()
+ output_dir_ (),
+ suppress_inline_ ()
{
_parse (start, argc, argv, opt, arg);
}
@@ -214,7 +195,8 @@ options (int argc,
::cli::unknown_mode arg)
: help_ (),
version_ (),
- output_dir_ ()
+ output_dir_ (),
+ suppress_inline_ ()
{
end = _parse (1, argc, argv, opt, arg);
}
@@ -228,7 +210,8 @@ options (int start,
::cli::unknown_mode arg)
: help_ (),
version_ (),
- output_dir_ ()
+ output_dir_ (),
+ suppress_inline_ ()
{
end = _parse (start, argc, argv, opt, arg);
}
@@ -249,6 +232,8 @@ struct _cli_options_map_init
&::cli::thunk<options, bool, &options::version_>;
_cli_options_map_["--output-dir"] =
&::cli::thunk<options, std::string, &options::output_dir_>;
+ _cli_options_map_["--suppress-inline"] =
+ &::cli::thunk<options, bool, &options::suppress_inline_>;
}
} _cli_options_map_init_;
diff --git a/cli/options.hxx b/cli/options.hxx
index 37ec251..cf92229 100644
--- a/cli/options.hxx
+++ b/cli/options.hxx
@@ -213,6 +213,9 @@ class options
std::string const&
output_dir () const;
+ bool const&
+ suppress_inline () const;
+
private:
int
_parse (int start,
@@ -225,6 +228,9 @@ class options
bool help_;
bool version_;
std::string output_dir_;
+ bool suppress_inline_;
};
+#include "options.ixx"
+
#endif // OPTIONS_HXX
diff --git a/cli/options.ixx b/cli/options.ixx
new file mode 100644
index 0000000..ac93219
--- /dev/null
+++ b/cli/options.ixx
@@ -0,0 +1,31 @@
+// This code was generated by CLI, a command line interface
+// compiler for C++.
+//
+
+// options
+//
+
+inline bool const& options::
+help () const
+{
+ return help_;
+}
+
+inline bool const& options::
+version () const
+{
+ return version_;
+}
+
+inline std::string const& options::
+output_dir () const
+{
+ return output_dir_;
+}
+
+inline bool const& options::
+suppress_inline () const
+{
+ return suppress_inline_;
+}
+