diff options
Diffstat (limited to 'TAO')
88 files changed, 2254 insertions, 1369 deletions
diff --git a/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp b/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp index 4a73d93397c..6bc50409d28 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp +++ b/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.cpp @@ -9,12 +9,12 @@ namespace CCF namespace CIDL { LexicalAnalyzer:: - LexicalAnalyzer (TokenStream<char>& is) + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is) : IDL2::LexicalAnalyzer (is), IDL3::LexicalAnalyzer (is) { // Keywords (alphabetic order). - + keyword_table_.insert ("composition"); keyword_table_.insert ("entity" ); keyword_table_.insert ("executor" ); diff --git a/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp b/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp index 0ffd9b04912..978c06b8bef 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp +++ b/TAO/CIAO/CCF/CCF/CIDL/LexicalAnalyzer.hpp @@ -14,7 +14,7 @@ namespace CCF class LexicalAnalyzer : public virtual IDL3::LexicalAnalyzer { public: - LexicalAnalyzer (TokenStream<char>& is); + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is); }; } } diff --git a/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp b/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp index 33ac8583dc3..7f42782c765 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp +++ b/TAO/CIAO/CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp @@ -45,6 +45,7 @@ namespace CCF // Implied translation region with CCM-related types. // + /* TranslationRegion& ctr (tu.new_node<TranslationRegion> ()); tu.new_edge<ContainsImplied> (tu, ctr, ".components"); @@ -56,6 +57,7 @@ namespace CCF tu.new_edge<Defines> ( cm, tu.new_node<LocalInterface> (), "EnterpriseComponent"); + */ } } } diff --git a/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp b/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp index 9e7750d6131..61cd626d02a 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp +++ b/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.cpp @@ -17,25 +17,6 @@ namespace CCF // Composition // // - Composition::Kind const - Composition::Kind::entity (Composition::Kind::entity_), - Composition::Kind::process (Composition::Kind::process_), - Composition::Kind::service (Composition::Kind::service_), - Composition::Kind::session (Composition::Kind::session_); - - namespace - { - char const* composition_kind_labels_[] = - { - "entity", "process", "service", "session" - }; - } - - Composition::Kind::operator char const* () const - { - return composition_kind_labels_[v_]; - } - namespace { TypeInfo diff --git a/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp b/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp index 59632b110e8..62b1e3afa7f 100644 --- a/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp +++ b/TAO/CIAO/CCF/CCF/CIDL/SemanticGraph/Composition.hpp @@ -16,41 +16,6 @@ namespace CCF class Composition : public virtual Scope { public: - class Kind - { - public: - static Kind const entity, process, service, session; - - public: - operator char const* () const; - - bool - operator== (Kind d) const - { - return v_ == d.v_; - } - - bool - operator!= (Kind d) const - { - return v_ != d.v_; - } - - private: - enum Value - { - entity_, process_, service_, session_ - } v_; - - Kind (Value v) - : v_ (v) - { - } - }; - - virtual Kind - kind () = 0; - static Introspection::TypeInfo const& static_type_info (); @@ -66,12 +31,6 @@ namespace CCF class EntityComposition : public virtual Composition { public: - virtual Kind - kind () - { - return Kind::entity; - } - static Introspection::TypeInfo const& static_type_info (); @@ -87,12 +46,6 @@ namespace CCF class ProcessComposition : public virtual Composition { public: - virtual Kind - kind () - { - return Kind::process; - } - static Introspection::TypeInfo const& static_type_info (); @@ -109,12 +62,6 @@ namespace CCF class ServiceComposition : public virtual Composition { public: - virtual Kind - kind () - { - return Kind::service; - } - static Introspection::TypeInfo const& static_type_info (); @@ -131,12 +78,6 @@ namespace CCF class SessionComposition : public virtual Composition { public: - virtual Kind - kind () - { - return Kind::session; - } - static Introspection::TypeInfo const& static_type_info (); diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/Diagnostic.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/Diagnostic.hpp index eecc527b432..34eb0006b69 100644 --- a/TAO/CIAO/CCF/CCF/CompilerElements/Diagnostic.hpp +++ b/TAO/CIAO/CCF/CCF/CompilerElements/Diagnostic.hpp @@ -135,7 +135,7 @@ namespace Diagnostic Stream& operator<< (Record const& msg) { - std::cout << msg.file () << ":" << msg.line () << ": " + std::cerr << msg.file () << ":" << msg.line () << ": " << msg.description () << std::endl; switch (msg.type ()) diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/Makefile.alt b/TAO/CIAO/CCF/CCF/CompilerElements/Makefile.alt index 3626ec1eb28..b5b6747c233 100644 --- a/TAO/CIAO/CCF/CCF/CompilerElements/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/CompilerElements/Makefile.alt @@ -10,7 +10,9 @@ $(call include, $(root)/Config.rules) $(call include, $(UTILITY_ROOT)/BuildRules/Archive.pre.rules) -cxx_translation_units := Introspection.cpp +cxx_translation_units := Introspection.cpp \ + PreprocessorToken.cpp \ + Preprocessor.cpp module_base := CompilerElements module_prefix := diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/Preprocessor.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/Preprocessor.hpp index f829301caaf..105fca3cc0f 100644 --- a/TAO/CIAO/CCF/CCF/CompilerElements/Preprocessor.hpp +++ b/TAO/CIAO/CCF/CCF/CompilerElements/Preprocessor.hpp @@ -2,313 +2,38 @@ // author : Boris Kolpackov <boris@dre.vanderbilt.edu> // cvs-id : $Id$ -#ifndef CCF_PREPROCESSOR_HPP -#define CCF_PREPROCESSOR_HPP +#ifndef CCF_COMPILER_ELEMENTS_PREPROCESSOR_HPP +#define CCF_COMPILER_ELEMENTS_PREPROCESSOR_HPP -#include <locale> -#include <deque> +#include <memory> #include "CCF/CompilerElements/TokenStream.hpp" - -// tmp -// #include <iostream> +#include "CCF/CompilerElements/PreprocessorToken.hpp" namespace CCF { - //@@ this code is experimental and needs cleaning - class Preprocessor : public TokenStream<char> + namespace CompilerElements { - public: - virtual - ~Preprocessor () {} - - Preprocessor (TokenStream<char>& is) - : state (PREPROCESSING), - loc_ ("C"), - is_ (is) - { - } - - public: - virtual int_type - next () - { - return out_get (); - } - - private: - int_type - underflow () + namespace CPP { - int_type i = in_get (); - - if (eos (i)) + class Preprocessor : public TokenStream<Token> { - return i; - } + public: + virtual + ~Preprocessor (); - char_type c = to_char_type (i); + Preprocessor (TokenStream<char>& is); - //std::cerr << "next_i: c = " << c << std::endl; + virtual Token + next (); - switch (c) - { - case '\\': return handle_escape (); - case '\"': - { - if (state == STRING_LITERAL) state = PREPROCESSING; - else if (state == PREPROCESSING) state = STRING_LITERAL; - else - { - //@@error - } - break; - } - case '\'': - { - if (state == CHAR_LITERAL) state = PREPROCESSING; - else if (state == PREPROCESSING) state = CHAR_LITERAL; - else - { - //@@error - } - break; - } - case '#': - { - // std::cerr << "see \'#\'; state is " << state << std::endl; - if (state != PREPROCESSING) break; - return handle_preprocessor_token (); - } - } - - return i; - } - - int_type - handle_escape () - { - int_type i = in_get (); - - if (eos (i)) - { - //@@ error - return i; - } - - char_type c = to_char_type (i); - - //@@ '\n' won't work on MS - switch (c) - { - case '\n': return underflow (); //skip it - default: - { - out_buffer_.push_back (i); - return '\\'; - } - } - } - - void - skip_white_space () - { - while (true) - { - int_type i = in_get (); - if (!eos (i)) - { - char_type c = to_char_type (i); - if (std::isspace (c, loc_) && c != '\n') continue; - } + private: + class PreprocessorImpl; - in_put (i); - break; - } + std::auto_ptr<PreprocessorImpl> impl_; + }; } - - int_type - handle_preprocessor_token () - { - // std::cerr << "handle_preprocessor_token" << std::endl; - - skip_white_space (); - - std::string lexeme; - - int_type i; - char_type c; - - while (true) - { - i = in_get (); - - if (eos (i)) - { - //@@ error - return i; - } - - c = to_char_type (i); - - if (std::isalnum (c, loc_)) - { - lexeme += c; - continue; - } - break; - } - - if (lexeme == "include") return handle_preprocessor_include (); - else - { - // skip till newline - while (true) - { - if (c == '\n') break; - - i = in_get (); - - if (eos (i)) - { - //@@ error - return i; - } - - c = to_char_type (i); - } - } - - return underflow (); - } - - - int_type - handle_preprocessor_include () - { - //out_put (std::string ("include")); - - skip_white_space (); - - std::string file; - - int_type i = in_get (); - - if (eos (i)) - { - //@@ error - return i; - } - - char_type c = to_char_type (i); - - char_type finilizer; - - if (c == '\"') finilizer = c; - else if (c == '<') finilizer = '>'; - else - { - //@@error - } - - while (true) - { - i = in_get (); - - if (eos (i)) - { - //@@ error - return i; - } - - c = to_char_type (i); - - if (c == finilizer) break; - - file += c; - } - - //@@ it's probably a good idea to skip until the newline - // and perhaps check that all the rest is whitespace. - - if (finilizer == '>') out_put (std::string("sinclude \"")); - else out_put (std::string("include \"")); - - out_put (file); - out_put ("\";"); - - return out_get (); - } - - - private: - - // Buffer manipulation - - int_type - in_get () - { - if (in_buffer_.empty ()) - { - return is_.next (); - } - else - { - int_type i = in_buffer_.front (); - in_buffer_.pop_front (); - return i; - } - } - - void - in_put (int_type c) - { - in_buffer_.push_back (c); - } - - int_type - out_get () - { - if (out_buffer_.empty ()) - { - return underflow (); - } - else - { - int_type i = out_buffer_.front (); - out_buffer_.pop_front (); - return i; - } - } - - void - out_put (std::string const& str) - { - for (std::string::const_iterator i = str.begin (); i != str.end (); i++) - { - out_buffer_.push_back (*i); - } - } - - void - out_put (int_type c) - { - out_buffer_.push_back (c); - } - - private: - enum State - { - PREPROCESSING, - STRING_LITERAL, - CHAR_LITERAL - } state; - - std::locale loc_; - TokenStream<char>& is_; - std::deque<int_type> in_buffer_; - std::deque<int_type> out_buffer_; - }; + } } -#endif //CCF_PREPROCESSOR_HPP +#endif // CCF_COMPILER_ELEMENTS_PREPROCESSOR_HPP diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp b/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp new file mode 100644 index 00000000000..5f3e629243e --- /dev/null +++ b/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.cpp @@ -0,0 +1,57 @@ +// file : CCF/CompilerElements/PreprocessorToken.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/CompilerElements/PreprocessorToken.hpp" + +namespace CCF +{ + namespace CompilerElements + { + namespace CPP + { + Token const Token::eos; + + Token:: + Token (char c, unsigned long line) + : c_ (traits::to_int_type (c)), line_ (line) + { + } + + Token:: + Token () + : c_ (traits::eof ()), line_ (0) + { + } + + Token:: + operator char () const throw (EOS) + { + if (*this == eos) throw EOS (); + + return traits::to_char_type (c_); + } + + + unsigned long Token:: + line () const throw (EOS) + { + if (*this == eos) throw EOS (); + + return line_; + } + + bool + operator== (Token const& a, Token const& b) + { + return a.c_ == b.c_; + } + + bool + operator!= (Token const& a, Token const& b) + { + return a.c_ != b.c_; + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.hpp new file mode 100644 index 00000000000..5c82076a01c --- /dev/null +++ b/TAO/CIAO/CCF/CCF/CompilerElements/PreprocessorToken.hpp @@ -0,0 +1,58 @@ +// file : CCF/CompilerElements/PreprocessorToken.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP +#define CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP + +#include <string> + +//@@ It is probably a good idea to move preprocessor into a +// separate library. +// + +namespace CCF +{ + namespace CompilerElements + { + namespace CPP + { + class Token + { + public: + static Token const eos; + + public: + Token (char c, unsigned long line); + + class EOS {}; + + operator char () const throw (EOS); + + unsigned long + line () const throw (EOS); + + friend bool + operator== (Token const& a, Token const& b); + + friend bool + operator!= (Token const& a, Token const& b); + + private: + // Constructs eos token. + // + Token (); + + private: + typedef + std::char_traits<char> + traits; + + traits::int_type c_; + unsigned long line_; + }; + } + } +} + +#endif // CCF_COMPILER_ELEMENTS_PREPROCESSOR_TOKEN_HPP diff --git a/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp index 0a9f291eec8..d3132eea980 100644 --- a/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp +++ b/TAO/CIAO/CCF/CCF/CompilerElements/TokenStream.hpp @@ -2,75 +2,77 @@ // author : Boris Kolpackov <boris@dre.vanderbilt.edu> // cvs-id : $Id$ -#ifndef TOKEN_STREAM_HPP -#define TOKEN_STREAM_HPP +#ifndef CCF_COMPILER_ELEMENTS_TOKEN_STREAM_HPP +#define CCF_COMPILER_ELEMENTS_TOKEN_STREAM_HPP #include <string> #include <istream> namespace CCF { - template <typename Token> - class TokenStream + namespace CompilerElements { - public: - virtual Token - next () = 0; - }; - + template <typename Token> + class TokenStream + { + public: + virtual Token + next () = 0; + }; - template <> - class TokenStream<char> - { - public: - typedef - std::char_traits<char> - traits; + template <> + class TokenStream<char> + { + public: + typedef + std::char_traits<char> + traits; - typedef - traits::int_type - int_type; + typedef + traits::int_type + int_type; - typedef - traits::char_type - char_type; + typedef + traits::char_type + char_type; - public: - virtual int_type - next () = 0; + public: + virtual int_type + next () = 0; - char_type - to_char_type (int_type i) - { - return traits::to_char_type (i); - } + static char_type + to_char_type (int_type i) + { + return traits::to_char_type (i); + } - bool - eos (int_type i) - { - return i == traits::eof (); - } - }; + static int_type + eos () + { + return traits::eof (); + } + }; - class InputStreamAdapter : public TokenStream<char> - { - public: - InputStreamAdapter (std::istream& is) - : is_ (is) + class InputStreamAdapter : public TokenStream<char> { - } + public: + InputStreamAdapter (std::istream& is) + : is_ (is) + { + } - public: + public: - virtual int_type - next () - { - return is_.get (); - } + virtual int_type + next () + { + return is_.get (); + } - private: - std::istream& is_; - }; + private: + std::istream& is_; + }; + } } -#endif //TOKEN_STREAM_HPP +#endif // CCF_COMPILER_ELEMENTS_TOKEN_STREAM_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp index 1e665664e05..e70b67cd2db 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp @@ -18,37 +18,41 @@ namespace CCF namespace IDL2 { LexicalAnalyzer:: - LexicalAnalyzer (TokenStream<char>& is) - : loc_ ("C"), - is_ (is), - after_nl (true), - line_ (0) + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is) + : loc_ ("C"), is_ (is) { // Keywords (alphabetic order). // - keyword_table_.insert ("abstract" ); - keyword_table_.insert ("attribute" ); - keyword_table_.insert ("const" ); - keyword_table_.insert ("exception" ); - keyword_table_.insert ("enum" ); - keyword_table_.insert ("factory" ); - keyword_table_.insert ("in" ); - keyword_table_.insert ("include" ); - keyword_table_.insert ("inout" ); - keyword_table_.insert ("interface" ); - keyword_table_.insert ("local" ); - keyword_table_.insert ("module" ); - keyword_table_.insert ("oneway" ); - keyword_table_.insert ("out" ); - keyword_table_.insert ("raises" ); - keyword_table_.insert ("sequence" ); - keyword_table_.insert ("sinclude" ); - keyword_table_.insert ("struct" ); - keyword_table_.insert ("supports" ); - keyword_table_.insert ("typedef" ); - keyword_table_.insert ("typeid" ); - keyword_table_.insert ("typeprefix"); + keyword_table_.insert ("abstract" ); + keyword_table_.insert ("attribute" ); + keyword_table_.insert ("__binclude" ); + keyword_table_.insert ("const" ); + keyword_table_.insert ("custom" ); + keyword_table_.insert ("exception" ); + keyword_table_.insert ("enum" ); + keyword_table_.insert ("factory" ); + keyword_table_.insert ("in" ); + keyword_table_.insert ("inout" ); + keyword_table_.insert ("interface" ); + keyword_table_.insert ("__qinclude" ); + keyword_table_.insert ("local" ); + keyword_table_.insert ("module" ); + keyword_table_.insert ("native" ); + keyword_table_.insert ("oneway" ); + keyword_table_.insert ("out" ); + keyword_table_.insert ("private" ); + keyword_table_.insert ("public" ); + keyword_table_.insert ("raises" ); + keyword_table_.insert ("readonly" ); + keyword_table_.insert ("sequence" ); + keyword_table_.insert ("struct" ); + keyword_table_.insert ("supports" ); + keyword_table_.insert ("truncatable"); + keyword_table_.insert ("typedef" ); + keyword_table_.insert ("typeid" ); + keyword_table_.insert ("typeprefix" ); + keyword_table_.insert ("valuetype" ); // Identifiers (alphabetic order). // @@ -118,66 +122,51 @@ namespace CCF operator_table_.insert ("^"); // xor } - LexicalAnalyzer::Char LexicalAnalyzer:: - get_from_stream () - { - int_type i = is_.next (); - - if (after_nl) - { - after_nl = false; - line_++; - } - - if (i == '\n') after_nl = true; - - return Char (i, line_); - } - LexicalAnalyzer::Char LexicalAnalyzer:: get () { - if (!buffer_.empty ()) + if (!ibuffer_.empty ()) { - Char c = buffer_.front (); - buffer_.pop_front (); + Char c = ibuffer_.front (); + ibuffer_.pop_front (); return c; } else { - return get_from_stream (); + return is_.next (); } } LexicalAnalyzer::Char LexicalAnalyzer:: peek () { - if (buffer_.empty ()) + if (ibuffer_.empty ()) { - buffer_.push_back (get_from_stream ()); + ibuffer_.push_back (is_.next ()); } - return buffer_.front (); + return ibuffer_.front (); } LexicalAnalyzer::Char LexicalAnalyzer:: peek_more () { - if (buffer_.size () < 2) + while (ibuffer_.size () < 2) { - buffer_.push_back (get_from_stream ()); + ibuffer_.push_back (is_.next ()); } - return buffer_.at (1); + return ibuffer_.at (1); } void LexicalAnalyzer:: ret (Char const& c) { - buffer_.push_front (c); + ibuffer_.push_front (c); } + TokenPtr LexicalAnalyzer:: next () { @@ -185,7 +174,7 @@ namespace CCF { Char c = skip_space (get ()); - if (c.is_eof ()) return TokenPtr (new EndOfStream (c.line ())); + if (is_eos (c)) return TokenPtr (new EndOfStream (0)); TokenPtr token; @@ -202,13 +191,13 @@ namespace CCF // Check for identifier last because it can be triggered by // wide string prefix (L"..."). // - if (c.is_alpha (loc_) || c == '_' || (c == ':' && peek () == ':')) + if (is_alpha (c) || c == '_' || (c == ':' && peek () == ':')) { return identifier (c); } cerr << c.line () << ": error: unable to derive any token " - << "from \'" << c.char_ () << "\'" << endl; + << "from \'" << c << "\'" << endl; //Do some primitive error recovery. @@ -216,7 +205,7 @@ namespace CCF while (c != ';') { c = skip_space (get ()); - if (c.is_eof ()) return TokenPtr (new EndOfStream (c.line ())); + if (is_eos (c)) return TokenPtr (new EndOfStream (0)); } } } @@ -224,89 +213,11 @@ namespace CCF LexicalAnalyzer::Char LexicalAnalyzer:: skip_space (Char c) { - bool first (true); - - while (true) - { - if (!first) c = get (); - else first = false; - - if (c.is_eof ()) return c; - - // Handling spaces - if (c.is_space (loc_)) continue; - - // Handling C++ comments - if (c == '/' && peek () == '/') - { - cxx_comment (c); - continue; - } - - // Handling C comments - if (c == '/' && peek () == '*') - { - c_comment (c); - continue; - } + while (!is_eos (c) && is_space (c)) c = get (); - return c; - } + return c; } - - void LexicalAnalyzer:: - cxx_comment (Char c) - { - while (c != '\n') - { - c = get (); - - if (c.is_eof ()) - { - cerr << "warning: no new line at the end of file" - << endl; - - //@@ I wonder if it's ok to call get () again after getting eof. - //@@ no, it's not: istream throws exception (when enabled) on - // second attempt. - break; - } - } - } - - void LexicalAnalyzer:: - c_comment (Char c) - { - get (); // get '*' - - do - { - c = get (); - - if (c.is_eof ()) - { - cerr << "error: end of file before C-style comment finished" - << endl; - return; - - //@@ I wonder if it's ok to call get () again after getting eof. - // No, it is not. - } - - //cerr << "lexer: c_comment: read character \'" << c << "\'" - // << endl; - } - while (c != '*' || peek () != '/'); - - //cerr << "lexer: c_comment: finished C-comment \'" << c - // << "\',\'" << to_char_type (peek ()) - // << "\'" << endl; - - get (); // get '/' - } - - bool LexicalAnalyzer:: read_simple_identifier (string& lexeme, CharBuffer& buf) { @@ -314,27 +225,27 @@ namespace CCF buf.push_back (c); - if (c.is_eof ()) return false; + if (is_eos (c)) return false; - if (c.is_alpha (loc_) || c == '_') + if (is_alpha (c) || c == '_') { - lexeme += c.char_ (); + lexeme += c; while (true) { c = peek (); - if (c.is_eof ()) + if (is_eos (c)) { - cerr << "warning: no new line at the end of file" - << endl; + cerr << "warning: no new line at the end of file" << endl; break; } - if (c.is_alnum (loc_) || c == '_') + if (is_alnum (c) || c == '_') { - buf.push_back (get ()); - lexeme += c.char_ (); + get (); + buf.push_back (c); + lexeme += c; continue; } @@ -349,8 +260,7 @@ namespace CCF bool LexicalAnalyzer:: - traverse_identifier_tree (string& lexeme, - IdentifierTreeNode const& node) + traverse_identifier_tree (string& lexeme, IdentifierTreeNode const& node) { if (node.map_.empty ()) return true; @@ -385,61 +295,61 @@ namespace CCF TokenPtr LexicalAnalyzer:: - identifier (Char first) + identifier (Char c) { - Char c (first); + unsigned long line (c.line ()); string lexeme; enum - { - SIMPLE, - SCOPED, - OTHER - } type = SIMPLE; + { + simple, + scoped, + other + } type = simple; if (c == ':') { - if((c = get ()) != ':') + //@@ not checking for eos here + if ((c = get ()) != ':') { cerr << "error: " << c.line () << ": \':\' expected." << endl; - return TokenPtr (new EndOfStream (c.line ())); + return TokenPtr (new EndOfStream (0)); //@@ error handling is lame for lexical analyzer. } lexeme = "::"; - type = SCOPED; + type = scoped; c = get (); } // First caracter of an identifier. // - if (c.is_eof ()) + if (is_eos (c)) { cerr << "error: invalid identifier" << endl; - return TokenPtr (new EndOfStream (c.line ())); + return TokenPtr (new EndOfStream (0)); } - if (c.is_alpha (loc_) || c == '_') + if (is_alpha (c) || c == '_') { - lexeme += c.char_ (); + lexeme += c; } else { cerr << "error: invalid identifier" << endl; - return TokenPtr (new EndOfStream (c.line ())); + return TokenPtr (new EndOfStream (0)); } while (true) { c = peek (); - if (c.is_eof ()) + if (is_eos (c)) { - cerr << "warning: no new line at the end of file" - << endl; + cerr << "warning: no new line at the end of file" << endl; break; } @@ -447,10 +357,10 @@ namespace CCF // << "\'; current lexeme \'" << lexeme << "\'" // << endl; - if (c.is_alnum (loc_) || c == '_') + if (is_alnum (c) || c == '_') { get (); - lexeme += c.char_ (); + lexeme += c; continue; } @@ -459,7 +369,7 @@ namespace CCF get (); get (); lexeme += "::"; - if (type == SIMPLE) type = OTHER; + if (type == simple) type = other; continue; } @@ -469,7 +379,7 @@ namespace CCF //cerr << "lexer: found identifier with lexeme \'" // << lexeme << "\'" << endl; - if (type == SIMPLE) + if (type == simple) { // Check if it's a keyword. { @@ -477,7 +387,7 @@ namespace CCF if (i != keyword_table_.end ()) { - return TokenPtr (new Keyword (*i, first.line ())); + return TokenPtr (new Keyword (*i, line)); } } @@ -493,7 +403,7 @@ namespace CCF if (traverse_identifier_tree (lexeme, i->second)) { return TokenPtr ( - new SimpleIdentifier (lexeme, first.line ())); + new SimpleIdentifier (lexeme, line)); } else { @@ -506,26 +416,28 @@ namespace CCF // if (lexeme == "TRUE" || lexeme == "FALSE") { - return TokenPtr (new BooleanLiteral (lexeme, line_)); + return TokenPtr (new BooleanLiteral (lexeme, line)); } // Default to SimpleIdentifier. // - return TokenPtr (new SimpleIdentifier (lexeme, line_)); + return TokenPtr (new SimpleIdentifier (lexeme, line)); } - else if (type == SCOPED) + else if (type == scoped) { - return TokenPtr (new ScopedIdentifier (lexeme, first.line ())); + return TokenPtr (new ScopedIdentifier (lexeme, line)); } - else //type == OTHER + else //type == other { - return TokenPtr (new Identifier (lexeme, first.line ())); + return TokenPtr (new Identifier (lexeme, line)); } } bool LexicalAnalyzer:: punctuation (Char c, TokenPtr& token) { + unsigned long line (c.line ()); + PunctuationTable::const_iterator i = punctuation_table_.begin (); while (true) @@ -538,7 +450,7 @@ namespace CCF { Char pc (peek ()); - if (!pc.is_eof () && (*i)[1] == pc) + if (!is_eos (pc) && (*i)[1] == pc) { get (); } @@ -551,7 +463,7 @@ namespace CCF } } - token = TokenPtr (new Punctuation (*i, c.line ()));; + token = TokenPtr (new Punctuation (*i, line)); return true; } } @@ -559,6 +471,8 @@ namespace CCF bool LexicalAnalyzer:: operator_ (Char c, TokenPtr& token) { + unsigned long line (c.line ()); + OperatorTable::const_iterator i = operator_table_.begin (); while (true) @@ -571,7 +485,7 @@ namespace CCF { Char pc (peek ()); - if (!pc.is_eof () && (*i)[1] == pc) + if (!is_eos (pc) && (*i)[1] == pc) { get (); } @@ -584,7 +498,7 @@ namespace CCF } } - token = TokenPtr (new Operator (*i, c.line ()));; + token = TokenPtr (new Operator (*i, line)); return true; } } @@ -656,13 +570,9 @@ namespace CCF { // hex - char c = *++s; + char c (*++s); - //@@ should use is_hex_digit - // - if((c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F')) + if(is_hex_digit (c)) { // Maximum 2 digits. // @@ -747,15 +657,16 @@ namespace CCF { if (c != '\'') return false; + unsigned long line (c.line ()); string lexeme; Char prev (c); while (true) { - Char c = get (); + c = get (); - if (c.is_eof ()) + if (is_eos (c)) { cerr << "error: end of file while reading character literal" << endl; @@ -764,7 +675,7 @@ namespace CCF if (c == '\'' && prev != '\\') break; - lexeme += c.char_ (); + lexeme += c; prev = c; } @@ -773,7 +684,7 @@ namespace CCF pair<char, size_t> r (scan_char (lexeme.c_str ())); if (r.second != lexeme.size ()) throw Format (); - token = TokenPtr (new CharacterLiteral (r.first, lexeme, c.line ())); + token = TokenPtr (new CharacterLiteral (r.first, lexeme, line)); return true; } catch (Format const&) @@ -788,6 +699,7 @@ namespace CCF { if (c != '\"') return false; + unsigned long line (c.line ()); string lexeme; string value; @@ -802,7 +714,7 @@ namespace CCF // Check if there are more strings. // - Char c = skip_space (get ()); + c = skip_space (get ()); if (c != '\"') { @@ -811,7 +723,7 @@ namespace CCF } - // Add single space as string separator. + // Add single space as a string separator. // lexeme += " "; } @@ -819,7 +731,7 @@ namespace CCF // cerr << "string literal: <" << lexeme << ">/<" << value << ">" // << endl; - token = TokenPtr (new StringLiteral (value, lexeme, c.line ())); + token = TokenPtr (new StringLiteral (value, lexeme, line)); return true; } catch (Format const&) @@ -840,7 +752,7 @@ namespace CCF { Char c = get (); - if (c.is_eof ()) + if (is_eos (c)) { cerr << "error: end of file while reading string literal" << endl; break; @@ -848,7 +760,7 @@ namespace CCF if (c == '\"' && prev != '\\') break; - r += c.char_ (); + r += c; prev = c; } @@ -860,33 +772,31 @@ namespace CCF throw (Format, Boundary) { unsigned long long const max (~0ULL); - unsigned long long bound (max / base); + char const* p (s.c_str ()); // Skip leading 0 if any. // while (*p != '\0' && *p == '0') ++p; + unsigned long long result (0); while(*p != '\0') { unsigned short digit; - //@@ I am using Char here just because I need - // manipulation functions. That's very bad. - // - Char c (Char (*p).to_upper (loc_)); + char c (to_upper (*p)); - if (c.is_dec_digit (loc_)) + if (is_dec_digit (c)) { - digit = c.char_ () - '0'; + digit = c - '0'; } - else if (c.is_hex_digit (loc_)) + else if (is_hex_digit (c)) { - digit = c.char_ () - 'A' + 10; + digit = c - 'A' + 10; } else { @@ -917,15 +827,15 @@ namespace CCF // integer_literal). // bool LexicalAnalyzer:: - integer_literal (Char first, TokenPtr& token) + integer_literal (Char c, TokenPtr& token) { try { - Char c (first); + if (!is_dec_digit (c)) return false; - if (!c.is_dec_digit (loc_)) return false; + unsigned long line (c.line ()); - ret (c); // Temporary return the character. + ret (c); // Temporarily return the character. string lexeme, number; @@ -936,27 +846,28 @@ namespace CCF // if (c == '0') { - lexeme += c.char_ (); + lexeme += c; get (); Char pc (peek ()); - if (!pc.is_eof ()) + if (!is_eos (pc)) { if (pc == 'x' || pc == 'X') { + get (); base = 16; - lexeme += get ().char_ (); + lexeme += pc; c = peek (); } else { base = 8; - if (!pc.is_oct_digit (loc_)) + if (!is_oct_digit (pc)) { - number += c.char_ (); // this is needed to handle single 0 + number += c; // this is needed to handle single 0 } c = pc; @@ -964,7 +875,7 @@ namespace CCF } else { - number += c.char_ (); // this is needed to handle single 0 + number += c; // this is needed to handle single 0 } } @@ -973,25 +884,25 @@ namespace CCF // Make sure c is a legal character. // - if (c.is_eof ()) break; + if (is_eos (c)) break; - if (base == 8 && !c.is_oct_digit (loc_)) + if (base == 8 && !is_oct_digit (c)) { break; } - else if (base == 10 && !c.is_dec_digit (loc_)) + else if (base == 10 && !is_dec_digit (c)) { break; } - else if (!c.is_hex_digit (loc_)) + else if (!is_hex_digit (c)) { break; } get (); - lexeme += c.char_ (); - number += c.char_ (); + lexeme += c; + number += c; c = peek (); } @@ -1003,7 +914,7 @@ namespace CCF //cerr << "integer literal: <" << lexeme << ">/<" << number << ">/<" // << value << ">" << endl; - token = TokenPtr (new IntegerLiteral (value, lexeme, first.line ())); + token = TokenPtr (new IntegerLiteral (value, lexeme, line)); return true; } catch (Format const&) diff --git a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp index c5026369b5a..e912cb9c313 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp @@ -5,16 +5,16 @@ #ifndef CCF_IDL2_LEXICAL_ANALYZER_HPP #define CCF_IDL2_LEXICAL_ANALYZER_HPP +//@@ I wonder what I actually use from this list. +// #include <set> #include <map> #include <deque> #include <locale> -#include <cctype> #include <string> -#include <istream> #include "CCF/CompilerElements/TokenStream.hpp" - +#include "CCF/CompilerElements/PreprocessorToken.hpp" #include "CCF/IDL2/Token.hpp" namespace CCF @@ -25,170 +25,29 @@ namespace CCF // // - class LexicalAnalyzer : public TokenStream<TokenPtr> + class LexicalAnalyzer : public CompilerElements::TokenStream<TokenPtr> { public: virtual ~LexicalAnalyzer () throw () {} public: - LexicalAnalyzer (TokenStream<char>& is); - virtual TokenPtr - next (); - - protected: typedef - TokenStream<char>::int_type - int_type; + CompilerElements::CPP::Token + Char; typedef - TokenStream<char>::char_type - char_type; - - typedef - TokenStream<char>::traits - traits; - - struct Char - { - Char (int_type c, unsigned long line = 0) - : c_ (c), line_ (line) - { - } - - public: - bool - is_eof () const - { - return !traits::not_eof (c_); - } - - bool - is_alpha (std::locale const& l) const - { - return std::isalpha (char_ (), l); - } - - bool - is_oct_digit (std::locale const& l) const - { - char_type c (char_ ()); - - return std::isdigit (c, l) && c != '8' && c != '9'; - } - - bool - is_dec_digit (std::locale const& l) const - { - return std::isdigit (char_ (), l); - } - - bool - is_hex_digit (std::locale const& l) const - { - return std::isxdigit (char_ (), l); - } - - bool - is_alnum (std::locale const& l) const - { - return std::isalnum (char_ (), l); - } - - bool - is_space (std::locale const& l) const - { - return std::isspace (char_ (), l); - } - - Char - to_upper (std::locale const& l) const - { - return Char (std::toupper (char_ (), l), line_); - } - - public: - char_type - char_ () const - { - return traits::to_char_type (c_); - } - - unsigned long - line () const - { - return line_; - } - - public: - friend bool - operator== (Char const& a, Char const& b) - { - return a.is_eof () && b.is_eof () || a.char_ () == b.char_ (); - } - - friend bool - operator== (Char const& a, char b) - { - return !a.is_eof () && a.char_ () == b; - } - - friend bool - operator== (char a, Char const& b) - { - return b == a; - } - - friend bool - operator!= (Char const& a, Char const& b) - { - return !(a.is_eof () && b.is_eof () || a.char_ () == b.char_ ()); - } - - friend bool - operator!= (Char const& a, char b) - { - return a.is_eof () || a.char_ () != b; - } - - friend bool - operator!= (char a, Char const& b) - { - return b != a; - } + std::deque<Char> + CharBuffer; - private: - int_type c_; - unsigned long line_; - }; + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is); + virtual TokenPtr + next (); protected: virtual Char - get (); - - virtual Char - peek (); - - virtual Char - peek_more (); - - virtual void - ret (Char const& c); - - /* - char_type - to_char_type (int_type i); - */ - - virtual void - cxx_comment (Char c); - - virtual void - c_comment (Char c); - - virtual Char skip_space (Char c); virtual TokenPtr @@ -212,6 +71,9 @@ namespace CCF virtual bool integer_literal (Char c, TokenPtr& token); + // Literal scanners. + // + // class Format {}; class Boundary {}; @@ -226,6 +88,70 @@ namespace CCF throw (Format, Boundary); protected: + virtual Char + get (); + + virtual Char + peek (); + + virtual Char + peek_more (); + + virtual void + ret (Char const& c); + + protected: + // Character utility functions. + // + bool + is_alpha (char c) const + { + return std::isalpha (c, loc_); + } + + bool + is_oct_digit (char c) const + { + return std::isdigit (c, loc_) && c != '8' && c != '9'; + } + + bool + is_dec_digit (char c) const + { + return std::isdigit (c, loc_); + } + + bool + is_hex_digit (char c) const + { + return std::isxdigit (c, loc_); + } + + bool + is_alnum (char c) const + { + return std::isalnum (c, loc_); + } + + bool + is_space (char c) const + { + return std::isspace (c, loc_); + } + + bool + is_eos (Char const& c) const + { + return c == Char::eos; + } + + char + to_upper (char c) const + { + return std::toupper (c, loc_); + } + + protected: typedef std::set<std::string> KeywordTable; @@ -253,15 +179,7 @@ namespace CCF std::set<std::string> OperatorTable; - typedef - std::deque<Char> - CharBuffer; - protected: - - Char - get_from_stream (); - bool read_simple_identifier (std::string& lexeme, CharBuffer& buf); @@ -272,20 +190,14 @@ namespace CCF protected: std::locale loc_; - TokenStream<char>& is_; + CompilerElements::TokenStream<Char>& is_; + + CharBuffer ibuffer_; KeywordTable keyword_table_; IdentifierTreeNode identifier_tree_; PunctuationTable punctuation_table_; OperatorTable operator_table_; - - // line numbering mechanism - bool after_nl; - unsigned long line_; - - // look ahead mechanism - - CharBuffer buffer_; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive index 4fe3e2bf4df..54547c96912 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive +++ b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive @@ -24,6 +24,7 @@ translated_units := SemanticGraph/Attribute.o \ SemanticGraph/Member.o \ SemanticGraph/Module.o \ SemanticGraph/Name.o \ + SemanticGraph/Native.o \ SemanticGraph/Operation.o \ SemanticGraph/Sequence.o \ SemanticGraph/Struct.o \ @@ -40,6 +41,7 @@ translated_units += Traversal/Attribute.o \ Traversal/Interface.o \ Traversal/Member.o \ Traversal/Module.o \ + Traversal/Native.o \ Traversal/Operation.o \ Traversal/Sequence.o \ Traversal/Struct.o \ @@ -58,10 +60,12 @@ translated_units += SemanticAction/Impl/Attribute.o \ SemanticAction/Impl/Interface.o \ SemanticAction/Impl/Member.o \ SemanticAction/Impl/Module.o \ + SemanticAction/Impl/Native.o \ SemanticAction/Impl/Operation.o \ SemanticAction/Impl/Struct.o \ SemanticAction/Impl/TypeId.o \ - SemanticAction/Impl/Typedef.o + SemanticAction/Impl/Typedef.o \ + SemanticAction/Impl/ValueType.o module_base := IDL2 module_prefix := diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp index e5ef98bf15a..f6b3433f57b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp @@ -32,28 +32,35 @@ namespace CCF error_handler (context, dout), - ABSTRACT ("abstract" ), - ATTRIBUTE ("attribute" ), - CONST ("const" ), - ENUM ("enum" ), - EXCEPTION ("exception" ), - FACTORY ("factory" ), - IN ("in" ), - INCLUDE ("include" ), - INOUT ("inout" ), - INTERFACE ("interface" ), - LOCAL ("local" ), - MODULE ("module" ), - ONEWAY ("oneway" ), - OUT ("out" ), - RAISES ("raises" ), - SEQUENCE ("sequence" ), - SINCLUDE ("sinclude" ), - STRUCT ("struct" ), - SUPPORTS ("supports" ), - TYPEDEF ("typedef" ), - TYPEID ("typeid" ), - TYPEPREFIX ("typeprefix" ), + ABSTRACT ("abstract" ), + ATTRIBUTE ("attribute" ), + BINCLUDE ("__binclude" ), + CONST ("const" ), + CUSTOM ("custom" ), + ENUM ("enum" ), + EXCEPTION ("exception" ), + FACTORY ("factory" ), + IN ("in" ), + INOUT ("inout" ), + INTERFACE ("interface" ), + QINCLUDE ("__qinclude" ), + LOCAL ("local" ), + MODULE ("module" ), + NATIVE ("native" ), + ONEWAY ("oneway" ), + OUT ("out" ), + PRIVATE ("private" ), + PUBLIC ("public" ), + RAISES ("raises" ), + READONLY ("readonly" ), + SEQUENCE ("sequence" ), + STRUCT ("struct" ), + SUPPORTS ("supports" ), + TRUNCATABLE ("truncatable"), + TYPEDEF ("typedef" ), + TYPEID ("typeid" ), + TYPEPREFIX ("typeprefix" ), + VALUETYPE ("valuetype" ), COLON (":"), COMMA (","), @@ -83,12 +90,21 @@ namespace CCF // Attribute // // + act_attribute_begin_ro ( + f.attribute (), &SemanticAction::Attribute::begin_ro), + + act_attribute_begin_rw ( + f.attribute (), &SemanticAction::Attribute::begin_rw), + act_attribute_type ( f.attribute (), &SemanticAction::Attribute::type), act_attribute_name ( f.attribute (), &SemanticAction::Attribute::name), + act_attribute_end ( + f.attribute (), &SemanticAction::Attribute::end), + // Enum // // @@ -117,17 +133,19 @@ namespace CCF act_exception_end ( f.exception (), &SemanticAction::Exception::end), + // Include // // - act_include_begin (f.include (), &SemanticAction::Include::begin), - act_include_end (f.include (), &SemanticAction::Include::end), + act_include_quote ( + f.include (), &SemanticAction::Include::quote), + + act_include_bracket ( + f.include (), &SemanticAction::Include::bracket), - act_system_include_begin ( - f.system_include (), &SemanticAction::SystemInclude::begin), + act_include_end ( + f.include (), &SemanticAction::Include::end), - act_system_include_end ( - f.system_include (), &SemanticAction::SystemInclude::end), // Interface // @@ -173,6 +191,8 @@ namespace CCF act_member_name ( f.member (), &SemanticAction::Member::name), + act_member_end ( + f.member (), &SemanticAction::Member::end), // Module // @@ -188,6 +208,16 @@ namespace CCF act_module_end (f.module (), &SemanticAction::Module::end), + // Native + // + // + act_native_name ( + f.native (), &SemanticAction::Native::name), + + act_native_end ( + f.native (), &SemanticAction::Native::end), + + // Operation // // @@ -258,7 +288,37 @@ namespace CCF &SemanticAction::TypePrefix::begin), act_type_prefix_end (f.type_prefix (), - &SemanticAction::TypePrefix::end) + &SemanticAction::TypePrefix::end), + + // ValueType + // + // + act_abstract_value_type_begin_def ( + f.value_type (), &SemanticAction::ValueType::begin_abstract_def), + + act_abstract_value_type_begin_fwd ( + f.value_type (), &SemanticAction::ValueType::begin_abstract_fwd), + + act_concrete_value_type_begin_def ( + f.value_type (), &SemanticAction::ValueType::begin_concrete_def), + + act_concrete_value_type_begin_fwd ( + f.value_type (), &SemanticAction::ValueType::begin_concrete_fwd), + + act_value_type_inherits ( + f.value_type (), &SemanticAction::ValueType::inherits), + + act_value_type_supports ( + f.value_type (), &SemanticAction::ValueType::supports), + + act_value_type_open_scope ( + f.value_type (), &SemanticAction::Scope::open_scope), + + act_value_type_close_scope ( + f.value_type (), &SemanticAction::Scope::close_scope), + + act_value_type_end ( + f.value_type (), &SemanticAction::ValueType::end) { language = guard @@ -278,39 +338,45 @@ namespace CCF ; */ - import = - include_decl - | system_include_decl + import = include_decl ; include_decl = - INCLUDE - >> string_literal[act_include_begin] + ( + (QINCLUDE >> string_literal[act_include_quote]) + | (BINCLUDE >> string_literal[act_include_bracket]) + ) >> SEMI[act_include_end] ; - system_include_decl = - SINCLUDE - >> string_literal[act_system_include_begin] - >> SEMI[act_system_include_end] - ; + // There are two classes of types: First class include + // interface and valuetype. Seond class include all other + // types like struct, etc. I wonder how I can represent it + // in the grammar. + // declaration = abstract_type_decl | const_decl - | enum_decl - | exception_decl | extension | local_type_decl | module_decl - | struct_decl - | typedef_ - | type_id - | type_prefix + | type_decl + | type_id_decl + | type_prefix_decl | unconstrained_interface_decl + | concrete_value_type_decl ; - type_id = + type_decl = + enum_decl + | exception_decl + | native_decl + | struct_decl + | typedef_decl + ; + + type_id_decl = TYPEID >> ( identifier @@ -319,7 +385,7 @@ namespace CCF >> SEMI[act_type_id_end] ; - type_prefix = + type_prefix_decl = TYPEPREFIX >> ( identifier @@ -334,7 +400,9 @@ namespace CCF ( assertion ("interface or valuetype declaration expected") ( - INTERFACE >> assertion ()(abstract_interface_decl) + (INTERFACE >> assertion ()(abstract_interface_decl)) + | + (VALUETYPE >> assertion ()(abstract_value_type_decl)) ) )[error_handler] ; @@ -502,6 +570,7 @@ namespace CCF enumerator_decl = identifier[act_enum_enumerator]; + // interface // // @@ -600,6 +669,23 @@ namespace CCF )[error_handler] ; + interface_inheritance_spec = + assertion ("interface name expected", + f.interface (), + &SemanticAction::Interface::end) + ( + identifier[act_interface_inherits] + ) + >> *( + COMMA + >> assertion ("interface name expected", + f.interface (), + &SemanticAction::Interface::end) + ( + identifier[act_interface_inherits] + ) + ) + ; interface_def_trailer = interface_body @@ -655,28 +741,14 @@ namespace CCF ; */ - - interface_inheritance_spec = - assertion ("interface name expected", - f.interface (), - &SemanticAction::Interface::end) - ( - identifier[act_interface_inherits] - ) - >> *( - COMMA - >> assertion ("interface name expected", - f.interface (), - &SemanticAction::Interface::end) - ( - identifier[act_interface_inherits] - ) - ) - ; - interface_body = *( - attribute_decl + const_decl + | type_decl + | type_id_decl + | type_prefix_decl + + | attribute_decl | operation_decl ) ; @@ -686,10 +758,14 @@ namespace CCF // // attribute_decl = - ATTRIBUTE + ( + (READONLY >> ATTRIBUTE)[act_attribute_begin_ro] + | + ATTRIBUTE[act_attribute_begin_rw] + ) >> identifier[act_attribute_type] >> simple_identifier[act_attribute_name] - >> SEMI + >> SEMI[act_attribute_end] ; @@ -725,17 +801,18 @@ namespace CCF // member_decl = identifier[act_member_type] - >> member_declarator_list - >> SEMI + >> simple_identifier[act_member_name] + >> *(COMMA >> simple_identifier[act_member_name]) + >> SEMI[act_member_end] ; - - member_declarator_list = - identifier[act_member_name] - >> *( - COMMA - >> identifier[act_member_name] - ) + // native + // + // + native_decl = + NATIVE + >> simple_identifier[act_native_name] + >> SEMI[act_native_end] ; @@ -853,10 +930,11 @@ namespace CCF // // - typedef_ = + typedef_decl = TYPEDEF >> typedef_type_spec - >> typedef_declarator_list + >> simple_identifier[act_typedef_declarator] + >> *(COMMA >> simple_identifier[act_typedef_declarator]) >> SEMI[act_typedef_end] ; @@ -865,13 +943,175 @@ namespace CCF | SEQUENCE >> LT >> identifier[act_typedef_begin_seq] >> GT ; - typedef_declarator_list = - identifier[act_typedef_declarator] + + // valuetype + // + // + abstract_value_type_decl = + guard + ( + ( + simple_identifier + >> SEMI + )[act_abstract_value_type_begin_fwd][act_value_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_abstract_value_type_begin_def] + + >> value_type_inheritance_spec + >> !(SUPPORTS >> value_type_supports_spec) + >> LBRACE[act_value_type_open_scope] + >> value_type_def_trailer + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_abstract_value_type_begin_def] + + >> value_type_supports_spec + >> LBRACE[act_value_type_open_scope] + >> value_type_def_trailer + ) + | + ( + ( + simple_identifier + >> LBRACE + )[act_abstract_value_type_begin_def][act_value_type_open_scope] + + >> value_type_def_trailer + ) + )[error_handler] + ; + + concrete_value_type_decl = + guard + ( + VALUETYPE + >> ( + ( + simple_identifier + >> SEMI + )[act_concrete_value_type_begin_fwd][act_value_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_concrete_value_type_begin_def] + + >> value_type_inheritance_spec + >> !(SUPPORTS >> value_type_supports_spec) + >> LBRACE[act_value_type_open_scope] + >> value_type_def_trailer + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_concrete_value_type_begin_def] + + >> value_type_supports_spec + >> LBRACE[act_value_type_open_scope] + >> value_type_def_trailer + ) + | + ( + ( + simple_identifier + >> LBRACE + )[act_concrete_value_type_begin_def][act_value_type_open_scope] + + >> value_type_def_trailer + ) + ) + )[error_handler] + ; + + + value_type_inheritance_spec = + identifier[act_value_type_inherits] + >> *( + COMMA + >> identifier[act_value_type_inherits] + ) + ; + + value_type_supports_spec = + identifier[act_value_type_supports] >> *( COMMA - >> identifier[act_typedef_declarator] + >> identifier[act_value_type_supports] ) ; + + value_type_def_trailer = + value_type_body + >> RBRACE[act_value_type_close_scope] + >> SEMI[act_value_type_end] + ; + + value_type_body = + *( + const_decl + | type_decl + | type_id_decl + | type_prefix_decl + + | attribute_decl + | operation_decl + | value_type_member_decl + | value_type_factory_decl + ) + ; + + + // valuetype member + // + // + value_type_member_decl = + (PUBLIC | PRIVATE) + >> identifier // [act_member_type] + >> simple_identifier // [act_member_name] + >> *(COMMA >> simple_identifier /*[act_member_name]*/) + >> SEMI + ; + + // valuetype factory + // + // + value_type_factory_decl = + FACTORY + >> simple_identifier //[act_value_type_factory_name] + >> LPAREN + >> value_type_factory_parameter_list + >> RPAREN + >> !(RAISES >> LPAREN >> value_type_factory_raises_list >> RPAREN) + >> SEMI + ; + + value_type_factory_parameter_list = + *( + value_type_factory_parameter + >> *(COMMA >> value_type_factory_parameter) + ) + ; + + value_type_factory_parameter = + IN + >> (identifier >> simple_identifier) //[act_value_type_factory_parameter] + ; + + value_type_factory_raises_list = + identifier //[act_value_type_factory_raises] + >> *(COMMA >> identifier) // [act_value_type_factory_raises]) + ; } } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp index 65b30935a61..cb840da7b6c 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp @@ -298,34 +298,44 @@ namespace CCF ErrorHandler error_handler; RootErrorHandler root_error_handler; - // End of stream parser + // End of stream parser. + // EndOfStreamParser EOS; // Keyword parsers (alphabetic order). + // KeywordParser ABSTRACT; KeywordParser ATTRIBUTE; + KeywordParser BINCLUDE; KeywordParser CONST; + KeywordParser CUSTOM; KeywordParser ENUM; KeywordParser EXCEPTION; KeywordParser FACTORY; KeywordParser IN; - KeywordParser INCLUDE; KeywordParser INOUT; KeywordParser INTERFACE; + KeywordParser QINCLUDE; KeywordParser LOCAL; KeywordParser MODULE; + KeywordParser NATIVE; KeywordParser ONEWAY; KeywordParser OUT; + KeywordParser PRIVATE; + KeywordParser PUBLIC; KeywordParser RAISES; + KeywordParser READONLY; KeywordParser SEQUENCE; - KeywordParser SINCLUDE; KeywordParser STRUCT; KeywordParser SUPPORTS; + KeywordParser TRUNCATABLE; KeywordParser TYPEDEF; KeywordParser TYPEID; KeywordParser TYPEPREFIX; + KeywordParser VALUETYPE; // Punctuation parsers (alphabetic group order). + // PunctuationParser COLON; PunctuationParser COMMA; PunctuationParser LBRACE; @@ -371,7 +381,8 @@ namespace CCF Rule extension; Rule include_decl; - Rule system_include_decl; + + Rule type_decl; Rule module_decl; @@ -402,8 +413,8 @@ namespace CCF Rule abstract_interface_decl; Rule local_interface_decl; Rule unconstrained_interface_decl; - Rule interface_def_trailer; Rule interface_inheritance_spec; + Rule interface_def_trailer; Rule interface_body; Rule attribute_decl; @@ -414,7 +425,8 @@ namespace CCF Rule direction_specifier; Rule member_decl; - Rule member_declarator_list; + + Rule native_decl; Rule operation_decl; Rule operation_decl_trailer; @@ -426,12 +438,25 @@ namespace CCF Rule struct_def_trailer; Rule struct_body; - Rule typedef_; + Rule typedef_decl; Rule typedef_type_spec; - Rule typedef_declarator_list; - Rule type_id; - Rule type_prefix; + Rule type_id_decl; + Rule type_prefix_decl; + + Rule abstract_value_type_decl; + Rule concrete_value_type_decl; + Rule value_type_inheritance_spec; + Rule value_type_supports_spec; + Rule value_type_def_trailer; + Rule value_type_body; + + Rule value_type_member_decl; + + Rule value_type_factory_decl; + Rule value_type_factory_parameter_list; + Rule value_type_factory_parameter; + Rule value_type_factory_raises_list; public: Parser (CompilerElements::Context& context, @@ -458,12 +483,18 @@ namespace CCF // Attribute // // + NoArgAction<SemanticAction::Attribute> + act_attribute_begin_ro, act_attribute_begin_rw; + OneArgAction<IdentifierPtr, SemanticAction::Attribute> act_attribute_type; OneArgAction<SimpleIdentifierPtr, SemanticAction::Attribute> act_attribute_name; + NoArgAction<SemanticAction::Attribute> + act_attribute_end; + // Enum // // @@ -488,21 +519,16 @@ namespace CCF NoArgAction<SemanticAction::Exception> act_exception_end; + // Include // // OneArgAction<StringLiteralPtr, SemanticAction::Include> - act_include_begin; + act_include_quote, act_include_bracket; NoArgAction<SemanticAction::Include> act_include_end; - OneArgAction<StringLiteralPtr, SemanticAction::SystemInclude> - act_system_include_begin; - - NoArgAction<SemanticAction::SystemInclude> - act_system_include_end; - // Interface // @@ -537,6 +563,8 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Member> act_member_name; + NoArgAction<SemanticAction::Member> + act_member_end; // Module // @@ -553,6 +581,15 @@ namespace CCF NoArgAction<SemanticAction::Module> act_module_end; + // Native + // + // + OneArgAction<SimpleIdentifierPtr, SemanticAction::Native> + act_native_name; + + NoArgAction<SemanticAction::Native> + act_native_end; + // Operation // @@ -657,6 +694,28 @@ namespace CCF NoArgAction<SemanticAction::TypePrefix> act_type_prefix_end; + + + // ValueType + // + // + OneArgAction<SimpleIdentifierPtr, SemanticAction::ValueType> + act_abstract_value_type_begin_def, + act_abstract_value_type_begin_fwd, + act_concrete_value_type_begin_def, + act_concrete_value_type_begin_fwd; + + OneArgAction<IdentifierPtr, SemanticAction::ValueType> + act_value_type_inherits, act_value_type_supports; + + ScopeAction + act_value_type_open_scope; + + ScopeAction + act_value_type_close_scope; + + NoArgAction<SemanticAction::ValueType> + act_value_type_end; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp index c21381818c6..3be5c7dac15 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction.hpp @@ -14,10 +14,12 @@ #include "CCF/IDL2/SemanticAction/Interface.hpp" #include "CCF/IDL2/SemanticAction/Member.hpp" #include "CCF/IDL2/SemanticAction/Module.hpp" +#include "CCF/IDL2/SemanticAction/Native.hpp" #include "CCF/IDL2/SemanticAction/Operation.hpp" #include "CCF/IDL2/SemanticAction/Struct.hpp" #include "CCF/IDL2/SemanticAction/Typedef.hpp" #include "CCF/IDL2/SemanticAction/TypeId.hpp" #include "CCF/IDL2/SemanticAction/Factory.hpp" +#include "CCF/IDL2/SemanticAction/ValueType.hpp" #endif // CCF_IDL2_SEMANTIC_ACTION_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp index 3fd8a8a196f..29a084d0e19 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp @@ -23,10 +23,19 @@ namespace CCF ~Attribute () throw () {} virtual void + begin_ro () = 0; + + virtual void + begin_rw () = 0; + + virtual void type (IdentifierPtr const& id) = 0; virtual void name (SimpleIdentifierPtr const& id) = 0; + + virtual void + end () = 0; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp index 4c3b9b182f5..9258ba7d9f6 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp @@ -18,12 +18,13 @@ namespace CCF class Interface; class Member; class Module; + class Native; class Operation; class Struct; - class SystemInclude; class Typedef; class TypeId; class TypePrefix; + class ValueType; // // @@ -55,15 +56,15 @@ namespace CCF virtual Module& module () = 0; + virtual Native& + native () = 0; + virtual Operation& operation () = 0; virtual Struct& struct_ () = 0; - virtual SystemInclude& - system_include () = 0; - virtual Typedef& typedef_ () = 0; @@ -72,6 +73,11 @@ namespace CCF virtual TypePrefix& type_prefix () = 0; + + //@@ In some places I use 'value_type' and in others 'valuetype'. + // + virtual ValueType& + value_type () = 0; }; } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp index 065f443eb51..c1928d0b807 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp @@ -31,11 +31,25 @@ namespace CCF } void Attribute:: - type (IdentifierPtr const& id) + begin_ro () { - if (ctx.trace ()) cerr << "attribute " << id; + if (ctx.trace ()) cerr << "readonly attribute" << endl; + + a_ = &ctx.tu ().new_node<ReadAttribute> (); + } - type_ = 0; + void Attribute:: + begin_rw () + { + if (ctx.trace ()) cerr << "readwrite attribute" << endl; + + a_ = &ctx.tu ().new_node<ReadWriteAttribute> (); + } + + void Attribute:: + type (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << id << endl; Name name (id->lexeme ()); ScopedName from (ctx.scope ().scoped_name ()); @@ -44,7 +58,9 @@ namespace CCF { try { - type_ = &resolve<Type> (from, name, complete); + Type& t (resolve<Type> (from, name, complete)); + + ctx.tu ().new_edge<Belongs> (*a_, t); } catch (Resolve const&) { @@ -73,16 +89,15 @@ namespace CCF void Attribute:: name (SimpleIdentifierPtr const& id) { - if (ctx.trace ()) cerr << " " << id << endl; + if (ctx.trace ()) cerr << id << endl; - if (type_) - { - SemanticGraph::Attribute& a ( - ctx.tu ().new_node<SemanticGraph::Attribute> ()); + ctx.tu ().new_edge<Defines> (ctx.scope (), *a_, id->lexeme ()); + } - ctx.tu ().new_edge<Belongs> (a, *type_); - ctx.tu ().new_edge<Defines> (ctx.scope (), a, id->lexeme ()); - } + void Attribute:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; } } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp index f3e06941b6d..f14f272ade2 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp @@ -29,13 +29,22 @@ namespace CCF Attribute (Context& c); virtual void + begin_ro (); + + virtual void + begin_rw (); + + virtual void type (IdentifierPtr const& id); virtual void name (SimpleIdentifierPtr const& id); + virtual void + end (); + private: - SemanticGraph::Type* type_; + SemanticGraph::Attribute* a_; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp index ffec220d177..0076b9d757c 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp @@ -81,7 +81,7 @@ namespace CCF if (trace) cerr << "resolve: resolution process for \'" << name << "\' from \'" << from << "\' failed." << endl; - + throw NotFound (); } else diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp index ac94f3292a9..5e990895493 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp @@ -35,12 +35,13 @@ namespace CCF interface_ (ctx_), member_ (ctx_), module_ (ctx_), + native_ (ctx_), operation_ (ctx_), struct__ (ctx_), - system_include_ (ctx_), typedef__ (ctx_), type_id_ (ctx_), - type_prefix_ (ctx_) + type_prefix_ (ctx_), + value_type_ (ctx_) { // Implied translation region with fundamental types. // diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp index 554dbc3dd39..0dff9bd6bea 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp @@ -22,10 +22,12 @@ #include "CCF/IDL2/SemanticAction/Impl/Interface.hpp" #include "CCF/IDL2/SemanticAction/Impl/Member.hpp" #include "CCF/IDL2/SemanticAction/Impl/Module.hpp" +#include "CCF/IDL2/SemanticAction/Impl/Native.hpp" #include "CCF/IDL2/SemanticAction/Impl/Operation.hpp" #include "CCF/IDL2/SemanticAction/Impl/Struct.hpp" #include "CCF/IDL2/SemanticAction/Impl/Typedef.hpp" #include "CCF/IDL2/SemanticAction/Impl/TypeId.hpp" +#include "CCF/IDL2/SemanticAction/Impl/ValueType.hpp" namespace CCF { @@ -90,6 +92,12 @@ namespace CCF return module_; } + virtual SemanticAction::Native& + native () + { + return native_; + } + virtual SemanticAction::Operation& operation () { @@ -102,12 +110,6 @@ namespace CCF return struct__; } - virtual SemanticAction::SystemInclude& - system_include () - { - return system_include_; - } - virtual SemanticAction::Typedef& typedef_ () { @@ -126,6 +128,12 @@ namespace CCF return type_prefix_; } + virtual SemanticAction::ValueType& + value_type () + { + return value_type_; + } + protected: Context ctx_; @@ -137,12 +145,13 @@ namespace CCF Interface interface_; Member member_; Module module_; + Native native_; Operation operation_; Struct struct__; - SystemInclude system_include_; Typedef typedef__; TypeId type_id_; TypePrefix type_prefix_; + ValueType value_type_; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp index 6b450608029..90d658168dd 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp @@ -24,9 +24,6 @@ namespace CCF // // - // Include - // - // Include:: ~Include () throw () { @@ -39,39 +36,18 @@ namespace CCF } void Include:: - begin (StringLiteralPtr const& sl) + quote (StringLiteralPtr const& sl) { - if (ctx.trace ()) cerr << "include " << sl << endl; + if (ctx.trace ()) cerr << "__qinclude " << sl << endl; } void Include:: - end () - { - if (ctx.trace ()) cerr << "end" << endl; - } - - // SystemInclude - // - // - SystemInclude:: - ~SystemInclude () throw () + bracket (StringLiteralPtr const& sl) { + if (ctx.trace ()) cerr << "__binclude " << sl << endl; } - SystemInclude:: - SystemInclude (Context& c) - : ctx (c) - { - } - - void SystemInclude:: - begin (StringLiteralPtr const& sl) - { - if (ctx.trace ()) cerr << "include <" << sl->lexeme () << ">" - << endl; - } - - void SystemInclude:: + void Include:: end () { if (ctx.trace ()) cerr << "end" << endl; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp index 738154880e4..c2d710fa716 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp @@ -17,9 +17,6 @@ namespace CCF { namespace Impl { - // - // - // class Include : public virtual SemanticAction::Include { public: @@ -29,28 +26,10 @@ namespace CCF Include (Context& c); virtual void - begin (StringLiteralPtr const& sl); + quote (StringLiteralPtr const& sl); virtual void - end (); - - private: - Context& ctx; - }; - - // - // - // - class SystemInclude : public virtual SemanticAction::SystemInclude - { - public: - virtual - ~SystemInclude () throw (); - - SystemInclude (Context& c); - - virtual void - begin (StringLiteralPtr const& sl); + bracket (StringLiteralPtr const& sl); virtual void end (); diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp index 1df1bcfd3dd..ac3971842e5 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp @@ -37,6 +37,8 @@ namespace CCF SimpleName name (id->lexeme ()); + //@@ Not handling NotUnique exception. + // if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) { now (dynamic_cast<AbstractInterface&>(*s)); diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Makefile.alt index 6f75d4f2076..548c1fa0c07 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Makefile.alt @@ -20,10 +20,12 @@ cxx_translation_units := Attribute.cpp \ Interface.cpp \ Member.cpp \ Module.cpp \ + Native.cpp \ Operation.cpp \ Struct.cpp \ TypeId.cpp \ - Typedef.cpp + Typedef.cpp \ + ValueType.cpp CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp index 588ab5e56c6..2803d1f9bcd 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp @@ -51,6 +51,12 @@ namespace CCF cerr << "error: invalid member declaration" << endl; throw; } + + //@@ I am not handling NotUnique here. For example if + // I provide module name as type then the compiler + // will ICE. Think about other places it may happen + // (attribute, value memebr, typeded, others?). + // } catch (NotFound const&) { @@ -61,7 +67,7 @@ namespace CCF { cerr << "declaration with name \'" << name << "\' visible from scope \'" << from - << "\' is not a type declaration" << endl; + << "\' is not a type declaration" << endl; cerr << "using non-type as an member type is illegal" << endl; } catch (NotComplete const& e) @@ -87,6 +93,12 @@ namespace CCF ctx.tu ().new_edge<Defines> (ctx.scope (), m, name); } } + + void Member:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; + } } } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp index 5928b574fbc..3c996484665 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp @@ -9,8 +9,6 @@ #include "CCF/IDL2/SemanticAction/Member.hpp" #include "CCF/IDL2/SemanticAction/Impl/Elements.hpp" -using namespace std; - namespace CCF { namespace IDL2 @@ -34,6 +32,9 @@ namespace CCF virtual void name (SimpleIdentifierPtr const& id); + virtual void + end (); + private: SemanticGraph::Type* type_; }; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp new file mode 100644 index 00000000000..1032028e442 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp @@ -0,0 +1,59 @@ +// file : CCF/IDL2/SemanticAction/Impl/Native.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +//@@ Sometimes I include SemanticGraph headers in sematic action +// headers even though I need them only in .cpp (like here). +// + +#include "CCF/IDL2/SemanticGraph/Native.hpp" +#include "CCF/IDL2/SemanticAction/Impl/Native.hpp" + +#include <iostream> + +using std::cerr; +using std::endl; + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + Native:: + ~Native () throw () + { + } + + Native:: + Native (Context& c) + : Base (c) + { + } + + void Native:: + name (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "native " << id << endl; + + SimpleName name (id->lexeme ()); + + SemanticGraph::Native& n ( + ctx.tu ().new_node<SemanticGraph::Native> ()); + + ctx.tu ().new_edge<Defines> (ctx.scope (), n, name); + } + + void Native:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; + } + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp new file mode 100644 index 00000000000..2cfd6fecfe8 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp @@ -0,0 +1,39 @@ +// file : CCF/IDL2/SemanticAction/Impl/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_NATIVE_HPP +#define CCF_IDL2_SEMANTIC_ACTION_IMPL_NATIVE_HPP + +#include "CCF/IDL2/SemanticAction/Native.hpp" +#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + class Native : public virtual SemanticAction::Native, + public Base + { + public: + virtual + ~Native () throw (); + + Native (Context& c); + + virtual void + name (SimpleIdentifierPtr const& id); + + virtual void + end (); + }; + } + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_NATIVE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp index 4598af8574e..88968137b5d 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp @@ -65,7 +65,7 @@ namespace CCF { Type& t (resolve<Type> (from, name, complete)); - if (op_->one_way ()) + if (dynamic_cast<OneWayOperation*>(op_)) { if (dynamic_cast<Void*> (&t) == 0) throw NotVoid (); } @@ -134,14 +134,15 @@ namespace CCF { try { - if (op_->one_way () && direction != Direction::in) + if (dynamic_cast<OneWayOperation*>(op_) && + direction != Direction::in) { throw NotIn (); } Type& t (resolve<Type> (from, name, complete)); - Parameter* p; + Parameter* p (0); switch (direction) { @@ -210,7 +211,7 @@ namespace CCF { try { - if (op_->one_way ()) throw OneWay (); + if (dynamic_cast<OneWayOperation*>(op_)) throw OneWay (); SemanticGraph::Exception& e ( resolve<SemanticGraph::Exception> (from, name)); diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp index ffd6a9f4eb1..6fd58d77043 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp @@ -38,7 +38,7 @@ namespace CCF void Struct:: begin_def (SimpleIdentifierPtr const& id) { - if (ctx.trace ()) cerr << "struct def" << id << endl; + if (ctx.trace ()) cerr << "struct def " << id << endl; SimpleName name (id->lexeme ()); @@ -57,7 +57,7 @@ namespace CCF void Struct:: begin_fwd (SimpleIdentifierPtr const& id) { - if (ctx.trace ()) cerr << "struct fwd" << id << endl; + if (ctx.trace ()) cerr << "struct fwd " << id << endl; SimpleName name (id->lexeme ()); diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp index 3949c0412c4..b4cd955ed7f 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp @@ -120,11 +120,26 @@ namespace CCF { if (ctx.trace ()) cerr << " " << id << endl; - if (type_ != 0) + SimpleName name (id->lexeme ()); + + try + { + if (lookup (ctx.tu (), ctx.scope (), name) == 0) + { + if (type_ != 0) + { + ctx.tu ().new_edge<Aliases> (ctx.scope (), *type_, name); + } + + return; + } + } + catch (NotUnique const& ) { - SimpleName name (id->lexeme ()); - ctx.tu ().new_edge<Aliases> (ctx.scope (), *type_, name); } + + cerr << "error: invalid typedef declaration" << endl; + cerr << "error: redeclaration of name " << name << endl; } void Typedef:: diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp new file mode 100644 index 00000000000..9e6358bca4f --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp @@ -0,0 +1,149 @@ +// file : CCF/IDL2/SemanticAction/Impl/ValueType.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticAction/Impl/ValueType.hpp" + +#include <iostream> + +using std::cerr; +using std::endl; + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + using namespace SemanticGraph; + + ValueType:: + ~ValueType () throw () {} + + ValueType:: + ValueType (Context& c) + : ScopeBase<SemanticGraph::ValueType> (c) + { + } + + void ValueType:: + begin_abstract_def (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "abstract valuetype def " << id << endl; + + qualifier_ = Qualifier::abstract; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<AbstractValueType&>(*s)); + } + else + { + now (ctx.tu ().new_node<AbstractValueType> ()); + } + + ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name); + } + + void ValueType:: + begin_abstract_fwd (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "abstract valuetype fwd " << id << endl; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<AbstractValueType&>(*s)); + } + else + { + now (ctx.tu ().new_node<AbstractValueType> ()); + } + + ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name); + } + + void ValueType:: + begin_concrete_def (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "concrete valuetype def " << id << endl; + + qualifier_ = Qualifier::concrete; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<ConcreteValueType&>(*s)); + } + else + { + now (ctx.tu ().new_node<ConcreteValueType> ()); + } + + ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name); + } + + void ValueType:: + begin_concrete_fwd (SimpleIdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "concrete valuetype fwd " << id << endl; + + SimpleName name (id->lexeme ()); + + if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name)) + { + now (dynamic_cast<ConcreteValueType&>(*s)); + } + else + { + now (ctx.tu ().new_node<ConcreteValueType> ()); + } + + ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name); + } + + void ValueType:: + inherits (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "inherits " << id << endl; + } + + void ValueType:: + supports (IdentifierPtr const& id) + { + if (ctx.trace ()) cerr << "supports " << id << endl; + } + + void ValueType:: + open_scope () + { + if (ctx.trace ()) cerr << "scope open" << endl; + + push (ctx.scope ()); + ctx.scope (now ()); + } + + void ValueType:: + close_scope () + { + ctx.scope (top ()); + pop (); + + if (ctx.trace ()) cerr << "scope close" << endl; + } + + void ValueType:: + end () + { + if (ctx.trace ()) cerr << "end" << endl; + } + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp new file mode 100644 index 00000000000..b25ea5b4e70 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp @@ -0,0 +1,69 @@ +// file : CCF/IDL2/SemanticAction/Impl/ValueType.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_HPP +#define CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_HPP + +#include "CCF/IDL2/SemanticGraph/ValueType.hpp" +#include "CCF/IDL2/SemanticAction/ValueType.hpp" +#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + namespace Impl + { + class ValueType : public virtual SemanticAction::ValueType, + public virtual ScopeBase<SemanticGraph::ValueType> + { + public: + virtual + ~ValueType () throw (); + + ValueType (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 + begin_concrete_fwd (SimpleIdentifierPtr const& id); + + virtual void + inherits (IdentifierPtr const& id); + + virtual void + supports (IdentifierPtr const& id); + + virtual void + open_scope (); + + virtual void + close_scope (); + + virtual void + end (); + + private: + struct Qualifier + { + enum Value { abstract, concrete }; + }; + + Qualifier::Value qualifier_; + }; + } + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp index 8e93021d0d1..58b7deaf83b 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp @@ -23,20 +23,10 @@ namespace CCF ~Include () throw () {} virtual void - begin (StringLiteralPtr const& sl) = 0; + quote (StringLiteralPtr const& sl) = 0; virtual void - end () = 0; - }; - - class SystemInclude - { - public: - virtual - ~SystemInclude () throw () {} - - virtual void - begin (StringLiteralPtr const& sl) = 0; + bracket (StringLiteralPtr const& sl) = 0; virtual void end () = 0; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp index 8dc28735151..e98dc3c273c 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp @@ -13,9 +13,6 @@ namespace CCF { namespace SemanticAction { - // - // - // class Interface : public virtual Scope { public: @@ -27,19 +24,19 @@ namespace CCF virtual void begin_abstract_fwd (SimpleIdentifierPtr const& id) = 0; - + virtual void begin_local_def (SimpleIdentifierPtr const& id) = 0; virtual void begin_local_fwd (SimpleIdentifierPtr const& id) = 0; - + virtual void begin_unconstrained_def (SimpleIdentifierPtr const& id) = 0; virtual void begin_unconstrained_fwd (SimpleIdentifierPtr const& id) = 0; - + virtual void inherits (IdentifierPtr const& id) = 0; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp index 44d98d9cc99..c8cbd4195b0 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp @@ -24,6 +24,9 @@ namespace CCF virtual void name (SimpleIdentifierPtr const& id) = 0; + + virtual void + end () = 0; }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp new file mode 100644 index 00000000000..f1107d5b971 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp @@ -0,0 +1,32 @@ +// file : CCF/IDL2/SemanticAction/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_NATIVE_HPP +#define CCF_IDL2_SEMANTIC_ACTION_NATIVE_HPP + +#include "CCF/IDL2/SemanticAction/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + class Native + { + public: + virtual + ~Native () throw () {} + + virtual void + name (SimpleIdentifierPtr const& id) = 0; + + virtual void + end () = 0; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_NATIVE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp new file mode 100644 index 00000000000..65df08ac4c9 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp @@ -0,0 +1,53 @@ +// file : CCF/IDL2/SemanticAction/ValueType.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_HPP +#define CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_HPP + +#include "CCF/IDL2/SemanticAction/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticAction + { + class ValueType : public virtual Scope + { + public: + virtual + ~ValueType () throw () {} + + virtual void + begin_abstract_def (SimpleIdentifierPtr const& id) = 0; + + virtual void + begin_abstract_fwd (SimpleIdentifierPtr const& id) = 0; + + virtual void + begin_concrete_def (SimpleIdentifierPtr const& id) = 0; + + virtual void + begin_concrete_fwd (SimpleIdentifierPtr const& id) = 0; + + virtual void + inherits (IdentifierPtr const& id) = 0; + + virtual void + supports (IdentifierPtr const& id) = 0; + + virtual void + open_scope () = 0; + + virtual void + close_scope () = 0; + + virtual void + end () = 0; + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp index ed57da0da48..bc1951debf2 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp @@ -16,6 +16,7 @@ #include "CCF/IDL2/SemanticGraph/Member.hpp" #include "CCF/IDL2/SemanticGraph/Module.hpp" #include "CCF/IDL2/SemanticGraph/Name.hpp" +#include "CCF/IDL2/SemanticGraph/Native.hpp" #include "CCF/IDL2/SemanticGraph/Operation.hpp" #include "CCF/IDL2/SemanticGraph/Sequence.hpp" #include "CCF/IDL2/SemanticGraph/Struct.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp index 83505aae29f..02ae0481c17 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp @@ -32,6 +32,69 @@ namespace CCF TypeInfo const& Attribute:: static_type_info () { return attribute_; } + + + // ReadAttribute + // + // + namespace + { + TypeInfo + read_attribute_init_ () + { + TypeInfo ti (typeid (ReadAttribute)); + ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ()); + return ti; + } + + TypeInfo read_attribute_ (read_attribute_init_ ()); + } + + TypeInfo const& ReadAttribute:: + static_type_info () { return read_attribute_; } + + + // WriteAttribute + // + // + namespace + { + TypeInfo + write_attribute_init_ () + { + TypeInfo ti (typeid (WriteAttribute)); + ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ()); + return ti; + } + + TypeInfo write_attribute_ (write_attribute_init_ ()); + } + + TypeInfo const& WriteAttribute:: + static_type_info () { return write_attribute_; } + + + // ReadWriteAttribute + // + // + namespace + { + TypeInfo + read_write_attribute_init_ () + { + TypeInfo ti (typeid (ReadWriteAttribute)); + ti.add_base ( + Access::PUBLIC, true, ReadAttribute::static_type_info ()); + ti.add_base ( + Access::PUBLIC, true, WriteAttribute::static_type_info ()); + return ti; + } + + TypeInfo read_write_attribute_ (read_write_attribute_init_ ()); + } + + TypeInfo const& ReadWriteAttribute:: + static_type_info () { return read_write_attribute_; } } } } diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Makefile.alt index 77601c6d393..044fffaa010 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Makefile.alt @@ -20,6 +20,7 @@ cxx_translation_units := Attribute.cpp \ Member.cpp \ Module.cpp \ Name.cpp \ + Native.cpp \ Operation.cpp \ Sequence.cpp \ Struct.cpp \ diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp new file mode 100644 index 00000000000..06d9aa90f70 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp @@ -0,0 +1,36 @@ +// file : CCF/IDL2/SemanticGraph/Native.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SemanticGraph/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + using Introspection::TypeInfo; + using Introspection::Access; + + // Native + // + // + namespace + { + TypeInfo + native_init_ () + { + TypeInfo ti (typeid (Native)); + ti.add_base (Access::PUBLIC, true, Type::static_type_info ()); + return ti; + } + + TypeInfo native_ (native_init_ ()); + } + + TypeInfo const& Native:: + static_type_info () { return native_; } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp new file mode 100644 index 00000000000..82895e51e7c --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp @@ -0,0 +1,40 @@ +// file : CCF/IDL2/SemanticGraph/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP +#define CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP + +#include "CCF/IDL2/SemanticGraph/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SemanticGraph + { + class Native : public virtual Type + { + public: + virtual bool + complete () const + { + return true; + } + + static Introspection::TypeInfo const& + static_type_info (); + + protected: + friend class Graph<Node, Edge>; + + Native () + { + type_info (static_type_info ()); + } + }; + } + } +} + +#endif // CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp index 878bc4076bd..7b08fec23cf 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp @@ -77,21 +77,6 @@ namespace CCF // Parameter // // - Parameter::Direction const - Parameter::Direction::in (Parameter::Direction::in_), - Parameter::Direction::out (Parameter::Direction::out_), - Parameter::Direction::inout (Parameter::Direction::inout_); - - namespace - { - char const* direction_labels_[] = {"in", "out", "inout"}; - } - - Parameter::Direction::operator char const* () const - { - return direction_labels_[v_]; - } - namespace { TypeInfo diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp index a361d2bc47b..0048300493d 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp @@ -137,47 +137,12 @@ namespace CCF class Parameter : public virtual Instance { public: - class Direction - { - public: - static Direction const in, out, inout; - - public: - operator char const* () const; - - bool - operator== (Direction d) const - { - return v_ == d.v_; - } - - bool - operator!= (Direction d) const - { - return v_ != d.v_; - } - - private: - enum Value - { - in_, out_, inout_ - } v_; - - Direction (Value v) - : v_ (v) - { - } - }; - std::string name () const { return name_; } - virtual Direction - direction () const = 0; - static Introspection::TypeInfo const& static_type_info (); @@ -203,13 +168,6 @@ namespace CCF class InParameter : public virtual Parameter { public: - virtual Direction - direction () const - { - return Direction::in; - } - - static Introspection::TypeInfo const& static_type_info (); @@ -226,13 +184,6 @@ namespace CCF class OutParameter : public virtual Parameter { public: - virtual Direction - direction () const - { - return Direction::out; - } - - static Introspection::TypeInfo const& static_type_info (); @@ -249,13 +200,6 @@ namespace CCF class InOutParameter : public virtual Parameter { public: - virtual Direction - direction () const - { - return Direction::inout; - } - - static Introspection::TypeInfo const& static_type_info (); @@ -322,9 +266,6 @@ namespace CCF return dynamic_cast<Returns&> (belongs ()); } - virtual bool - one_way () const = 0; - static Introspection::TypeInfo const& static_type_info (); @@ -366,12 +307,6 @@ namespace CCF class OneWayOperation : public virtual Operation { public: - virtual bool - one_way () const - { - return true; - } - static Introspection::TypeInfo const& static_type_info (); @@ -391,12 +326,6 @@ namespace CCF class TwoWayOperation : public virtual Operation { public: - virtual bool - one_way () const - { - return false; - } - static Introspection::TypeInfo const& static_type_info (); diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp index 8034eb92006..9b3dd558bea 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp @@ -14,6 +14,7 @@ #include "CCF/IDL2/Traversal/Interface.hpp" #include "CCF/IDL2/Traversal/Member.hpp" #include "CCF/IDL2/Traversal/Module.hpp" +#include "CCF/IDL2/Traversal/Native.hpp" #include "CCF/IDL2/Traversal/Operation.hpp" #include "CCF/IDL2/Traversal/Struct.hpp" #include "CCF/IDL2/Traversal/Sequence.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp index 4c93301ad88..c4e10d18057 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp @@ -19,7 +19,6 @@ namespace CCF Node<SemanticGraph::FundamentalType> FundamentalType; - typedef Node<SemanticGraph::Object> Object; diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt index 1febb5e02e2..822c3c6d384 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt @@ -17,6 +17,7 @@ cxx_translation_units := Attribute.cpp \ Interface.cpp \ Member.cpp \ Module.cpp \ + Native.cpp \ Operation.cpp \ Sequence.cpp \ Struct.cpp \ diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp new file mode 100644 index 00000000000..59a99bec8ad --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp @@ -0,0 +1,16 @@ +// file : CCF/IDL2/Traversal/Native.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + } + } +} + diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp new file mode 100644 index 00000000000..ad70473c234 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp @@ -0,0 +1,24 @@ +// file : CCF/IDL2/Traversal/Native.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_NATIVE_HPP +#define CCF_IDL2_TRAVERSAL_NATIVE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SemanticGraph/Native.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + typedef + Node<SemanticGraph::Native> + Native; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_NATIVE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.cpp b/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.cpp index cefb3617488..04f0a90c615 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.cpp +++ b/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.cpp @@ -9,7 +9,7 @@ namespace CCF namespace IDL3 { LexicalAnalyzer:: - LexicalAnalyzer (TokenStream<char>& is) + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is) : IDL2::LexicalAnalyzer (is) { // Keywords (alphabetic order). diff --git a/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.hpp b/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.hpp index d72cc6b11b4..d0b581cee05 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/LexicalAnalyzer.hpp @@ -14,7 +14,7 @@ namespace CCF class LexicalAnalyzer : public virtual IDL2::LexicalAnalyzer { public: - LexicalAnalyzer (TokenStream<char>& is); + LexicalAnalyzer (CompilerElements::TokenStream<Char>& is); }; } } diff --git a/TAO/CIAO/CCF/CCF/IDL3/Parser.cpp b/TAO/CIAO/CCF/CCF/IDL3/Parser.cpp index f9094177344..759ccd0f15b 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/Parser.cpp +++ b/TAO/CIAO/CCF/CCF/IDL3/Parser.cpp @@ -91,6 +91,12 @@ namespace CCF // EventType // + act_event_type_begin_abstract_def ( + f.event_type (), &SemanticAction::EventType::begin_abstract_def), + + act_event_type_begin_abstract_fwd ( + f.event_type (), &SemanticAction::EventType::begin_abstract_fwd), + act_event_type_begin_concrete_def ( f.event_type (), &SemanticAction::EventType::begin_concrete_def), @@ -100,6 +106,9 @@ namespace CCF act_event_type_inherits ( f.event_type (), &SemanticAction::EventType::inherits), + act_event_type_supports ( + f.event_type (), &SemanticAction::EventType::supports), + act_event_type_open_scope ( f.event_type (), &SemanticAction::EventType::open_scope), @@ -160,11 +169,26 @@ namespace CCF { IDL2::Parser::extension = component_decl - | eventtype_decl + | concrete_event_type_decl | home_decl | extension ; + IDL2::Parser::abstract_type_decl = + ABSTRACT + >> guard + ( + assertion ("interface, valuetype or eventtype declaration expected") + ( + (INTERFACE >> assertion ()(abstract_interface_decl)) + | + (VALUETYPE >> assertion ()(abstract_value_type_decl)) + | + (EVENTTYPE >> assertion ()(abstract_event_type_decl)) + ) + )[error_handler] + ; + // component // // @@ -271,51 +295,135 @@ namespace CCF >> SEMI ; + //@@ action name inconsistency: act_event_type_bagin_abstract_ftw + // and act_abstract_value_type... + // eventtype // // - eventtype_decl = - EVENTTYPE - >> ( - ( - simple_identifier - >> SEMI[act_event_type_begin_concrete_fwd][act_event_type_end] - ) - | - ( - ( - simple_identifier - >> COLON - )[act_event_type_begin_concrete_def] - >> eventtype_inheritance_spec - >> LBRACE[act_event_type_open_scope] - >> eventtype_def_trailer - ) - | - ( - ( - simple_identifier - >> LBRACE - )[act_event_type_begin_concrete_def][act_event_type_open_scope] - >> eventtype_def_trailer - ) - ) + abstract_event_type_decl = + guard + ( + ( + simple_identifier + >> SEMI + )[act_event_type_begin_abstract_fwd][act_event_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_event_type_begin_abstract_def] + + >> event_type_inheritance_spec + >> !(SUPPORTS >> event_type_supports_spec) + >> LBRACE[act_event_type_open_scope] + >> event_type_def_trailer + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_event_type_begin_abstract_def] + + >> event_type_supports_spec + >> LBRACE[act_event_type_open_scope] + >> event_type_def_trailer + ) + | + ( + ( + simple_identifier + >> LBRACE + )[act_event_type_begin_abstract_def][act_event_type_open_scope] + + >> event_type_def_trailer + ) + )[error_handler] + ; + + concrete_event_type_decl = + guard + ( + EVENTTYPE + >> ( + ( + simple_identifier + >> SEMI + )[act_event_type_begin_concrete_fwd][act_event_type_end] + | + ( + ( + simple_identifier + >> COLON + )[act_event_type_begin_concrete_def] + + >> event_type_inheritance_spec + >> !(SUPPORTS >> event_type_supports_spec) + >> LBRACE[act_event_type_open_scope] + >> event_type_def_trailer + ) + | + ( + ( + simple_identifier + >> SUPPORTS + )[act_event_type_begin_concrete_def] + + >> event_type_supports_spec + >> LBRACE[act_event_type_open_scope] + >> event_type_def_trailer + ) + | + ( + ( + simple_identifier + >> LBRACE + )[act_event_type_begin_concrete_def][act_event_type_open_scope] + + >> event_type_def_trailer + ) + ) + )[error_handler] + ; + + + event_type_inheritance_spec = + identifier[act_event_type_inherits] + >> *( + COMMA + >> identifier[act_event_type_inherits] + ) ; + event_type_supports_spec = + identifier[act_event_type_supports] + >> *( + COMMA + >> identifier[act_event_type_supports] + ) + ; - eventtype_def_trailer = -// eventtype_body - RBRACE[act_event_type_close_scope] + event_type_def_trailer = + event_type_body + >> RBRACE[act_event_type_close_scope] >> SEMI[act_event_type_end] ; - //@@ inconsistent usage of eventype/event_type. - // + event_type_body = + *( + const_decl + | type_decl + | type_id_decl + | type_prefix_decl - eventtype_inheritance_spec = - identifier[act_event_type_inherits] - >> *(COMMA >> identifier[act_event_type_inherits]) + | attribute_decl + | operation_decl + | value_type_member_decl + | value_type_factory_decl + ) ; // @@ -348,7 +456,12 @@ namespace CCF home_body = *( - attribute_decl + const_decl + | type_decl + | type_id_decl + | type_prefix_decl + + | attribute_decl | operation_decl | home_factory_decl | home_finder_decl diff --git a/TAO/CIAO/CCF/CCF/IDL3/Parser.hpp b/TAO/CIAO/CCF/CCF/IDL3/Parser.hpp index 20bf58da5a8..bde2db6575a 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/Parser.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/Parser.hpp @@ -44,27 +44,31 @@ namespace CCF Rule extension; - // Component + // component + // Rule component_decl; Rule component_def_trailer; Rule component_inheritance_spec; Rule component_support_spec; Rule component_body; - // Component body elements Rule provides_decl; Rule uses_decl; Rule emits_decl; Rule publishes_decl; Rule consumes_decl; - // Eventtype - Rule eventtype_decl; - Rule eventtype_def_trailer; - Rule eventtype_inheritance_spec; - Rule eventtype_body; - - // Home + // eventtype + // + Rule abstract_event_type_decl; + Rule concrete_event_type_decl; + Rule event_type_inheritance_spec; + Rule event_type_supports_spec; + Rule event_type_def_trailer; + Rule event_type_body; + + // home + // Rule home_decl; Rule home_header; Rule home_inheritance_spec; @@ -109,6 +113,7 @@ namespace CCF NoArgAction<SemanticAction::Component> act_component_end; + // Provides // OneArgAction<IdentifierPtr, SemanticAction::Provides> @@ -117,6 +122,7 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Provides> act_provides_name; + // Uses // OneArgAction<IdentifierPtr, SemanticAction::Uses> @@ -125,6 +131,7 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Uses> act_uses_name; + // Publishes // OneArgAction<IdentifierPtr, SemanticAction::Publishes> @@ -133,6 +140,7 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Publishes> act_publishes_name; + // Emits // OneArgAction<IdentifierPtr, SemanticAction::Emits> @@ -141,6 +149,7 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Emits> act_emits_name; + // Consumes // OneArgAction<IdentifierPtr, SemanticAction::Consumes> @@ -149,13 +158,17 @@ namespace CCF OneArgAction<SimpleIdentifierPtr, SemanticAction::Consumes> act_consumes_name; + // EventType // OneArgAction<SimpleIdentifierPtr, SemanticAction::EventType> - act_event_type_begin_concrete_def, act_event_type_begin_concrete_fwd; + act_event_type_begin_abstract_def, + act_event_type_begin_abstract_fwd, + act_event_type_begin_concrete_def, + act_event_type_begin_concrete_fwd; OneArgAction<IdentifierPtr, SemanticAction::EventType> - act_event_type_inherits; + act_event_type_inherits, act_event_type_supports; ScopeAction act_event_type_open_scope; @@ -166,6 +179,7 @@ namespace CCF NoArgAction<SemanticAction::EventType> act_event_type_end; + // Home // OneArgAction<SimpleIdentifierPtr, SemanticAction::Home> @@ -189,6 +203,7 @@ namespace CCF NoArgAction<SemanticAction::Home> act_home_end; + // HomeFactory // OneArgAction<SimpleIdentifierPtr, SemanticAction::HomeFactory> @@ -202,6 +217,7 @@ namespace CCF OneArgAction<IdentifierPtr, SemanticAction::HomeFactory> act_home_factory_raises; + // HomeFinder // OneArgAction<SimpleIdentifierPtr, SemanticAction::HomeFinder> diff --git a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp index bf9ffc93a5c..aa0aa247e31 100644 --- a/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp +++ b/TAO/CIAO/CCF/CCF/IDL3/SemanticAction/EventType.hpp @@ -20,6 +20,12 @@ namespace CCF { public: virtual void + begin_abstract_def (SimpleIdentifierPtr const& id) = 0; + + virtual void + begin_abstract_fwd (SimpleIdentifierPtr const& id) = 0; + + virtual void begin_concrete_def (SimpleIdentifierPtr const& id) = 0; virtual void @@ -29,6 +35,9 @@ namespace CCF inherits (IdentifierPtr const& id) = 0; virtual void + supports (IdentifierPtr const& id) = 0; + + virtual void end () = 0; }; } 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 (); - } - }; } } } diff --git a/TAO/CIAO/CCF/Documentation/TODO b/TAO/CIAO/CCF/Documentation/TODO index dc4432a0373..a6b4440c43f 100644 --- a/TAO/CIAO/CCF/Documentation/TODO +++ b/TAO/CIAO/CCF/Documentation/TODO @@ -72,7 +72,7 @@ Legend: @% IDL feature: attribute (completion) (left: exception spec) -@@ IDL feature: valuetype (4) +@% IDL feature: valuetype (4) @% IDL feature: event (completion); do after (4) diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/ExecutorMappingGenerator.cpp b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/ExecutorMappingGenerator.cpp index e5d6c09c430..dacfef74fa3 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/ExecutorMappingGenerator.cpp +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/ExecutorMappingGenerator.cpp @@ -19,7 +19,6 @@ using std::string; using std::ostream; using std::endl; - using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; @@ -900,7 +899,10 @@ namespace } }; - struct ParameterEmitter : Traversal::Parameter, public Emitter + struct ParameterEmitter : Traversal::InParameter, + Traversal::OutParameter, + Traversal::InOutParameter, + public Emitter { ParameterEmitter (Context& c, ostream& os) : Emitter (c, os) @@ -908,15 +910,39 @@ namespace } virtual void - pre (Type& p) + pre (InParameter& p) + { + os << " in "; + } + + virtual void + pre (OutParameter& p) + { + os << " out "; + } + + virtual void + pre (InOutParameter& p) + { + os << " inout "; + } + + virtual void + name (InParameter& p) + { + os << p.name (); + } + + virtual void + name (OutParameter& p) { - os << p.direction () << " "; + os << p.name (); } virtual void - name (Type& p) + name (InOutParameter& p) { - os << " " << p.name (); + os << p.name (); } }; diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/Makefile.alt b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/Makefile.alt index ce842ab8bf1..17d395292ae 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/Makefile.alt +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/Makefile.alt @@ -18,8 +18,8 @@ module_suffix := CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) -# -L$(root)/CCF/CompilerElements \ -# -lCompilerElements \ +# -L$(UTILITY_ROOT)/Utility/Introspection \ +# -lIntrospection \ CXX_LINK_LIBS += -L$(root)/CCF/CIDL \ -lCIDL \ @@ -29,8 +29,8 @@ CXX_LINK_LIBS += -L$(root)/CCF/CIDL \ -lIDL2 \ -L$(root)/CCF/CodeGenerationKit \ -lCodeGenerationKit \ - -L$(UTILITY_ROOT)/Utility/Introspection \ - -lIntrospection \ + -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ -L$(BOOST_ROOT)/lib \ -lboost_regex \ -lboost_filesystem diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/cidlc.cpp b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/cidlc.cpp index a2477142214..43bba90c291 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/cidlc.cpp +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/cidlc.cpp @@ -25,8 +25,9 @@ using std::cerr; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::CIDL; -using namespace SemanticGraph; +using namespace CCF::CIDL::SemanticGraph; int main (int argc, char* argv[]) @@ -116,20 +117,18 @@ main (int argc, char* argv[]) ? static_cast<std::istream&> (ifs) : static_cast<std::istream&> (std::cin); - CCF::InputStreamAdapter isa (is); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (is); + CPP::Preprocessor pp (isa); if (cl.get_value ("preprocess-only", false)) { while (true) { - CCF::Preprocessor::int_type i = pp.next (); + CPP::Token t (pp.next ()); - if (pp.eos (i)) break; + if (t == CPP::Token::eos) break; - CCF::Preprocessor::char_type c = pp.to_char_type (i); - - std::cout << c; + std::cout << t; } return 0; } @@ -217,6 +216,10 @@ main (int argc, char* argv[]) { cerr << "invalid name exception" << endl; } + catch (std::exception const& e) + { + cerr << "caught standard exception " << e.what () << endl; + } catch (...) { cerr << "caught unknown exception" << endl; diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl index 57b5d5de22c..2cad0998826 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl @@ -12,7 +12,16 @@ module M2 interface I {}; interface J {}; - eventtype E {}; + eventtype E supports I, J + { + factory new (in string name); + public string name; + }; + + valuetype V + { + public long l; + }; component C2 : M1::C1 supports I, J { @@ -56,7 +65,8 @@ module M2 out long ol, in M::I i, out unsigned long long ull, - inout S_Seq s_seq) raises (Ex1, Ex2); + inout S_Seq s_seq, + in V v) raises (Ex1, Ex2); factory new (in long l, in OctetSeq s) raises (Ex2, Ex1); finder find (in long l, in OctetSeq s) raises (Ex1, Ex2); diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig index 8fcc3a95830..1e20f3b4cd2 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig @@ -53,7 +53,7 @@ module M2 attribute ::M::I ai; attribute ::M2::OctetSeq seq; attribute ::M2::S_Seq a_s_seq; - void foo (in long l, inout boolean b, out long ol, in ::M::I i, out unsigned long long ull, inout ::M2::S_Seq s_seq) raises (::M2::Ex1, ::M2::Ex2); + void foo (in long l, inout boolean b, out long ol, in ::M::I i, out unsigned long long ull, inout ::M2::S_Seq s_seq, in ::M2::V v) raises (::M2::Ex1, ::M2::Ex2); ::Components::EnterpriseComponent new (in long l, in ::M2::OctetSeq s) raises (::M2::Ex2, ::M2::Ex1); ::Components::EnterpriseComponent find (in long l, in ::M2::OctetSeq s) raises (::M2::Ex1, ::M2::Ex2); }; diff --git a/TAO/CIAO/CCF/Example/IDL2/CxxMapping/Makefile.alt b/TAO/CIAO/CCF/Example/IDL2/CxxMapping/Makefile.alt index a629a1f7298..b783266b593 100644 --- a/TAO/CIAO/CCF/Example/IDL2/CxxMapping/Makefile.alt +++ b/TAO/CIAO/CCF/Example/IDL2/CxxMapping/Makefile.alt @@ -18,13 +18,12 @@ module_suffix := CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) -# -L$(root)/CCF/CompilerElements \ -# -lCompilerElements \ + CXX_LINK_LIBS += -L$(root)/CCF/IDL2 \ -lIDL2 \ - -L$(UTILITY_ROOT)/Utility/Introspection \ - -lIntrospection \ + -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ -L$(BOOST_ROOT)/lib \ -lboost_filesystem diff --git a/TAO/CIAO/CCF/Example/IDL2/CxxMapping/driver.cpp b/TAO/CIAO/CCF/Example/IDL2/CxxMapping/driver.cpp index 72700da941b..11c6e895611 100644 --- a/TAO/CIAO/CCF/Example/IDL2/CxxMapping/driver.cpp +++ b/TAO/CIAO/CCF/Example/IDL2/CxxMapping/driver.cpp @@ -21,6 +21,7 @@ using std::cerr; using std::cout; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::IDL2; using namespace CCF::IDL2::SemanticGraph; @@ -36,8 +37,8 @@ main () fs::path file_path ("stdout"); - CCF::InputStreamAdapter isa (std::cin); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (std::cin); + CPP::Preprocessor pp (isa); LexicalAnalyzer lexer (pp); diff --git a/TAO/CIAO/CCF/Test/CIDL/Compiler/GeneratorImpl.hpp b/TAO/CIAO/CCF/Test/CIDL/Compiler/GeneratorImpl.hpp index 6829fa2bb2b..169fb57ace3 100644 --- a/TAO/CIAO/CCF/Test/CIDL/Compiler/GeneratorImpl.hpp +++ b/TAO/CIAO/CCF/Test/CIDL/Compiler/GeneratorImpl.hpp @@ -41,7 +41,8 @@ namespace CIDL virtual void pre (Type& c) { - cout << "composition " << c.kind () << " "; + //@@ TODO kind + cout << "composition " << "session" << " "; } virtual void diff --git a/TAO/CIAO/CCF/Test/CIDL/Compiler/Makefile.alt b/TAO/CIAO/CCF/Test/CIDL/Compiler/Makefile.alt index a4edc5af913..aeb0fc38f7a 100644 --- a/TAO/CIAO/CCF/Test/CIDL/Compiler/Makefile.alt +++ b/TAO/CIAO/CCF/Test/CIDL/Compiler/Makefile.alt @@ -18,8 +18,6 @@ module_suffix := CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) -# -L$(root)/CCF/CompilerElements \ -# -lCompilerElements \ CXX_LINK_LIBS += -L$(root)/CCF/CIDL \ -lCIDL \ @@ -27,8 +25,8 @@ CXX_LINK_LIBS += -L$(root)/CCF/CIDL \ -lIDL3 \ -L$(root)/CCF/IDL2 \ -lIDL2 \ - -L$(UTILITY_ROOT)/Utility/Introspection \ - -lIntrospection \ + -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ -L$(BOOST_ROOT)/lib \ -lboost_filesystem diff --git a/TAO/CIAO/CCF/Test/CIDL/Compiler/driver.cpp b/TAO/CIAO/CCF/Test/CIDL/Compiler/driver.cpp index cd03d281820..222dd8f851c 100644 --- a/TAO/CIAO/CCF/Test/CIDL/Compiler/driver.cpp +++ b/TAO/CIAO/CCF/Test/CIDL/Compiler/driver.cpp @@ -21,6 +21,7 @@ using std::cerr; using std::cout; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::CIDL; using namespace SemanticGraph; @@ -33,8 +34,8 @@ main () fs::path file_path ("stdout"); - CCF::InputStreamAdapter isa (std::cin); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (std::cin); + CPP::Preprocessor pp (isa); LexicalAnalyzer lexer (pp); diff --git a/TAO/CIAO/CCF/Test/CompilerElements/CPP/Makefile.alt b/TAO/CIAO/CCF/Test/CompilerElements/CPP/Makefile.alt new file mode 100644 index 00000000000..728922c9eb2 --- /dev/null +++ b/TAO/CIAO/CCF/Test/CompilerElements/CPP/Makefile.alt @@ -0,0 +1,24 @@ +# file : Test/CompilerElements/CPP/Makefile.alt +# author : Boris Kolpackov <boris@dre.vanderbilt.edu> +# cvs-id : $Id$ + +root = ../../.. + +include $(root)/Bootstrap.rules + +$(call include, $(root)/Config.rules) + +$(call include, $(UTILITY_ROOT)/BuildRules/Executable.pre.rules) + +cxx_translation_units := driver.cpp + +module_base := driver +module_prefix := +module_suffix := + +CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) + +CXX_LINK_LIBS += -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ + +$(call include, $(UTILITY_ROOT)/BuildRules/Executable.post.rules) diff --git a/TAO/CIAO/CCF/Test/CompilerElements/CPP/driver.cpp b/TAO/CIAO/CCF/Test/CompilerElements/CPP/driver.cpp new file mode 100644 index 00000000000..de3624d86a7 --- /dev/null +++ b/TAO/CIAO/CCF/Test/CompilerElements/CPP/driver.cpp @@ -0,0 +1,40 @@ +// file : CCF/Test/CompilerElements/CPP/driver.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include <iostream> + +#include "CCF/CompilerElements/TokenStream.hpp" +#include "CCF/CompilerElements/Preprocessor.hpp" + +using std::cout; +using std::endl; + +using CCF::CompilerElements::InputStreamAdapter; + +using namespace CCF::CompilerElements::CPP; + +int +main () +{ + InputStreamAdapter isa (std::cin); + Preprocessor pp (isa); + + try + { + for (;;) + { + Token t (pp.next ()); + + if (t == Token::eos) break; + + std::cout << t; + } + } + catch (std::exception const& e) + { + cout << e.what () << endl; + } + + return 0; +} diff --git a/TAO/CIAO/CCF/Test/CompilerElements/Makefile.alt b/TAO/CIAO/CCF/Test/CompilerElements/Makefile.alt new file mode 100644 index 00000000000..63ed35c66d3 --- /dev/null +++ b/TAO/CIAO/CCF/Test/CompilerElements/Makefile.alt @@ -0,0 +1,19 @@ +# file : Test/CompilerElements/Makefile.alt +# author : Boris Kolpackov <boris@dre.vanderbilt.edu> +# cvs-id : $Id$ + +root := ../.. + +include $(root)/Bootstrap.rules + +$(call include, $(root)/Config.rules) + +$(call include, $(UTILITY_ROOT)/BuildRules/Recursion.pre.rules) + +target_makefile_list := +target_directory_list := CPP +default_makefile_name := Makefile.alt + + +$(call include, $(UTILITY_ROOT)/BuildRules/Recursion.post.rules) + diff --git a/TAO/CIAO/CCF/Test/IDL2/Compiler/Makefile.alt b/TAO/CIAO/CCF/Test/IDL2/Compiler/Makefile.alt index ac86d6e10ac..4ae8873a6cb 100644 --- a/TAO/CIAO/CCF/Test/IDL2/Compiler/Makefile.alt +++ b/TAO/CIAO/CCF/Test/IDL2/Compiler/Makefile.alt @@ -20,13 +20,11 @@ module_suffix := CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) -# -L$(root)/CCF/CompilerElements \ -# -lCompilerElements \ CXX_LINK_LIBS += -L$(root)/CCF/IDL2 \ -lIDL2 \ - -L$(UTILITY_ROOT)/Utility/Introspection \ - -lIntrospection \ + -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ -L$(BOOST_ROOT)/lib \ -lboost_filesystem diff --git a/TAO/CIAO/CCF/Test/IDL2/Compiler/driver.cpp b/TAO/CIAO/CCF/Test/IDL2/Compiler/driver.cpp index 16f8fce9656..71d8dc9b971 100644 --- a/TAO/CIAO/CCF/Test/IDL2/Compiler/driver.cpp +++ b/TAO/CIAO/CCF/Test/IDL2/Compiler/driver.cpp @@ -21,6 +21,7 @@ using std::cerr; using std::cout; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::IDL2; using namespace CCF::IDL2::SemanticGraph; @@ -33,8 +34,8 @@ main () fs::path file_path ("stdout"); - CCF::InputStreamAdapter isa (std::cin); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (std::cin); + CPP::Preprocessor pp (isa); LexicalAnalyzer lexer (pp); diff --git a/TAO/CIAO/CCF/Test/IDL2/Traversal/Recreate/GeneratorImpl.hpp b/TAO/CIAO/CCF/Test/IDL2/Traversal/Recreate/GeneratorImpl.hpp index 9c231b769c6..52b89e03e12 100644 --- a/TAO/CIAO/CCF/Test/IDL2/Traversal/Recreate/GeneratorImpl.hpp +++ b/TAO/CIAO/CCF/Test/IDL2/Traversal/Recreate/GeneratorImpl.hpp @@ -16,6 +16,7 @@ namespace IDL2 { using namespace CCF::IDL2; + using namespace CCF::IDL2::SemanticGraph; using std::cout; using std::endl; @@ -451,18 +452,44 @@ namespace IDL2 //-- - struct Parameter : Traversal::Parameter + struct Parameter : Traversal::InParameter, + Traversal::OutParameter, + Traversal::InOutParameter { virtual void - pre (Type& p) + pre (InParameter& p) { - cout << p.direction () << " "; + cout << " in "; } virtual void - name (Type& p) + pre (OutParameter& p) { - cout << " " << p.name (); + cout << " out "; + } + + virtual void + pre (InOutParameter& p) + { + cout << " inout "; + } + + virtual void + name (InParameter& p) + { + cout << p.name (); + } + + virtual void + name (OutParameter& p) + { + cout << p.name (); + } + + virtual void + name (InOutParameter& p) + { + cout << p.name (); } }; diff --git a/TAO/CIAO/CCF/Test/IDL3/Compiler/Makefile.alt b/TAO/CIAO/CCF/Test/IDL3/Compiler/Makefile.alt index 53f99350be1..f0fdb5339b7 100644 --- a/TAO/CIAO/CCF/Test/IDL3/Compiler/Makefile.alt +++ b/TAO/CIAO/CCF/Test/IDL3/Compiler/Makefile.alt @@ -18,15 +18,13 @@ module_suffix := CXX_PREPROCESS_FLAGS += -I$(root) -I$(UTILITY_ROOT) -I$(BOOST_ROOT) -# -L$(root)/CCF/CompilerElements \ -# -lCompilerElements \ CXX_LINK_LIBS += -L$(root)/CCF/IDL3 \ -lIDL3 \ -L$(root)/CCF/IDL2 \ -lIDL2 \ - -L$(UTILITY_ROOT)/Utility/Introspection \ - -lIntrospection \ + -L$(root)/CCF/CompilerElements \ + -lCompilerElements \ -L$(BOOST_ROOT)/lib \ -lboost_filesystem diff --git a/TAO/CIAO/CCF/Test/IDL3/Compiler/driver.cpp b/TAO/CIAO/CCF/Test/IDL3/Compiler/driver.cpp index e861d68f3d4..d2f8ff91ba0 100644 --- a/TAO/CIAO/CCF/Test/IDL3/Compiler/driver.cpp +++ b/TAO/CIAO/CCF/Test/IDL3/Compiler/driver.cpp @@ -21,6 +21,7 @@ using std::cerr; using std::cout; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::IDL3; using namespace SemanticGraph; @@ -33,8 +34,8 @@ main () fs::path file_path ("stdout"); - CCF::InputStreamAdapter isa (std::cin); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (std::cin); + CPP::Preprocessor pp (isa); LexicalAnalyzer lexer (pp); @@ -74,7 +75,7 @@ main () parser.start ()); if (dout.error_count () != 0) return -1; - + IDL3::Generator g; g.generate (tu); diff --git a/TAO/CIAO/CCF/Test/Makefile.alt b/TAO/CIAO/CCF/Test/Makefile.alt index 58c106f9899..c252ea7e63f 100644 --- a/TAO/CIAO/CCF/Test/Makefile.alt +++ b/TAO/CIAO/CCF/Test/Makefile.alt @@ -11,7 +11,7 @@ $(call include, $(root)/Config.rules) $(call include, $(UTILITY_ROOT)/BuildRules/Recursion.pre.rules) target_makefile_list := -target_directory_list := IDL2 IDL3 CIDL +target_directory_list := CompilerElements IDL2 IDL3 CIDL default_makefile_name := Makefile.alt $(call include, $(UTILITY_ROOT)/BuildRules/Recursion.post.rules) diff --git a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp index e50a30f573b..2563c59d648 100644 --- a/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp +++ b/TAO/CIAO/CIDLC/ExecutorMappingGenerator.cpp @@ -19,7 +19,6 @@ using std::string; using std::ostream; using std::endl; - using namespace CCF::CIDL; using namespace CCF::CIDL::SemanticGraph; @@ -721,6 +720,7 @@ namespace struct ExplicitPortEmitter : Traversal::Attribute, Traversal::Operation, Traversal::HomeFactory, + Traversal::HomeFinder, Emitter { ExplicitPortEmitter (Context& c, ostream& os) @@ -846,9 +846,63 @@ namespace { os << ", "; } + + // HomeFinder. + // + + virtual void + returns (SemanticGraph::HomeFinder&) + { + os << "::Components::EnterpriseComponent "; + } + + virtual void + name (SemanticGraph::HomeFinder& hf) + { + os << " " << hf.name (); + } + + virtual void + receives_pre (SemanticGraph::HomeFinder&) + { + os << " ("; + } + + virtual void + receives_post (SemanticGraph::HomeFinder&) + { + os << ")"; + } + + virtual void + raises_pre (SemanticGraph::HomeFinder&) + { + os << " raises ("; + } + + virtual void + raises_post (SemanticGraph::HomeFinder&) + { + os << ")"; + } + + virtual void + post (SemanticGraph::HomeFinder&) + { + os << ";"; + } + + virtual void + comma (SemanticGraph::HomeFinder&) + { + os << ", "; + } }; - struct ParameterEmitter : Traversal::Parameter, public Emitter + struct ParameterEmitter : Traversal::InParameter, + Traversal::OutParameter, + Traversal::InOutParameter, + public Emitter { ParameterEmitter (Context& c, ostream& os) : Emitter (c, os) @@ -856,15 +910,39 @@ namespace } virtual void - pre (Type& p) + pre (InParameter& p) + { + os << " in "; + } + + virtual void + pre (OutParameter& p) + { + os << " out "; + } + + virtual void + pre (InOutParameter& p) + { + os << " inout "; + } + + virtual void + name (InParameter& p) + { + os << p.name (); + } + + virtual void + name (OutParameter& p) { - os << p.direction () << " "; + os << p.name (); } virtual void - name (Type& p) + name (InOutParameter& p) { - os << " " << p.name (); + os << p.name (); } }; diff --git a/TAO/CIAO/CIDLC/cidlc.cpp b/TAO/CIAO/CIDLC/cidlc.cpp index be70f1a8922..58cef8d8da5 100644 --- a/TAO/CIAO/CIDLC/cidlc.cpp +++ b/TAO/CIAO/CIDLC/cidlc.cpp @@ -34,8 +34,9 @@ using std::cerr; using std::endl; +using namespace CCF::CompilerElements; using namespace CCF::CIDL; -using namespace SemanticGraph; +using namespace CCF::CIDL::SemanticGraph; int main (int argc, char* argv[]) @@ -143,20 +144,18 @@ main (int argc, char* argv[]) ? static_cast<std::istream&> (ifs) : static_cast<std::istream&> (std::cin); - CCF::InputStreamAdapter isa (is); - CCF::Preprocessor pp (isa); + InputStreamAdapter isa (is); + CPP::Preprocessor pp (isa); if (cl.get_value ("preprocess-only", false)) { while (true) { - CCF::Preprocessor::int_type i = pp.next (); + CPP::Token t (pp.next ()); - if (pp.eos (i)) break; + if (t == CPP::Token::eos) break; - CCF::Preprocessor::char_type c = pp.to_char_type (i); - - std::cout << c; + std::cout << t; } return 0; } diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index f231c9a8730..6b58861aa3a 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,125 @@ +Tue Dec 30 17:03:27 2003 Boris Kolpackov <boris@dre.vanderbilt.edu> + + * CCF/CCF/CompilerElements/Diagnostic.hpp: + * CCF/CCF/CompilerElements/TokenStream.hpp: + + Cosmetic changes. + + + * CCF/CCF/CompilerElements/Makefile.alt: + * CCF/CCF/CompilerElements/Preprocessor.hpp: + * CCF/CCF/CompilerElements/PreprocessorToken.cpp: + * CCF/CCF/CompilerElements/PreprocessorToken.hpp: + + New (though not very capable) preprocessor for the time being. + + + * CCF/CCF/IDL2/SemanticAction/Native.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp: + * CCF/CCF/IDL2/SemanticGraph/Native.cpp: + * CCF/CCF/IDL2/SemanticGraph/Native.hpp: + * CCF/CCF/IDL2/Traversal/Native.cpp: + * CCF/CCF/IDL2/Traversal/Native.hpp: + + Added support for IDL2 native feature. + + + * CCF/CCF/IDL2/LexicalAnalyzer.cpp: + * CCF/CCF/IDL2/LexicalAnalyzer.hpp: + * CCF/CCF/IDL2/Makefile.archive: + * CCF/CCF/IDL2/Parser.cpp: + * CCF/CCF/IDL2/Parser.hpp: + * CCF/CCF/IDL2/SemanticAction.hpp: + * CCF/CCF/IDL2/SemanticGraph.hpp: + * CCF/CCF/IDL2/Traversal.hpp: + * CCF/CCF/IDL2/SemanticAction/Attribute.hpp: + * CCF/CCF/IDL2/SemanticAction/Factory.hpp: + * CCF/CCF/IDL2/SemanticAction/Include.hpp: + * CCF/CCF/IDL2/SemanticAction/Interface.hpp: + * CCF/CCF/IDL2/SemanticAction/Member.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Makefile.alt: + * CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp: + * CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp: + * CCF/CCF/IDL2/SemanticGraph/Attribute.cpp: + * CCF/CCF/IDL2/SemanticGraph/Makefile.alt: + * CCF/CCF/IDL2/SemanticGraph/Operation.cpp: + * CCF/CCF/IDL2/SemanticGraph/Operation.hpp: + * CCF/CCF/IDL2/Traversal/Fundamental.hpp: + * CCF/CCF/IDL2/Traversal/Makefile.alt: + + Cosmetic changes. + + + * CCF/CCF/IDL3/SemanticAction/EventType.hpp: + * CCF/CCF/IDL3/SemanticAction/Impl/EventType.cpp: + * CCF/CCF/IDL3/SemanticAction/Impl/EventType.hpp: + + Added support for IDL3 eventtype feature. + + + * CCF/CCF/IDL3/LexicalAnalyzer.cpp: + * CCF/CCF/IDL3/LexicalAnalyzer.hpp: + * CCF/CCF/IDL3/Parser.cpp: + * CCF/CCF/IDL3/Parser.hpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Factory.cpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Factory.hpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Include.cpp: + * CCF/CCF/IDL3/SemanticAction/Impl/Include.hpp: + + Cosmetic changes. + + + * CCF/CCF/CIDL/LexicalAnalyzer.cpp: + * CCF/CCF/CIDL/LexicalAnalyzer.hpp: + * CCF/CCF/CIDL/SemanticAction/Impl/Factory.cpp: + * CCF/CCF/CIDL/SemanticGraph/Composition.cpp: + * CCF/CCF/CIDL/SemanticGraph/Composition.hpp: + + Cosmetic changes. + + + * CCF/Example/CIDL/LocalExecutorMapping/ExecutorMappingGenerator.cpp: + * CCF/Example/CIDL/LocalExecutorMapping/Makefile.alt: + * CCF/Example/CIDL/LocalExecutorMapping/cidlc.cpp: + * CCF/Example/CIDL/LocalExecutorMapping/test-2.idl: + * CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig: + * CCF/Example/IDL2/CxxMapping/Makefile.alt: + * CCF/Example/IDL2/CxxMapping/driver.cpp: + * CCF/Test/Makefile.alt: + * CCF/Test/CIDL/Compiler/GeneratorImpl.hpp: + * CCF/Test/CIDL/Compiler/Makefile.alt: + * CCF/Test/CIDL/Compiler/driver.cpp: + * CCF/Test/CompilerElements/Makefile.alt: + * CCF/Test/CompilerElements/CPP/Makefile.alt: + * CCF/Test/CompilerElements/CPP/driver.cpp: + * CCF/Test/IDL2/Compiler/Makefile.alt: + * CCF/Test/IDL2/Compiler/driver.cpp: + * CCF/Test/IDL2/Traversal/Recreate/GeneratorImpl.hpp: + * CCF/Test/IDL3/Compiler/Makefile.alt: + * CCF/Test/IDL3/Compiler/driver.cpp: + * CIDLC/ExecutorMappingGenerator.cpp: + * CIDLC/cidlc.cpp: + + Updated to reflect changes above. + + + * CCF/Documentation/TODO: + + Reflected new achievements. + + Tue Dec 30 13:53:20 2003 Tao Lu <lu@dre.vanderbilt.edu> * examples/Philosophers/Philosophers.idl: |