diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-15 20:56:19 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-15 20:56:19 +0000 |
commit | 84c8be1e55e740e167e90c1e41a5fb40a71f7585 (patch) | |
tree | 1ebaddb31a3f02ea2d88a18f21e1b3d063299198 /TAO/CIAO/CCF | |
parent | be37dd035c617903426a08f12de20003a3ad5460 (diff) | |
download | ATCD-84c8be1e55e740e167e90c1e41a5fb40a71f7585.tar.gz |
ChangeLogTag: Wed Oct 15 15:43:13 2003 Boris Kolpackov <boris@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/CIAO/CCF')
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp | 3 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Makefile.archive | 2 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Parser.cpp | 11 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Parser.hpp | 6 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp | 65 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp | 3 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp | 1 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt | 1 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.cpp | 58 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.hpp | 127 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp | 1 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt | 1 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp | 77 | ||||
-rw-r--r-- | TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp | 97 | ||||
-rw-r--r-- | TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl | 5 | ||||
-rw-r--r-- | TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2_exec.idl.orig | 3 |
16 files changed, 457 insertions, 4 deletions
diff --git a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp index b977aff35cc..586faa76387 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp @@ -30,6 +30,7 @@ namespace CCF keyword_table_.insert ("local" ); keyword_table_.insert ("module" ); keyword_table_.insert ("out" ); + keyword_table_.insert ("sequence" ); keyword_table_.insert ("sinclude" ); keyword_table_.insert ("supports" ); keyword_table_.insert ("typedef" ); @@ -84,6 +85,8 @@ namespace CCF punctuation_table_.insert ("}"); punctuation_table_.insert ("("); punctuation_table_.insert (")"); + punctuation_table_.insert ("<"); + punctuation_table_.insert (">"); punctuation_table_.insert (";"); } diff --git a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive index 81827acb354..e4793978cbd 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive +++ b/TAO/CIAO/CCF/CCF/IDL2/Makefile.archive @@ -19,6 +19,7 @@ translated_units := SyntaxTree/BuiltIn.o \ SyntaxTree/Interface.o \ SyntaxTree/Module.o \ SyntaxTree/Operation.o \ + SyntaxTree/Sequence.o \ SyntaxTree/Translation.o \ SyntaxTree/TypeId.o \ SyntaxTree/Typedef.o \ @@ -29,6 +30,7 @@ translated_units += Traversal/BuiltIn.o \ Traversal/Interface.o \ Traversal/Module.o \ Traversal/Operation.o \ + Traversal/Sequence.o \ Traversal/Translation.o translated_units += SemanticAction/Operation.o diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp index d5831b90013..9873d5720e7 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.cpp @@ -42,6 +42,7 @@ namespace CCF LOCAL ("local"), MODULE ("module"), OUT ("out"), + SEQUENCE ("sequence"), SINCLUDE ("sinclude"), SUPPORTS ("supports"), TYPEDEF ("typedef"), @@ -54,6 +55,8 @@ namespace CCF RBRACE ("}"), LPAREN ("("), RPAREN (")"), + LT ("<"), + GT (">"), SEMI (";"), @@ -130,6 +133,9 @@ namespace CCF act_typedef_begin ( f.typedef_ (), &SemanticAction::Typedef::begin), + act_typedef_begin_seq ( + f.typedef_ (), &SemanticAction::Typedef::begin_seq), + act_typedef_declarator ( f.typedef_ (), &SemanticAction::Typedef::declarator), @@ -431,13 +437,14 @@ namespace CCF typedef_ = TYPEDEF - >> identifier[act_typedef_begin] + >> typedef_type_spec >> typedef_declarator_list >> SEMI[act_typedef_end] ; typedef_type_spec = - identifier[act_typedef_begin] + identifier[act_typedef_begin] + | SEQUENCE >> LT >> identifier[act_typedef_begin_seq] >> GT ; typedef_declarator_list = diff --git a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp index 6cb5497ec9a..d43dcaae5bd 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Parser.hpp @@ -309,6 +309,7 @@ namespace CCF KeywordParser LOCAL; KeywordParser MODULE; KeywordParser OUT; + KeywordParser SEQUENCE; KeywordParser SINCLUDE; KeywordParser SUPPORTS; KeywordParser TYPEDEF; @@ -322,6 +323,8 @@ namespace CCF PunctuationParser RBRACE; PunctuationParser LPAREN; PunctuationParser RPAREN; + PunctuationParser LT; + PunctuationParser GT; PunctuationParser SEMI; IdentifierParser identifier; @@ -502,6 +505,9 @@ namespace CCF OneArgAction<IdentifierPtr, SemanticAction::Typedef> act_typedef_begin; + OneArgAction<IdentifierPtr, SemanticAction::Typedef> + act_typedef_begin_seq; + OneArgAction<SimpleIdentifierPtr, SemanticAction::Typedef> act_typedef_declarator; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp index 95c1403ae43..00d2c949a50 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp @@ -6,8 +6,11 @@ #define CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPEDEF_HPP #include "CCF/IDL2/SyntaxTree/Typedef.hpp" +#include "CCF/IDL2/SyntaxTree/Sequence.hpp" #include "CCF/IDL2/SemanticAction/Typedef.hpp" +#include <sstream> + namespace CCF { namespace IDL2 @@ -75,6 +78,68 @@ namespace CCF } virtual void + begin_seq (IdentifierPtr const& id) + { + if (trace_) cerr << "typedef sequence<" << id << ">" << endl; + + using namespace SyntaxTree; + + Name name (id->lexeme ()); + + //@@ can use the same predicate with begin () + // + struct Predicate : public DeclarationTable::ResolvePredicate + { + virtual bool + test (DeclarationPtr const& d) const throw () + { + return d->is_a<TypeDecl> (); + } + } p; + + try + { + ScopedName type (scope_->table ().resolve ( + name, + scope_->name (), + scope_->peek_order (), + p)); + + Order order = scope_->create_order (); + + std::ostringstream ostr; + ostr << order; + + SimpleName name (ostr.str ()); + + UnboundedSequenceDeclPtr seq ( + new UnboundedSequenceDecl (name, order, scope_, type)); + + scope_->insert (seq); + + type_ = seq->name (); + + if (trace_) cerr << "assigned anonymous sequence name " + << type_ << endl; + + } + catch (DeclarationTable::NameNotFound const&) + { + cerr << "error: invalid sequence declaration" << endl; + cerr << "no type with name \'" + << name << "\' visible from scope \'" + << scope_->name () << "\'" << endl; + } + catch (DeclarationTable::PredicateNotMet const&) + { + cerr << "error: invalid sequence declaration" << endl; + cerr << "no type with name \'" + << name << "\' visible from scope \'" + << scope_->name () << "\'" << endl; + } + } + + virtual void declarator (SimpleIdentifierPtr const& id) { if (trace_) cerr << " " << id << endl; diff --git a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp index 6cf8f0c8cff..d4214f6d9ea 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp @@ -26,6 +26,9 @@ namespace CCF begin (IdentifierPtr const& id) = 0; virtual void + begin_seq (IdentifierPtr const& id) = 0; + + virtual void declarator (SimpleIdentifierPtr const& id) = 0; virtual void diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp index 7a81f72daac..1ef90bc9715 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree.hpp @@ -10,6 +10,7 @@ #include "CCF/IDL2/SyntaxTree/Interface.hpp" #include "CCF/IDL2/SyntaxTree/Module.hpp" #include "CCF/IDL2/SyntaxTree/Operation.hpp" +#include "CCF/IDL2/SyntaxTree/Sequence.hpp" #include "CCF/IDL2/SyntaxTree/Translation.hpp" #include "CCF/IDL2/SyntaxTree/Typedef.hpp" #include "CCF/IDL2/SyntaxTree/TypeId.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt index 9061713c1b6..c55ae599f83 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Makefile.alt @@ -15,6 +15,7 @@ cxx_translation_units := BuiltIn.cpp \ Interface.cpp \ Module.cpp \ Operation.cpp \ + Sequence.cpp \ Translation.cpp \ Typedef.cpp \ TypeId.cpp \ diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.cpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.cpp new file mode 100644 index 00000000000..fcfac12be8f --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.cpp @@ -0,0 +1,58 @@ +// file : CCF/IDL2/SyntaxTree/Sequence.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/SyntaxTree/Sequence.hpp" + +using namespace Introspection; + +namespace CCF +{ + namespace IDL2 + { + namespace SyntaxTree + { + + // SequnceDecl + // + // + namespace + { + TypeInfo + sequence_decl_init_ () + { + TypeInfo ti (typeid (SequenceDecl)); + ti.add_base (Access::PUBLIC, true, TypeDecl::static_type_info ()); + return ti; + } + + TypeInfo sequence_decl_ (sequence_decl_init_ ()); + } + + TypeInfo const& SequenceDecl:: + static_type_info () { return sequence_decl_; } + + + // UnboundedSequnceDecl + // + // + namespace + { + TypeInfo + unbounded_sequence_decl_init_ () + { + TypeInfo ti (typeid (UnboundedSequenceDecl)); + ti.add_base ( + Access::PUBLIC, true, SequenceDecl::static_type_info ()); + + return ti; + } + + TypeInfo unbounded_sequence_decl_ (unbounded_sequence_decl_init_ ()); + } + + TypeInfo const& UnboundedSequenceDecl:: + static_type_info () { return unbounded_sequence_decl_; } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.hpp b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.hpp new file mode 100644 index 00000000000..391a7b2d178 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/SyntaxTree/Sequence.hpp @@ -0,0 +1,127 @@ +// file : CCF/IDL2/SyntaxTree/Sequence.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_SYNTAX_TREE_SEQUENCE_HPP +#define CCF_IDL2_SYNTAX_TREE_SEQUENCE_HPP + +#include "CCF/IDL2/SyntaxTree/Elements.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace SyntaxTree + { + + // + // + // + class SequenceDecl : public virtual TypeDecl + { + protected: + virtual + ~SequenceDecl () throw () {} + + SequenceDecl (ScopedName const& type) + : type_ (table (), type) + { + type_info (static_type_info ()); + } + + // This c-tor is never called. + // + SequenceDecl (); + + public: + TypeDeclPtr + type () + { + return type_.resolve (); + } + + public: + virtual bool + defined () const + { + //@@ TODO + return true; + } + + // Runtime declaration type information. + // + public: + virtual std::string + declaration_class () + { + return "sequence"; + } + + + public: + static Utility::Introspection::TypeInfo const& + static_type_info (); + + private: + TypeDeclRef type_; + }; + + typedef + StrictPtr<SequenceDecl> + SequenceDeclPtr; + + + + // + // + // + class UnboundedSequenceDecl : public virtual SequenceDecl + { + public: + virtual + ~UnboundedSequenceDecl () throw () {} + + UnboundedSequenceDecl (SimpleName const& name, + Order const& order, + ScopePtr const& scope, + ScopedName const& type) + : Declaration (name, order, scope), + SequenceDecl (type) + { + type_info (static_type_info ()); + } + + public: + virtual TypeDeclPtr + clone_typedef_temporary (SimpleName const& name, + Order const& order, + ScopePtr const& scope) + { + return TypeDeclPtr (new UnboundedSequenceDecl ( + name, + order, + scope, + type ()->name ())); + } + + // Runtime declaration type information + public: + virtual std::string + declaration_class () + { + return "unbounded sequence"; + } + + public: + static Utility::Introspection::TypeInfo const& + static_type_info (); + }; + + typedef + StrictPtr<UnboundedSequenceDecl> + UnboundedSequenceDeclPtr; + } + } +} + +#endif // CCF_IDL2_SYNTAX_TREE_SEQUENCE_HPP diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp index d87a0919da4..3efa40686a7 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal.hpp @@ -10,6 +10,7 @@ #include "CCF/IDL2/Traversal/Interface.hpp" #include "CCF/IDL2/Traversal/Module.hpp" #include "CCF/IDL2/Traversal/Operation.hpp" +#include "CCF/IDL2/Traversal/Sequence.hpp" #include "CCF/IDL2/Traversal/Translation.hpp" #include "CCF/IDL2/Traversal/Typedef.hpp" #include "CCF/IDL2/Traversal/TypeId.hpp" diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt index 67994d38627..dcd59368c3f 100644 --- a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Makefile.alt @@ -15,6 +15,7 @@ cxx_translation_units := BuiltIn.cpp \ Interface.cpp \ Module.cpp \ Operation.cpp \ + Sequence.cpp \ Translation.cpp diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp new file mode 100644 index 00000000000..154701a42fe --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp @@ -0,0 +1,77 @@ +// file : CCF/IDL2/Traversal/Sequence.cpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#include "CCF/IDL2/Traversal/Sequence.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // SequenceDecl + // + // + void SequenceDecl:: + traverse (NodePtr const& n) + { + if (!delegate (n)) + { + pre (n); + type (n); + post (n); + } + } + + void SequenceDecl:: + pre (NodePtr const&) + { + } + + void SequenceDecl:: + type (NodePtr const& n) + { + if (type_ != 0) type_->dispatch (n->type ()); + else dispatch (n->type ()); + } + + void SequenceDecl:: + post (NodePtr const&) + { + } + + + // UnboundedSequenceDecl + // + // + void UnboundedSequenceDecl:: + traverse (NodePtr const& n) + { + if (!delegate (n)) + { + pre (n); + type (n); + post (n); + } + } + + void UnboundedSequenceDecl:: + pre (NodePtr const&) + { + } + + void UnboundedSequenceDecl:: + type (NodePtr const& n) + { + if (type_ != 0) type_->dispatch (n->type ()); + else dispatch (n->type ()); + } + + void UnboundedSequenceDecl:: + post (NodePtr const&) + { + } + } + } +} diff --git a/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp new file mode 100644 index 00000000000..3ec257412c7 --- /dev/null +++ b/TAO/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp @@ -0,0 +1,97 @@ +// file : CCF/IDL2/Traversal/Sequence.hpp +// author : Boris Kolpackov <boris@dre.vanderbilt.edu> +// cvs-id : $Id$ + +#ifndef CCF_IDL2_TRAVERSAL_SEQUENCE_HPP +#define CCF_IDL2_TRAVERSAL_SEQUENCE_HPP + +#include "CCF/IDL2/Traversal/Elements.hpp" +#include "CCF/IDL2/SyntaxTree/Sequence.hpp" + +namespace CCF +{ + namespace IDL2 + { + namespace Traversal + { + // + // + // + struct SequenceDecl : IDL2::Traversal::Traverser + { + typedef + SyntaxTree::SequenceDeclPtr + NodePtr; + + SequenceDecl (Dispatcher* type = 0) + : type_ (type) + { + map (typeid (SyntaxTree::SequenceDecl), this); + } + + virtual bool + traverse (SyntaxTree::NodePtr const& n) + { + traverse (n->dynamic_type<SyntaxTree::SequenceDecl> ()); + return true; + } + + virtual void + traverse (NodePtr const&); + + virtual void + pre (NodePtr const&); + + virtual void + type (NodePtr const&); + + virtual void + post (NodePtr const&); + + private: + Dispatcher* type_; + }; + + + // + // + // + struct UnboundedSequenceDecl : IDL2::Traversal::Traverser + { + typedef + SyntaxTree::UnboundedSequenceDeclPtr + NodePtr; + + UnboundedSequenceDecl (Dispatcher* type = 0) + : type_ (type) + { + map (typeid (SyntaxTree::UnboundedSequenceDecl), this); + } + + virtual bool + traverse (SyntaxTree::NodePtr const& n) + { + traverse (n->dynamic_type<SyntaxTree::UnboundedSequenceDecl> ()); + return true; + } + + virtual void + traverse (NodePtr const&); + + virtual void + pre (NodePtr const&); + + virtual void + type (NodePtr const&); + + virtual void + post (NodePtr const&); + + private: + Dispatcher* type_; + }; + } + } +} + +#endif // CCF_IDL2_TRAVERSAL_SEQUENCE_HPP diff --git a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl index 8636e803654..64d65d1e7d1 100644 --- a/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl +++ b/TAO/CIAO/CCF/Example/CIDL/LocalExecutorMapping/test-2.idl @@ -12,12 +12,15 @@ module M2 { provides Goof g; }; + + typedef sequence<octet> OctetSeq; home H2 : M1::H1 manages C2 { attribute long l; attribute M::I i; + attribute OctetSeq seq; void foo (in long l, inout boolean b, out long ol, in M::I i, out unsigned long long ull); - factory new (in long l); + factory new (in long l, in OctetSeq s); }; }; 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 4177cb09b4f..7cffd205c67 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 @@ -57,8 +57,9 @@ module M2 { attribute long l; attribute ::M::I i; + attribute ::M2::OctetSeq seq; void foo (in long l, inout boolean b, out long ol, in ::M::I i, out unsigned long long ull); - ::Components::EnterpriseComponent new (in long l); + ::Components::EnterpriseComponent new (in long l, in ::M2::OctetSeq s); }; local interface CCM_H2 : CCM_H2Explicit, CCM_H2Implicit |