diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-30 23:16:29 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-12-30 23:16:29 +0000 |
commit | c821f78feeb21f7d3a39944c9bf62b7f4111f422 (patch) | |
tree | 3ca3de159b390e345b7ee5ced754a2430c89e694 /TAO/CIAO/CCF/CCF/IDL3 | |
parent | 3e47f65a8b512b1c3f3089af98c513fb42fc8c93 (diff) | |
download | ATCD-c821f78feeb21f7d3a39944c9bf62b7f4111f422.tar.gz |
ChangeLogTag: Tue Dec 30 17:03:27 2003 Boris Kolpackov <boris@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/CIAO/CCF/CCF/IDL3')
3 files changed, 235 insertions, 0 deletions
diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/HomeFinder.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/HomeFinder.hpp new file mode 100644 index 00000000000..c20cbd43406 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/HomeFinder.hpp @@ -0,0 +1,37 @@ +// file : CCF/IDL3/SemanticAction/HomeFinder.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL3_SEMANTIC_ACTION_HOME_FINDER_HPP +#define CCF_IDL3_SEMANTIC_ACTION_HOME_FINDER_HPP + +#include "CCF/IDL3/SemanticAction/Elements.hpp" + +namespace CCF +{ + namespace IDL3 + { + namespace SemanticAction + { + // + // + // + class HomeFinder + { + public: + + virtual void + name (SimpleIdentifierPtr const& id) = 0; + + virtual void + parameter (IdentifierPtr const& type, + SimpleIdentifierPtr const& name) = 0; + + virtual void + raises (IdentifierPtr const& id) = 0; + }; + } + } +} + +#endif // CCF_IDL3_SEMANTIC_ACTION_HOME_FINDER_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.cpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.cpp new file mode 100644 index 00000000000..31917f96f3c --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.cpp @@ -0,0 +1,148 @@ +// file : CCF/IDL3/SemanticAction/Impl/HomeFinder.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL3/SemanticGraph/Home.hpp" +#include "CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp" + +#include <iostream> + +using std::cerr; +using std::endl; + + +namespace CCF +{ + namespace IDL3 + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + HomeFinder:: + ~HomeFinder () throw () + { + } + + HomeFinder:: + HomeFinder (Context& c) + : Base (c) + { + } + + void HomeFinder:: + name (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << " " << id << endl; + + hf_ = 0; + + SemanticGraph::Home& h ( + dynamic_cast<SemanticGraph::Home&>(ctx.scope ())); + + SemanticGraph::Component& c ( + dynamic_cast<SemanticGraph::Component&>(h.manages ().managee ())); + + SimpleName name (id->lexeme ()); + + hf_ = &ctx.tu ().new_node<SemanticGraph::HomeFinder> (); + + ctx.tu ().new_edge<Returns> (*hf_, c); + ctx.tu ().new_edge<Defines> (ctx.scope (), *hf_, name); + } + + + void HomeFinder:: + parameter (IdentifierPtr const& type_id, + SimpleIdentifierPtr const& name_id) + { + if (ctx.trace ()) cerr << "parameter in " << " " + << type_id << " " << name_id << endl; + + if (hf_ == 0) return; + + Name name (type_id->lexeme ()); + ScopedName from (ctx.scope ().scoped_name ()); + + try + { + try + { + Type& t (resolve<Type> (from, name, complete)); + + Parameter& p ( + ctx.tu ().new_node<InParameter> (name_id->lexeme ())); + + ctx.tu ().new_edge<Belongs> (p, t); + ctx.tu ().new_edge<Receives> (*hf_, p); + } + catch (Resolve const&) + { + cerr << "error: invalid parameter declaration" << endl; + throw; + } + } + catch (NotFound const&) + { + cerr << "no type with name \'" << name + << "\' visible from scope \'" << from << "\'" << endl; + } + catch (WrongType const&) + { + cerr << "declaration with name \'" << name + << "\' visible from scope \'" << from + << "\' is not a type declaration" << endl; + cerr << "using non-type as an finder parameter type is " + << "illegal" << endl; + } + catch (NotComplete const& e) + { + cerr << "type \'" << e.name () << "\' is not complete" << endl; + } + } + + void HomeFinder:: + raises (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "raises " << id << endl; + + if (hf_ == 0) return; + + Name name (id->lexeme ()); + ScopedName from (ctx.scope ().scoped_name ()); + + try + { + try + { + SemanticGraph::Exception& e ( + resolve<SemanticGraph::Exception> (from, name)); + + ctx.tu ().new_edge<Raises> (*hf_, e); + } + catch (Resolve const&) + { + cerr << "error: invalid raises declaration" << endl; + throw; + } + } + catch (NotFound const&) + { + cerr << "no exception with name \'" << name + << "\' visible from scope \'" << from << "\'" << endl; + } + catch (WrongType const&) + { + cerr << "declaration with name \'" << name + << "\' visible from scope \'" << from + << "\' is not an exception declaration" << endl; + cerr << "using non-exception type in raises declaration is " + << "illegal" << endl; + } + } + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp new file mode 100644 index 00000000000..6c6c022cbac --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp @@ -0,0 +1,50 @@ +// file : CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL3_SEMANTIC_ACTION_IMPL_HOME_FINDER_HPP +#define CCF_IDL3_SEMANTIC_ACTION_IMPL_HOME_FINDER_HPP + +#include "CCF/IDL2/SemanticGraph/Operation.hpp" +#include "CCF/IDL3/SemanticAction/HomeFinder.hpp" +#include "CCF/IDL3/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace IDL3 + { + namespace SemanticAction + { + namespace Impl + { + // + // + // + class HomeFinder : public virtual SemanticAction::HomeFinder, + public Base + { + public: + virtual + ~HomeFinder () throw (); + + HomeFinder (Context& c); + + virtual void + name (SimpleIdentifierPtr const& id); + + virtual void + parameter (IdentifierPtr const& type_id, + SimpleIdentifierPtr const& name_id); + + virtual void + raises (IdentifierPtr const& id); + + private: + SemanticGraph::HomeFinder* hf_; + }; + } + } + } +} + +#endif // CCF_IDL3_SEMANTIC_ACTION_IMPL_HOME_FINDER_HPP |