diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-03-30 11:05:46 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-03-30 11:05:46 +0200 |
commit | b143a4a1a028d3147b9b603e77866780b34ee828 (patch) | |
tree | 521e0d3602a08970cf477e3f139cc40f9dd01af2 /odb/context.cxx | |
parent | cf80396f8b6147e9048c1f3bd50b3086f754d037 (diff) |
Add code generator infrastructure
Diffstat (limited to 'odb/context.cxx')
-rw-r--r-- | odb/context.cxx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/odb/context.cxx b/odb/context.cxx new file mode 100644 index 0000000..913aa5d --- /dev/null +++ b/odb/context.cxx @@ -0,0 +1,49 @@ +// file : odb/context.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <stack> +#include "context.hxx" + +using namespace std; + +context:: +context (ostream& os_, + semantics::unit& unit_, + options_type const& ops) + : data_ (new (shared) data), + os (os_), + unit (unit_), + options (ops) +{ +} + +context:: +context (context& c) + : data_ (c.data_), + os (c.os), + unit (c.unit), + options (c.options) +{ +} + +// namespace +// + +void namespace_:: +traverse (type& ns) +{ + string name (ns.name ()); + + if (name.empty ()) + os << "namespace"; + else + os << "namespace " << name; + + os << "{"; + + traversal::namespace_::traverse (ns); + + os << "}"; +} |