summaryrefslogtreecommitdiff
path: root/CIAO/CCF/CCF/IDL2/SemanticAction
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/CCF/CCF/IDL2/SemanticAction')
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp47
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Const.hpp33
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Elements.hpp32
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Enum.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Exception.hpp38
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp104
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp205
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp55
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp119
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.hpp39
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp133
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.hpp320
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp94
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.cpp72
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.cpp67
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.hpp42
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp102
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp200
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp50
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp260
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp69
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp113
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.cpp65
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.hpp42
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp51
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp34
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.cpp351
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp84
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp266
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp99
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.hpp45
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp146
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp327
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp65
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.cpp225
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.hpp57
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp293
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp65
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.cpp152
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp42
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.cpp149
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp48
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp56
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Module.hpp38
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp32
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/NumericExpression.hpp77
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Operation.cpp29
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Operation.hpp62
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Struct.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp46
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp56
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/Union.hpp53
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp53
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeFactory.hpp36
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeMember.hpp41
62 files changed, 5764 insertions, 0 deletions
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp
new file mode 100644
index 00000000000..9d002fbc3f5
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Attribute.hpp
@@ -0,0 +1,47 @@
+// file : CCF/IDL2/SemanticAction/Attribute.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_ATTRIBUTE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_ATTRIBUTE_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Attribute
+ {
+ virtual ~Attribute ()
+ {
+ }
+
+ 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
+ get_raises (IdentifierPtr const& id) = 0;
+
+ virtual void
+ set_raises (IdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_ATTRIBUTE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Const.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Const.hpp
new file mode 100644
index 00000000000..92e1ee09dbe
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Const.hpp
@@ -0,0 +1,33 @@
+// file : CCF/IDL2/SemanticAction/Const.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_CONST_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_CONST_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Const
+ {
+ virtual ~Const ()
+ {
+ }
+
+ virtual void
+ begin (IdentifierPtr const& type,
+ SimpleIdentifierPtr const& name) = 0;
+
+ virtual void
+ expr () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_CONST_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Elements.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Elements.hpp
new file mode 100644
index 00000000000..3bd1f4bdd99
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Elements.hpp
@@ -0,0 +1,32 @@
+// file : CCF/IDL2/SemanticAction/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_ELEMENTS_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_ELEMENTS_HPP
+
+#include "CCF/IDL2/Token.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Scope
+ {
+ virtual ~Scope ()
+ {
+ }
+
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ close_scope () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_ELEMENTS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Enum.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Enum.hpp
new file mode 100644
index 00000000000..468da206b6e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Enum.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/SemanticAction/Enum.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_ENUM_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_ENUM_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Enum
+ {
+ virtual ~Enum ()
+ {
+ }
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ enumerator (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_ENUM_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Exception.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Exception.hpp
new file mode 100644
index 00000000000..3bd7323c943
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Exception.hpp
@@ -0,0 +1,38 @@
+// file : CCF/IDL2/SemanticAction/Exception.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_EXCEPTION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_EXCEPTION_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Exception : Scope
+ {
+ virtual ~Exception ()
+ {
+ }
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ close_scope () = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_EXCEPTION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp
new file mode 100644
index 00000000000..2f84d760710
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Factory.hpp
@@ -0,0 +1,104 @@
+// file : CCF/IDL2/SemanticAction/Factory.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_FACTORY_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_FACTORY_HPP
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Attribute;
+ struct Const;
+ struct Enum;
+ struct Exception;
+ struct Include;
+ struct Interface;
+ struct Member;
+ struct Module;
+ struct Native;
+ struct NumericExpression;
+ struct Operation;
+ struct Struct;
+ struct Typedef;
+ struct TypeId;
+ struct TypePrefix;
+ struct Union;
+ struct ValueType;
+ struct ValueTypeFactory;
+ struct ValueTypeMember;
+
+ //
+ //
+ //
+ struct Factory
+ {
+ virtual
+ ~Factory () {}
+
+ virtual Attribute&
+ attribute () = 0;
+
+ virtual Const&
+ const_ () = 0;
+
+ virtual SemanticAction::Enum&
+ enum_ () = 0;
+
+ virtual SemanticAction::Exception&
+ exception () = 0;
+
+ virtual Include&
+ include () = 0;
+
+ virtual Interface&
+ interface () = 0;
+
+ virtual Member&
+ member () = 0;
+
+ virtual Module&
+ module () = 0;
+
+ virtual Native&
+ native () = 0;
+
+ virtual NumericExpression&
+ numeric_expression () = 0;
+
+ virtual Operation&
+ operation () = 0;
+
+ virtual Struct&
+ struct_ () = 0;
+
+ virtual Typedef&
+ typedef_ () = 0;
+
+ virtual TypeId&
+ type_id () = 0;
+
+ virtual TypePrefix&
+ type_prefix () = 0;
+
+ virtual Union&
+ union_ () = 0;
+
+ virtual ValueType&
+ value_type () = 0;
+
+ virtual ValueTypeFactory&
+ value_type_factory () = 0;
+
+ virtual ValueTypeMember&
+ value_type_member () = 0;
+ };
+
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_FACTORY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp
new file mode 100644
index 00000000000..dde00c85988
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.cpp
@@ -0,0 +1,205 @@
+// file : CCF/IDL2/SemanticAction/Impl/Attribute.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Attribute.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Attribute::
+ Attribute (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Attribute::
+ begin_ro ()
+ {
+ if (ctx.trace ()) cerr << "readonly attribute" << endl;
+
+ readonly_ = true;
+
+
+ }
+
+ void Attribute::
+ begin_rw ()
+ {
+ if (ctx.trace ()) cerr << "readwrite attribute" << endl;
+
+ readonly_ = false;
+ }
+
+ void Attribute::
+ type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ type_ = 0;
+
+ try
+ {
+ try
+ {
+ type_ = &resolve<Type> (from, name, Flags::complete);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid attribute declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+ cerr << "using non-type as an attribute type is illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+ void Attribute::
+ name (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << id << endl;
+
+ if (type_ != 0)
+ {
+ if (readonly_)
+ a_ = &ctx.tu ().new_node<ReadAttribute> (
+ ctx.file (), id->line ());
+ else
+ a_ = &ctx.tu ().new_node<ReadWriteAttribute> (
+ ctx.file (), id->line ());
+
+ ctx.tu ().new_edge<Belongs> (*a_, *type_);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *a_, id->lexeme ());
+ }
+ }
+
+ void Attribute::
+ get_raises (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "get-raise " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Exception& e (
+ resolve<SemanticGraph::Exception> (from, name));
+
+ ctx.tu ().new_edge<GetRaises> (
+ dynamic_cast<ReadAttribute&> (*a_), e);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid raises declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no exception with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not an exception declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-exception type in raises declaration is "
+ << "illegal" << endl;
+ }
+ }
+
+ void Attribute::
+ set_raises (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "set-raise " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Exception& e (
+ resolve<SemanticGraph::Exception> (from, name));
+
+ ctx.tu ().new_edge<SetRaises> (
+ dynamic_cast<WriteAttribute&> (*a_), e);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid raises declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no exception with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not an exception declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-exception type in raises declaration is "
+ << "illegal" << endl;
+ }
+ }
+
+ void Attribute::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp
new file mode 100644
index 00000000000..88bc8e5016a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Attribute.hpp
@@ -0,0 +1,55 @@
+// file : CCF/IDL2/SemanticAction/Impl/Attribute.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_ATTRIBUTE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_ATTRIBUTE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Attribute.hpp"
+#include "CCF/IDL2/SemanticAction/Attribute.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Attribute : SemanticAction::Attribute, Base
+ {
+ 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
+ get_raises (IdentifierPtr const& id);
+
+ virtual void
+ set_raises (IdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ bool readonly_;
+ SemanticGraph::Type* type_;
+ SemanticGraph::Attribute* a_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_ATTRIBUTE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp
new file mode 100644
index 00000000000..9685d0874ee
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.cpp
@@ -0,0 +1,119 @@
+// file : CCF/IDL2/SemanticAction/Impl/Const.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Const.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Const::
+ Const (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Const::
+ begin (IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id)
+ {
+ if (ctx.trace ())
+ cerr << "const " << type_id << " " << name_id << endl;
+
+ const_ = 0;
+
+ SimpleName name (name_id->lexeme ());
+ Name type_name (type_id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ Type& t (resolve<Type> (from, type_name, Flags::complete));
+
+ if (dynamic_cast<Octet*> (&t) ||
+ dynamic_cast<Short*> (&t) ||
+ dynamic_cast<UnsignedShort*> (&t) ||
+ dynamic_cast<Long*> (&t) ||
+ dynamic_cast<UnsignedLong*> (&t) ||
+ dynamic_cast<LongLong*> (&t) ||
+ dynamic_cast<UnsignedLongLong*> (&t))
+ {
+ // Integer constant.
+ //
+ const_ = &ctx.tu ().new_node<SemanticGraph::IntConst> (
+ ctx.file (), name_id->line ());
+
+ ctx.tu ().new_edge<Belongs> (*const_, t);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *const_, name);
+ }
+
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "invalid const 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&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "no type with name \'" << type_name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "declaration with name \'" << type_name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "using non-type as a const type is illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+ void Const::
+ expr ()
+ {
+ //@@ Need to check if int_exp_stack is empty.
+ //
+ if (const_ && ctx.int_exp_size () > 0)
+ {
+ IntExpression& expr (ctx.int_exp_pop ());
+
+ ctx.tu ().new_edge<Initializes> (expr, *const_);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.hpp
new file mode 100644
index 00000000000..37ac3153d16
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Const.hpp
@@ -0,0 +1,39 @@
+// file : CCF/IDL2/SemanticAction/Impl/Const.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_CONST_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_CONST_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticAction/Const.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Const : SemanticAction::Const, Base
+ {
+ Const (Context& c);
+
+ virtual void
+ begin (IdentifierPtr const& type,
+ SimpleIdentifierPtr const& name);
+
+ virtual void
+ expr ();
+
+ private:
+ SemanticGraph::Const* const_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_CONST_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp
new file mode 100644
index 00000000000..0076b9d757c
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.cpp
@@ -0,0 +1,133 @@
+// file : CCF/IDL2/SemanticAction/Impl/Elements.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace
+{
+ bool trace (false);
+}
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ // @@ Need pointer iterator adapter.
+
+ using namespace SemanticGraph;
+ using SemanticGraph::Scope;
+
+ Nameables
+ resolve (TranslationUnit& tu,
+ ScopedName const& from,
+ Name const& name) throw (NotFound)
+ {
+
+ if (trace) cerr << "resolve: starting resolution process for \'"
+ << name << "\' from \'" << from << "\'" << endl;
+
+ Nameables r;
+
+ // Check if name is already scoped.
+ //
+ if (name.scoped ())
+ {
+ r = tu.lookup (ScopedName (name));
+ }
+ else
+ {
+ // Obtain all nodes corresponding to this scope name.
+ //
+
+ for (ScopedName next (from);;)
+ {
+ Nameables scopes (tu.lookup (next));
+
+ // Lookup the name in each scope.
+ //
+ for (Nameables::const_iterator
+ i (scopes.begin ()), end (scopes.end ());
+ i != end; ++i)
+ {
+ if (Scope* s = dynamic_cast<Scope*> (*i))
+ {
+ s->lookup (name, r);
+ }
+ }
+
+ if (r.begin () != r.end () || next.simple ())
+ {
+ // Found something -or- at the root scope.
+ //
+ break;
+ }
+
+ next = ScopedName (next.begin (), next.end () - 1);
+ }
+ }
+
+ if (r.begin () == r.end ())
+ {
+ if (trace) cerr << "resolve: resolution process for \'"
+ << name << "\' from \'" << from << "\' failed."
+ << endl;
+
+ throw NotFound ();
+ }
+ else
+ {
+ if (trace) cerr << "resolve: resolution process for \'"
+ << name << "\' from \'" << from << "\' succeeded:"
+ << endl;
+
+ for (Nameables::const_iterator i (r.begin ()), end (r.end ());
+ i != end; ++i)
+ {
+ if (trace) cerr << "\t\'" << (**i).scoped_name () << "\'"
+ << endl;
+ }
+ }
+
+ return r;
+ }
+
+
+ // Lookup *all* scopes for a simple name
+ //
+ //
+ Nameable*
+ lookup (SemanticGraph::TranslationUnit& tu,
+ SemanticGraph::Scope& in,
+ SemanticGraph::SimpleName const& name) throw (NotUnique)
+ {
+ Nameables r;
+
+ Nameables scopes (tu.lookup (in.scoped_name ()));
+
+ for (Nameables::const_iterator
+ i (scopes.begin ()), end (scopes.end ());
+ i != end; ++i)
+ {
+ dynamic_cast<Scope&> (**i).lookup (name, r);
+ }
+
+ if (r.size () > 1) throw NotUnique ();
+
+ if (r.empty ()) return 0;
+
+ return *(r.begin ());
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.hpp
new file mode 100644
index 00000000000..51da2657b5d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.hpp
@@ -0,0 +1,320 @@
+// file : CCF/IDL2/SemanticAction/Impl/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
+
+#include <stack>
+
+#include "CCF/IDL2/SemanticGraph/Translation.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+/*
+ Design notes:
+
+ (1) I am using stack-based approach to handle cases like this:
+
+ struct A
+ {
+ struct B
+ {
+ struct C
+ {
+ ...
+ } c;
+
+ } b;
+ };
+
+ Even though you can't write the same let's say for interface
+ I am still using stack approach for consistency and possible
+ meta-coding.
+
+*/
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+
+ //
+ //
+ //
+ class Context
+ {
+ public:
+ Context (bool trace,
+ SemanticGraph::TranslationUnit& tu,
+ CompilerElements::Context& parsing_context)
+ : trace_ (trace),
+ tu_ (tu),
+ parsing_context_ (parsing_context)
+ {
+ }
+
+ bool
+ trace ()
+ {
+ return trace_;
+ }
+
+ SemanticGraph::TranslationUnit&
+ tu () const
+ {
+ return tu_;
+ }
+
+ SemanticGraph::Scope&
+ scope () const
+ {
+ return *scope_;
+ }
+
+ void
+ scope (SemanticGraph::Scope& scope)
+ {
+ scope_ = &scope;
+ }
+
+ SemanticGraph::TranslationRegion&
+ region () const
+ {
+ return *region_;
+ }
+
+ void
+ region (SemanticGraph::TranslationRegion& r)
+ {
+ region_ = &r;
+ }
+
+ CompilerElements::Context&
+ parsing_context () const
+ {
+ return parsing_context_;
+ }
+
+ SemanticGraph::Path const&
+ file () const
+ {
+ return parsing_context_.get<SemanticGraph::Path> ("file-path");
+ }
+
+ public:
+ void
+ int_exp_push (SemanticGraph::IntExpression& e)
+ {
+ int_exp_stack_.push (&e);
+ }
+
+ SemanticGraph::IntExpression&
+ int_exp_pop ()
+ {
+ SemanticGraph::IntExpression& e (*int_exp_stack_.top ());
+ int_exp_stack_.pop ();
+ return e;
+ }
+
+ std::size_t
+ int_exp_size ()
+ {
+ return int_exp_stack_.size ();
+ }
+
+ void
+ int_exp_flush ()
+ {
+ while (int_exp_stack_.size ())
+ int_exp_stack_.pop ();
+ }
+
+ private:
+ bool trace_;
+ SemanticGraph::TranslationUnit& tu_;
+ SemanticGraph::TranslationRegion* region_;
+ SemanticGraph::Scope* scope_;
+
+ CompilerElements::Context& parsing_context_;
+
+ std::stack<SemanticGraph::IntExpression*> int_exp_stack_;
+
+ private:
+ Context (Context const&);
+ void operator= (Context const&);
+ };
+
+
+ //
+ //
+ //
+ class Base
+ {
+ protected:
+ virtual
+ ~Base ()
+ {
+ }
+
+ Base (Context& c)
+ : ctx (c)
+ {
+ }
+
+ protected:
+
+ class Resolve {};
+
+ template <typename Id>
+ struct ExceptionTemplate : Resolve
+ {
+ explicit
+ ExceptionTemplate (SemanticGraph::ScopedName name)
+ : name_ (name)
+ {
+ }
+
+ SemanticGraph::ScopedName
+ name () const
+ {
+ return name_;
+ }
+
+ private:
+ SemanticGraph::ScopedName name_;
+ };
+
+
+ struct NotFound : Resolve {};
+
+ class WrongType_ {};
+ typedef ExceptionTemplate<WrongType_> WrongType;
+
+ class NotUnique : Resolve {};
+
+ class NotDefined_ {};
+ typedef ExceptionTemplate<NotDefined_> NotDefined;
+
+ class NotComplete_ {};
+ typedef ExceptionTemplate<NotComplete_> NotComplete;
+
+ struct Flags
+ {
+ enum Value
+ {
+ none = 0x00,
+ complete = 0x01,
+ defined = 0x02
+ };
+ };
+
+ template <typename T>
+ T&
+ resolve (SemanticGraph::ScopedName const& from,
+ SemanticGraph::Name const& name,
+ Flags::Value flags = Flags::none)
+ throw (NotFound, NotUnique, WrongType, NotDefined, NotComplete);
+
+
+ class AlreadyInherited_ {};
+ typedef ExceptionTemplate<AlreadyInherited_> AlreadyInherited;
+
+ class AlreadySupported_ {};
+ typedef ExceptionTemplate<AlreadySupported_> AlreadySupported;
+
+ template<typename I>
+ void
+ check_inheritance (I begin, I end, SemanticGraph::Nameable& t)
+ throw (AlreadyInherited);
+
+ template<typename I>
+ void
+ check_support (I begin, I end, SemanticGraph::Nameable& t)
+ throw (AlreadySupported);
+
+ protected:
+ Context& ctx;
+ };
+
+
+ //
+ //
+ //
+ template <typename T>
+ class ScopeBase : public Base
+ {
+ protected:
+ ScopeBase (Context& c)
+ : Base (c)
+ {
+ }
+
+ protected:
+ T&
+ now () const
+ {
+ return *now_;
+ }
+
+ void
+ now (T& t)
+ {
+ now_ = &t;
+ }
+
+ void
+ push (SemanticGraph::Scope& t)
+ {
+ stack_.push (&t);
+ }
+
+ void
+ pop ()
+ {
+ stack_.pop ();
+ }
+
+ SemanticGraph::Scope&
+ top ()
+ {
+ return *stack_.top ();
+ }
+
+ private:
+ T* now_;
+ std::stack<SemanticGraph::Scope*> stack_;
+ };
+
+
+ //
+ //
+ //
+ class NotFound {};
+ class NotUnique {};
+
+ SemanticGraph::Nameables
+ resolve (SemanticGraph::TranslationUnit& tu,
+ SemanticGraph::ScopedName const& from,
+ SemanticGraph::Name const& name) throw (NotFound);
+
+
+
+
+ SemanticGraph::Nameable*
+ lookup (SemanticGraph::TranslationUnit& tu,
+ SemanticGraph::Scope& in,
+ SemanticGraph::SimpleName const& name) throw (NotUnique);
+ }
+ }
+ }
+}
+
+#include "CCF/IDL2/SemanticAction/Impl/Elements.tpp"
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_ELEMENTS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp
new file mode 100644
index 00000000000..13d4e8905d4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Elements.tpp
@@ -0,0 +1,94 @@
+// file : CCF/IDL2/SemanticAction/Impl/Elements.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ template <typename T>
+ T& Base::
+ resolve (SemanticGraph::ScopedName const& from,
+ SemanticGraph::Name const& name,
+ Flags::Value flags)
+ throw (NotFound, NotUnique, WrongType, NotDefined, NotComplete)
+ {
+ using namespace SemanticGraph;
+
+ try
+ {
+ Nameables nodes (Impl::resolve (ctx.tu (), from, name));
+
+
+ if (nodes.size () != 1) throw NotUnique ();
+
+ Nameable& node (**(nodes.begin ()));
+
+ try
+ {
+ T& t (dynamic_cast<T&> (node));
+
+ if (flags & Flags::defined)
+ {
+ if (!t.defined ()) throw NotDefined (node.scoped_name ());
+ }
+
+ if (flags & Flags::complete)
+ {
+ SemanticGraph::Type& type (
+ dynamic_cast<SemanticGraph::Type&> (t));
+
+ if (!type.complete ())
+ {
+ throw NotComplete (node.scoped_name ());
+ }
+ }
+
+ return t;
+ }
+ catch (std::bad_cast const&)
+ {
+ throw WrongType (node.scoped_name ());
+ }
+ }
+ catch (Impl::NotFound const&)
+ {
+ throw NotFound ();
+ }
+ }
+
+ template<typename I>
+ void Base::
+ check_inheritance (I begin, I end, SemanticGraph::Nameable& t)
+ throw (AlreadyInherited)
+ {
+ for (;begin != end; ++begin)
+ {
+ if ((**begin).inheritee () == t)
+ {
+ throw AlreadyInherited (t.scoped_name ());
+ }
+ }
+ }
+
+ template<typename I>
+ void Base::
+ check_support (I begin, I end, SemanticGraph::Nameable& t)
+ throw (AlreadySupported)
+ {
+ for (;begin != end; ++begin)
+ {
+ if ((**begin).supportee () == t)
+ {
+ throw AlreadySupported (t.scoped_name ());
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.cpp
new file mode 100644
index 00000000000..cece740ed39
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.cpp
@@ -0,0 +1,72 @@
+// file : CCF/IDL2/SemanticAction/Impl/Enum.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Enum.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Enum::
+ Enum (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Enum::
+ begin (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "enum " << id << endl;
+
+ type_ = 0;
+
+ SimpleName name (id->lexeme ());
+
+ type_ = &ctx.tu ().new_node<SemanticGraph::Enum> (
+ ctx.file (), id->line ());
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *type_, name);
+ }
+
+ void Enum::
+ enumerator (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "enumerator " << id << endl;
+
+ //@@ Need to check for redeclaration of the name.
+ //
+
+ SimpleName name (id->lexeme ());
+
+ if (type_ != 0)
+ {
+ Enumerator& e (
+ ctx.tu ().new_node<Enumerator> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Belongs> (e, *type_);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), e, name);
+ }
+ }
+
+ void Enum::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.hpp
new file mode 100644
index 00000000000..df25fb0455f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Enum.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticAction/Impl/Enum.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_ENUM_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_ENUM_HPP
+
+#include "CCF/IDL2/SemanticGraph/Enum.hpp"
+#include "CCF/IDL2/SemanticAction/Enum.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Enum : SemanticAction::Enum, Base
+ {
+ Enum (Context& c);
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id);
+
+ virtual void
+ enumerator (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ SemanticGraph::Enum* type_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_ENUM_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.cpp
new file mode 100644
index 00000000000..63af631c4b9
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.cpp
@@ -0,0 +1,67 @@
+// file : CCF/IDL2/SemanticAction/Impl/Exception.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Exception.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Exception::
+ Exception (Context& c)
+ : ScopeBase<SemanticGraph::Exception> (c)
+ {
+ }
+
+ void Exception::
+ begin (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "exception " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ now (ctx.tu ().new_node<SemanticGraph::Exception> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Exception::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Exception::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Exception::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.hpp
new file mode 100644
index 00000000000..6ed44048b36
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Exception.hpp
@@ -0,0 +1,42 @@
+// file : CCF/IDL2/SemanticAction/Impl/Exception.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_EXCEPTION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_EXCEPTION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+#include "CCF/IDL2/SemanticAction/Exception.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Exception : SemanticAction::Exception,
+ ScopeBase<SemanticGraph::Exception>
+ {
+ Exception (Context& c);
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_EXCEPTION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp
new file mode 100644
index 00000000000..6a680d14831
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.cpp
@@ -0,0 +1,102 @@
+// file : CCF/IDL2/SemanticAction/Impl/Factory.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+
+#include "CCF/IDL2/SemanticAction/Impl/Factory.hpp"
+
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ template <typename X>
+ void Factory::
+ define_fund_type (Root& root, SimpleName const& name)
+ {
+ ctx_.tu ().template new_edge<Defines> (
+ root,
+ ctx_.tu ().template new_node<X> ("fundamental-types", 0), name);
+ }
+
+ Factory::
+ Factory (CompilerElements::Context& parsing_context,
+ Diagnostic::Stream&,
+ SemanticGraph::TranslationUnit& tu)
+ : ctx_ (parsing_context.get ("trace-semantic-action", false),
+ tu,
+ parsing_context),
+
+ attribute_ (ctx_),
+ const__ (ctx_),
+ enum__ (ctx_),
+ exception_ (ctx_),
+ include_ (ctx_),
+ interface_ (ctx_),
+ member_ (ctx_),
+ module_ (ctx_),
+ native_ (ctx_),
+ numeric_expression_ (ctx_),
+ operation_ (ctx_),
+ struct__ (ctx_),
+ typedef__ (ctx_),
+ type_id_ (ctx_),
+ type_prefix_ (ctx_),
+ union__ (ctx_),
+ value_type_ (ctx_),
+ value_type_factory_ (ctx_),
+ value_type_member_ (ctx_)
+ {
+ // Implied translation region with fundamental types.
+ //
+ TranslationRegion& ftr (
+ tu.new_node<TranslationRegion> (
+ "fundamental-type", 0));
+
+ tu.new_edge<ContainsImplied> (tu, ftr, "fundamental-type");
+
+ Root& fr (tu.new_node<Root> ("fundamental-types", 0));
+ tu.new_edge<ContainsRoot> (ftr, fr);
+
+ define_fund_type<Object> (fr, "Object");
+ define_fund_type<ValueBase> (fr, "ValueBase");
+ define_fund_type<Any> (fr, "any");
+ define_fund_type<Boolean> (fr, "boolean");
+ define_fund_type<Char> (fr, "char");
+ define_fund_type<Double> (fr, "double");
+ define_fund_type<Float> (fr, "float");
+ define_fund_type<Long> (fr, "long");
+ define_fund_type<LongDouble> (fr, "long double");
+ define_fund_type<LongLong> (fr, "long long");
+ define_fund_type<Octet> (fr, "octet");
+ define_fund_type<Short> (fr, "short");
+ define_fund_type<String> (fr, "string");
+ define_fund_type<UnsignedLong> (fr, "unsigned long");
+ define_fund_type<UnsignedLongLong> (fr, "unsigned long long");
+ define_fund_type<UnsignedShort> (fr, "unsigned short");
+ define_fund_type<Void> (fr, "void");
+ define_fund_type<Wchar> (fr, "wchar");
+ define_fund_type<Wstring> (fr, "wstring");
+
+ TranslationRegion& principal (
+ tu.new_node<TranslationRegion> (ctx_.file (), 0));
+
+ tu.new_edge<ContainsPrincipal> (tu, principal);
+
+ Root& root (tu.new_node<Root> (ctx_.file (), 0));
+ tu.new_edge<ContainsRoot> (principal, root);
+
+ ctx_.region (principal);
+ ctx_.scope (root);
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp
new file mode 100644
index 00000000000..f385fdec57f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Factory.hpp
@@ -0,0 +1,200 @@
+// file : CCF/IDL2/SemanticAction/Impl/Factory.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_FACTORY_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_FACTORY_HPP
+
+#include "CCF/CompilerElements/Diagnostic.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Translation.hpp"
+
+#include "CCF/IDL2/SemanticAction/Factory.hpp"
+
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+//@@ It would be nice to move this includes into .cpp
+//
+#include "CCF/IDL2/SemanticAction/Impl/Attribute.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Const.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Enum.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Exception.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Include.hpp"
+#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/NumericExpression.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/Union.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/ValueType.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Factory : virtual IDL2::SemanticAction::Factory
+ {
+ Factory (CompilerElements::Context& context,
+ Diagnostic::Stream& dout,
+ SemanticGraph::TranslationUnit& tu);
+
+ virtual SemanticAction::Attribute&
+ attribute ()
+ {
+ return attribute_;
+ }
+
+ virtual SemanticAction::Const&
+ const_ ()
+ {
+ return const__;
+ }
+
+ virtual SemanticAction::Enum&
+ enum_ ()
+ {
+ return enum__;
+ }
+
+ virtual SemanticAction::Exception&
+ exception ()
+ {
+ return exception_;
+ }
+
+ virtual SemanticAction::Include&
+ include ()
+ {
+ return include_;
+ }
+
+ virtual SemanticAction::Interface&
+ interface ()
+ {
+ return interface_;
+ }
+
+ virtual SemanticAction::Member&
+ member ()
+ {
+ return member_;
+ }
+
+ virtual SemanticAction::Module&
+ module ()
+ {
+ return module_;
+ }
+
+ virtual SemanticAction::Native&
+ native ()
+ {
+ return native_;
+ }
+
+ virtual SemanticAction::NumericExpression&
+ numeric_expression ()
+ {
+ return numeric_expression_;
+ }
+
+ virtual SemanticAction::Operation&
+ operation ()
+ {
+ return operation_;
+ }
+
+ virtual SemanticAction::Struct&
+ struct_ ()
+ {
+ return struct__;
+ }
+
+ virtual SemanticAction::Typedef&
+ typedef_ ()
+ {
+ return typedef__;
+ }
+
+ virtual SemanticAction::TypeId&
+ type_id ()
+ {
+ return type_id_;
+ }
+
+ virtual SemanticAction::TypePrefix&
+ type_prefix ()
+ {
+ return type_prefix_;
+ }
+
+ virtual SemanticAction::Union&
+ union_ ()
+ {
+ return union__;
+ }
+
+ virtual SemanticAction::ValueType&
+ value_type ()
+ {
+ return value_type_;
+ }
+
+ virtual ValueTypeFactory&
+ value_type_factory ()
+ {
+ return value_type_factory_;
+ }
+
+ virtual SemanticAction::ValueTypeMember&
+ value_type_member ()
+ {
+ return value_type_member_;
+ }
+
+ protected:
+ Context ctx_;
+
+ private:
+ template <typename X>
+ void
+ define_fund_type (SemanticGraph::Root& root,
+ SemanticGraph::SimpleName const& name);
+
+ private:
+ Attribute attribute_;
+ Const const__;
+ Enum enum__;
+ Exception exception_;
+ Include include_;
+ Interface interface_;
+ Member member_;
+ Module module_;
+ Native native_;
+ NumericExpression numeric_expression_;
+ Operation operation_;
+ Struct struct__;
+ Typedef typedef__;
+ TypeId type_id_;
+ TypePrefix type_prefix_;
+ Union union__;
+ ValueType value_type_;
+ ValueTypeFactory value_type_factory_;
+ ValueTypeMember value_type_member_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_FACTORY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp
new file mode 100644
index 00000000000..5fcbe4a0c31
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.cpp
@@ -0,0 +1,50 @@
+// file : CCF/IDL2/SemanticAction/Impl/Include.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Include.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ // @@ This is left unimplemented for now. Later, code from
+ // IDL3 should be copied here. Or better yet this implementation
+ // should allow customization via overriding.
+ //
+ Include::
+ Include (Context& c)
+ : ctx (c)
+ {
+ }
+
+ void Include::
+ quote (StringLiteralPtr const& sl)
+ {
+ if (ctx.trace ()) cerr << "__qinclude " << sl << endl;
+ }
+
+ void Include::
+ bracket (StringLiteralPtr const& sl)
+ {
+ if (ctx.trace ()) cerr << "__binclude " << sl << endl;
+ }
+
+ void Include::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp
new file mode 100644
index 00000000000..57b573e23a3
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Include.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticAction/Impl/Include.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_INCLUDE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_INCLUDE_HPP
+
+
+#include "CCF/IDL2/SemanticAction/Include.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Include : SemanticAction::Include
+ {
+ Include (Context& c);
+
+ virtual void
+ quote (StringLiteralPtr const& sl);
+
+ virtual void
+ bracket (StringLiteralPtr const& sl);
+
+ virtual void
+ end ();
+
+ private:
+ Context& ctx;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_INCLUDE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp
new file mode 100644
index 00000000000..63c5dc9d5be
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.cpp
@@ -0,0 +1,260 @@
+// file : CCF/IDL2/SemanticAction/Impl/Interface.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Interface.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Interface::
+ Interface (Context& c)
+ : ScopeBase<SemanticGraph::Interface> (c)
+ {
+ }
+
+ void Interface::
+ begin_abstract_def (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "abstract interface def " << id << endl;
+
+ qualifier_ = Qualifier::abstract;
+
+ SimpleName name (id->lexeme ());
+
+ //@@ Not handling NotUnique exception.
+ //
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<AbstractInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<AbstractInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ begin_abstract_fwd (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "abstract interface fwd " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<AbstractInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<AbstractInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ begin_local_def (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "local interface def " << id << endl;
+
+ qualifier_ = Qualifier::local;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<LocalInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<LocalInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ begin_local_fwd (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "local interface fwd " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<LocalInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<LocalInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ begin_unconstrained_def (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "unconstrained interface def " << id
+ << endl;
+
+ qualifier_ = Qualifier::unconstrained;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<UnconstrainedInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<UnconstrainedInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ begin_unconstrained_fwd (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "unconstrained interface fwd " << id
+ << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<UnconstrainedInterface&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<UnconstrainedInterface> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void Interface::
+ inherits (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << " inherits " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Interface& i (
+ resolve<SemanticGraph::Interface> (from, name, Flags::defined));
+
+ switch (qualifier_)
+ {
+ case Qualifier::abstract:
+ {
+ if (dynamic_cast<AbstractInterface*> (&i)) break;
+
+ throw WrongType (i.scoped_name ());
+ }
+ case Qualifier::unconstrained:
+ {
+ if (dynamic_cast<UnconstrainedInterface*> (&i) ||
+ dynamic_cast<AbstractInterface*> (&i)) break;
+
+ throw WrongType (i.scoped_name ());
+ }
+ default: break;
+ }
+
+ check_inheritance (now ().inherits_begin (),
+ now ().inherits_end (),
+ i);
+
+ ctx.tu ().new_edge<Inherits> (now (), i);
+ ctx.tu ().new_edge<Extends> (now (), i);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid inheritance specification" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no interface with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "incompatible type in inheritance specification" << endl;
+ }
+ catch (NotDefined const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "attempt to inherit from forward-declared interface "
+ << e.name () << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "inheritance from forward-declared interface is illegal"
+ << endl;
+ }
+ catch (AlreadyInherited const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "directly inheriting from interface \'" << e.name ()
+ << "\' more than once is illegal" << endl;
+ }
+ }
+
+ void Interface::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Interface::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Interface::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp
new file mode 100644
index 00000000000..f25315a1a28
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Interface.hpp
@@ -0,0 +1,69 @@
+// file : CCF/IDL2/SemanticAction/Impl/Interface.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_INTERFACE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_INTERFACE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+#include "CCF/IDL2/SemanticAction/Interface.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Interface : SemanticAction::Interface,
+ ScopeBase<SemanticGraph::Interface>
+ {
+ Interface (Context& c);
+
+ virtual void
+ begin_abstract_def (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_abstract_fwd (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_local_def (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_local_fwd (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_unconstrained_def (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_unconstrained_fwd (SimpleIdentifierPtr const& id);
+
+ virtual void
+ inherits (IdentifierPtr const& id);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+
+ private:
+ struct Qualifier
+ {
+ enum Value { abstract, local, unconstrained };
+ };
+
+ Qualifier::Value qualifier_;
+ };
+
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_INTERFACE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp
new file mode 100644
index 00000000000..790bb2a6c95
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.cpp
@@ -0,0 +1,113 @@
+// file : CCF/IDL2/SemanticAction/Impl/Member.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Member.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Member::
+ Member (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Member::
+ type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "member " << id << endl;
+
+ type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ // With introduction of CORBA 3.1 we have a new beast:
+ // struct with incoplete members which itself becomes
+ // incomplete.
+ //
+ type_ = &resolve<Type> (from, name/*, Flags::complete*/);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": 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&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type as a member type is illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+
+ void Member::
+ name (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << " " << id << endl;
+
+ if (type_)
+ {
+ SimpleName name (id->lexeme ());
+
+ SemanticGraph::Member& m (
+ ctx.tu ().new_node<SemanticGraph::Member> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Belongs> (m, *type_);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), m, name);
+ }
+ }
+
+ void Member::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp
new file mode 100644
index 00000000000..2ec51a1ab01
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Member.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticAction/Impl/Member.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticAction/Member.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Member : SemanticAction::Member, Base
+ {
+ Member (Context& c);
+
+ virtual void
+ type (IdentifierPtr const& id);
+
+ virtual void
+ name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ SemanticGraph::Type* type_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.cpp
new file mode 100644
index 00000000000..b2b003d6d73
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.cpp
@@ -0,0 +1,65 @@
+// file : CCF/IDL2/SemanticAction/Impl/Module.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Module.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Module::
+ Module (Context& c)
+ : ScopeBase<SemanticGraph::Module> (c)
+ {
+ }
+
+ void Module::
+ begin (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "module " << id << endl;
+
+ now (ctx.tu ().new_node<SemanticGraph::Module> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), id->lexeme ());
+ }
+
+ void Module::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Module::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Module::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.hpp
new file mode 100644
index 00000000000..1fbbc4c78fc
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Module.hpp
@@ -0,0 +1,42 @@
+// file : CCF/IDL2/SemanticAction/Impl/Module.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_MODULE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_MODULE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+#include "CCF/IDL2/SemanticAction/Module.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Module : SemanticAction::Module,
+ ScopeBase<SemanticGraph::Module>
+ {
+ Module (Context& c);
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_MODULE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp
new file mode 100644
index 00000000000..162fd1d5bfe
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.cpp
@@ -0,0 +1,51 @@
+// file : CCF/IDL2/SemanticAction/Impl/Native.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#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 (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.file (), id->line ()));
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), n, name);
+ }
+
+ void Native::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp
new file mode 100644
index 00000000000..52875c58862
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Native.hpp
@@ -0,0 +1,34 @@
+// 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
+ {
+ struct Native : SemanticAction::Native, Base
+ {
+ Native (Context& c);
+
+ virtual void
+ name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_NATIVE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.cpp
new file mode 100644
index 00000000000..e949438aff8
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.cpp
@@ -0,0 +1,351 @@
+// file : CCF/IDL2/SemanticAction/Impl/NumericExpression.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ NumericExpression::
+ NumericExpression (Context& c)
+ : Base (c)
+ {
+ }
+
+ void NumericExpression::
+ flush ()
+ {
+ if (ctx.trace ())
+ cerr << "expression" << endl;
+
+ ctx.int_exp_flush ();
+ }
+
+ void NumericExpression::
+ const_ (IdentifierPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << "const " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ Const& c (resolve<Const> (from, name));
+
+ if (IntConst* ic = dynamic_cast<IntConst*> (&c))
+ {
+ ctx.int_exp_push (*ic);
+ }
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid reference to const" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no const with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a const declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-const as a reference to const is illegal"
+ << endl;
+ }
+ }
+
+ void NumericExpression::
+ integer_literal (IntegerLiteralPtr const& il)
+ {
+ if (ctx.trace ())
+ cerr << "integer literal " << il->value () << endl;
+
+ ctx.int_exp_push (
+ ctx.tu ().new_node<IntLiteral> (
+ ctx.file (), il->line (), il->value ()));
+ }
+
+ void NumericExpression::
+ pre (OperatorPtr const& op)
+ {
+ line_ = op->line ();
+ }
+
+ void NumericExpression::
+ pos ()
+ {
+ if (ctx.trace ())
+ cerr << "unary +" << endl;
+
+ // Nothing to do.
+ }
+
+ void NumericExpression::
+ neg ()
+ {
+ if (ctx.trace ())
+ cerr << "unary -" << endl;
+
+ if (ctx.int_exp_size () < 1)
+ return;
+
+ IntExpression& expr (ctx.int_exp_pop ());
+
+ IntNeg& neg (ctx.tu ().new_node<IntNeg> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntNegates> (neg, expr);
+
+ ctx.int_exp_push (neg);
+ }
+
+ void NumericExpression::
+ com ()
+ {
+ if (ctx.trace ())
+ cerr << "unary ~" << endl;
+
+ if (ctx.int_exp_size () < 1)
+ return;
+
+ IntExpression& expr (ctx.int_exp_pop ());
+
+ IntCom& com (ctx.tu ().new_node<IntCom> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntComplements> (com, expr);
+
+ ctx.int_exp_push (com);
+ }
+
+ void NumericExpression::
+ mul ()
+ {
+ if (ctx.trace ())
+ cerr << "*" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& multiplier (ctx.int_exp_pop ());
+ IntExpression& multiplicand (ctx.int_exp_pop ());
+
+ IntMul& mul (ctx.tu ().new_node<IntMul> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntMultiplies> (mul, multiplicand);
+ ctx.tu ().new_edge<IntMultiplies> (mul, multiplier);
+
+ ctx.int_exp_push (mul);
+ }
+
+ void NumericExpression::
+ div ()
+ {
+ if (ctx.trace ())
+ cerr << "/" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& divisor (ctx.int_exp_pop ());
+ IntExpression& divident (ctx.int_exp_pop ());
+
+ IntDiv& div (ctx.tu ().new_node<IntDiv> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntDivides> (div, divident);
+ ctx.tu ().new_edge<IntDivides> (div, divisor);
+
+ ctx.int_exp_push (div);
+ }
+
+ void NumericExpression::
+ rem ()
+ {
+ if (ctx.trace ())
+ cerr << "%" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& divisor (ctx.int_exp_pop ());
+ IntExpression& divident (ctx.int_exp_pop ());
+
+ IntRem& rem (ctx.tu ().new_node<IntRem> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntDivides> (rem, divident);
+ ctx.tu ().new_edge<IntDivides> (rem, divisor);
+
+ ctx.int_exp_push (rem);
+ }
+
+
+ void NumericExpression::
+ add ()
+ {
+ if (ctx.trace ())
+ cerr << "+" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& second_item (ctx.int_exp_pop ());
+ IntExpression& first_item (ctx.int_exp_pop ());
+
+ IntAdd& add (ctx.tu ().new_node<IntAdd> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntAdds> (add, first_item);
+ ctx.tu ().new_edge<IntAdds> (add, second_item);
+
+ ctx.int_exp_push (add);
+ }
+
+ void NumericExpression::
+ sub ()
+ {
+ if (ctx.trace ())
+ cerr << "-" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& subtrahend (ctx.int_exp_pop ());
+ IntExpression& minuend (ctx.int_exp_pop ());
+
+ IntSub& sub (ctx.tu ().new_node<IntSub> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntSubtracts> (sub, minuend);
+ ctx.tu ().new_edge<IntSubtracts> (sub, subtrahend);
+
+ ctx.int_exp_push (sub);
+ }
+
+ void NumericExpression::
+ rsh ()
+ {
+ if (ctx.trace ())
+ cerr << ">>" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& factor (ctx.int_exp_pop ());
+ IntExpression& pattern (ctx.int_exp_pop ());
+
+ IntRsh& rsh (ctx.tu ().new_node<IntRsh> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntShifts> (rsh, pattern);
+ ctx.tu ().new_edge<IntShifts> (rsh, factor);
+
+ ctx.int_exp_push (rsh);
+ }
+
+ void NumericExpression::
+ lsh ()
+ {
+ if (ctx.trace ())
+ cerr << "<<" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& factor (ctx.int_exp_pop ());
+ IntExpression& pattern (ctx.int_exp_pop ());
+
+ IntLsh& lsh (ctx.tu ().new_node<IntLsh> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntShifts> (lsh, pattern);
+ ctx.tu ().new_edge<IntShifts> (lsh, factor);
+
+ ctx.int_exp_push (lsh);
+ }
+
+ void NumericExpression::
+ and_ ()
+ {
+ if (ctx.trace ())
+ cerr << "&" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& second_pattern (ctx.int_exp_pop ());
+ IntExpression& first_pattern (ctx.int_exp_pop ());
+
+ IntAnd& and_ (ctx.tu ().new_node<IntAnd> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntConjuncts> (and_, first_pattern);
+ ctx.tu ().new_edge<IntConjuncts> (and_, second_pattern);
+
+ ctx.int_exp_push (and_);
+ }
+
+ void NumericExpression::
+ xor_ ()
+ {
+ if (ctx.trace ())
+ cerr << "^" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& second_pattern (ctx.int_exp_pop ());
+ IntExpression& first_pattern (ctx.int_exp_pop ());
+
+ IntXor& xor_ (ctx.tu ().new_node<IntXor> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntExclusivelyDisjuncts> (xor_, first_pattern);
+ ctx.tu ().new_edge<IntExclusivelyDisjuncts> (xor_, second_pattern);
+
+ ctx.int_exp_push (xor_);
+ }
+
+ void NumericExpression::
+ or_ ()
+ {
+ if (ctx.trace ())
+ cerr << "|" << endl;
+
+ if (ctx.int_exp_size () < 2)
+ return;
+
+ IntExpression& second_pattern (ctx.int_exp_pop ());
+ IntExpression& first_pattern (ctx.int_exp_pop ());
+
+ IntOr& or_ (ctx.tu ().new_node<IntOr> (ctx.file (), line_));
+
+ ctx.tu ().new_edge<IntInclusivelyDisjuncts> (or_, first_pattern);
+ ctx.tu ().new_edge<IntInclusivelyDisjuncts> (or_, second_pattern);
+
+ ctx.int_exp_push (or_);
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp
new file mode 100644
index 00000000000..fe0b399cb60
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp
@@ -0,0 +1,84 @@
+// file : CCF/IDL2/SemanticAction/Impl/NumericExpression.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_NUMERIC_EXPRESSION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_NUMERIC_EXPRESSION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticAction/NumericExpression.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct NumericExpression : SemanticAction::NumericExpression, Base
+ {
+ NumericExpression (Context& c);
+
+ virtual void
+ flush ();
+
+ virtual void
+ const_ (IdentifierPtr const&);
+
+ virtual void
+ integer_literal (IntegerLiteralPtr const&);
+
+ virtual void
+ pre (OperatorPtr const&);
+
+ virtual void
+ pos ();
+
+ virtual void
+ neg ();
+
+ virtual void
+ com ();
+
+ virtual void
+ mul ();
+
+ virtual void
+ div ();
+
+ virtual void
+ rem ();
+
+ virtual void
+ add ();
+
+ virtual void
+ sub ();
+
+ virtual void
+ rsh ();
+
+ virtual void
+ lsh ();
+
+ virtual void
+ and_ ();
+
+ virtual void
+ xor_ ();
+
+ virtual void
+ or_ ();
+
+
+ private:
+ unsigned long line_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_NUMERIC_EXPRESSION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp
new file mode 100644
index 00000000000..7401e2f65ea
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.cpp
@@ -0,0 +1,266 @@
+// file : CCF/IDL2/SemanticAction/Impl/Operation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Operation.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Operation::
+ Operation (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Operation::
+ one_way ()
+ {
+ if (ctx.trace ()) cerr << "oneway ";
+ one_way_ = true;
+ }
+
+ void Operation::
+ two_way ()
+ {
+ if (ctx.trace ()) cerr << "twoway ";
+ one_way_ = false;
+ }
+
+ void Operation::
+ type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "operation " << id;
+
+ type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ type_ = &resolve<Type> (from, name, Flags::complete);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid operation declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type as an operation return type is illegal"
+ << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+ void Operation::
+ name (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << " " << id << endl;
+
+ if (one_way_)
+ {
+ if (dynamic_cast<Void*> (type_) == 0)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid operation declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "oneway operation should have void as a return type"
+ << endl;
+ }
+
+ op_ = &ctx.tu ().new_node<OneWayOperation> (
+ ctx.file (), id->line ());
+ }
+ else
+ op_ = &ctx.tu ().new_node<TwoWayOperation> (
+ ctx.file (), id->line ());
+
+ SimpleName name (id->lexeme ());
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *op_, name);
+
+ if (type_)
+ {
+ ctx.tu ().new_edge<Returns> (*op_, *type_);
+ }
+ }
+
+
+ void Operation::
+ parameter (Direction::Value direction,
+ IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id)
+ {
+ if (ctx.trace ()) cerr << "parameter " << direction << " "
+ << type_id << " " << name_id << endl;
+
+ Name name (type_id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ struct NotIn : Resolve {};
+
+ try
+ {
+ try
+ {
+ if (one_way_ && direction != Direction::in)
+ throw NotIn ();
+
+ Type& t (resolve<Type> (from, name, Flags::complete));
+
+ Parameter* p (0);
+
+ switch (direction)
+ {
+ case Direction::in:
+ {
+ p = &ctx.tu ().new_node<InParameter> (
+ ctx.file (), name_id->line (), name_id->lexeme ());
+ break;
+ }
+ case Direction::out:
+ {
+ p = &ctx.tu ().new_node<OutParameter> (
+ ctx.file (), name_id->line (), name_id->lexeme ());
+ break;
+ }
+ case Direction::inout:
+ {
+ p = &ctx.tu ().new_node<InOutParameter> (
+ ctx.file (), name_id->line (), name_id->lexeme ());
+ break;
+ }
+ }
+
+ ctx.tu ().new_edge<Belongs> (*p, t);
+ ctx.tu ().new_edge<Receives> (*op_, *p);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "invalid parameter declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "using non-type as an operation parameter type is "
+ << "illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ catch (NotIn const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "parameter of oneway operation should have \'in\' "
+ << "direction" << endl;
+ }
+ }
+
+
+ void Operation::
+ raises (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "raises " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ struct OneWay : Resolve {};
+
+ try
+ {
+ try
+ {
+ if (one_way_)
+ throw OneWay ();
+
+ SemanticGraph::Exception& e (
+ resolve<SemanticGraph::Exception> (from, name));
+
+ ctx.tu ().new_edge<Raises> (*op_, e);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid raises declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no exception with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not an exception declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-exception type in raises declaration is "
+ << "illegal" << endl;
+ }
+ catch (OneWay const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "oneway operation may not raise exceptions" << endl;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp
new file mode 100644
index 00000000000..e45cef9fcf4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Operation.hpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticAction/Impl/Operation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_OPERATION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_OPERATION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+#include "CCF/IDL2/SemanticAction/Operation.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ //
+ //
+ //
+ struct Operation : SemanticAction::Operation, Base
+ {
+ Operation (Context& c);
+
+ virtual void
+ one_way ();
+
+ virtual void
+ two_way ();
+
+ virtual void
+ type (IdentifierPtr const& id);
+
+ virtual void
+ name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ parameter (Direction::Value direction,
+ IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id);
+
+ virtual void
+ raises (IdentifierPtr const& id);
+
+ private:
+ bool one_way_;
+ SemanticGraph::Type* type_;
+ SemanticGraph::Operation* op_;
+ };
+
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_OPERATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp
new file mode 100644
index 00000000000..966eba12824
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.cpp
@@ -0,0 +1,99 @@
+// file : CCF/IDL2/SemanticAction/Impl/Struct.cpp
+// author : Jeff Parsons <j.parsons@vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Struct.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Struct::
+ Struct (Context& c)
+ : ScopeBase<SemanticGraph::Struct> (c)
+ {
+ }
+
+ // @@ I need a mechanism for propagating exceptions from
+ // semantic actions to the parser in order to stop
+ // semantic action invocation.
+ //
+
+ void Struct::
+ begin_def (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "struct def " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<SemanticGraph::Struct&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<SemanticGraph::Struct> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Struct::
+ begin_fwd (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "struct fwd " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<SemanticGraph::Struct&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<SemanticGraph::Struct> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void Struct::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Struct::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Struct::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.hpp
new file mode 100644
index 00000000000..0fafd69962f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Struct.hpp
@@ -0,0 +1,45 @@
+// file : CCF/IDL2/SemanticAction/Impl/Struct.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_STRUCT_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_STRUCT_HPP
+
+#include "CCF/IDL2/SemanticGraph/Struct.hpp"
+#include "CCF/IDL2/SemanticAction/Struct.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Struct : SemanticAction::Struct,
+ ScopeBase<SemanticGraph::Struct>
+ {
+ Struct (Context& c);
+
+ virtual void
+ begin_def (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_fwd (SimpleIdentifierPtr const& id);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_STRUCT_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp
new file mode 100644
index 00000000000..816d83f6d12
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.cpp
@@ -0,0 +1,146 @@
+// file : CCF/IDL2/SemanticAction/Impl/TypeId.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/TypeId.hpp"
+
+#include "CCF/IDL2/SemanticGraph/TypeId.hpp"
+
+// These inclusions are needed to ensure that typeprefix is applied to a
+// suitable declaration.
+
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+#include "CCF/IDL2/SemanticGraph/ValueType.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ // TypeId
+ //
+ //
+ TypeId::
+ TypeId (Context& c)
+ : ctx (c)
+ {
+ }
+
+ void TypeId::
+ begin (IdentifierPtr const& d, StringLiteralPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << "typeid " << d << " " << id << endl;
+
+ Name name (d->lexeme ());
+ SemanticGraph::StringLiteral tid (id->value ());
+
+ try
+ {
+ ScopedName from (ctx.scope ().scoped_name ());
+ Nameables nodes (resolve (ctx.tu (), from, name));
+
+ ScopedName full ((**(nodes.begin ())).scoped_name ());
+
+ SemanticGraph::TypeId& ti (
+ ctx.tu ().new_node<SemanticGraph::TypeId> (
+ ctx.file (), d->line (), full, tid));
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), ti, "typeid");
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "invalid typeid declaration" << endl;
+
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "no declaration with name \'"
+ << name << "\' visible from scope \'"
+ << ctx.scope ().scoped_name () << "\'" << endl;
+ }
+ }
+
+ void TypeId::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+
+
+ // TypePrefix
+ //
+ //
+ TypePrefix::
+ TypePrefix (Context& c)
+ : ctx (c)
+ {
+ }
+
+ void TypePrefix::
+ begin (IdentifierPtr const& d, StringLiteralPtr const& prefix)
+ {
+ if (ctx.trace ()) cerr << "typeprefix " << d << " " << prefix
+ << endl;
+
+ Name name (d->lexeme ());
+ SemanticGraph::StringLiteral tprefix (prefix->value ());
+
+ try
+ {
+ ScopedName from (ctx.scope ().scoped_name ());
+ Nameables nodes (resolve (ctx.tu (), from, name));
+
+ Nameable& node (**(nodes.begin ()));
+
+ dynamic_cast<SemanticGraph::Scope&> (node);
+
+ ScopedName full (node.scoped_name ());
+
+ SemanticGraph::TypePrefix& tp (
+ ctx.tu ().new_node<SemanticGraph::TypePrefix> (
+ ctx.file (), d->line (), full, tprefix));
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), tp, "typeprefix");
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "invalid typeprefix declaration" << endl;
+
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "no declaration with name \'"
+ << name << "\' visible from scope \'"
+ << ctx.scope ().scoped_name () << "\'" << endl;
+ }
+ catch (std::bad_cast const&)
+ {
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "invalid typeprefix declaration" << endl;
+
+ cerr << ctx.file () << ":" << d->line () << ": error: "
+ << "no suitable declaration with name \'"
+ << name << "\' visible from scope \'"
+ << ctx.scope ().scoped_name () << "\'" << endl;
+ }
+ }
+
+ void TypePrefix::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp
new file mode 100644
index 00000000000..e88971eade4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/TypeId.hpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticAction/Impl/TypeId.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP
+
+#include "CCF/IDL2/SemanticAction/TypeId.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ //
+ //
+ //
+ struct TypeId : SemanticAction::TypeId
+ {
+ TypeId (Context& c);
+
+ virtual void
+ begin (IdentifierPtr const& d, StringLiteralPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ Context& ctx;
+ };
+
+
+ //
+ //
+ //
+ struct TypePrefix : SemanticAction::TypePrefix
+ {
+ TypePrefix (Context& c);
+
+ virtual void
+ begin (IdentifierPtr const& d, StringLiteralPtr const& prefix);
+
+ virtual void
+ end ();
+
+ private:
+ Context& ctx;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPE_ID_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp
new file mode 100644
index 00000000000..fcd4257fa52
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.cpp
@@ -0,0 +1,327 @@
+// file : CCF/IDL2/SemanticAction/Impl/Typedef.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Typedef.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Array.hpp"
+#include "CCF/IDL2/SemanticGraph/Sequence.hpp"
+#include "CCF/IDL2/SemanticGraph/String.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+//@@ names used in smantic actions are inconsistent
+// e.g. begin () vs name (), etc
+//
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Typedef::
+ Typedef (Context& c)
+ : Base (c)
+ {
+ }
+
+ void Typedef::
+ pre (KeywordPtr const& id)
+ {
+ line_ = id->line ();
+ }
+
+ void Typedef::
+ begin (IdentifierPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << "typedef " << id << endl;
+
+ define_ = false;
+ type_ = 0;
+ array_type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ type_ = &resolve<Type> (from, name);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid typedef declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type in typedef is illegal" << endl;
+ }
+ }
+
+ void Typedef::
+ begin_unbounded_seq (IdentifierPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << "typedef u-sequence<" << id << ">" << endl;
+
+ define_ = true;
+ type_ = 0;
+ array_type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ Type& t (resolve<Type> (from, name));
+
+ UnboundedSequence& s (
+ ctx.tu ().new_node<UnboundedSequence> (
+ ctx.file (), line_));
+
+ ctx.tu ().new_edge<ArgumentsWithType> (t, s);
+
+ type_ = &s;
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid sequence declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type in sequence specialization is illegal"
+ << endl;
+ }
+ }
+
+ void Typedef::
+ begin_bounded_seq (IdentifierPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << "typedef b-sequence<" << id << ">" << endl;
+
+ define_ = true;
+ type_ = 0;
+ array_type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ Type& t (resolve<Type> (from, name));
+
+ BoundedSequence& s (
+ ctx.tu ().new_node<BoundedSequence> (
+ ctx.file (), line_));
+
+ ctx.tu ().new_edge<ArgumentsWithType> (t, s);
+
+ type_ = &s;
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid sequence declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type in sequence specialization is illegal"
+ << endl;
+ }
+ }
+
+ void Typedef::
+ begin_bounded_string ()
+ {
+ if (ctx.trace ()) cerr << "typedef b-string" << endl;
+
+ define_ = true;
+ type_ = 0;
+ array_type_ = 0;
+
+ type_ = &ctx.tu ().new_node<BoundedString> (ctx.file (), line_);
+ bound ();
+ }
+
+ void Typedef::
+ begin_bounded_wstring ()
+ {
+ if (ctx.trace ()) cerr << "typedef b-wstring" << endl;
+
+ define_ = true;
+ type_ = 0;
+ array_type_ = 0;
+
+ type_ = &ctx.tu ().new_node<BoundedWideString> (ctx.file (), line_);
+ bound ();
+ }
+
+ void Typedef::
+ begin_array ()
+ {
+ if (ctx.trace ()) cerr << "array" << endl;
+
+ define_ = true;
+ array_type_ = 0;
+
+ if (type_ == 0)
+ return;
+
+ if (type_->named_begin () == type_->named_end ())
+ {
+ cerr << ctx.file () << ":" << line_ << ": error: "
+ << "anonymous types in array declarations "
+ << "are not supported" << endl;
+
+ cerr << ctx.file () << ":" << line_ << ": error: "
+ << "use another typedef to name this type" << endl;
+
+ return;
+ }
+
+ Array& a (ctx.tu ().new_node<Array> (ctx.file (), line_));
+ ctx.tu ().new_edge<ArgumentsWithType> (*type_, a);
+
+ array_type_ = &a;
+ }
+
+ void Typedef::
+ bound ()
+ {
+ if (ctx.trace ()) cerr << "bound" << endl;
+
+ if (ctx.int_exp_size () < 1)
+ return;
+
+ IntExpression& expr (ctx.int_exp_pop ());
+
+ if (array_type_ != 0)
+ {
+ Specialization& s (dynamic_cast<Specialization&> (*array_type_));
+ ctx.tu ().new_edge<ArgumentsWithValue> (expr, s);
+ }
+ else if (type_ != 0)
+ {
+ Specialization& s (dynamic_cast<Specialization&> (*type_));
+ ctx.tu ().new_edge<ArgumentsWithValue> (expr, s);
+ }
+ }
+
+ void Typedef::
+ declarator (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << " " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ try
+ {
+ if (lookup (ctx.tu (), ctx.scope (), name) == 0)
+ {
+ if (array_type_ != 0)
+ {
+ assert (define_);
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *array_type_, name);
+
+ define_ = false;
+ array_type_ = 0;
+ }
+ else if (type_ != 0)
+ {
+ if (define_)
+ {
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *type_, name);
+ define_ = false;
+ }
+ else
+ {
+ ctx.tu ().new_edge<Aliases> (ctx.scope (), *type_, name);
+ }
+ }
+ return;
+ }
+ }
+ catch (NotUnique const& )
+ {
+ }
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid typedef declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "redeclaration of name " << name << endl;
+
+ array_type_ = 0;
+ }
+
+ void Typedef::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp
new file mode 100644
index 00000000000..638bbc8afd8
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Typedef.hpp
@@ -0,0 +1,65 @@
+// file : CCF/IDL2/SemanticAction/Impl/Typedef.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPEDEF_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPEDEF_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticAction/Typedef.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Typedef : SemanticAction::Typedef, Base
+ {
+ Typedef (Context& c);
+
+ virtual void
+ pre (KeywordPtr const& id);
+
+ virtual void
+ begin (IdentifierPtr const& id);
+
+ virtual void
+ begin_unbounded_seq (IdentifierPtr const& id);
+
+ virtual void
+ begin_bounded_seq (IdentifierPtr const& id);
+
+ virtual void
+ begin_bounded_string ();
+
+ virtual void
+ begin_bounded_wstring ();
+
+ virtual void
+ begin_array ();
+
+ virtual void
+ bound ();
+
+ virtual void
+ declarator (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ bool define_;
+ unsigned long line_;
+ SemanticGraph::Type* type_;
+ SemanticGraph::Type* array_type_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_TYPEDEF_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.cpp
new file mode 100644
index 00000000000..375b8a9abab
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.cpp
@@ -0,0 +1,225 @@
+// file : CCF/IDL2/SemanticAction/Impl/Union.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/Union.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Enum.hpp"
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ Union::
+ Union (Context& c)
+ : ScopeBase<SemanticGraph::Union> (c)
+ {
+ }
+
+ void Union::
+ begin_def (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "union def " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<SemanticGraph::Union&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<SemanticGraph::Union> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Defines> (ctx.scope (), now (), name);
+ }
+
+ void Union::
+ begin_fwd (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "union fwd " << id << endl;
+
+ SimpleName name (id->lexeme ());
+
+ if (Nameable* s = lookup (ctx.tu (), ctx.scope (), name))
+ {
+ now (dynamic_cast<SemanticGraph::Union&>(*s));
+ }
+ else
+ {
+ now (ctx.tu ().new_node<SemanticGraph::Union> (
+ ctx.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void Union::
+ type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "type " << id << endl;
+
+ type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ type_ = &resolve<Type> (from, name);
+
+ if (!(dynamic_cast<Enum*> (type_) ||
+ dynamic_cast<Boolean*> (type_) ||
+ dynamic_cast<Char*> (type_) ||
+ dynamic_cast<Wchar*> (type_) ||
+ dynamic_cast<Short*> (type_) ||
+ dynamic_cast<UnsignedShort*> (type_) ||
+ dynamic_cast<Long*> (type_) ||
+ dynamic_cast<UnsignedLong*> (type_) ||
+ dynamic_cast<LongLong*> (type_) ||
+ dynamic_cast<UnsignedLongLong*> (type_)))
+ {
+ throw WrongType (type_->scoped_name ());
+ }
+
+ ctx.tu ().new_edge<ArgumentsWithType> (*type_, now ());
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid union declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a valid discriminant type" << endl;
+ }
+ }
+
+ void Union::
+ open_scope ()
+ {
+ if (ctx.trace ()) cerr << "scope open" << endl;
+
+ push (ctx.scope ());
+ ctx.scope (now ());
+ }
+
+ void Union::
+ member_type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "type " << id << endl;
+
+ member_type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ // With introduction of CORBA 3.1 we have a new beast:
+ // union with incoplete members which itself becomes
+ // incomplete.
+ //
+ member_type_ = &resolve<Type> (from, name/*, Flags::complete*/);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid union 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&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type as an member type is illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+ void Union::
+ member_name (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "name " << id << endl;
+
+ if (member_type_)
+ {
+ SimpleName name (id->lexeme ());
+
+ SemanticGraph::UnionMember& m (
+ ctx.tu ().new_node<SemanticGraph::UnionMember> (
+ ctx.file (), id->line ()));
+
+ ctx.tu ().new_edge<Belongs> (m, *member_type_);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), m, name);
+ }
+ }
+
+ void Union::
+ close_scope ()
+ {
+ ctx.scope (top ());
+ pop ();
+
+ if (ctx.trace ()) cerr << "scope close" << endl;
+ }
+
+ void Union::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.hpp
new file mode 100644
index 00000000000..8ab8022c62a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/Union.hpp
@@ -0,0 +1,57 @@
+// file : CCF/IDL2/SemanticAction/Impl/Union.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_UNION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_UNION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Union.hpp"
+#include "CCF/IDL2/SemanticAction/Union.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct Union : SemanticAction::Union, ScopeBase<SemanticGraph::Union>
+ {
+ Union (Context& c);
+
+ virtual void
+ begin_def (SimpleIdentifierPtr const& id);
+
+ virtual void
+ begin_fwd (SimpleIdentifierPtr const& id);
+
+ virtual void
+ type (IdentifierPtr const& id);
+
+ virtual void
+ open_scope ();
+
+ virtual void
+ member_type (IdentifierPtr const& id);
+
+ virtual void
+ member_name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ close_scope ();
+
+ virtual void
+ end ();
+
+ private:
+ SemanticGraph::Type* type_;
+ SemanticGraph::Type* member_type_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_UNION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp
new file mode 100644
index 00000000000..3d6b92132e6
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.cpp
@@ -0,0 +1,293 @@
+// 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 (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.file (), id->line ()));
+ }
+
+ 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.file (), id->line ()));
+ }
+
+ 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.file (), id->line ()));
+ }
+
+ 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.file (), id->line ()));
+ }
+
+ ctx.tu ().new_edge<Mentions> (ctx.scope (), now (), name);
+ }
+
+ void ValueType::
+ inherits (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "inherits " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::ValueType& v (
+ resolve<SemanticGraph::ValueType> (from, name, Flags::defined));
+
+ check_inheritance (now ().inherits_begin (),
+ now ().inherits_end (),
+ v);
+
+
+ bool abstract (dynamic_cast<AbstractValueType*> (&v) != 0);
+
+ if (dynamic_cast<AbstractValueType*> (&now ()) != 0)
+ {
+ // Abstract valuetype may only inherit from abstract ones.
+ //
+ if (!abstract)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid inheritance specification" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "abstract valuetype `" << now ().name ()
+ << "\' may not inherit from concrete valuetype `"
+ << v.scoped_name () << "\'" << endl;
+ return;
+ }
+ }
+ else
+ {
+ // Concrete valuetype may inherit from single concrete
+ // valutype in which case it should be the first in the
+ // inheritance list.
+ //
+ if (now ().inherits_begin () != now ().inherits_end () &&
+ !abstract)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid inheritance specification" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "concrete valuetype `" << v.scoped_name ()
+ << "\' is not the first in the inheritance list of "
+ << "valuetype `" << now ().name () << "\'" << endl;
+ return;
+ }
+ }
+
+ ctx.tu ().new_edge<Inherits> (now (), v);
+ ctx.tu ().new_edge<Extends> (now (), v);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid inheritance specification" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no valuetype with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "incompatible type in inheritance specification" << endl;
+ }
+ catch (NotDefined const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "attempt to inherit from the forward-declared valuetype "
+ << e.name () << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "inheritance from a forward-declared valuetype is illegal"
+ << endl;
+ }
+ catch (AlreadyInherited const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "directly inheriting from valuetype \'" << e.name ()
+ << "\' more than once is illegal" << endl;
+ }
+ }
+
+ void ValueType::
+ supports (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "supports " << id << endl;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Interface& i (
+ resolve<SemanticGraph::Interface> (from, name, Flags::defined));
+
+ check_support (now ().supports_begin (),
+ now ().supports_end (),
+ i);
+
+ ctx.tu ().new_edge<Supports> (now (), i);
+ ctx.tu ().new_edge<Extends> (now (), i);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid supports specification" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no interface with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "incompatible type in supports specification" << endl;
+ }
+ catch (NotDefined const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "attempt to support forward-declared interface "
+ << e.name () << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "support of forward-declared interface is illegal"
+ << endl;
+ }
+ catch (AlreadySupported const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "directly supporting interface \'" << e.name ()
+ << "\' more than once is illegal" << 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/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp
new file mode 100644
index 00000000000..da0bea59a84
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueType.hpp
@@ -0,0 +1,65 @@
+// 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
+ {
+ struct ValueType : SemanticAction::ValueType,
+ ScopeBase<SemanticGraph::ValueType>
+ {
+ 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/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.cpp
new file mode 100644
index 00000000000..f87138f9b70
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.cpp
@@ -0,0 +1,152 @@
+// file : CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ ValueTypeFactory::
+ ValueTypeFactory (Context& c)
+ : Base (c)
+ {
+ }
+
+ void ValueTypeFactory::
+ name (SimpleIdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << " " << id << endl;
+
+ f_ = 0;
+
+ SemanticGraph::ValueType& h (
+ dynamic_cast<SemanticGraph::ValueType&>(ctx.scope ()));
+
+ SimpleName name (id->lexeme ());
+
+ f_ = &ctx.tu ().new_node<SemanticGraph::ValueTypeFactory> (
+ ctx.file (), id->line ());
+
+ ctx.tu ().new_edge<Returns> (*f_, h);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *f_, name);
+ }
+
+
+ void ValueTypeFactory::
+ parameter (IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id)
+ {
+ if (ctx.trace ()) cerr << "parameter in " << " "
+ << type_id << " " << name_id << endl;
+
+ if (f_ == 0) return;
+
+ Name name (type_id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ Type& t (resolve<Type> (from, name, Flags::complete));
+
+ Parameter& p (
+ ctx.tu ().new_node<InParameter> (
+ ctx.file (), name_id->line (), name_id->lexeme ()));
+
+ ctx.tu ().new_edge<Belongs> (p, t);
+ ctx.tu ().new_edge<Receives> (*f_, p);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "invalid parameter declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "using non-type as an factory parameter type is "
+ << "illegal" << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << type_id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+ void ValueTypeFactory::
+ raises (IdentifierPtr const& id)
+ {
+ if (ctx.trace ()) cerr << "raises " << id << endl;
+
+ if (f_ == 0) return;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ SemanticGraph::Exception& e (
+ resolve<SemanticGraph::Exception> (from, name));
+
+ ctx.tu ().new_edge<Raises> (*f_, e);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid raises declaration" << endl;
+ throw;
+ }
+ }
+ catch (NotFound const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no exception with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not an exception declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-exception type in raises declaration is "
+ << "illegal" << endl;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp
new file mode 100644
index 00000000000..949492152e5
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp
@@ -0,0 +1,42 @@
+// file : CCF/IDL2/SemanticAction/Impl/ValueTypeFactory.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_FACTORY_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_FACTORY_HPP
+
+#include "CCF/IDL2/SemanticGraph/ValueType.hpp"
+#include "CCF/IDL2/SemanticAction/ValueTypeFactory.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct ValueTypeFactory : SemanticAction::ValueTypeFactory, Base
+ {
+ ValueTypeFactory (Context& c);
+
+ virtual void
+ name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ parameter (IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id);
+
+ virtual void
+ raises (IdentifierPtr const& id);
+
+ private:
+ SemanticGraph::ValueTypeFactory* f_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_FACTORY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.cpp
new file mode 100644
index 00000000000..c85b8023a07
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.cpp
@@ -0,0 +1,149 @@
+// file : CCF/IDL2/SemanticAction/Impl/ValueTypeMember.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp"
+
+#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp"
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ using namespace SemanticGraph;
+
+ ValueTypeMember::
+ ValueTypeMember (Context& c)
+ : Base (c)
+ {
+ }
+
+ void ValueTypeMember::
+ begin_private ()
+ {
+ if (ctx.trace ())
+ cerr << "private valuetype member" << endl;
+
+ access_ = SemanticGraph::ValueTypeMember::Access::private_;
+ }
+
+ void ValueTypeMember::
+ begin_public ()
+ {
+ if (ctx.trace ())
+ cerr << "public valuetype member" << endl;
+
+ access_ = SemanticGraph::ValueTypeMember::Access::public_;
+ }
+
+ void ValueTypeMember::
+ type (IdentifierPtr const& id)
+ {
+ if (ctx.trace ())
+ cerr << " type: " << id << endl;
+
+ type_ = 0;
+
+ Name name (id->lexeme ());
+ ScopedName from (ctx.scope ().scoped_name ());
+
+ try
+ {
+ try
+ {
+ type_ = &resolve<Type> (from, name, Flags::complete);
+ }
+ catch (Resolve const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "invalid valuetype 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&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "no type with name \'" << name
+ << "\' visible from scope \'" << from << "\'" << endl;
+ }
+ catch (WrongType const&)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "declaration with name \'" << name
+ << "\' visible from scope \'" << from
+ << "\' is not a type declaration" << endl;
+
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "using non-type as a valuetype member type is illegal"
+ << endl;
+ }
+ catch (NotComplete const& e)
+ {
+ cerr << ctx.file () << ":" << id->line () << ": error: "
+ << "type \'" << e.name () << "\' is not complete" << endl;
+ }
+ }
+
+
+ void ValueTypeMember::
+ name (SimpleIdentifierPtr const& id)
+ {
+ using namespace SemanticGraph;
+
+ if (ctx.trace ()) cerr << " name: " << id << endl;
+
+ if (type_)
+ {
+ SimpleName name (id->lexeme ());
+
+ SemanticGraph::ValueTypeMember* m;
+
+ switch (access_)
+ {
+ case SemanticGraph::ValueTypeMember::Access::private_:
+ {
+ m = &ctx.tu ().new_node<ValueTypePrivateMember> (
+ ctx.file (), id->line ());
+ break;
+ }
+ case SemanticGraph::ValueTypeMember::Access::public_:
+ {
+ m = &ctx.tu ().new_node<ValueTypePublicMember> (
+ ctx.file (), id->line ());
+ break;
+ }
+ default:
+ {
+ abort ();
+ }
+ }
+
+ ctx.tu ().new_edge<Belongs> (*m, *type_);
+ ctx.tu ().new_edge<Defines> (ctx.scope (), *m, name);
+ }
+ }
+
+ void ValueTypeMember::
+ end ()
+ {
+ if (ctx.trace ()) cerr << "end" << endl;
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp
new file mode 100644
index 00000000000..96e575cd35f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp
@@ -0,0 +1,48 @@
+// file : CCF/IDL2/SemanticAction/Impl/ValueTypeMember.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp"
+#include "CCF/IDL2/SemanticAction/ValueTypeMember.hpp"
+#include "CCF/IDL2/SemanticAction/Impl/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ namespace Impl
+ {
+ struct ValueTypeMember : SemanticAction::ValueTypeMember, Base
+ {
+ ValueTypeMember (Context& c);
+
+ virtual void
+ begin_private ();
+
+ virtual void
+ begin_public ();
+
+ virtual void
+ type (IdentifierPtr const& id);
+
+ virtual void
+ name (SimpleIdentifierPtr const& id);
+
+ virtual void
+ end ();
+
+ private:
+ SemanticGraph::ValueTypeMember::Access::Value access_;
+ SemanticGraph::Type* type_;
+ };
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_IMPL_VALUE_TYPE_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp
new file mode 100644
index 00000000000..dda020e73d5
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Include.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/SemanticAction/Include.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_INCLUDE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_INCLUDE_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Include
+ {
+ virtual ~Include ()
+ {
+ }
+
+ virtual void
+ quote (StringLiteralPtr const& sl) = 0;
+
+ virtual void
+ bracket (StringLiteralPtr const& sl) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_INCLUDE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp
new file mode 100644
index 00000000000..1f5a327caee
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Interface.hpp
@@ -0,0 +1,56 @@
+// file : CCF/IDL2/SemanticAction/Interface.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_INTERFACE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_INTERFACE_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Interface : Scope
+ {
+ virtual ~Interface ()
+ {
+ }
+
+ virtual void
+ begin_abstract_def (SimpleIdentifierPtr const& id) = 0;
+
+ 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;
+
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ close_scope () = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_INTERFACE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp
new file mode 100644
index 00000000000..e706b7d1a78
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Member.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/SemanticAction/Member.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Member
+ {
+ virtual ~Member ()
+ {
+ }
+
+ virtual void
+ type (IdentifierPtr const& id) = 0;
+
+ virtual void
+ name (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Module.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Module.hpp
new file mode 100644
index 00000000000..49e9eea7723
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Module.hpp
@@ -0,0 +1,38 @@
+// file : CCF/IDL2/SemanticAction/Module.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_MODULE_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_MODULE_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Module : Scope
+ {
+ virtual ~Module ()
+ {
+ }
+
+ virtual void
+ begin (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ close_scope () = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_MODULE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Native.hpp
new file mode 100644
index 00000000000..368920f2615
--- /dev/null
+++ b/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
+ {
+ struct Native
+ {
+ virtual ~Native ()
+ {
+ }
+
+ virtual void
+ name (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_NATIVE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/NumericExpression.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/NumericExpression.hpp
new file mode 100644
index 00000000000..671019133de
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/NumericExpression.hpp
@@ -0,0 +1,77 @@
+// file : CCF/IDL2/SemanticAction/NumericExpression.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_NUMERIC_EXPRESSION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_NUMERIC_EXPRESSION_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct NumericExpression
+ {
+ virtual ~NumericExpression ()
+ {
+ }
+
+ virtual void
+ flush () = 0;
+
+ virtual void
+ const_ (IdentifierPtr const&) = 0;
+
+ virtual void
+ integer_literal (IntegerLiteralPtr const&) = 0;
+
+ virtual void
+ pre (OperatorPtr const&) = 0;
+
+ virtual void
+ pos () = 0;
+
+ virtual void
+ neg () = 0;
+
+ virtual void
+ com () = 0;
+
+ virtual void
+ mul () = 0;
+
+ virtual void
+ div () = 0;
+
+ virtual void
+ rem () = 0;
+
+ virtual void
+ add () = 0;
+
+ virtual void
+ sub () = 0;
+
+ virtual void
+ rsh () = 0;
+
+ virtual void
+ lsh () = 0;
+
+ virtual void
+ and_ () = 0;
+
+ virtual void
+ xor_ () = 0;
+
+ virtual void
+ or_ () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_NUMERIC_EXPRESSION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.cpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.cpp
new file mode 100644
index 00000000000..b75d48400a4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.cpp
@@ -0,0 +1,29 @@
+// file : CCF/IDL2/SemanticAction/Operation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticAction/Operation.hpp"
+
+#include <ostream>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ }
+ }
+}
+
+namespace
+{
+ char* labels[] = {"in", "out", "inout"};
+}
+
+std::ostream&
+operator<< (std::ostream& o,
+ CCF::IDL2::SemanticAction::Operation::Direction::Value d)
+{
+ return o << labels[d];
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.hpp
new file mode 100644
index 00000000000..7cdd069faa0
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Operation.hpp
@@ -0,0 +1,62 @@
+// file : CCF/IDL2/SemanticAction/Operation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_OPERATION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_OPERATION_HPP
+
+#include <iosfwd>
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Operation
+ {
+ virtual ~Operation ()
+ {
+ }
+
+ virtual void
+ one_way () = 0;
+
+ virtual void
+ two_way () = 0;
+
+ virtual void
+ type (IdentifierPtr const& id) = 0;
+
+ virtual void
+ name (SimpleIdentifierPtr const& id) = 0;
+
+ struct Direction
+ {
+ enum Value
+ {
+ in = 0,
+ out,
+ inout
+ };
+ };
+
+ virtual void
+ parameter (Direction::Value direction,
+ IdentifierPtr const& type_id,
+ SimpleIdentifierPtr const& name_id) = 0;
+
+ virtual void
+ raises (IdentifierPtr const& id) = 0;
+ };
+ }
+ }
+}
+
+std::ostream&
+operator<< (std::ostream& o,
+ CCF::IDL2::SemanticAction::Operation::Direction::Value d);
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_OPERATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Struct.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Struct.hpp
new file mode 100644
index 00000000000..8a53b85ff15
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Struct.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticAction/Struct.hpp
+// author : Jeff Parsons <j.parsons@vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_STRUCT_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_STRUCT_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Struct : Scope
+ {
+ virtual ~Struct ()
+ {
+ }
+
+ virtual void
+ begin_def (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ begin_fwd (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ close_scope () = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_STRUCT_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp
new file mode 100644
index 00000000000..535fbc80654
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/TypeId.hpp
@@ -0,0 +1,46 @@
+// file : CCF/IDL2/SemanticAction/TypeId.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct TypeId
+ {
+ virtual ~TypeId ()
+ {
+ }
+
+ virtual void
+ begin (IdentifierPtr const& name, StringLiteralPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+
+
+ struct TypePrefix
+ {
+ virtual ~TypePrefix ()
+ {
+ }
+
+ virtual void
+ begin (IdentifierPtr const& name, StringLiteralPtr const& prefix) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_TYPE_ID_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp
new file mode 100644
index 00000000000..ad90573a6bb
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Typedef.hpp
@@ -0,0 +1,56 @@
+// file : CCF/IDL2/SemanticAction/Typedef.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_TYPEDEF_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_TYPEDEF_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Typedef
+ {
+ virtual ~Typedef ()
+ {
+ }
+
+ virtual void
+ pre (KeywordPtr const& id) = 0;
+
+ virtual void
+ begin (IdentifierPtr const& id) = 0;
+
+ virtual void
+ begin_unbounded_seq (IdentifierPtr const& id) = 0;
+
+ virtual void
+ begin_bounded_seq (IdentifierPtr const& id) = 0;
+
+ virtual void
+ begin_bounded_string () = 0;
+
+ virtual void
+ begin_bounded_wstring () = 0;
+
+ virtual void
+ begin_array () = 0;
+
+ virtual void
+ bound () = 0;
+
+ virtual void
+ declarator (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_TYPEDEF_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/Union.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/Union.hpp
new file mode 100644
index 00000000000..8b7c5d51f46
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/Union.hpp
@@ -0,0 +1,53 @@
+// file : CCF/IDL2/SemanticAction/Union.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_UNION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_UNION_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct Union : Scope
+ {
+ virtual ~Union ()
+ {
+ }
+
+ virtual void
+ begin_def (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ begin_fwd (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ type (IdentifierPtr const& id) = 0;
+
+ //@@ Scope declares these functions. Why do I need to
+ // repeat it here?
+ //
+ virtual void
+ open_scope () = 0;
+
+ virtual void
+ member_type (IdentifierPtr const& id) = 0;
+
+ virtual void
+ member_name (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ close_scope () = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_UNION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/ValueType.hpp
new file mode 100644
index 00000000000..2db412f6a32
--- /dev/null
+++ b/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
+ {
+ struct ValueType : Scope
+ {
+ virtual ~ValueType ()
+ {
+ }
+
+ 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/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeFactory.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeFactory.hpp
new file mode 100644
index 00000000000..f7239c45a94
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeFactory.hpp
@@ -0,0 +1,36 @@
+// file : CCF/IDL2/SemanticAction/ValueTypeFactory.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_FACTORY_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_FACTORY_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct ValueTypeFactory
+ {
+ virtual ~ValueTypeFactory ()
+ {
+ }
+
+ virtual void
+ name (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ parameter (IdentifierPtr const& type,
+ SimpleIdentifierPtr const& name) = 0;
+
+ virtual void
+ raises (IdentifierPtr const& id) = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_FACTORY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeMember.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeMember.hpp
new file mode 100644
index 00000000000..08fc89fd028
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction/ValueTypeMember.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticAction/ValueTypeMember.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_VALUE_TYPE_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticAction
+ {
+ struct ValueTypeMember
+ {
+ virtual ~ValueTypeMember ()
+ {
+ }
+
+ virtual void
+ begin_private () = 0;
+
+ virtual void
+ begin_public () = 0;
+
+ virtual void
+ type (IdentifierPtr const& id) = 0;
+
+ virtual void
+ name (SimpleIdentifierPtr const& id) = 0;
+
+ virtual void
+ end () = 0;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_MEMBER_HPP