summaryrefslogtreecommitdiff
path: root/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl
diff options
context:
space:
mode:
Diffstat (limited to 'modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl')
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp83
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp42
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp27
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp35
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp53
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp119
-rw-r--r--modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp46
7 files changed, 405 insertions, 0 deletions
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp
new file mode 100644
index 00000000000..a39a801cd15
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.cpp
@@ -0,0 +1,83 @@
+// file : CCF/CIDL/SemanticAction/Impl/Composition.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/CIDL/SemanticAction/Impl/Composition.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Composition::
+ Composition (Context& c)
+ : ScopeBase<SemanticGraph::Composition> (c)
+ {
+ }
+
+ void Composition::
+ begin (SimpleIdentifierPtr const& id, Category::Value c)
+ {
+ if (ctx.trace ()) cerr << "composition " << id << endl;
+
+ if(c == Category::entity)
+ {
+ now (ctx.tu ().new_node<EntityComposition> (
+ ctx.file (), id->line ()));
+ }
+ else if (c == Category::process)
+ {
+ now (ctx.tu ().new_node<ProcessComposition> (
+ ctx.file (), id->line ()));
+ }
+ else if (c == Category::service)
+ {
+ now (ctx.tu ().new_node<ServiceComposition> (
+ ctx.file (), id->line ()));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<SessionComposition> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), id->lexeme ());
+ }
+
+ void Composition::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Composition::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Composition::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp
new file mode 100644
index 00000000000..9bfce6dc78c
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Composition.hpp
@@ -0,0 +1,42 @@
+// file : CCF/CIDL/SemanticAction/Impl/Composition.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP
+#define CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP
+
+#include "CCF/CIDL/SemanticGraph/Composition.hpp"
+#include "CCF/CIDL/SemanticAction/Composition.hpp"
+#include "CCF/CIDL/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Composition : SemanticAction::Composition,
+ ScopeBase<SemanticGraph::Composition>
+ {
+ Composition (Context& c);
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id, Category::Value c);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_COMPOSITION_HPP
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp
new file mode 100644
index 00000000000..5e4a0e2525e
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Elements.hpp
@@ -0,0 +1,27 @@
+// file : CCF/CIDL/SemanticAction/Impl/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
+#define CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
+
+#include "CCF/CIDL/SemanticAction/Elements.hpp"
+#include "CCF/IDL3/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using IDL3::SemanticAction::Impl::Context;
+ using IDL3::SemanticAction::Impl::Base;
+ using IDL3::SemanticAction::Impl::ScopeBase;
+ }
+ }
+ }
+}
+
+#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp
new file mode 100644
index 00000000000..37a6e589ca5
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp
@@ -0,0 +1,35 @@
+// file : CCF/CIDL/SemanticAction/Impl/Factory.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+
+#include "CCF/CIDL/SemanticAction/Impl/Factory.hpp"
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Factory::
+ Factory (CompilerElements::Context& context,
+ Diagnostic::Stream& dout,
+ SemanticGraph::TranslationUnit& tu)
+ : IDL2::SemanticAction::Impl::Factory (context, dout, tu),
+ IDL3::SemanticAction::Impl::Factory (context, dout, tu),
+
+ composition_ (ctx_),
+ home_executor_ (ctx_)
+ {
+ }
+ }
+ }
+ }
+}
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp
new file mode 100644
index 00000000000..4cea4e35b82
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.hpp
@@ -0,0 +1,53 @@
+// file : CCF/CIDL/SemanticAction/Impl/Factory.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP
+#define CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP
+
+#include "CCF/CIDL/SemanticAction/Factory.hpp"
+#include "CCF/IDL3/SemanticAction/Impl/Factory.hpp"
+
+#include "CCF/CIDL/SemanticAction/Impl/Composition.hpp"
+#include "CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp"
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ //
+ //
+ //
+ struct Factory : virtual CIDL::SemanticAction::Factory,
+ virtual IDL3::SemanticAction::Impl::Factory
+ {
+ Factory (CompilerElements::Context& context,
+ Diagnostic::Stream& dout,
+ SemanticGraph::TranslationUnit& tu);
+
+ virtual SemanticAction::Composition&
+ composition ()
+ {
+ return composition_;
+ }
+
+ virtual SemanticAction::HomeExecutor&
+ home_executor ()
+ {
+ return home_executor_;
+ }
+
+ private:
+ Composition composition_;
+ HomeExecutor home_executor_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_FACTORY_HPP
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp
new file mode 100644
index 00000000000..acbb6e9f5e0
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp
@@ -0,0 +1,119 @@
+// file : CCF/CIDL/SemanticAction/Impl/HomeExecutor.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ HomeExecutor::
+ HomeExecutor (Context& c)
+ : Base (c)
+ {
+ }
+
+ void HomeExecutor::
+ begin (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "home executor " << id << endl;
+
+ id_ = id;
+ he_ = &ctx.tu ().new_node<SemanticGraph::HomeExecutor> (
+ ctx.file (), id->line ());
+ }
+
+ void HomeExecutor::
+ implements (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "implements " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ c_ = 0;
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Home& h (
+ resolve<SemanticGraph::Home> (from, name, Flags::defined));
+
+ c_ = &dynamic_cast<SemanticGraph::Component&> (
+ h.manages ().managee ());
+
+ ctx.tu ().new_edge<Implements> (*he_, h);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid implements specification" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no home with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "incompatible type in implements specification" << endl;
+ }
+ catch (NotDefined const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "attempt to implement forward-declared home "
+ << e.name () << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "implementation of forward-declared home is illegal"
+ << endl;
+ }
+ }
+
+ void HomeExecutor::
+ manages (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "manages " << id << endl;
+
+ if (c_ != 0)
+ {
+ SemanticGraph::ComponentExecutor& ce (
+ ctx.tu ().new_node<SemanticGraph::ComponentExecutor> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Implements> (ce, *c_);
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), ce, id->lexeme ());
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *he_, id_->lexeme ());
+
+ ctx.tu ().new_edge<Manages> (*he_, ce);
+ }
+ }
+
+ void HomeExecutor::
+ end ()
+ {
+ id_ = 0;
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp
new file mode 100644
index 00000000000..23d3a3e7cca
--- /dev/null
+++ b/modules/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp
@@ -0,0 +1,46 @@
+// file : CCF/CIDL/SemanticAction/Impl/HomeExecutor.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP
+#define CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP
+
+#include "CCF/CIDL/SemanticGraph/Executor.hpp"
+#include "CCF/CIDL/SemanticAction/HomeExecutor.hpp"
+#include "CCF/CIDL/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace CIDL
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct HomeExecutor : SemanticAction::HomeExecutor, Base
+ {
+ HomeExecutor (Context& c);
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id);
+
+ virtual void
+ implements (IdentifierPtr const& id);
+
+ virtual void
+ manages (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ SimpleIdentifierPtr id_;
+ SemanticGraph::HomeExecutor* he_;
+ SemanticGraph::Component* c_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_CIDL_SEMANTIC_ACTION_IMPL_HOME_EXECUTOR_HPP