diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-20 07:04:17 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-20 07:04:17 +0200 |
commit | f15dcbcb90c92e0ce4c9ff575349b60713fe1f83 (patch) | |
tree | e90adb4e0b581ab7adcc6554f1efd9de381b4684 /cli | |
parent | ebfe8dc9d7093e932f91a649636e2202630cc16f (diff) | |
download | cli-f15dcbcb90c92e0ce4c9ff575349b60713fe1f83.tar.gz cli-f15dcbcb90c92e0ce4c9ff575349b60713fe1f83.tar.xz cli-f15dcbcb90c92e0ce4c9ff575349b60713fe1f83.zip |
Add definition unit to context
Diffstat (limited to 'cli')
-rw-r--r-- | cli/context.cxx | 5 | ||||
-rw-r--r-- | cli/context.hxx | 12 | ||||
-rw-r--r-- | cli/generator.cxx | 17 | ||||
-rw-r--r-- | cli/makefile | 5 |
4 files changed, 28 insertions, 11 deletions
diff --git a/cli/context.cxx b/cli/context.cxx index 96eec1c..cd03386 100644 --- a/cli/context.cxx +++ b/cli/context.cxx @@ -10,9 +10,11 @@ using namespace std; context:: -context (std::ostream& os_) +context (std::ostream& os_, + semantics::cli_unit& unit_) : data_ (new (shared) data), os (os_), + unit (unit_), reserved_name_map (data_->reserved_name_map_) { } @@ -21,6 +23,7 @@ context:: context (context& c) : data_ (c.data_), os (c.os), + unit (c.unit), reserved_name_map (c.reserved_name_map) { } diff --git a/cli/context.hxx b/cli/context.hxx index c3caa73..4d88fe9 100644 --- a/cli/context.hxx +++ b/cli/context.hxx @@ -28,6 +28,7 @@ private: public: std::ostream& os; + semantics::cli_unit& unit; typedef std::map<string, string> reserved_name_map_type; reserved_name_map_type& reserved_name_map; @@ -45,8 +46,10 @@ public: escape (string const&) const; public: - context (std::ostream& os_); - context (context& c); + context (std::ostream&, + semantics::cli_unit&); + + context (context&); private: context& @@ -57,10 +60,7 @@ private: // struct namespace_: traversal::namespace_, context { - namespace_ (context& c) - : context (c) - { - } + namespace_ (context& c) : context (c) {} virtual void pre (type&); diff --git a/cli/generator.cxx b/cli/generator.cxx index cf9de69..c23f382 100644 --- a/cli/generator.cxx +++ b/cli/generator.cxx @@ -13,6 +13,10 @@ #include <cutl/compiler/code-stream.hxx> #include <cutl/compiler/cxx-indenter.hxx> +#include "header.hxx" +#include "source.hxx" +#include "inline.hxx" + #include "context.hxx" #include "generator.hxx" @@ -154,7 +158,7 @@ generate (semantics::cli_unit& unit, path const& p) // { cxx_filter filt (hxx); - context ctx (hxx); + context ctx (hxx, unit); string guard (make_guard (hxx_name, "", ctx)); @@ -162,6 +166,7 @@ generate (semantics::cli_unit& unit, path const& p) << "#define " << guard << endl << endl; + generate_header (ctx); if (inl) { @@ -177,17 +182,23 @@ generate (semantics::cli_unit& unit, path const& p) if (inl) { cxx_filter filt (ixx); - context ctx (ixx); + context ctx (ixx, unit); + generate_inline (ctx); } // CXX // { cxx_filter filt (cxx); - context ctx (cxx); + context ctx (cxx, unit); cxx << "#include \"" << hxx_name << "\"" << endl << endl; + + if (!inl) + generate_inline (ctx); + + generate_source (ctx); } auto_rm.cancel (); diff --git a/cli/makefile b/cli/makefile index 10899be..a6026a6 100644 --- a/cli/makefile +++ b/cli/makefile @@ -9,7 +9,10 @@ cxx_tun := cli.cxx lexer.cxx parser.cxx cxx_tun += \ context.cxx \ -generator.cxx +generator.cxx \ +header.cxx \ +inline.cxx \ +source.cxx cxx_tun += \ semantics/class.cxx \ |