diff options
Diffstat (limited to 'TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl')
6 files changed, 112 insertions, 131 deletions
diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.cpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.cpp index faf36555923..687010bf718 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.cpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.cpp @@ -31,6 +31,44 @@ namespace CCF } void EventType:: + begin_abstract_def (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "abstract eventtype def " << id << endl; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<AbstractEventType&>(*s)); + } + else + { + now (ctx.tu ().new_node<AbstractEventType> ()); + } + + ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name); + } + + void EventType:: + begin_abstract_fwd (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "abstract eventtype fwd " << id << endl; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<AbstractEventType&>(*s)); + } + else + { + now (ctx.tu ().new_node<AbstractEventType> ()); + } + + ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name); + } + + void EventType:: begin_concrete_def (SimpleIdentifierPtr const& id) { if (ctx.trace ()) cerr << "concrete eventtype def " << id << endl; @@ -52,7 +90,7 @@ namespace CCF void EventType:: begin_concrete_fwd (SimpleIdentifierPtr const& id) { - if (ctx.trace ()) cerr << "concrete eventtype fwd" << id << endl; + if (ctx.trace ()) cerr << "concrete eventtype fwd " << id << endl; SimpleName name (id->lexeme ()); @@ -75,6 +113,12 @@ namespace CCF } void EventType:: + supports (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "supports " << id << endl; + } + + void EventType:: open_scope () { if (ctx.trace ()) cerr << "scope open" << endl; diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp index f3676561e54..b0b95c4e151 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp @@ -30,6 +30,12 @@ namespace CCF EventType (Context& c); virtual void + begin_abstract_def (SimpleIdentifierPtr const& id); + + virtual void + begin_abstract_fwd (SimpleIdentifierPtr const& id); + + virtual void begin_concrete_def (SimpleIdentifierPtr const& id); virtual void @@ -39,6 +45,9 @@ namespace CCF inherits (IdentifierPtr const& id); virtual void + supports (IdentifierPtr const& id); + + virtual void open_scope (); virtual void diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.cpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.cpp index 57c37360697..ad8a7cd7ff7 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.cpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.cpp @@ -32,7 +32,6 @@ namespace CCF include_ (ctx_, context, dout, *this), provides_ (ctx_), publishes_ (ctx_), - system_include_ (ctx_, context, dout, *this), uses_ (ctx_) { } diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.hpp index de3eed7d3fd..50cb6c8a3d6 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Factory.hpp @@ -9,7 +9,6 @@ #include "CCF/IDL2/SemanticAction/Impl/Factory.hpp" -#include "CCF/IDL3/SemanticAction/Impl/Include.hpp" #include "CCF/IDL3/SemanticAction/Impl/Component.hpp" #include "CCF/IDL3/SemanticAction/Impl/Provides.hpp" #include "CCF/IDL3/SemanticAction/Impl/Uses.hpp" @@ -20,6 +19,7 @@ #include "CCF/IDL3/SemanticAction/Impl/Home.hpp" #include "CCF/IDL3/SemanticAction/Impl/HomeFactory.hpp" #include "CCF/IDL3/SemanticAction/Impl/HomeFinder.hpp" +#include "CCF/IDL3/SemanticAction/Impl/Include.hpp" namespace CCF { @@ -105,12 +105,6 @@ namespace CCF return publishes_; } - virtual IDL2::SemanticAction::SystemInclude& - system_include () - { - return system_include_; - } - virtual SemanticAction::Uses& uses () { @@ -129,7 +123,6 @@ namespace CCF Include include_; Provides provides_; Publishes publishes_; - SystemInclude system_include_; Uses uses_; }; } diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.cpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.cpp index 7c1c98a2728..5c510f33f57 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.cpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.cpp @@ -30,34 +30,51 @@ namespace CCF // IncludeImpl // // - IncludeImpl:: - ~IncludeImpl () throw () + Include:: + ~Include () throw () { } - IncludeImpl:: - IncludeImpl (Context& c, - CompilerElements::Context& context, - Diagnostic::Stream& dout, - SemanticAction::Factory& action_factory, - Type type) + Include:: + Include (Context& c, + CompilerElements::Context& context, + Diagnostic::Stream& dout, + SemanticAction::Factory& action_factory) : ctx (c), context_ (context), dout_ (dout), - action_factory_ (action_factory), - type_ (type) + action_factory_ (action_factory) { abs_path_stack_.push ( fs::normalize ( fs::complete (context_.get<fs::path> ("file-path")))); } - void IncludeImpl:: - begin_impl (StringLiteralPtr const& sl) + void Include:: + quote (StringLiteralPtr const& sl) + { + impl (sl, quote_); + } + + void Include:: + bracket (StringLiteralPtr const& sl) + { + impl (sl, bracket_); + } + + + void Include:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; + } + + void Include:: + impl (StringLiteralPtr const& sl, Type_ type) { std::string prefix; - if (type_ == user) + if (type == quote_) { prefix = std::string ("include") + " \"" + sl->value () + "\""; } @@ -91,7 +108,7 @@ namespace CCF { bool found (false); - if (type_ == user) + if (type == quote_) { fs::path rel_path (abs_path_stack_.top ().branch_path ()); @@ -159,7 +176,7 @@ namespace CCF TranslationRegion& r (ctx.tu() .new_node<TranslationRegion> ()); - if (type_ == user) + if (type == quote_) { ctx.tu ().new_edge<QuoteIncludes> ( ctx.region (), r, include_path); @@ -194,8 +211,8 @@ namespace CCF // //@@ this code is highly experimental - InputStreamAdapter isa (ifs); - Preprocessor pp (isa); + CompilerElements::InputStreamAdapter isa (ifs); + CompilerElements::CPP::Preprocessor pp (isa); IDL3::LexicalAnalyzer lexer (pp); TokenList token_stream; @@ -248,20 +265,14 @@ namespace CCF } } - void IncludeImpl:: - end_impl () - { - if (ctx.trace ()) cerr << "end" << endl; - } - - bool IncludeImpl:: + bool Include:: handle_already_included (fs::path const& path, StringLiteralPtr const& sl) { if(!include_file_set_.insert (path).second) { - cerr << "warning: skipping already included file " << sl - << endl; + // cerr << "warning: skipping already included file " << sl + // << endl; return true; } return false; diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp index 0bc4a631986..98fc5f8a169 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp @@ -31,31 +31,36 @@ namespace CCF // Note: overriding IDL2 include to allow inclusion of IDL3 files // // - class IncludeImpl + class Include : public virtual IDL2::SemanticAction::Include { - protected: + public: virtual - ~IncludeImpl () throw (); + ~Include () throw (); - enum Type - { - system, - user - }; + Include (Context& c, + CompilerElements::Context& context, + Diagnostic::Stream& dout, + SemanticAction::Factory& action_factory); - IncludeImpl (Context& c, - CompilerElements::Context& context, - Diagnostic::Stream& dout, - SemanticAction::Factory& action_factory, - Type type); + virtual void + quote (StringLiteralPtr const& sl); virtual void - begin_impl (StringLiteralPtr const& sl); + bracket (StringLiteralPtr const& sl); virtual void - end_impl (); + end (); private: + enum Type_ + { + quote_, + bracket_ + }; + + virtual void + impl (StringLiteralPtr const& sl, Type_ type); + bool handle_already_included (fs::path const& path, StringLiteralPtr const& sl); @@ -66,8 +71,6 @@ namespace CCF Diagnostic::Stream& dout_; SemanticAction::Factory& action_factory_; - Type type_; - std::stack<SemanticGraph::TranslationRegion*> stack_; std::stack<fs::path> abs_path_stack_, rel_path_stack_; @@ -81,84 +84,6 @@ namespace CCF std::set<fs::path, FilePathComparator> include_file_set_; }; - - - // - // - // - struct Include : virtual IDL2::SemanticAction::Include, IncludeImpl - { - virtual - ~Include () throw () - { - } - - Include (Context& c, - CompilerElements::Context& context, - Diagnostic::Stream& dout, - SemanticAction::Factory& action_factory) - : IncludeImpl (c, - context, - dout, - action_factory, - IncludeImpl::user) - { - } - - virtual void - begin (StringLiteralPtr const& sl) - { - begin_impl (sl); - } - - virtual void - end () - { - end_impl (); - } - }; - - // - // - // - struct SystemInclude : virtual IDL2::SemanticAction::SystemInclude, - IncludeImpl - { - virtual - ~SystemInclude () throw () - { - } - - SystemInclude (Context& c, - CompilerElements::Context& context, - Diagnostic::Stream& dout, - SemanticAction::Factory& action_factory) - : IncludeImpl (c, - context, - dout, - action_factory, - IncludeImpl::system) - { - } - - virtual void - begin (StringLiteralPtr const& sl) - { - //@@ This is a really dirty hack. Need to think of - // a mechanism to address this issue. - // - if (sl->value () != "Components.idl") - { - begin_impl (sl); - } - } - - virtual void - end () - { - end_impl (); - } - }; } } } |