summaryrefslogtreecommitdiff
path: root/CIAO/CCF/CCF/IDL2
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/CCF/CCF/IDL2')
-rw-r--r--CIAO/CCF/CCF/IDL2/IDL2.mpc16
-rw-r--r--CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp964
-rw-r--r--CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp203
-rw-r--r--CIAO/CCF/CCF/IDL2/Parser.cpp2360
-rw-r--r--CIAO/CCF/CCF/IDL2/Parser.hpp872
-rw-r--r--CIAO/CCF/CCF/IDL2/Parsing/Action.hpp142
-rw-r--r--CIAO/CCF/CCF/IDL2/Parsing/Elements.hpp168
-rw-r--r--CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp325
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticAction.hpp31
-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
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph.hpp32
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp37
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp145
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp264
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp656
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp1078
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp14
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp34
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp51
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp443
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4103
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp427
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4102
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m417
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp91
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp188
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp486
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp1013
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp122
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp181
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp24
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp56
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp34
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp33
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp253
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp239
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp33
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp228
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp359
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp82
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp106
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp58
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp87
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp67
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp41
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp255
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp287
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp73
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp56
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp104
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp177
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp158
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp102
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp174
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp90
-rw-r--r--CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp107
-rw-r--r--CIAO/CCF/CCF/IDL2/Token.cpp13
-rw-r--r--CIAO/CCF/CCF/IDL2/Token.hpp348
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal.hpp31
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Array.cpp78
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Array.hpp51
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp280
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp170
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp16
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp471
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp128
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp16
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp30
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp38
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp36
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp16
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp101
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp757
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp15
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp89
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp99
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Member.cpp50
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Member.hpp42
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Module.cpp15
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Module.hpp48
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Native.cpp16
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Native.hpp24
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp15
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp178
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp201
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp111
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp69
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/String.cpp93
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/String.hpp64
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp38
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp35
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp37
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp107
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp16
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp34
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Union.cpp81
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/Union.hpp63
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp15
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp89
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp150
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp59
-rw-r--r--CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp54
169 files changed, 24384 insertions, 0 deletions
diff --git a/CIAO/CCF/CCF/IDL2/IDL2.mpc b/CIAO/CCF/CCF/IDL2/IDL2.mpc
new file mode 100644
index 00000000000..74273a71a7f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/IDL2.mpc
@@ -0,0 +1,16 @@
+//$Id$
+
+project(IDL2): cidlc {
+ sharedname =
+ staticname = IDL2
+ libout = ..
+
+ Source_Files {
+ .
+ ./SemanticGraph
+ ./Traversal
+ ./SemanticAction
+ ./SemanticAction/Impl
+
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp b/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp
new file mode 100644
index 00000000000..e357a1a0c28
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.cpp
@@ -0,0 +1,964 @@
+// file : CCF/IDL2/LexicalAnalyzer.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/LexicalAnalyzer.hpp"
+
+#include <stdlib.h> // strtol
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+using std::string;
+using std::pair;
+using std::size_t;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ LexicalAnalyzer::
+ LexicalAnalyzer (CompilerElements::TokenStream<Char>& is)
+ : loc_ ("C"), is_ (is)
+ {
+ // Keywords (alphabetic order).
+ //
+
+ keyword_table_.insert ("abstract" );
+ keyword_table_.insert ("attribute" );
+ keyword_table_.insert ("__binclude" );
+ keyword_table_.insert ("case" );
+ keyword_table_.insert ("const" );
+ keyword_table_.insert ("custom" );
+ keyword_table_.insert ("default" );
+ keyword_table_.insert ("exception" );
+ keyword_table_.insert ("enum" );
+ keyword_table_.insert ("factory" );
+ keyword_table_.insert ("getraises" );
+ keyword_table_.insert ("in" );
+ keyword_table_.insert ("inout" );
+ keyword_table_.insert ("interface" );
+ keyword_table_.insert ("__qinclude" );
+ keyword_table_.insert ("local" );
+ keyword_table_.insert ("module" );
+ keyword_table_.insert ("native" );
+ keyword_table_.insert ("oneway" );
+ keyword_table_.insert ("out" );
+ keyword_table_.insert ("private" );
+ keyword_table_.insert ("public" );
+ keyword_table_.insert ("raises" );
+ keyword_table_.insert ("readonly" );
+ keyword_table_.insert ("sequence" );
+ keyword_table_.insert ("setraises" );
+ keyword_table_.insert ("struct" );
+ keyword_table_.insert ("supports" );
+ keyword_table_.insert ("switch" );
+ keyword_table_.insert ("truncatable");
+ keyword_table_.insert ("typedef" );
+ keyword_table_.insert ("typeid" );
+ keyword_table_.insert ("typeprefix" );
+ keyword_table_.insert ("union" );
+ keyword_table_.insert ("valuetype" );
+
+ // Identifiers (alphabetic order).
+ //
+ // Note: if you are planning to hack something up
+ // in the code below, first make sure you understand
+ // how everything works!
+ //
+
+ IdentifierTreeNode end;
+
+ identifier_tree_["Object" ] = end;
+ identifier_tree_["ValueBase"] = end;
+ identifier_tree_["any" ] = end;
+ identifier_tree_["boolean" ] = end;
+ identifier_tree_["char" ] = end;
+ identifier_tree_["double" ] = end;
+ identifier_tree_["float" ] = end;
+
+ IdentifierTreeNode long_;
+ long_["" ] = end;
+ long_["double"] = end;
+ long_["long" ] = end;
+
+ identifier_tree_["long" ] = long_;
+ identifier_tree_["octet" ] = end;
+ identifier_tree_["short" ] = end;
+ identifier_tree_["string" ] = end;
+
+ IdentifierTreeNode unsigned_long_;
+ unsigned_long_["" ] = end;
+ unsigned_long_["long"] = end;
+
+ IdentifierTreeNode unsigned_;
+ unsigned_["long" ] = unsigned_long_;
+ unsigned_["short" ] = end;
+
+ identifier_tree_["unsigned" ] = unsigned_;
+ identifier_tree_["void" ] = end;
+ identifier_tree_["wchar" ] = end;
+ identifier_tree_["wstring" ] = end;
+
+ // punctuation (pair-matched).
+ //
+ punctuation_table_.insert (":");
+ punctuation_table_.insert (",");
+ punctuation_table_.insert ("{");
+ punctuation_table_.insert ("}");
+ punctuation_table_.insert ("[");
+ punctuation_table_.insert ("]");
+ punctuation_table_.insert ("(");
+ punctuation_table_.insert (")");
+ punctuation_table_.insert ("<");
+ punctuation_table_.insert (">");
+ punctuation_table_.insert (";");
+
+ // operators
+ //
+ operator_table_.insert ("+"); // add
+ operator_table_.insert ("&"); // and
+ operator_table_.insert ("~"); // com
+ operator_table_.insert ("/"); // div
+ operator_table_.insert ("="); // eq
+ operator_table_.insert ("<<"); // lsh
+ operator_table_.insert ("*"); // mul
+ operator_table_.insert ("|"); // or
+ operator_table_.insert ("%"); // rem
+ operator_table_.insert ("-"); // sub
+ operator_table_.insert (">>"); // rsh
+ operator_table_.insert ("^"); // xor
+ }
+
+
+ LexicalAnalyzer::Char LexicalAnalyzer::
+ get ()
+ {
+ if (!ibuffer_.empty ())
+ {
+ Char c = ibuffer_.front ();
+ ibuffer_.pop_front ();
+ return c;
+ }
+ else
+ {
+ return is_.next ();
+ }
+ }
+
+ LexicalAnalyzer::Char LexicalAnalyzer::
+ peek ()
+ {
+ if (ibuffer_.empty ())
+ {
+ ibuffer_.push_back (is_.next ());
+ }
+
+ return ibuffer_.front ();
+ }
+
+ LexicalAnalyzer::Char LexicalAnalyzer::
+ peek_more ()
+ {
+ while (ibuffer_.size () < 2)
+ {
+ ibuffer_.push_back (is_.next ());
+ }
+
+ return ibuffer_.at (1);
+ }
+
+ void LexicalAnalyzer::
+ ret (Char const& c)
+ {
+ ibuffer_.push_front (c);
+ }
+
+
+ TokenPtr LexicalAnalyzer::
+ next ()
+ {
+ while (true) // Recovery loop.
+ {
+ Char c = skip_space (get ());
+
+ if (is_eos (c)) return TokenPtr (new EndOfStream (0));
+
+ TokenPtr token;
+
+ if (character_literal (c, token)) return token;
+
+ if (string_literal (c, token)) return token;
+
+ if (integer_literal (c, token)) return token;
+
+ // Check for identifier after literals because it can be
+ // triggered by wide string prefix (L"...").
+ //
+ if (is_alpha (c) || c == '_' || (c == ':' && peek () == ':'))
+ {
+ return identifier (c);
+ }
+
+ // Check for punctuation after identifier because ':' in
+ // scoped name will trigger.
+ //
+ if (operator_ (c, token)) return token;
+
+ if (punctuation (c, token)) return token;
+
+ cerr << c.line () << ": error: unable to derive any token "
+ << "from \'" << c << "\'" << endl;
+
+
+ //Do some primitive error recovery.
+ //
+ while (c != ';')
+ {
+ c = skip_space (get ());
+ if (is_eos (c)) return TokenPtr (new EndOfStream (0));
+ }
+ }
+ }
+
+ LexicalAnalyzer::Char LexicalAnalyzer::
+ skip_space (Char c)
+ {
+ while (!is_eos (c) && is_space (c)) c = get ();
+
+ return c;
+ }
+
+ bool LexicalAnalyzer::
+ read_simple_identifier (string& lexeme, CharBuffer& buf)
+ {
+ Char c = skip_space (get ());
+
+ buf.push_back (c);
+
+ if (is_eos (c)) return false;
+
+ if (is_alpha (c) || c == '_')
+ {
+ lexeme += c;
+
+ while (true)
+ {
+ c = peek ();
+
+ if (is_eos (c))
+ {
+ cerr << "warning: no new line at the end of file" << endl;
+ break;
+ }
+
+ if (is_alnum (c) || c == '_')
+ {
+ get ();
+ buf.push_back (c);
+ lexeme += c;
+ continue;
+ }
+
+ break;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+
+ bool LexicalAnalyzer::
+ traverse_identifier_tree (string& lexeme, IdentifierTreeNode const& node)
+ {
+ if (node.map_.empty ()) return true;
+
+ CharBuffer buf;
+ string part;
+
+ if (read_simple_identifier (part, buf))
+ {
+ IdentifierTreeNode::PrefixMap::const_iterator i (
+ node.map_.find (part));
+
+ if (i != node.map_.end ())
+ {
+ if (traverse_identifier_tree (part, i->second))
+ {
+ lexeme += " " + part;
+ return true;
+ }
+ }
+ }
+
+ // Return characters to the buffer in case we couldn't
+ // match anything.
+
+ for(;!buf.empty (); buf.pop_back ()) ret (buf.back ());
+
+ // Check is the node.map_ contains empty key which indicates
+ // that what we've got is good enough.
+ //
+ return node.map_.find ("") != node.map_.end ();
+ }
+
+
+ TokenPtr LexicalAnalyzer::
+ identifier (Char c)
+ {
+ unsigned long line (c.line ());
+
+ string lexeme;
+
+ enum
+ {
+ simple,
+ scoped,
+ other
+ } type = simple;
+
+ if (c == ':')
+ {
+ //@@ not checking for eos here
+ if ((c = get ()) != ':')
+ {
+ cerr << "error: " << c.line () << ": \':\' expected."
+ << endl;
+
+ return TokenPtr (new EndOfStream (0));
+ //@@ error handling is lame for lexical analyzer.
+ }
+
+ lexeme = "::";
+ type = scoped;
+ c = get ();
+ }
+
+ // First caracter of an identifier.
+ //
+ if (is_eos (c))
+ {
+ cerr << "error: invalid identifier" << endl;
+ return TokenPtr (new EndOfStream (0));
+ }
+
+ if (is_alpha (c) || c == '_')
+ {
+ lexeme += c;
+ }
+ else
+ {
+ cerr << "error: invalid identifier" << endl;
+ return TokenPtr (new EndOfStream (0));
+ }
+
+ while (true)
+ {
+ c = peek ();
+
+ if (is_eos (c))
+ {
+ cerr << "warning: no new line at the end of file" << endl;
+ break;
+ }
+
+ // cerr << "lexer::identifier: peeking on \'" << c.char_ ()
+ // << "\'; current lexeme \'" << lexeme << "\'"
+ // << endl;
+
+ if (is_alnum (c) || c == '_')
+ {
+ get ();
+ lexeme += c;
+ continue;
+ }
+
+ if (c == ':' && peek_more () == ':')
+ {
+ get ();
+ get ();
+ lexeme += "::";
+ if (type == simple) type = other;
+ continue;
+ }
+
+ break;
+ }
+
+ //cerr << "lexer: found identifier with lexeme \'"
+ // << lexeme << "\'" << endl;
+
+ if (type == simple)
+ {
+ // Check if it's a keyword.
+ {
+ KeywordTable::const_iterator i (keyword_table_.find (lexeme));
+
+ if (i != keyword_table_.end ())
+ {
+ return TokenPtr (new Keyword (*i, line));
+ }
+
+ // This part is tricky. If it's after 6pm then come back
+ // in the morning. In essence I want the same name
+ // ('string' and 'wstring') to be recognized as a keyword
+ // in one case and as an identifier in the other. When
+ // we see 'string' followed by '<' we want it to be a
+ // keyword. If it's just all by itself then we want to treat
+ // it as an identifier (since it is a complete construct
+ // by itself). So here we are going to check for that.
+ //
+
+ if (lexeme == "string" || lexeme == "wstring")
+ {
+ Char c = skip_space (get ());
+ ret (c);
+
+ if (c == '<')
+ {
+ return TokenPtr (new Keyword (lexeme, line));
+ }
+ }
+ }
+
+ // Check if it is a reserved identifier.
+ //
+
+ {
+ IdentifierTreeNode::PrefixMap::const_iterator i (
+ identifier_tree_.map_.find (lexeme));
+
+ if (i != identifier_tree_.map_.end ())
+ {
+ if (traverse_identifier_tree (lexeme, i->second))
+ {
+ return TokenPtr (
+ new SimpleIdentifier (lexeme, line));
+ }
+ else
+ {
+ //@@ error
+ }
+ }
+ }
+
+ // Check if it is a boolean literal.
+ //
+ if (lexeme == "TRUE" || lexeme == "FALSE")
+ {
+ return TokenPtr (new BooleanLiteral (lexeme, line));
+ }
+
+ // Default to SimpleIdentifier.
+ //
+ return TokenPtr (new SimpleIdentifier (lexeme, line));
+ }
+ else if (type == scoped)
+ {
+ return TokenPtr (new ScopedIdentifier (lexeme, line));
+ }
+ else //type == other
+ {
+ return TokenPtr (new Identifier (lexeme, line));
+ }
+ }
+
+ bool LexicalAnalyzer::
+ punctuation (Char c, TokenPtr& token)
+ {
+ unsigned long line (c.line ());
+
+ PunctuationTable::const_iterator i = punctuation_table_.begin ();
+
+ while (true)
+ {
+ for (;i != punctuation_table_.end () && (*i)[0] != c; ++i);
+
+ if (i == punctuation_table_.end ()) return false;
+
+ if (i->size () == 2) // two-character punctuation
+ {
+ Char pc (peek ());
+
+ if (!is_eos (pc) && (*i)[1] == pc)
+ {
+ get ();
+ }
+ else
+ {
+ // Move on to the next candidate.
+ //
+ ++i;
+ continue;
+ }
+ }
+
+ token = TokenPtr (new Punctuation (*i, line));
+ return true;
+ }
+ }
+
+ bool LexicalAnalyzer::
+ operator_ (Char c, TokenPtr& token)
+ {
+ unsigned long line (c.line ());
+
+ OperatorTable::const_iterator i = operator_table_.begin ();
+
+ while (true)
+ {
+ for (;i != operator_table_.end () && (*i)[0] != c; ++i);
+
+ if (i == operator_table_.end ()) return false;
+
+ if (i->size () == 2) // two-character operator
+ {
+ Char pc (peek ());
+
+ if (!is_eos (pc) && (*i)[1] == pc)
+ {
+ get ();
+ }
+ else
+ {
+ // Move on to the next candidate.
+ //
+ ++i;
+ continue;
+ }
+ }
+
+ token = TokenPtr (new Operator (*i, line));
+ return true;
+ }
+ }
+
+ pair<char, size_t> LexicalAnalyzer::
+ scan_char (char const* s) throw (Format)
+ {
+ if (*s == '\0')
+ {
+ throw Format ();
+ }
+ else if (*s != '\\')
+ {
+ return pair<char, size_t> (*s, 1);
+ }
+ else
+ {
+ // Expected size is 2.
+ //
+ pair<char, size_t> r ('\0', 2);
+
+ switch (*++s)
+ {
+ case 'n':
+ r.first = '\n';
+ break;
+
+ case 't':
+ r.first = '\t';
+ break;
+
+ case 'v':
+ r.first = '\v';
+ break;
+
+ case 'b':
+ r.first = '\b';
+ break;
+
+ case 'r':
+ r.first = '\r';
+ break;
+
+ case 'f':
+ r.first = '\f';
+ break;
+
+ case 'a':
+ r.first = '\a';
+ break;
+
+ case '\\':
+ r.first = '\\';
+ break;
+
+ case '?':
+ r.first = '\?';
+ break;
+
+ case '\'':
+ r.first = '\'';
+ break;
+
+ case '"':
+ r.first = '\"';
+ break;
+
+ case 'x':
+ {
+ // hex
+
+ char c (*++s);
+
+ if(is_hex_digit (c))
+ {
+ // Maximum 2 digits.
+ //
+ string holder (s, 2);
+
+ char* end;
+
+ // Cannot fail. -1 < v < 256.
+ //
+ long v (strtol(holder.c_str (), &end, 16));
+
+ r.first = static_cast<char> (v);
+ r.second = 2 + end - holder.c_str ();
+ }
+ else
+ {
+ throw Format ();
+ }
+ break;
+ }
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ // Maximum 3 digits.
+ //
+ string holder (s, 3);
+
+ char* end;
+
+ // Cannot fail.
+ //
+ long v (strtol(holder.c_str (), &end, 8));
+
+ if (v < 0 || v > 255) throw Format ();
+
+ r.first = static_cast<char> (v);
+ r.second = 1 + end - holder.c_str ();
+
+ break;
+ }
+ default:
+ {
+ throw Format ();
+ }
+ }
+
+ return r;
+
+ }
+ }
+
+ string LexicalAnalyzer::
+ scan_string (string const& s) throw (Format)
+ {
+ string r;
+
+ char const* p = s.c_str ();
+
+ while (*p != '\0')
+ {
+ pair<char, size_t> c (scan_char (p));
+
+ if (c.first == '\0') throw Format ();
+
+ r += c.first;
+ p += c.second;
+ }
+
+ return r;
+ }
+
+
+ bool LexicalAnalyzer::
+ character_literal (Char c, TokenPtr& token)
+ {
+ if (c != '\'') return false;
+
+ unsigned long line (c.line ());
+ string lexeme;
+
+ Char prev (c);
+
+ while (true)
+ {
+ c = get ();
+
+ if (is_eos (c))
+ {
+ cerr << "error: end of file while reading character literal"
+ << endl;
+ break;
+ }
+
+ if (c == '\'' && prev != '\\') break;
+
+ lexeme += c;
+ prev = c;
+ }
+
+ try
+ {
+ pair<char, size_t> r (scan_char (lexeme.c_str ()));
+ if (r.second != lexeme.size ()) throw Format ();
+
+ token = TokenPtr (new CharacterLiteral (r.first, lexeme, line));
+ return true;
+ }
+ catch (Format const&)
+ {
+ cerr << "error: invalid character literal format" << endl;
+ return false;
+ }
+ }
+
+ bool LexicalAnalyzer::
+ string_literal (Char c, TokenPtr& token)
+ {
+ if (c != '\"') return false;
+
+ unsigned long line (c.line ());
+ string lexeme;
+ string value;
+
+ try
+ {
+ while (true)
+ {
+ string r (string_literal_trailer ());
+ value += scan_string (r);
+ lexeme += '\"' + r + '\"';
+
+ // Check if there are more strings.
+ //
+
+ c = skip_space (get ());
+
+ if (c != '\"')
+ {
+ ret (c); // put it back
+ break;
+ }
+
+
+ // Add single space as a string separator.
+ //
+ lexeme += " ";
+ }
+
+ // cerr << "string literal: <" << lexeme << ">/<" << value << ">"
+ // << endl;
+
+ token = TokenPtr (new StringLiteral (value, lexeme, line));
+ return true;
+ }
+ catch (Format const&)
+ {
+ cerr << "error: invalid string literal format" << endl;
+ return false;
+ }
+ }
+
+ string LexicalAnalyzer::
+ string_literal_trailer ()
+ {
+ string r;
+
+ Char prev ('\"', 0);
+
+ while (true)
+ {
+ Char c = get ();
+
+ if (is_eos (c))
+ {
+ cerr << "error: end of file while reading string literal" << endl;
+ break;
+ }
+
+ if (c == '\"' && prev != '\\') break;
+
+ r += c;
+ prev = c;
+ }
+
+ return r;
+ }
+
+ unsigned long long LexicalAnalyzer::
+ scan_integer (string const& s, unsigned short base)
+ throw (Format, Boundary)
+ {
+ unsigned long long const max (~0ULL);
+ unsigned long long bound (max / base);
+
+
+ char const* p (s.c_str ());
+
+ // Skip leading 0 if any.
+ //
+ while (*p != '\0' && *p == '0') ++p;
+
+
+ unsigned long long result (0);
+
+ while(*p != '\0')
+ {
+ unsigned short digit;
+
+ char c (to_upper (*p));
+
+ if (is_dec_digit (c))
+ {
+ digit = c - '0';
+ }
+ else if (is_hex_digit (c))
+ {
+ digit = c - 'A' + 10;
+ }
+ else
+ {
+ throw Format ();
+ }
+
+ if (digit > base) throw Format ();
+
+ if (result > bound)
+ {
+ // cerr << "boundary: base: " << base << "; bound: " << std::hex
+ // << bound << "; result: " << std::hex << result << endl;
+
+ throw Boundary ();
+ }
+
+
+ result *= base;
+ result += digit;
+
+ ++p;
+ }
+
+ return result;
+ }
+
+ //@@ need to return unparsed characters for recovery (like in
+ // integer_literal).
+ //
+ bool LexicalAnalyzer::
+ integer_literal (Char c, TokenPtr& token)
+ {
+ try
+ {
+ if (!is_dec_digit (c)) return false;
+
+ unsigned long line (c.line ());
+
+ ret (c); // Temporarily return the character.
+
+ string lexeme, number;
+
+ unsigned short base (10); // assume 10
+
+ // Determine base and get rid of its identifications.
+ //
+ //
+ if (c == '0')
+ {
+ lexeme += c;
+
+ get ();
+
+ Char pc (peek ());
+
+ if (!is_eos (pc))
+ {
+ if (pc == 'x' || pc == 'X')
+ {
+ get ();
+ base = 16;
+ lexeme += pc;
+
+ c = peek ();
+ }
+ else
+ {
+ base = 8;
+ if (!is_oct_digit (pc))
+ {
+ number += c; // this is needed to handle single 0
+ }
+
+ c = pc;
+ }
+ }
+ else
+ {
+ number += c; // this is needed to handle single 0
+ }
+ }
+
+ while (true)
+ {
+ // Make sure c is a legal character.
+ //
+
+ if (is_eos (c)) break;
+
+ if (base == 8 && !is_oct_digit (c))
+ {
+ break;
+ }
+ else if (base == 10 && !is_dec_digit (c))
+ {
+ break;
+ }
+ else if (!is_hex_digit (c))
+ {
+ break;
+ }
+
+ get ();
+
+ lexeme += c;
+ number += c;
+
+ c = peek ();
+ }
+
+ if (number.empty ()) throw Format ();
+
+ unsigned long long value (scan_integer (number, base));
+
+ //cerr << "integer literal: <" << lexeme << ">/<" << number << ">/<"
+ // << value << ">" << endl;
+
+ token = TokenPtr (new IntegerLiteral (value, lexeme, line));
+ return true;
+ }
+ catch (Format const&)
+ {
+ cerr << "error: invalid integer literal format" << endl;
+ return false;
+ }
+ catch (Boundary const&)
+ {
+ cerr << "error: integer literal is too big" << endl;
+ return false;
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp b/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp
new file mode 100644
index 00000000000..e75641e40c8
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/LexicalAnalyzer.hpp
@@ -0,0 +1,203 @@
+// file : CCF/IDL2/LexicalAnalyzer.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_LEXICAL_ANALYZER_HPP
+#define CCF_IDL2_LEXICAL_ANALYZER_HPP
+
+#include <set>
+#include <map>
+#include <deque>
+#include <locale>
+#include <string>
+
+#include "CCF/CompilerElements/TokenStream.hpp"
+#include "CCF/CompilerElements/PreprocessorToken.hpp"
+#include "CCF/IDL2/Token.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ //@@ Call to get() after eof is illegal.
+ //
+ //
+
+ class LexicalAnalyzer : public CompilerElements::TokenStream<TokenPtr>
+ {
+ public:
+ virtual
+ ~LexicalAnalyzer () throw () {}
+
+ public:
+
+ typedef
+ CompilerElements::CPP::Token
+ Char;
+
+ typedef
+ std::deque<Char>
+ CharBuffer;
+
+ LexicalAnalyzer (CompilerElements::TokenStream<Char>& is);
+
+ virtual TokenPtr
+ next ();
+
+ protected:
+ virtual Char
+ skip_space (Char c);
+
+ virtual TokenPtr
+ identifier (Char c);
+
+ virtual bool
+ punctuation (Char c, TokenPtr& token);
+
+ virtual bool
+ operator_ (Char c, TokenPtr& token);
+
+ virtual bool
+ character_literal (Char c, TokenPtr& token);
+
+ virtual bool
+ string_literal (Char c, TokenPtr& token);
+
+ virtual std::string
+ string_literal_trailer ();
+
+ virtual bool
+ integer_literal (Char c, TokenPtr& token);
+
+ // Literal scanners.
+ //
+ //
+ class Format {};
+ class Boundary {};
+
+ std::pair<char, std::size_t>
+ scan_char (char const* s) throw (Format);
+
+ std::string
+ scan_string (std::string const& s) throw (Format);
+
+ unsigned long long
+ scan_integer (std::string const& s, unsigned short base)
+ throw (Format, Boundary);
+
+ protected:
+ virtual Char
+ get ();
+
+ virtual Char
+ peek ();
+
+ virtual Char
+ peek_more ();
+
+ virtual void
+ ret (Char const& c);
+
+ protected:
+ // Character utility functions.
+ //
+ bool
+ is_alpha (char c) const
+ {
+ return std::isalpha (c, loc_);
+ }
+
+ bool
+ is_oct_digit (char c) const
+ {
+ return std::isdigit (c, loc_) && c != '8' && c != '9';
+ }
+
+ bool
+ is_dec_digit (char c) const
+ {
+ return std::isdigit (c, loc_);
+ }
+
+ bool
+ is_hex_digit (char c) const
+ {
+ return std::isxdigit (c, loc_);
+ }
+
+ bool
+ is_alnum (char c) const
+ {
+ return std::isalnum (c, loc_);
+ }
+
+ bool
+ is_space (char c) const
+ {
+ return std::isspace (c, loc_);
+ }
+
+ bool
+ is_eos (Char const& c) const
+ {
+ return c == Char::eos;
+ }
+
+ char
+ to_upper (char c) const
+ {
+ return std::toupper (c, loc_);
+ }
+
+ protected:
+ typedef
+ std::set<std::string>
+ KeywordTable;
+
+ struct IdentifierTreeNode
+ {
+ typedef
+ std::map<std::string, IdentifierTreeNode>
+ PrefixMap;
+
+ IdentifierTreeNode&
+ operator[] (char const* key)
+ {
+ return map_[key];
+ }
+
+ PrefixMap map_;
+ };
+
+ typedef
+ std::set<std::string>
+ PunctuationTable;
+
+ typedef
+ std::set<std::string>
+ OperatorTable;
+
+ protected:
+ bool
+ read_simple_identifier (std::string& lexeme, CharBuffer& buf);
+
+ bool
+ traverse_identifier_tree (std::string& lexeme,
+ IdentifierTreeNode const& node);
+
+ protected:
+ std::locale loc_;
+
+ CompilerElements::TokenStream<Char>& is_;
+
+ CharBuffer ibuffer_;
+
+ KeywordTable keyword_table_;
+ IdentifierTreeNode identifier_tree_;
+ PunctuationTable punctuation_table_;
+ OperatorTable operator_table_;
+ };
+ }
+}
+
+#endif // CCF_IDL2_LEXICAL_ANALYZER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Parser.cpp b/CIAO/CCF/CCF/IDL2/Parser.cpp
new file mode 100644
index 00000000000..c368ad2b5d7
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Parser.cpp
@@ -0,0 +1,2360 @@
+// file : CCF/IDL2/Parser.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Parser.hpp"
+
+//
+// Note: DO NOT run emacs indenter (or any other indentation tool) over
+// this file because it will most likely break BNF indentation.
+//
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ using Parsing::DiagnosticType;
+ using Parsing::RecoveryMethod;
+
+ Parser::
+ ~Parser ()
+ {
+ }
+
+ Parser::
+ Parser (CompilerElements::Context& context,
+ Diagnostic::Stream& dout,
+ LexicalAnalyzer const& l,
+ SemanticAction::Factory& f)
+ : dout_ (dout),
+ lexer_ (l),
+ actions_ (f),
+
+ error_handler (context, dout),
+
+ ABSTRACT ("abstract" ),
+ ATTRIBUTE ("attribute" ),
+ BINCLUDE ("__binclude" ),
+ CASE ("case" ),
+ CONST ("const" ),
+ CUSTOM ("custom" ),
+ DEFAULT ("default" ),
+ ENUM ("enum" ),
+ EXCEPTION ("exception" ),
+ FACTORY ("factory" ),
+ GETRAISES ("getraises" ),
+ IN ("in" ),
+ INOUT ("inout" ),
+ INTERFACE ("interface" ),
+ QINCLUDE ("__qinclude" ),
+ LOCAL ("local" ),
+ MODULE ("module" ),
+ NATIVE ("native" ),
+ ONEWAY ("oneway" ),
+ OUT ("out" ),
+ PRIVATE ("private" ),
+ PUBLIC ("public" ),
+ RAISES ("raises" ),
+ READONLY ("readonly" ),
+ SEQUENCE ("sequence" ),
+ SETRAISES ("setraises" ),
+ STRING ("string" ),
+ STRUCT ("struct" ),
+ SUPPORTS ("supports" ),
+ SWITCH ("switch" ),
+ TRUNCATABLE ("truncatable"),
+ TYPEDEF ("typedef" ),
+ TYPEID ("typeid" ),
+ TYPEPREFIX ("typeprefix" ),
+ UNION ("union" ),
+ VALUETYPE ("valuetype" ),
+ WSTRING ("wstring" ),
+
+ COLON (":"),
+ COMMA (","),
+ LCBRACE ("{"),
+ RCBRACE ("}"),
+ LSBRACE ("["),
+ RSBRACE ("]"),
+ LPAREN ("("),
+ RPAREN (")"),
+ LT ("<"),
+ GT (">"),
+ SEMI (";"),
+
+
+ ADD ("+"),
+ AND ("&"),
+ COM ("~"),
+ DIV ("/"),
+ EQ ("="),
+ LSH ("<<"),
+ MUL ("*"),
+ OR ("|"),
+ REM ("%"),
+ SUB ("-"),
+ RSH (">>"),
+ XOR ("^"),
+
+
+ // Attribute
+ //
+ //
+ act_attribute_begin_ro (
+ f.attribute (), &SemanticAction::Attribute::begin_ro),
+
+ act_attribute_begin_rw (
+ f.attribute (), &SemanticAction::Attribute::begin_rw),
+
+ act_attribute_type (
+ f.attribute (), &SemanticAction::Attribute::type),
+
+ act_attribute_name (
+ f.attribute (), &SemanticAction::Attribute::name),
+
+ act_attribute_get_raises (
+ f.attribute (), &SemanticAction::Attribute::get_raises),
+
+ act_attribute_set_raises (
+ f.attribute (), &SemanticAction::Attribute::set_raises),
+
+ act_attribute_end (
+ f.attribute (), &SemanticAction::Attribute::end),
+
+ // Const
+ //
+ act_const_begin (
+ f.const_ (), &SemanticAction::Const::begin),
+
+ act_const_expr (
+ f.const_ (), &SemanticAction::Const::expr),
+
+ // Enum
+ //
+ //
+ act_enum_begin (
+ f.enum_ (), &SemanticAction::Enum::begin),
+
+ act_enum_enumerator (
+ f.enum_ (), &SemanticAction::Enum::enumerator),
+
+ act_enum_end (
+ f.enum_ (), &SemanticAction::Enum::end),
+
+
+ // Expression
+ //
+
+ act_const_expr_flush (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::flush),
+
+ act_numeric_expression_const (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::const_),
+
+ act_numeric_expression_integer_literal (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::integer_literal),
+
+ act_numeric_expression_pre (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::pre),
+
+ act_numeric_expression_pos (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::pos),
+
+ act_numeric_expression_neg (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::neg),
+
+ act_numeric_expression_com (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::com),
+
+ act_numeric_expression_mul (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::mul),
+
+ act_numeric_expression_div (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::div),
+
+ act_numeric_expression_rem (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::rem),
+
+ act_numeric_expression_add (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::add),
+
+ act_numeric_expression_sub (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::sub),
+
+ act_numeric_expression_rsh (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::rsh),
+
+ act_numeric_expression_lsh (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::lsh),
+
+ act_numeric_expression_and (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::and_),
+
+ act_numeric_expression_xor (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::xor_),
+
+ act_numeric_expression_or (
+ f.numeric_expression (),
+ &SemanticAction::NumericExpression::or_),
+
+ // Exception
+ //
+ //
+ act_exception_begin (
+ f.exception (), &SemanticAction::Exception::begin),
+
+ act_exception_open_scope (
+ f.exception (), &SemanticAction::Scope::open_scope),
+
+ act_exception_close_scope (
+ f.exception (), &SemanticAction::Scope::close_scope),
+
+ act_exception_end (
+ f.exception (), &SemanticAction::Exception::end),
+
+
+ // Include
+ //
+ //
+ act_include_quote (
+ f.include (), &SemanticAction::Include::quote),
+
+ act_include_bracket (
+ f.include (), &SemanticAction::Include::bracket),
+
+ act_include_end (
+ f.include (), &SemanticAction::Include::end),
+
+
+ // Interface
+ //
+ //
+ act_interface_begin_abstract_def (
+ f.interface (), &SemanticAction::Interface::begin_abstract_def),
+
+ act_interface_begin_abstract_fwd (
+ f.interface (), &SemanticAction::Interface::begin_abstract_fwd),
+
+ act_interface_begin_local_def (
+ f.interface (), &SemanticAction::Interface::begin_local_def),
+
+ act_interface_begin_local_fwd (
+ f.interface (), &SemanticAction::Interface::begin_local_fwd),
+
+ act_interface_begin_unconstrained_def (
+ f.interface (),
+ &SemanticAction::Interface::begin_unconstrained_def),
+
+ act_interface_begin_unconstrained_fwd (
+ f.interface (),
+ &SemanticAction::Interface::begin_unconstrained_fwd),
+
+ act_interface_inherits (
+ f.interface (), &SemanticAction::Interface::inherits),
+
+ act_interface_open_scope (
+ f.interface (), &SemanticAction::Scope::open_scope),
+
+ act_interface_close_scope (
+ f.interface (), &SemanticAction::Scope::close_scope),
+
+ act_interface_end (f.interface (), &SemanticAction::Interface::end),
+
+
+ // Member
+ //
+ //
+ act_member_type (
+ f.member (), &SemanticAction::Member::type),
+
+ act_member_name (
+ f.member (), &SemanticAction::Member::name),
+
+ act_member_end (
+ f.member (), &SemanticAction::Member::end),
+
+
+ // Module
+ //
+ //
+ act_module_begin (f.module (), &SemanticAction::Module::begin),
+
+ act_module_open_scope (
+ f.module (), &SemanticAction::Scope::open_scope),
+
+ act_module_close_scope (
+ f.module (), &SemanticAction::Scope::close_scope),
+
+ act_module_end (f.module (), &SemanticAction::Module::end),
+
+
+ // Native
+ //
+ //
+ act_native_name (
+ f.native (), &SemanticAction::Native::name),
+
+ act_native_end (
+ f.native (), &SemanticAction::Native::end),
+
+
+ // Operation
+ //
+ //
+ act_operation_one_way (
+ f.operation (), &SemanticAction::Operation::one_way),
+
+ act_operation_two_way (
+ f.operation (), &SemanticAction::Operation::two_way),
+
+ act_operation_type (
+ f.operation (), &SemanticAction::Operation::type),
+
+ act_operation_name (
+ f.operation (), &SemanticAction::Operation::name),
+
+ act_operation_parameter (
+ this, &Parser::act_operation_parameter_core),
+
+ act_operation_raises (
+ f.operation (), &SemanticAction::Operation::raises),
+
+
+ // Struct
+ //
+ //
+ act_struct_begin_def (
+ f.struct_ (), &SemanticAction::Struct::begin_def),
+
+ act_struct_begin_fwd (
+ f.struct_ (), &SemanticAction::Struct::begin_fwd),
+
+ act_struct_open_scope (
+ f.struct_ (), &SemanticAction::Scope::open_scope),
+
+ act_struct_close_scope (
+ f.struct_ (), &SemanticAction::Scope::close_scope),
+
+ act_struct_end (f.struct_ (), &SemanticAction::Struct::end),
+
+
+ // Typedef
+ //
+ //
+ act_typedef_pre (
+ f.typedef_ (), &SemanticAction::Typedef::pre),
+
+ act_typedef_begin (
+ f.typedef_ (), &SemanticAction::Typedef::begin),
+
+ act_typedef_begin_unbounded_seq (
+ f.typedef_ (), &SemanticAction::Typedef::begin_unbounded_seq),
+
+ act_typedef_begin_bounded_seq (
+ f.typedef_ (), &SemanticAction::Typedef::begin_bounded_seq),
+
+ act_typedef_begin_bounded_string (
+ f.typedef_ (), &SemanticAction::Typedef::begin_bounded_string),
+
+ act_typedef_begin_bounded_wstring (
+ f.typedef_ (), &SemanticAction::Typedef::begin_bounded_wstring),
+
+ act_typedef_begin_array (
+ f.typedef_ (), &SemanticAction::Typedef::begin_array),
+
+ act_typedef_bound (
+ f.typedef_ (), &SemanticAction::Typedef::bound),
+
+ act_typedef_declarator (
+ f.typedef_ (), &SemanticAction::Typedef::declarator),
+
+ act_typedef_end (
+ f.typedef_ (), &SemanticAction::Typedef::end),
+
+
+ // TypeId
+ //
+ //
+ act_type_id_begin (f.type_id (), &SemanticAction::TypeId::begin),
+ act_type_id_end (f.type_id (), &SemanticAction::TypeId::end),
+
+
+ // TypePrefix
+ //
+ //
+ act_type_prefix_begin (f.type_prefix (),
+ &SemanticAction::TypePrefix::begin),
+
+ act_type_prefix_end (f.type_prefix (),
+ &SemanticAction::TypePrefix::end),
+
+ // Union
+ //
+ //
+ act_union_begin_def (
+ f.union_ (), &SemanticAction::Union::begin_def),
+
+ act_union_begin_fwd (
+ f.union_ (), &SemanticAction::Union::begin_fwd),
+
+ act_union_type (
+ f.union_ (), &SemanticAction::Union::type),
+
+ act_union_open_scope (
+ f.union_ (), &SemanticAction::Scope::open_scope),
+
+ act_union_member_type (
+ f.union_ (), &SemanticAction::Union::member_type),
+
+ act_union_member_name (
+ f.union_ (), &SemanticAction::Union::member_name),
+
+ act_union_close_scope (
+ f.union_ (), &SemanticAction::Scope::close_scope),
+
+ act_union_end (
+ f.union_ (), &SemanticAction::Union::end),
+
+
+ // ValueType
+ //
+ //
+ act_value_type_begin_abstract_def (
+ f.value_type (), &SemanticAction::ValueType::begin_abstract_def),
+
+ act_value_type_begin_abstract_fwd (
+ f.value_type (), &SemanticAction::ValueType::begin_abstract_fwd),
+
+ act_value_type_begin_concrete_def (
+ f.value_type (), &SemanticAction::ValueType::begin_concrete_def),
+
+ act_value_type_begin_concrete_fwd (
+ f.value_type (), &SemanticAction::ValueType::begin_concrete_fwd),
+
+ act_value_type_inherits (
+ f.value_type (), &SemanticAction::ValueType::inherits),
+
+ act_value_type_supports (
+ f.value_type (), &SemanticAction::ValueType::supports),
+
+ act_value_type_open_scope (
+ f.value_type (), &SemanticAction::Scope::open_scope),
+
+ act_value_type_close_scope (
+ f.value_type (), &SemanticAction::Scope::close_scope),
+
+ act_value_type_end (
+ f.value_type (), &SemanticAction::ValueType::end),
+
+
+ // ValueTypeFactory
+ //
+ act_value_type_factory_name (
+ f.value_type_factory (), &SemanticAction::ValueTypeFactory::name),
+
+ act_value_type_factory_parameter (
+ f.value_type_factory (), &SemanticAction::ValueTypeFactory::parameter),
+
+ act_value_type_factory_raises (
+ f.value_type_factory (), &SemanticAction::ValueTypeFactory::raises),
+
+
+
+ // ValueTypeMember
+ //
+ act_value_type_member_begin_private (
+ f.value_type_member (),
+ &SemanticAction::ValueTypeMember::begin_private),
+
+ act_value_type_member_begin_public (
+ f.value_type_member (),
+ &SemanticAction::ValueTypeMember::begin_public),
+
+ act_value_type_member_type (
+ f.value_type_member (), &SemanticAction::ValueTypeMember::type),
+
+ act_value_type_member_name (
+ f.value_type_member (), &SemanticAction::ValueTypeMember::name),
+
+ act_value_type_member_end (
+ f.value_type_member (), &SemanticAction::ValueTypeMember::end)
+
+ {
+ language =
+ guard
+ (
+ guard
+ (
+ assertion ("declaration or include directive expected",
+ DiagnosticType::BEFORE)
+ (
+ (+import >> *declaration)
+ | +declaration
+ )
+ >> assertion ("declaration or include directive expected",
+ DiagnosticType::BEFORE)
+ (
+ EOS
+ )
+ )[error_handler]
+ )[root_error_handler] // Stops bailing out (rethrowing).
+ ;
+
+ import = include_decl
+ ;
+
+ include_decl =
+ (
+ (QINCLUDE >> string_literal[act_include_quote])
+ | (BINCLUDE >> string_literal[act_include_bracket])
+ )
+ >> SEMI[act_include_end]
+ ;
+
+ // There are two classes of types: The first class includes
+ // interface and valuetype. The second class includes all
+ // other types like struct, etc. I wonder how I can represent
+ // it in the grammar.
+ //
+
+ declaration =
+ abstract_type_decl
+ | const_decl
+ | extension
+ | local_type_decl
+ | module_decl
+ | type_decl
+ | type_id_decl
+ | type_prefix_decl
+ | unconstrained_interface_decl
+ | concrete_value_type_decl
+ ;
+
+ type_decl =
+ enum_decl
+ | exception_decl
+ | native_decl
+ | struct_decl
+ | typedef_decl
+ | union_decl
+ ;
+
+ type_id_decl =
+ TYPEID
+ >> guard
+ (
+ (
+ assertion ("type name expected")
+ (
+ identifier
+ )
+ >> assertion ("string literal expected",
+ DiagnosticType::BEFORE)
+ (
+ string_literal
+ )
+ )[act_type_id_begin]
+
+ >> assertion ("';' expected",
+ f.type_id (),
+ &SemanticAction::TypeId::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_type_id_end]
+ )
+ )[error_handler]
+ ;
+
+ type_prefix_decl =
+ TYPEPREFIX
+ >> guard
+ (
+ (
+ assertion ("type name expected")
+ (
+ identifier
+ )
+ >> assertion ("string literal expected",
+ DiagnosticType::BEFORE)
+ (
+ string_literal
+ )
+ )[act_type_prefix_begin]
+
+ >> assertion ("';' expected",
+ f.type_prefix (),
+ &SemanticAction::TypePrefix::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_type_prefix_end]
+ )
+ )[error_handler]
+ ;
+
+ abstract_type_decl =
+ ABSTRACT
+ >> guard
+ (
+ assertion ("interface or valuetype declaration expected")
+ (
+ (INTERFACE >> abstract_interface_decl)
+ |
+ (VALUETYPE >> abstract_value_type_decl)
+ )
+ )[error_handler]
+ ;
+
+ local_type_decl =
+ LOCAL
+ >> guard
+ (
+ assertion ("interface declaration expected")
+ (
+ INTERFACE >> local_interface_decl
+ )
+ )[error_handler]
+ ;
+
+ module_decl =
+ MODULE
+ >> guard
+ (
+ assertion ("module name expected")
+ (
+ simple_identifier[act_module_begin]
+ )
+ >> assertion ("'{' expected",
+ f.module (),
+ &SemanticAction::Module::end)
+ (
+ LCBRACE[act_module_open_scope]
+ )
+ >> assertion ("declaration expected",
+ f.module (),
+ &SemanticAction::Module::close_scope,
+ &SemanticAction::Module::end,
+ DiagnosticType::BEFORE)
+ (
+ hood (+declaration)
+ [
+ handler (f.module (),
+ &SemanticAction::Module::close_scope,
+ &SemanticAction::Module::end)
+ ]
+ )
+ >> assertion ("declaration or '}' expected",
+ f.module (),
+ &SemanticAction::Module::close_scope,
+ &SemanticAction::Module::end,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_module_close_scope]
+ )
+ >> assertion ("';' expected",
+ f.module (),
+ &SemanticAction::Module::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_module_end]
+ )
+ )[error_handler]
+ ;
+
+ // const
+ //
+ //
+ const_decl =
+ CONST
+ >> guard
+ (
+ (
+ assertion ("type name expected")
+ (
+ identifier
+ )
+ >> assertion ("const name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier
+ )
+ )[act_const_begin]
+ >> assertion ("'=' expected")
+ (
+ EQ[act_const_expr_flush] // flush expression stacks
+ )
+ >> assertion ("const expression expected")
+ (
+ const_expr[act_const_expr]
+ )
+ >> assertion ("';' expected",
+ RecoveryMethod::NONE)
+ (
+ SEMI
+ )
+ )[error_handler]
+ ;
+
+
+ // const expression
+ //
+ //
+
+ const_expr =
+ boolean_const_expr
+ | character_const_expr
+ | numeric_const_expr
+ | string_const_expr
+ ;
+
+ boolean_const_expr = boolean_literal;
+
+ character_const_expr = character_literal;
+
+ string_const_expr = string_literal;
+
+
+ //
+ //
+ numeric_const_expr =
+ guard
+ (
+ numeric_or_expr
+ )[error_handler]
+ ;
+
+ numeric_or_expr =
+ numeric_xor_expr
+ >> *(
+ OR[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_xor_expr
+ )
+ )[act_numeric_expression_or]
+ ;
+
+ numeric_xor_expr =
+ numeric_and_expr
+ >> *(
+ XOR[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_and_expr
+ )
+ )[act_numeric_expression_xor]
+ ;
+
+
+ numeric_and_expr =
+ numeric_shift_expr
+ >> *(
+ AND[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_shift_expr
+ )
+ )[act_numeric_expression_and]
+ ;
+
+ numeric_shift_expr =
+ numeric_add_expr
+ >> *(
+ (
+ RSH[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_add_expr
+ )
+ )[act_numeric_expression_rsh]
+ |
+ (
+ LSH[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_add_expr
+ )
+ )[act_numeric_expression_lsh]
+ )
+ ;
+
+ numeric_add_expr =
+ numeric_mul_expr
+ >> *(
+ ( ADD[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_mul_expr
+ )
+ )[act_numeric_expression_add]
+
+ |
+ ( SUB[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_mul_expr
+ )
+ )[act_numeric_expression_sub]
+ )
+ ;
+
+ numeric_mul_expr =
+ numeric_unary_expr
+ >> *(
+ ( MUL[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_unary_expr
+ )
+ )[act_numeric_expression_mul]
+
+ |
+ ( DIV[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_unary_expr
+ )
+ )[act_numeric_expression_div]
+
+ |
+ ( REM[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_unary_expr
+ )
+ )[act_numeric_expression_rem]
+ )
+ ;
+
+ numeric_unary_expr =
+ numeric_primary_expr
+
+ | ADD[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_primary_expr[act_numeric_expression_pos]
+ )
+
+ | SUB[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_primary_expr[act_numeric_expression_neg]
+ )
+
+ | COM[act_numeric_expression_pre]
+ >> assertion ("expression expected")
+ (
+ numeric_primary_expr[act_numeric_expression_com]
+ )
+ ;
+
+ numeric_primary_expr =
+ identifier[act_numeric_expression_const]
+ | integer_literal[act_numeric_expression_integer_literal]
+ | LPAREN
+ >> assertion ("expression expected")
+ (
+ numeric_const_expr
+ )
+ >> assertion ("')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ ;
+
+
+ // enum
+ //
+ //
+ enum_decl =
+ ENUM
+ >> guard
+ (
+ assertion ("enum name expected")
+ (
+ simple_identifier[act_enum_begin]
+ )
+ >> hood
+ (
+ assertion ("'{' expected")
+ (
+ LCBRACE
+ )
+ >> enumerator_decl >> *(COMMA >> enumerator_decl)
+ >> assertion ("',' or '}' expected",
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE
+ )
+ )
+ [
+ handler (f.enum_ (),
+ &SemanticAction::Enum::end)
+ ]
+ >> assertion ("';' expected",
+ f.enum_ (),
+ &SemanticAction::Enum::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_enum_end]
+ )
+ )[error_handler]
+ ;
+
+ enumerator_decl =
+ assertion ("enumerator name expected")
+ (
+ simple_identifier[act_enum_enumerator]
+ )
+ ;
+
+
+ // interface
+ //
+ //
+ abstract_interface_decl =
+ guard
+ (
+ assertion ("abstract interface declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_interface_begin_abstract_fwd][act_interface_end]
+ |
+ (
+ (
+ simple_identifier
+ >> COLON
+ )[act_interface_begin_abstract_def]
+
+ >> hood
+ (
+ interface_inheritance_spec
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_interface_open_scope]
+ )
+ >> hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_interface_begin_abstract_def][act_interface_open_scope]
+
+ >> hood
+ (
+ hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ local_interface_decl =
+ guard
+ (
+ assertion ("local interface declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_interface_begin_local_fwd][act_interface_end]
+ |
+ (
+ (
+ simple_identifier
+ >> COLON
+ )[act_interface_begin_local_def]
+
+ >> hood
+ (
+ interface_inheritance_spec
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_interface_open_scope]
+ )
+ >> hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_interface_begin_local_def][act_interface_open_scope]
+
+ >> hood
+ (
+ hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ unconstrained_interface_decl =
+ INTERFACE
+ >> guard
+ (
+ assertion ("interface declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_interface_begin_unconstrained_fwd][act_interface_end]
+ |
+ (
+ (
+ simple_identifier
+ >> COLON
+ )[act_interface_begin_unconstrained_def]
+
+ >> hood
+ (
+ interface_inheritance_spec
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_interface_open_scope]
+ )
+ >> hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_interface_begin_unconstrained_def][act_interface_open_scope]
+
+ >> hood
+ (
+ hood (interface_body)
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.interface (),
+ &SemanticAction::Interface::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_interface_close_scope]
+ )
+ )
+ [
+ handler (f.interface (),
+ &SemanticAction::Interface::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.interface (),
+ &SemanticAction::Interface::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_interface_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ interface_inheritance_spec =
+ guard
+ (
+ assertion ("base interface name expected")
+ (
+ identifier[act_interface_inherits]
+ )
+ >> *(
+ COMMA
+ >> assertion ("base eventtype name expected")
+ (
+ identifier[act_interface_inherits]
+ )
+ )
+ )[error_handler]
+ ;
+
+ interface_body =
+ *(
+ const_decl
+ | type_decl
+ | type_id_decl
+ | type_prefix_decl
+
+ | attribute_decl
+ | operation_decl
+ )
+ ;
+
+
+ // attribute
+ //
+ //
+ attribute_decl =
+ guard
+ (
+ (
+ (
+ READONLY
+ >> assertion ("'attribute' expected")
+ (
+ ATTRIBUTE
+ )
+ )[act_attribute_begin_ro]
+
+ >> hood (attribute_ro_decl_trailer)
+ [
+ handler (f.attribute (),
+ &SemanticAction::Attribute::end)
+ ]
+ >> assertion ("';' expected",
+ f.attribute (),
+ &SemanticAction::Attribute::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_attribute_end]
+ )
+ )
+ |
+ (
+ ATTRIBUTE[act_attribute_begin_rw]
+ >> hood (attribute_rw_decl_trailer)
+ [
+ handler (f.attribute (),
+ &SemanticAction::Attribute::end)
+ ]
+ >> assertion ("';' expected",
+ f.attribute (),
+ &SemanticAction::Attribute::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_attribute_end]
+ )
+ )
+ )[error_handler]
+ ;
+
+
+ attribute_ro_decl_trailer =
+ assertion ("attribute type name expected")
+ (
+ identifier[act_attribute_type]
+ )
+ >> assertion ("attribute name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier[act_attribute_name]
+ )
+ >> !(
+ attribute_ro_raises_spec
+ |
+ +(
+ COMMA
+ >> assertion ("attribute name expected")
+ (
+ simple_identifier[act_attribute_name]
+ )
+ )
+ )
+ ;
+
+ attribute_rw_decl_trailer =
+ assertion ("attribute type name expected")
+ (
+ identifier[act_attribute_type]
+ )
+ >> assertion ("attribute name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier[act_attribute_name]
+ )
+ >> !(
+ attribute_rw_raises_spec
+ |
+ +(
+ COMMA
+ >> assertion ("attribute name expected")
+ (
+ simple_identifier[act_attribute_name]
+ )
+ )
+ )
+ ;
+
+ attribute_ro_raises_spec =
+ RAISES
+ >> attribute_get_raises_list;
+
+
+ attribute_rw_raises_spec =
+ (
+ (GETRAISES >> attribute_get_raises_list)
+ >> !(SETRAISES >> attribute_set_raises_list)
+ )
+ |
+ (SETRAISES >> attribute_set_raises_list)
+ ;
+
+ attribute_get_raises_list =
+ assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> assertion ("exception name expected")
+ (
+ identifier[act_attribute_get_raises]
+ )
+ >> *(
+ COMMA
+ >> assertion ("exception name expected")
+ (
+ identifier[act_attribute_get_raises]
+ )
+ )
+ >> assertion ("',' or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ ;
+
+ attribute_set_raises_list =
+ assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> assertion ("exception name expected")
+ (
+ identifier[act_attribute_set_raises]
+ )
+ >> *(
+ COMMA
+ >> assertion ("exception name expected")
+ (
+ identifier[act_attribute_set_raises]
+ )
+ )
+ >> assertion ("',' or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ ;
+
+
+ // exception
+ //
+ //
+ exception_decl =
+ EXCEPTION
+ >> guard
+ (
+ assertion ("exception name expected")
+ (
+ simple_identifier[act_exception_begin]
+ )
+ >> hood
+ (
+ assertion ("'{' expected")
+ (
+ LCBRACE[act_exception_open_scope]
+ )
+ >> hood (exception_body)
+ [
+ handler (f.exception (),
+ &SemanticAction::Exception::close_scope)
+ ]
+ >> assertion ("member declaration or '}' expected",
+ f.exception (),
+ &SemanticAction::Exception::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_exception_close_scope]
+ )
+ )
+ [
+ handler (f.exception (),
+ &SemanticAction::Exception::end)
+ ]
+ >> assertion ("';' expected",
+ f.exception (),
+ &SemanticAction::Exception::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_exception_end]
+ )
+ )[error_handler]
+ ;
+
+ exception_body =
+ *member_decl
+ ;
+
+
+ // direction specifier
+ //
+ //
+ direction_specifier =
+ IN
+ | OUT
+ | INOUT
+ ;
+
+
+ // member
+ //
+ //
+ member_decl =
+ identifier[act_member_type]
+ >> guard
+ (
+ hood
+ (
+ assertion ("member name expected")
+ (
+ simple_identifier[act_member_name]
+ )
+ >> *(
+ COMMA
+ >> assertion ("member name expected")
+ (
+ simple_identifier[act_member_name]
+ )
+ )
+ )
+ [
+ handler (f.member (),
+ &SemanticAction::Member::end)
+ ]
+ >> assertion ("';' expected",
+ f.member (),
+ &SemanticAction::Member::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_member_end]
+ )
+ )[error_handler]
+ ;
+
+ // native
+ //
+ //
+ native_decl =
+ NATIVE
+ >> guard
+ (
+ assertion ("native name expected")
+ (
+ simple_identifier[act_native_name]
+ )
+ >> assertion ("';' expected",
+ f.native (),
+ &SemanticAction::Native::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_native_end]
+ )
+ )[error_handler]
+ ;
+
+
+ // operation
+ //
+ //
+ operation_decl =
+ guard
+ (
+ (
+ (
+ ONEWAY[act_operation_one_way]
+ >> assertion ("operation return type name expected")
+ (
+ identifier[act_operation_type]
+ )
+ )
+ |
+ (
+ identifier[act_operation_two_way][act_operation_type]
+ )
+ )
+ >> operation_decl_trailer
+ )[error_handler]
+ ;
+
+
+ operation_decl_trailer =
+ assertion ("operation name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier[act_operation_name]
+ )
+ >> assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> operation_parameter_list
+ >> assertion ("parameter declaration or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ >> !(
+ RAISES
+ >> assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> operation_raises_list
+ >> assertion ("',' or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ )
+ >> assertion ("';' expected",
+ RecoveryMethod::NONE)
+ (
+ SEMI
+ )
+ ;
+
+ operation_parameter_list =
+ *(
+ operation_parameter
+ >> *(
+ COMMA
+ >> assertion ("parameter declaration expected")
+ (
+ operation_parameter
+ )
+ )
+ )
+ ;
+
+ operation_parameter =
+ (
+ direction_specifier
+ >> assertion ("parameter type name expected")
+ (
+ identifier
+ )
+ >> assertion ("parameter name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier
+ )
+ )[act_operation_parameter]
+ ;
+
+ operation_raises_list =
+ assertion ("exception name expected")
+ (
+ identifier[act_operation_raises]
+ )
+ >> *(
+ COMMA
+ >> assertion ("exception name expected")
+ (
+ identifier[act_operation_raises]
+ )
+ )
+ ;
+
+
+ // struct
+ //
+ //
+ struct_decl =
+ STRUCT
+ >> guard
+ (
+ assertion ("struct declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_struct_begin_fwd][act_struct_end]
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_struct_begin_def][act_struct_open_scope]
+ >> hood
+ (
+ hood
+ (
+ assertion ("member declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ struct_body
+ )
+ )
+ [
+ handler (f.struct_ (),
+ &SemanticAction::Struct::close_scope)
+ ]
+ >> assertion ("member declaration or '}' expected",
+ f.struct_ (),
+ &SemanticAction::Struct::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_struct_close_scope]
+ )
+ )
+ [
+ handler (f.struct_ (),
+ &SemanticAction::Struct::end)
+ ]
+ >> assertion ("';' expected",
+ f.struct_ (),
+ &SemanticAction::Struct::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_struct_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ struct_body =
+ +member_decl
+ ;
+
+
+ // typedef
+ //
+ //
+
+ typedef_decl =
+ TYPEDEF[act_typedef_pre]
+ >> guard
+ (
+ assertion ("type name expected")
+ (
+ typedef_type_spec
+ )
+ >> typedef_declarator
+ >> *(COMMA >> typedef_declarator)
+ >> assertion ("';' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_typedef_end]
+ )
+ )[error_handler]
+ ;
+
+ typedef_declarator =
+ (
+ assertion ("typedef name expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ simple_identifier
+ )
+ >> !( LSBRACE[act_typedef_begin_array][act_const_expr_flush]
+ >> assertion ("const expression expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ numeric_const_expr[act_typedef_bound]
+ )
+ >> assertion ("']' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ RSBRACE
+ )
+ )
+ >> *( LSBRACE[act_const_expr_flush]
+ >> assertion ("const expression expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ numeric_const_expr[act_typedef_bound]
+ )
+ >> assertion ("']' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ RSBRACE
+ )
+ )
+ )[act_typedef_declarator]
+ ;
+
+ typedef_type_spec =
+ identifier[act_typedef_begin]
+ |
+ (
+ SEQUENCE
+ >> assertion ("'<' expected")
+ (
+ LT
+ )
+ >> (
+ (identifier >> GT)[act_typedef_begin_unbounded_seq]
+ |
+ (
+ assertion ("sequence type name expected")
+ (
+ identifier[act_typedef_begin_bounded_seq]
+ )
+ >> assertion ("'>' or ',' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ COMMA[act_const_expr_flush] // flush expression stacks
+ )
+ >> assertion ("const expression expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ numeric_const_expr[act_typedef_bound]
+ )
+ >> assertion ("'>' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ GT
+ )
+ )
+ )
+ )
+ |
+ (
+ STRING
+ >> assertion ("'<' expected")
+ (
+ LT[act_const_expr_flush] // flush expression stacks
+ )
+ >> assertion ("const expression expected")
+ (
+ numeric_const_expr[act_typedef_begin_bounded_string]
+ )
+ >> assertion ("'>' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ GT
+ )
+ )
+ |
+ (
+ WSTRING
+ >> assertion ("'<' expected")
+ (
+ LT[act_const_expr_flush] // flush expression stacks
+ )
+ >> assertion ("const expression expected")
+ (
+ numeric_const_expr[act_typedef_begin_bounded_wstring]
+ )
+ >> assertion ("'>' expected",
+ f.typedef_ (),
+ &SemanticAction::Typedef::end)
+ (
+ GT
+ )
+ )
+ ;
+
+ // union
+ //
+ //
+
+ union_decl =
+ UNION
+ >> guard
+ (
+ assertion ("union declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_union_begin_fwd][act_union_end]
+ |
+ (
+ (
+ simple_identifier
+ >> SWITCH
+ )[act_union_begin_def]
+
+ >> hood (union_def_trailer)
+ [
+ handler (f.union_ (),
+ &SemanticAction::Union::end)
+ ]
+ >> assertion ("';' expected",
+ f.union_ (),
+ &SemanticAction::Union::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_union_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ union_def_trailer =
+ assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> assertion ("discriminator type name expected")
+ (
+ identifier[act_union_type]
+ )
+ >> assertion ("')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_union_open_scope]
+ )
+ >> hood
+ (
+ assertion ("case statement expected")
+ (
+ union_body
+ )
+ )
+ [
+ handler (f.union_ (),
+ &SemanticAction::Union::close_scope)
+ ]
+ >> assertion ("case statement or \'}\' expected",
+ f.union_ (),
+ &SemanticAction::Union::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_union_close_scope]
+ )
+ ;
+
+
+ union_body =
+ +guard
+ (
+ +union_case_label
+ >> assertion ("type name expected",
+ DiagnosticType::BEFORE)
+ (
+ identifier[act_union_member_type]
+ )
+ >> assertion ("member name expected")
+ (
+ simple_identifier[act_union_member_name]
+ )
+ >> assertion ("';' expected",
+ RecoveryMethod::NONE)
+ (
+ SEMI
+ )
+ )[error_handler]
+ ;
+
+ union_case_label =
+ (
+ CASE[act_const_expr_flush] // flush expression stacks
+ >> assertion ("const expression expected")
+ (
+ const_expr
+ )
+ >> assertion ("':' expected")
+ (
+ COLON
+ )
+ )
+ |
+ ( DEFAULT
+ >> assertion ("':' expected")
+ (
+ COLON
+ )
+ )
+ ;
+
+
+ // valuetype
+ //
+ //
+ abstract_value_type_decl =
+ guard
+ (
+ assertion ("abstract valuetype declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_value_type_begin_abstract_fwd][act_value_type_end]
+ |
+ (
+ (
+ simple_identifier
+ >> COLON
+ )[act_value_type_begin_abstract_def]
+
+ >> hood
+ (
+ value_type_inheritance_spec
+ >> !(SUPPORTS >> value_type_supports_spec)
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_value_type_open_scope]
+ )
+ >> hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> SUPPORTS
+ )[act_value_type_begin_abstract_def]
+
+ >> hood
+ (
+ value_type_supports_spec
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_value_type_open_scope]
+ )
+ >> hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_value_type_begin_abstract_def][act_value_type_open_scope]
+
+ >> hood
+ (
+ hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+
+ concrete_value_type_decl =
+ VALUETYPE
+ >> guard
+ (
+ assertion ("valuetype declaration expected",
+ DiagnosticType::BEFORE)
+ (
+ (
+ simple_identifier
+ >> SEMI
+ )[act_value_type_begin_concrete_fwd][act_value_type_end]
+ |
+ (
+ (
+ simple_identifier
+ >> COLON
+ )[act_value_type_begin_concrete_def]
+
+ >> hood
+ (
+ value_type_inheritance_spec
+ >> !(SUPPORTS >> value_type_supports_spec)
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_value_type_open_scope]
+ )
+ >> hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> SUPPORTS
+ )[act_value_type_begin_concrete_def]
+
+ >> hood
+ (
+ value_type_supports_spec
+ >> assertion ("'{' expected")
+ (
+ LCBRACE[act_value_type_open_scope]
+ )
+ >> hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ |
+ (
+ (
+ simple_identifier
+ >> LCBRACE
+ )[act_value_type_begin_concrete_def][act_value_type_open_scope]
+
+ >> hood
+ (
+ hood (value_type_body)
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::close_scope)
+ ]
+ >> assertion ("declaration or '}' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::close_scope,
+ DiagnosticType::BEFORE)
+ (
+ RCBRACE[act_value_type_close_scope]
+ )
+ )
+ [
+ handler (f.value_type (),
+ &SemanticAction::ValueType::end)
+ ]
+
+ >> assertion ("';' expected",
+ f.value_type (),
+ &SemanticAction::ValueType::end,
+ RecoveryMethod::NONE)
+ (
+ SEMI[act_value_type_end]
+ )
+ )
+ )
+ )[error_handler]
+ ;
+
+ value_type_inheritance_spec =
+ guard
+ (
+ assertion ("base valuetype name expected")
+ (
+ identifier[act_value_type_inherits]
+ )
+ >> *(
+ COMMA
+ >> assertion ("base valuetype name expected")
+ (
+ identifier[act_value_type_inherits]
+ )
+ )
+ )[error_handler]
+ ;
+
+ value_type_supports_spec =
+ guard
+ (
+ assertion ("supported interface name expected")
+ (
+ identifier[act_value_type_supports]
+ )
+ >> *(
+ COMMA
+ >> assertion ("supported interface name expected")
+ (
+ identifier[act_value_type_supports]
+ )
+ )
+ )[error_handler]
+ ;
+
+ value_type_body =
+ *(
+ const_decl
+ | type_decl
+ | type_id_decl
+ | type_prefix_decl
+
+ | attribute_decl
+ | operation_decl
+ | value_type_member_decl
+ | value_type_factory_decl
+ )
+ ;
+
+
+ // valuetype factory
+ //
+ //
+ value_type_factory_decl =
+ FACTORY
+ >> guard
+ (
+ assertion ("factory name expected")
+ (
+ simple_identifier[act_value_type_factory_name]
+ )
+ >> assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> value_type_factory_parameter_list
+ >> assertion ("parameter declaration or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ >> !(
+ RAISES
+ >> assertion ("'(' expected")
+ (
+ LPAREN
+ )
+ >> value_type_factory_raises_list
+ >> assertion ("',' or ')' expected",
+ DiagnosticType::BEFORE)
+ (
+ RPAREN
+ )
+ )
+ >> assertion ("';' expected",
+ RecoveryMethod::NONE)
+ (
+ SEMI
+ )
+ )[error_handler]
+ ;
+
+ value_type_factory_parameter_list =
+ *(
+ value_type_factory_parameter
+ >> *(COMMA >> value_type_factory_parameter)
+ )
+ ;
+
+ value_type_factory_parameter =
+ IN
+ >> guard
+ (
+ (
+ assertion ("type name expected")
+ (
+ identifier
+ )
+ >> assertion ("parameter name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier
+ )
+ )[act_value_type_factory_parameter]
+ )[error_handler]
+ ;
+
+ value_type_factory_raises_list =
+ guard
+ (
+ assertion ("exception name expected")
+ (
+ identifier[act_value_type_factory_raises]
+ )
+ >> *(
+ COMMA
+ >> assertion ("exception name expected")
+ (
+ identifier[act_value_type_factory_raises]
+ )
+ )
+ )[error_handler]
+ ;
+
+
+ // valuetype member
+ //
+ //
+ value_type_member_decl =
+ (
+ PUBLIC[act_value_type_member_begin_public]
+ | PRIVATE[act_value_type_member_begin_private]
+ )
+ >> guard
+ (
+ assertion ("type name expected")
+ (
+ identifier[act_value_type_member_type]
+ )
+ >> assertion ("member name expected",
+ DiagnosticType::BEFORE)
+ (
+ simple_identifier[act_value_type_member_name]
+ )
+ >> *(
+ COMMA
+ >> assertion ("member name expected")
+ (
+ simple_identifier[act_value_type_member_name]
+ )
+ )
+ >> assertion ("';' expected",
+ RecoveryMethod::NONE)
+ (
+ SEMI
+ )
+ )[error_handler]
+ ;
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Parser.hpp b/CIAO/CCF/CCF/IDL2/Parser.hpp
new file mode 100644
index 00000000000..2a6e6b92b01
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Parser.hpp
@@ -0,0 +1,872 @@
+// file : CCF/IDL2/Parser.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_PARSER_HPP
+#define CCF_IDL2_PARSER_HPP
+
+#include "CCF/CompilerElements/Context.hpp"
+#include "CCF/CompilerElements/Diagnostic.hpp"
+#include "CCF/CompilerElements/FileSystem.hpp"
+
+#include "CCF/IDL2/SemanticAction.hpp"
+#include "CCF/IDL2/LexicalAnalyzer.hpp"
+
+#include "CCF/IDL2/Parsing/Elements.hpp"
+#include "CCF/IDL2/Parsing/Action.hpp"
+#include "CCF/IDL2/Parsing/Recovery.hpp"
+
+// #$%^ing MS.
+//
+#ifdef CONST
+#undef CONST
+#undef FACTORY
+#undef IN
+#undef OUT
+#endif
+
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ using Parsing::ActionExecutor;
+ using Parsing::NoArgAction;
+ using Parsing::OneArgAction;
+ using Parsing::TwoArgAction;
+
+ class Parser
+ {
+ public:
+ virtual
+ ~Parser ();
+
+ protected:
+ Diagnostic::Stream& dout_;
+ LexicalAnalyzer const& lexer_;
+ SemanticAction::Factory& actions_;
+
+ protected:
+ typedef
+ Parsing::Iterator
+ Iterator;
+
+ //
+ // Primitives
+ //
+
+ typedef
+ Parsing::EndOfStreamParser
+ EndOfStreamParser;
+
+ typedef
+ Parsing::KeywordParser
+ KeywordParser;
+
+ typedef
+ Parsing::PunctuationParser
+ PunctuationParser;
+
+ typedef
+ Parsing::OperatorParser
+ OperatorParser;
+
+ typedef
+ Parsing::IdentifierParser
+ IdentifierParser;
+
+ typedef
+ Parsing::SimpleIdentifierParser
+ SimpleIdentifierParser;
+
+
+ typedef
+ Parsing::RecoveryDescriptor
+ RecoveryDescriptor;
+
+ typedef
+ Parsing::Assertion
+ Assertion;
+
+ typedef
+ Parsing::RecoveryStatus
+ RecoveryStatus;
+
+ typedef
+ Parsing::Guard
+ Guard;
+
+ //@@ names are not thought out weel for error handling
+
+ struct ErrorHandler
+ {
+ ErrorHandler (CompilerElements::Context& context,
+ Diagnostic::Stream& dout)
+ : dout_ (dout),
+ context_ (context)
+ {
+ }
+
+ RecoveryStatus
+ operator() (Parsing::Scanner const& s, Parsing::Error e) const
+ {
+ Iterator i = e.where;
+
+ switch (e.descriptor->diagnostic_)
+ {
+ case Parsing::DiagnosticType::BEFORE:
+ {
+ Diagnostic::Error rec (
+ context_.get<fs::path> ("file-path").native_file_string (),
+ (*i)->line ());
+
+ rec << "before \'" << (*i)->lexeme () << "\': "
+ << e.descriptor->description_;
+
+ dout_ << rec;
+ break;
+ }
+ case Parsing::DiagnosticType::AFTER:
+ {
+ i--;
+
+ Diagnostic::Error rec (
+ context_.get<fs::path> ("file-path").native_file_string (),
+ (*i)->line ());
+
+ rec << "after \'" << (*i)->lexeme () << "\': "
+ << e.descriptor->description_;
+
+ dout_ << rec;
+ break;
+ }
+ case Parsing::DiagnosticType::NONE:
+ {
+ }
+ }
+
+ if (e.descriptor->action_one_.get ())
+ e.descriptor->action_one_->execute ();
+
+ if (e.descriptor->action_two_.get ())
+ e.descriptor->action_two_->execute ();
+
+ switch (e.descriptor->recovery_)
+ {
+ case Parsing::RecoveryMethod::STANDARD:
+ {
+ unsigned long balance = 0;
+
+ for (Iterator t = e.where; t != s.last; t++)
+ {
+ //std::cerr << "error recovery: skipping " << (*t)->lexeme ()
+ // << std::endl;
+
+ if ((*t)->lexeme () == "{") balance++;
+ else if ((*t)->lexeme () == "}")
+ {
+ if (balance > 0) balance--;
+ else
+ {
+ t++;
+ if ((*t)->lexeme () == ";") t++;
+
+ int length = t - s.first;
+ s.first += length;
+ return RecoveryStatus (RecoveryStatus::accept, length);
+ }
+ }
+
+ if (balance == 0 && (*t)->lexeme () == ";")
+ {
+ int length = t - s.first + 1;
+ s.first += length;
+ return RecoveryStatus (RecoveryStatus::accept, length);
+ }
+ }
+
+ switch (e.descriptor->diagnostic_)
+ {
+ case Parsing::DiagnosticType::BEFORE:
+ {
+ Diagnostic::Error rec (
+ context_.get<fs::path> ("file-path").native_file_string (),
+ (*i)->line ());
+
+ rec << "before \'" << (*i)->lexeme () << "\': "
+ << "unable to recover from previous error: bailing out";
+
+ dout_ << rec;
+ break;
+ }
+ case Parsing::DiagnosticType::AFTER:
+ {
+ Diagnostic::Error rec (
+ context_.get<fs::path> ("file-path").native_file_string (),
+ (*i)->line ());
+
+ rec << "after \'" << (*i)->lexeme () << "\': "
+ << "unable to recover from previous error: bailing out";
+
+ dout_ << rec;
+ break;
+ }
+ case Parsing::DiagnosticType::NONE:
+ {
+ }
+ }
+
+ e.descriptor->recovery_ = Parsing::RecoveryMethod::BAIL_OUT;
+ e.descriptor->diagnostic_ = Parsing::DiagnosticType::NONE;
+
+ e.descriptor->action_one_.reset ();
+ e.descriptor->action_two_.reset ();
+
+ // return RecoveryStatus (RecoveryStatus::rethrow);
+ throw e;
+ }
+ case Parsing::RecoveryMethod::NONE:
+ default:
+ {
+ int length = e.where - s.first;
+ s.first += length;
+ return RecoveryStatus (RecoveryStatus::accept, length);
+ }
+ case Parsing::RecoveryMethod::BAIL_OUT:
+ {
+ e.descriptor->recovery_ = Parsing::RecoveryMethod::BAIL_OUT;
+ e.descriptor->diagnostic_ = Parsing::DiagnosticType::NONE;
+
+ e.descriptor->action_one_.reset ();
+ e.descriptor->action_two_.reset ();
+
+ // return RecoveryStatus (RecoveryStatus::rethrow);
+ throw e;
+ }
+ }
+ }
+
+ Diagnostic::Stream& dout_;
+ CompilerElements::Context& context_;
+ };
+
+ struct RootErrorHandler
+ {
+ RecoveryStatus
+ operator() (Parsing::Scanner const&, Parsing::Error&) const
+ {
+ return RecoveryStatus (RecoveryStatus::fail);
+ }
+ };
+
+ struct handler
+ {
+ template<typename Object>
+ handler (Object& obj,
+ void (Object::*action_one)())
+ : action_one_ (Parsing::call_thunk (obj, action_one)),
+ action_two_ (0)
+ {
+ }
+
+ template<typename Object>
+ handler (Object& obj,
+ void (Object::*action_one)(),
+ void (Object::*action_two)())
+ : action_one_ (Parsing::call_thunk (obj, action_one)),
+ action_two_ (Parsing::call_thunk (obj, action_two))
+ {
+ }
+
+ handler (handler const& h)
+ : action_one_ (h.action_one_.get () ? h.action_one_->clone () : 0),
+ action_two_ (h.action_two_.get () ? h.action_two_->clone () : 0)
+ {
+ }
+
+ RecoveryStatus
+ operator() (Parsing::Scanner const&, Parsing::Error e) const
+ {
+ /*
+ assert (
+ e.descriptor->diagnostic_ == Parsing::DiagnosticType::NONE &&
+ e.descriptor->recovery_ == Parsing::RecoveryMethod::BAIL_OUT
+ );
+ */
+
+ if (action_one_.get ()) action_one_->execute ();
+ if (action_two_.get ()) action_two_->execute ();
+
+ // return RecoveryStatus (RecoveryStatus::rethrow);
+ throw e;
+ }
+
+ std::auto_ptr<Parsing::Thunk> action_one_;
+ std::auto_ptr<Parsing::Thunk> action_two_;
+ };
+
+ Guard guard;
+ Guard hood;
+ Assertion assertion;
+ ErrorHandler error_handler;
+ RootErrorHandler root_error_handler;
+
+ // End of stream parser.
+ //
+ EndOfStreamParser EOS;
+
+ // Keyword parsers (alphabetic order).
+ //
+ KeywordParser ABSTRACT;
+ KeywordParser ATTRIBUTE;
+ KeywordParser BINCLUDE;
+ KeywordParser CASE;
+ KeywordParser CONST;
+ KeywordParser CUSTOM;
+ KeywordParser DEFAULT;
+ KeywordParser ENUM;
+ KeywordParser EXCEPTION;
+ KeywordParser FACTORY;
+ KeywordParser GETRAISES;
+ KeywordParser IN;
+ KeywordParser INOUT;
+ KeywordParser INTERFACE;
+ KeywordParser QINCLUDE;
+ KeywordParser LOCAL;
+ KeywordParser MODULE;
+ KeywordParser NATIVE;
+ KeywordParser ONEWAY;
+ KeywordParser OUT;
+ KeywordParser PRIVATE;
+ KeywordParser PUBLIC;
+ KeywordParser RAISES;
+ KeywordParser READONLY;
+ KeywordParser SEQUENCE;
+ KeywordParser SETRAISES;
+ KeywordParser STRING;
+ KeywordParser STRUCT;
+ KeywordParser SUPPORTS;
+ KeywordParser SWITCH;
+ KeywordParser TRUNCATABLE;
+ KeywordParser TYPEDEF;
+ KeywordParser TYPEID;
+ KeywordParser TYPEPREFIX;
+ KeywordParser UNION;
+ KeywordParser VALUETYPE;
+ KeywordParser WSTRING;
+
+ // Punctuation parsers (alphabetic group order).
+ //
+ PunctuationParser COLON;
+ PunctuationParser COMMA;
+ PunctuationParser LCBRACE;
+ PunctuationParser RCBRACE;
+ PunctuationParser LSBRACE;
+ PunctuationParser RSBRACE;
+ PunctuationParser LPAREN;
+ PunctuationParser RPAREN;
+ PunctuationParser LT;
+ PunctuationParser GT;
+ PunctuationParser SEMI;
+
+ OperatorParser ADD;
+ OperatorParser AND;
+ OperatorParser COM;
+ OperatorParser DIV;
+ OperatorParser EQ;
+ OperatorParser LSH;
+ OperatorParser MUL;
+ OperatorParser OR;
+ OperatorParser REM;
+ OperatorParser SUB;
+ OperatorParser RSH;
+ OperatorParser XOR;
+
+
+ IdentifierParser identifier;
+ SimpleIdentifierParser simple_identifier;
+
+ Parsing::BooleanLiteralParser boolean_literal;
+ Parsing::CharacterLiteralParser character_literal;
+ Parsing::IntegerLiteralParser integer_literal;
+ Parsing::StringLiteralParser string_literal;
+
+ //
+ // Language
+ //
+ typedef
+ Parsing::Rule
+ Rule;
+
+ Rule language;
+ Rule import;
+ Rule declaration;
+ Rule extension;
+
+ Rule include_decl;
+
+ Rule type_decl;
+
+ Rule module_decl;
+
+ Rule const_decl;
+ Rule const_expr;
+
+ Rule enum_decl;
+ Rule enumerator_decl;
+
+ Rule boolean_const_expr;
+ Rule character_const_expr;
+ Rule numeric_const_expr;
+
+ Rule numeric_or_expr;
+ Rule numeric_xor_expr;
+ Rule numeric_and_expr;
+ Rule numeric_shift_expr;
+ Rule numeric_add_expr;
+ Rule numeric_mul_expr;
+ Rule numeric_unary_expr;
+ Rule numeric_primary_expr;
+
+ Rule string_const_expr;
+
+ Rule abstract_type_decl;
+ Rule local_type_decl;
+
+ Rule abstract_interface_decl;
+ Rule local_interface_decl;
+ Rule unconstrained_interface_decl;
+ Rule interface_inheritance_spec;
+ Rule interface_body;
+
+ Rule attribute_decl;
+ Rule attribute_ro_decl_trailer;
+ Rule attribute_rw_decl_trailer;
+ Rule attribute_ro_raises_spec;
+ Rule attribute_rw_raises_spec;
+ Rule attribute_get_raises_list;
+ Rule attribute_set_raises_list;
+
+ Rule exception_decl;
+ Rule exception_body;
+
+ Rule direction_specifier;
+
+ Rule member_decl;
+
+ Rule native_decl;
+
+ Rule operation_decl;
+ Rule operation_decl_trailer;
+ Rule operation_parameter_list;
+ Rule operation_parameter;
+ Rule operation_raises_list;
+
+ Rule struct_decl;
+ Rule struct_body;
+
+ Rule typedef_decl;
+ Rule typedef_declarator;
+ Rule typedef_type_spec;
+
+ Rule type_id_decl;
+ Rule type_prefix_decl;
+
+ Rule union_decl;
+ Rule union_def_trailer;
+ Rule union_body;
+ Rule union_case_label;
+
+ Rule abstract_value_type_decl;
+ Rule concrete_value_type_decl;
+ Rule value_type_inheritance_spec;
+ Rule value_type_supports_spec;
+ Rule value_type_body;
+
+ Rule value_type_factory_decl;
+ Rule value_type_factory_parameter_list;
+ Rule value_type_factory_parameter;
+ Rule value_type_factory_raises_list;
+
+ Rule value_type_member_decl;
+ public:
+ Parser (CompilerElements::Context& context,
+ Diagnostic::Stream& dout,
+ LexicalAnalyzer const& l,
+ SemanticAction::Factory& f);
+
+ virtual Rule const&
+ start() const
+ {
+ return language;
+ }
+
+ protected:
+
+ //
+ // Semantic actions
+ //
+ typedef
+ NoArgAction<SemanticAction::Scope>
+ ScopeAction;
+
+
+ // Attribute
+ //
+ //
+ NoArgAction<SemanticAction::Attribute>
+ act_attribute_begin_ro, act_attribute_begin_rw;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Attribute>
+ act_attribute_type;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Attribute>
+ act_attribute_name;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Attribute>
+ act_attribute_get_raises;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Attribute>
+ act_attribute_set_raises;
+
+ NoArgAction<SemanticAction::Attribute>
+ act_attribute_end;
+
+ // Const
+ //
+ TwoArgAction<IdentifierPtr, SimpleIdentifierPtr, SemanticAction::Const>
+ act_const_begin;
+
+ NoArgAction<SemanticAction::Const>
+ act_const_expr;
+
+
+ // Enum
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Enum>
+ act_enum_begin, act_enum_enumerator;
+
+ NoArgAction<SemanticAction::Enum>
+ act_enum_end;
+
+ // Expression
+ //
+ NoArgAction<SemanticAction::NumericExpression>
+ act_const_expr_flush;
+
+ OneArgAction<IdentifierPtr, SemanticAction::NumericExpression>
+ act_numeric_expression_const;
+
+ OneArgAction<IntegerLiteralPtr, SemanticAction::NumericExpression>
+ act_numeric_expression_integer_literal;
+
+ OneArgAction<OperatorPtr, SemanticAction::NumericExpression>
+ act_numeric_expression_pre;
+
+ NoArgAction<SemanticAction::NumericExpression>
+ act_numeric_expression_pos,
+ act_numeric_expression_neg,
+ act_numeric_expression_com,
+ act_numeric_expression_mul,
+ act_numeric_expression_div,
+ act_numeric_expression_rem,
+ act_numeric_expression_add,
+ act_numeric_expression_sub,
+ act_numeric_expression_rsh,
+ act_numeric_expression_lsh,
+ act_numeric_expression_and,
+ act_numeric_expression_xor,
+ act_numeric_expression_or;
+
+
+ // Exception
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Exception>
+ act_exception_begin;
+
+ ScopeAction
+ act_exception_open_scope;
+
+ ScopeAction
+ act_exception_close_scope;
+
+ NoArgAction<SemanticAction::Exception>
+ act_exception_end;
+
+
+ // Include
+ //
+ //
+ OneArgAction<StringLiteralPtr, SemanticAction::Include>
+ act_include_quote, act_include_bracket;
+
+ NoArgAction<SemanticAction::Include>
+ act_include_end;
+
+ // Interface
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Interface>
+ act_interface_begin_abstract_def,
+ act_interface_begin_abstract_fwd,
+ act_interface_begin_local_def,
+ act_interface_begin_local_fwd,
+ act_interface_begin_unconstrained_def,
+ act_interface_begin_unconstrained_fwd;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Interface>
+ act_interface_inherits;
+
+ ScopeAction
+ act_interface_open_scope;
+
+ ScopeAction
+ act_interface_close_scope;
+
+ NoArgAction<SemanticAction::Interface>
+ act_interface_end;
+
+
+ // Member
+ //
+ //
+ OneArgAction<IdentifierPtr, SemanticAction::Member>
+ act_member_type;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Member>
+ act_member_name;
+
+ NoArgAction<SemanticAction::Member>
+ act_member_end;
+
+
+ // Module
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Module>
+ act_module_begin;
+
+ ScopeAction
+ act_module_open_scope;
+
+ ScopeAction
+ act_module_close_scope;
+
+ NoArgAction<SemanticAction::Module>
+ act_module_end;
+
+ // Native
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Native>
+ act_native_name;
+
+ NoArgAction<SemanticAction::Native>
+ act_native_end;
+
+
+ // Operation
+ //
+ //
+ NoArgAction<SemanticAction::Operation>
+ act_operation_one_way, act_operation_two_way;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Operation>
+ act_operation_type;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Operation>
+ act_operation_name;
+
+ void
+ act_operation_parameter_core (Iterator begin, Iterator) const
+ {
+ SemanticAction::Operation::Direction::Value d;
+
+ if((*begin)->lexeme () == "in")
+ {
+ d = SemanticAction::Operation::Direction::in;
+ }
+ else if((*begin)->lexeme () == "out")
+ {
+ d = SemanticAction::Operation::Direction::out;
+ }
+ else
+ {
+ d = SemanticAction::Operation::Direction::inout;
+ }
+
+ begin++;
+
+ actions_.operation ().parameter (
+ d,
+ ReferenceCounting::strict_cast<Identifier>(*begin),
+ ReferenceCounting::strict_cast<SimpleIdentifier>(*(begin + 1)));
+ }
+
+ ActionExecutor<Parser>
+ act_operation_parameter;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Operation>
+ act_operation_raises;
+
+
+ // Struct
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Struct>
+ act_struct_begin_def;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Struct>
+ act_struct_begin_fwd;
+
+ ScopeAction
+ act_struct_open_scope;
+
+ ScopeAction
+ act_struct_close_scope;
+
+ NoArgAction<SemanticAction::Struct>
+ act_struct_end;
+
+
+ // Typedef
+ //
+ //
+ OneArgAction<KeywordPtr, SemanticAction::Typedef>
+ act_typedef_pre;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Typedef>
+ act_typedef_begin;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Typedef>
+ act_typedef_begin_unbounded_seq;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Typedef>
+ act_typedef_begin_bounded_seq;
+
+ NoArgAction<SemanticAction::Typedef>
+ act_typedef_begin_bounded_string;
+
+ NoArgAction<SemanticAction::Typedef>
+ act_typedef_begin_bounded_wstring;
+
+ NoArgAction<SemanticAction::Typedef>
+ act_typedef_begin_array;
+
+ NoArgAction<SemanticAction::Typedef>
+ act_typedef_bound;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Typedef>
+ act_typedef_declarator;
+
+ NoArgAction<SemanticAction::Typedef>
+ act_typedef_end;
+
+
+ // TypeId
+ //
+ //
+ TwoArgAction<IdentifierPtr,
+ StringLiteralPtr,
+ SemanticAction::TypeId>
+ act_type_id_begin;
+
+ NoArgAction<SemanticAction::TypeId>
+ act_type_id_end;
+
+
+ // TypePrefix
+ //
+ //
+ TwoArgAction<IdentifierPtr,
+ StringLiteralPtr,
+ SemanticAction::TypePrefix>
+ act_type_prefix_begin;
+
+ NoArgAction<SemanticAction::TypePrefix>
+ act_type_prefix_end;
+
+ // Union
+ //
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Union>
+ act_union_begin_def, act_union_begin_fwd;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Union>
+ act_union_type;
+
+ ScopeAction
+ act_union_open_scope;
+
+ OneArgAction<IdentifierPtr, SemanticAction::Union>
+ act_union_member_type;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::Union>
+ act_union_member_name;
+
+ ScopeAction
+ act_union_close_scope;
+
+ NoArgAction<SemanticAction::Union>
+ act_union_end;
+
+
+ // ValueType
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::ValueType>
+ act_value_type_begin_abstract_def,
+ act_value_type_begin_abstract_fwd,
+ act_value_type_begin_concrete_def,
+ act_value_type_begin_concrete_fwd;
+
+ OneArgAction<IdentifierPtr, SemanticAction::ValueType>
+ act_value_type_inherits, act_value_type_supports;
+
+ ScopeAction
+ act_value_type_open_scope;
+
+ ScopeAction
+ act_value_type_close_scope;
+
+ NoArgAction<SemanticAction::ValueType>
+ act_value_type_end;
+
+
+ // ValueTypeFactory
+ //
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::ValueTypeFactory>
+ act_value_type_factory_name;
+
+ TwoArgAction<IdentifierPtr,
+ SimpleIdentifierPtr,
+ SemanticAction::ValueTypeFactory>
+ act_value_type_factory_parameter;
+
+ OneArgAction<IdentifierPtr, SemanticAction::ValueTypeFactory>
+ act_value_type_factory_raises;
+
+
+ // ValueTypeMember
+ //
+ NoArgAction<SemanticAction::ValueTypeMember>
+ act_value_type_member_begin_private;
+
+ NoArgAction<SemanticAction::ValueTypeMember>
+ act_value_type_member_begin_public;
+
+ OneArgAction<IdentifierPtr, SemanticAction::ValueTypeMember>
+ act_value_type_member_type;
+
+ OneArgAction<SimpleIdentifierPtr, SemanticAction::ValueTypeMember>
+ act_value_type_member_name;
+
+ NoArgAction<SemanticAction::ValueTypeMember>
+ act_value_type_member_end;
+
+ };
+ }
+}
+
+#endif // CCF_IDL2_PARSER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Parsing/Action.hpp b/CIAO/CCF/CCF/IDL2/Parsing/Action.hpp
new file mode 100644
index 00000000000..2737abafb58
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Parsing/Action.hpp
@@ -0,0 +1,142 @@
+// file : CCF/IDL2/Parsing/Action.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_PARSING_ACTION_HPP
+#define CCF_IDL2_PARSING_ACTION_HPP
+
+#include "CCF/IDL2/Parsing/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Parsing
+ {
+ //
+ //
+ //
+ template <typename Obj>
+ class ActionExecutor
+ {
+ public:
+
+ typedef
+ void (Obj::*SemanticAction)(Iterator, Iterator) const;
+
+ ActionExecutor (Obj const* obj, SemanticAction action)
+ : obj_ (obj), action_ (action)
+ {
+ }
+
+ void operator () (Iterator begin, Iterator end) const
+ {
+ (obj_->*action_) (begin, end);
+ }
+
+ private:
+ Obj const* obj_;
+ SemanticAction action_;
+ };
+
+
+ //
+ //
+ //
+ template <typename Obj>
+ class NoArgAction
+ {
+ public:
+
+ typedef
+ void (Obj::*Action)();
+
+ NoArgAction (Obj& obj, Action action)
+ : obj_ (obj), action_ (action)
+ {
+ }
+
+ void operator () (Iterator, Iterator) const
+ {
+ (obj_.*action_) ();
+ }
+
+ private:
+ Obj& obj_;
+ Action action_;
+ };
+
+
+ //@@ Should prbably use Type instead of TypePtr
+ //
+ //
+ //
+ template <typename TypePtr, typename Obj>
+ class OneArgAction
+ {
+ public:
+
+ typedef
+ void (Obj::*Action)(TypePtr const&);
+
+ OneArgAction (Obj& obj, Action action)
+ : obj_ (obj), action_ (action)
+ {
+ }
+
+ void operator () (Iterator begin, Iterator end) const
+ {
+ if (end - begin != 1 )
+ {
+ //@@ throw
+ }
+
+ //@@ error handling if the strict_cast fails
+ (obj_.*action_) (
+ ReferenceCounting::strict_cast<typename TypePtr::Type> (*begin));
+ }
+
+ private:
+ Obj& obj_;
+ Action action_;
+ };
+
+
+ //
+ //
+ //
+ template <typename Arg1, typename Arg2, typename Obj>
+ class TwoArgAction
+ {
+ public:
+
+ typedef
+ void (Obj::*Action)(Arg1 const&, Arg2 const&);
+
+ TwoArgAction (Obj& obj, Action action)
+ : obj_ (obj), action_ (action)
+ {
+ }
+
+ void operator () (Iterator begin, Iterator end) const
+ {
+ if (end - begin != 2 )
+ {
+ //@@ throw
+ }
+
+ //@@ error handling if strict_cast fails
+ (obj_.*action_) (
+ ReferenceCounting::strict_cast<typename Arg1::Type> (*begin),
+ ReferenceCounting::strict_cast<typename Arg2::Type> (*(begin + 1)));
+ }
+
+ private:
+ Obj& obj_;
+ Action action_;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_PARSING_ACTION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Parsing/Elements.hpp b/CIAO/CCF/CCF/IDL2/Parsing/Elements.hpp
new file mode 100644
index 00000000000..88e091d8845
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Parsing/Elements.hpp
@@ -0,0 +1,168 @@
+// file : CCF/IDL2/Parsing/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_PARSING_ELEMENTS_HPP
+#define CCF_IDL2_PARSING_ELEMENTS_HPP
+
+#include <string>
+
+#include <boost/spirit.hpp>
+
+#include "CCF/IDL2/Token.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Parsing
+ {
+ using namespace boost::spirit;
+
+ typedef
+ TokenList::iterator
+ Iterator;
+
+ typedef
+ scanner<Iterator, scanner_policies<> >
+ Scanner;
+
+ typedef
+ rule<Scanner>
+ Rule;
+
+
+ //
+ //
+ //
+ template <typename Type>
+ struct IdentityParser : public parser <IdentityParser<Type> >
+ {
+ typedef
+ IdentityParser
+ self_t;
+
+ IdentityParser (std::string lexeme)
+ : lexeme_ (lexeme)
+ {
+ }
+
+ typename parser_result<self_t, Scanner>::type
+ parse(Scanner const& scan) const
+ {
+ if (!scan.at_end())
+ {
+ TokenPtr t = *scan;
+
+ if(ReferenceCounting::strict_cast<Type> (t) != 0 &&
+ lexeme_ == t->lexeme ())
+ {
+ Iterator save(scan.first);
+ ++scan;
+ return scan.create_match(1, t, save, scan.first);
+ }
+ }
+ return scan.no_match();
+ }
+
+ private:
+ std::string lexeme_;
+ };
+
+ typedef
+ IdentityParser<Keyword>
+ KeywordParser;
+
+ typedef
+ IdentityParser<Punctuation>
+ PunctuationParser;
+
+ typedef
+ IdentityParser<Operator>
+ OperatorParser;
+
+ //
+ //
+ //
+ template <typename Type>
+ struct TypeParser : public parser <TypeParser<Type> >
+ {
+ typedef
+ TypeParser
+ self_t;
+
+ typename parser_result<self_t, Scanner>::type
+ parse(Scanner const& scan) const
+ {
+ if (!scan.at_end())
+ {
+ TokenPtr t = *scan;
+
+ if(ReferenceCounting::strict_cast<Type> (t) != 0)
+ {
+ Iterator save(scan.first);
+ ++scan;
+ return scan.create_match(1, t, save, scan.first);
+ }
+ }
+ return scan.no_match();
+ }
+ };
+
+ typedef
+ TypeParser<EndOfStream>
+ EndOfStreamParser;
+
+ typedef
+ TypeParser<Identifier>
+ IdentifierParser;
+
+ typedef
+ TypeParser<SimpleIdentifier>
+ SimpleIdentifierParser;
+
+ typedef
+ TypeParser<ScopedIdentifier>
+ ScopedIdentifierParser;
+
+ // Literal parsers.
+ //
+
+ typedef
+ TypeParser<BooleanLiteral>
+ BooleanLiteralParser;
+
+ typedef
+ TypeParser<CharacterLiteral>
+ CharacterLiteralParser;
+
+ typedef
+ TypeParser<IntegerLiteral>
+ IntegerLiteralParser;
+
+ typedef
+ TypeParser<StringLiteral>
+ StringLiteralParser;
+
+ //
+ //
+ //
+ inline bool
+ parse (Iterator const& first_,
+ Iterator const& last,
+ Rule const& rule)
+ {
+ Iterator first = first_;
+ Scanner scan(first, last);
+ match<nil_t> hit = rule.parse(scan);
+
+ bool result = parse_info<Iterator>(
+ first, hit, hit && (first == last), hit.length()).full;
+
+ return result;
+ }
+ }
+ }
+}
+
+#endif // CCF_IDL2_PARSING_ELEMENTS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp b/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp
new file mode 100644
index 00000000000..d8b3739b335
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Parsing/Recovery.hpp
@@ -0,0 +1,325 @@
+// file : CCF/IDL2/Parsing/Recovery.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_PARSING_RECOVERY_HPP
+#define CCF_IDL2_PARSING_RECOVERY_HPP
+
+#include <memory>
+
+#include "CCF/CompilerElements/ReferenceCounting.hpp"
+#include "CCF/IDL2/Parsing/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Parsing
+ {
+
+ //
+ //
+ //
+ struct RecoveryMethod
+ {
+ enum Value
+ {
+ NONE,
+ STANDARD,
+ BAIL_OUT
+ };
+ };
+
+
+ //
+ //
+ //
+ struct DiagnosticType
+ {
+ enum Value
+ {
+ BEFORE,
+ AFTER,
+ NONE
+ };
+ };
+
+
+ //
+ //
+ //
+ class Thunk
+ {
+ public:
+ virtual
+ ~Thunk () {}
+
+ virtual void
+ execute () = 0;
+
+ virtual Thunk*
+ clone () const = 0;
+ };
+
+
+ //
+ //
+ //
+ template<typename Object>
+ class ThunkImpl : public Thunk
+ {
+ public:
+ typedef void (Object::*Func)();
+
+ ThunkImpl (Object& obj, Func func)
+ : obj_(obj),
+ func_ (func)
+ {
+ }
+
+ virtual void
+ execute ()
+ {
+ (obj_.*func_)();
+ }
+
+ virtual Thunk*
+ clone () const
+ {
+ return new ThunkImpl<Object> (obj_, func_);
+ }
+
+ private:
+ Object& obj_;
+ Func func_;
+ };
+
+ //
+ //
+ //
+ template<typename Object>
+ Thunk*
+ call_thunk (Object& obj, void (Object::*func)())
+ {
+ return new ThunkImpl<Object> (obj, func);
+ }
+
+
+ //
+ //
+ //
+ struct RecoveryDescriptor :
+ public virtual ReferenceCounting::DefaultImpl <>
+ {
+ virtual ~RecoveryDescriptor () throw () {}
+
+ RecoveryDescriptor (std::string d,
+ RecoveryMethod::Value recovery,
+ DiagnosticType::Value diagnostic)
+ : action_one_ (0),
+ action_two_ (0),
+ description_ (d),
+ recovery_ (recovery),
+ diagnostic_ (diagnostic)
+ {
+ }
+
+ template<typename Object>
+ RecoveryDescriptor (std::string d,
+ RecoveryMethod::Value recovery,
+ DiagnosticType::Value diagnostic,
+ Object& obj,
+ void (Object::*action_one)())
+ : action_one_ (call_thunk (obj, action_one)),
+ action_two_ (0),
+ description_ (d),
+ recovery_ (recovery),
+ diagnostic_ (diagnostic)
+ {
+ }
+
+ template<typename Object>
+ RecoveryDescriptor (std::string d,
+ RecoveryMethod::Value recovery,
+ DiagnosticType::Value diagnostic,
+ Object& obj,
+ void (Object::*action_one)(),
+ void (Object::*action_two)())
+ : action_one_ (call_thunk (obj, action_one)),
+ action_two_ (call_thunk (obj, action_two)),
+ description_ (d),
+ recovery_ (recovery),
+ diagnostic_ (diagnostic)
+ {
+ }
+
+ RecoveryDescriptor (RecoveryDescriptor const& rd)
+ : action_one_ (rd.action_one_.get () ? rd.action_one_->clone () : 0),
+ action_two_ (rd.action_two_.get () ? rd.action_two_->clone () : 0),
+ description_ (rd.description_),
+ recovery_ (rd.recovery_),
+ diagnostic_ (rd.diagnostic_)
+ {
+ }
+
+
+ std::auto_ptr<Thunk> action_one_;
+ std::auto_ptr<Thunk> action_two_;
+ std::string description_;
+ RecoveryMethod::Value recovery_;
+ DiagnosticType::Value diagnostic_;
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<RecoveryDescriptor>
+ RecoveryDescriptorPtr;
+
+
+ // I have to use a pointer to RecoveryDescriptor instead of
+ // just RecoveryDescriptor to subvert constness of descriptor
+ // member in spirit::parser_error.
+ //
+ //
+
+ typedef
+ parser_error<RecoveryDescriptorPtr, Iterator>
+ Error;
+
+
+ //
+ //
+ //
+ struct Assertion
+ {
+ typedef
+ assertion<RecoveryDescriptorPtr>
+ AssertionImpl;
+
+ AssertionImpl
+ operator () (RecoveryMethod::Value recovery = RecoveryMethod::NONE)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor ("", recovery, DiagnosticType::NONE)));
+ }
+
+ AssertionImpl
+ operator () (std::string d,
+ RecoveryMethod::Value recovery = RecoveryMethod::STANDARD,
+ DiagnosticType::Value diagnostic = DiagnosticType::AFTER)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (d, recovery, diagnostic)));
+ }
+
+ AssertionImpl
+ operator () (std::string d,
+ DiagnosticType::Value diagnostic)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ d, RecoveryMethod::STANDARD, diagnostic)));
+ }
+
+ template<typename Object>
+ AssertionImpl
+ operator () (std::string d,
+ Object& obj,
+ void (Object::*action_one)(),
+ RecoveryMethod::Value recovery = RecoveryMethod::STANDARD,
+ DiagnosticType::Value diagnostic = DiagnosticType::AFTER)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ d, recovery, diagnostic, obj, action_one)));
+ }
+
+ template<typename Object>
+ AssertionImpl
+ operator () (std::string d,
+ Object& obj,
+ void (Object::*action_one)(),
+ DiagnosticType::Value diagnostic)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ d, RecoveryMethod::STANDARD, diagnostic, obj, action_one)));
+ }
+
+ template<typename Object>
+ AssertionImpl
+ operator () (Object& obj,
+ void (Object::*action_one)(),
+ RecoveryMethod::Value recovery = RecoveryMethod::BAIL_OUT)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ "", recovery, DiagnosticType::NONE, obj, action_one)));
+ }
+
+ template<typename Object>
+ AssertionImpl
+ operator () (std::string d,
+ Object& obj,
+ void (Object::*action_one)(),
+ void (Object::*action_two)(),
+ RecoveryMethod::Value recovery = RecoveryMethod::STANDARD,
+ DiagnosticType::Value diagnostic = DiagnosticType::AFTER)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ d, recovery, diagnostic, obj, action_one, action_two)));
+ }
+
+ template<typename Object>
+ AssertionImpl
+ operator () (std::string d,
+ Object& obj,
+ void (Object::*action_one)(),
+ void (Object::*action_two)(),
+ DiagnosticType::Value diagnostic)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor (
+ d, RecoveryMethod::STANDARD, diagnostic, obj, action_one, action_two)));
+ }
+
+
+ template<typename Object>
+ AssertionImpl
+ operator () (Object& obj,
+ void (Object::*action_one)(),
+ void (Object::*action_two)(),
+ RecoveryMethod::Value recovery = RecoveryMethod::BAIL_OUT)
+ {
+ return AssertionImpl (
+ RecoveryDescriptorPtr (
+ new RecoveryDescriptor ("",
+ recovery,
+ DiagnosticType::NONE,
+ obj,
+ action_one,
+ action_two)));
+ }
+
+ };
+
+ typedef
+ error_status<>
+ RecoveryStatus;
+
+ typedef
+ guard<RecoveryDescriptorPtr>
+ Guard;
+ }
+ }
+}
+
+#endif // CCF_IDL2_PARSING_RECOVERY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticAction.hpp b/CIAO/CCF/CCF/IDL2/SemanticAction.hpp
new file mode 100644
index 00000000000..7311cf90910
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticAction.hpp
@@ -0,0 +1,31 @@
+// file : CCF/IDL2/SemanticAction.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_ACTION_HPP
+#define CCF_IDL2_SEMANTIC_ACTION_HPP
+
+#include "CCF/IDL2/SemanticAction/Elements.hpp"
+
+#include "CCF/IDL2/SemanticAction/Factory.hpp"
+
+#include "CCF/IDL2/SemanticAction/Attribute.hpp"
+#include "CCF/IDL2/SemanticAction/Const.hpp"
+#include "CCF/IDL2/SemanticAction/Enum.hpp"
+#include "CCF/IDL2/SemanticAction/Exception.hpp"
+#include "CCF/IDL2/SemanticAction/Include.hpp"
+#include "CCF/IDL2/SemanticAction/Interface.hpp"
+#include "CCF/IDL2/SemanticAction/Member.hpp"
+#include "CCF/IDL2/SemanticAction/Module.hpp"
+#include "CCF/IDL2/SemanticAction/Native.hpp"
+#include "CCF/IDL2/SemanticAction/NumericExpression.hpp"
+#include "CCF/IDL2/SemanticAction/Operation.hpp"
+#include "CCF/IDL2/SemanticAction/Struct.hpp"
+#include "CCF/IDL2/SemanticAction/Typedef.hpp"
+#include "CCF/IDL2/SemanticAction/TypeId.hpp"
+#include "CCF/IDL2/SemanticAction/Union.hpp"
+#include "CCF/IDL2/SemanticAction/ValueType.hpp"
+#include "CCF/IDL2/SemanticAction/ValueTypeFactory.hpp"
+#include "CCF/IDL2/SemanticAction/ValueTypeMember.hpp"
+
+#endif // CCF_IDL2_SEMANTIC_ACTION_HPP
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
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp
new file mode 100644
index 00000000000..224b0abb7df
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph.hpp
@@ -0,0 +1,32 @@
+// file : CCF/IDL2/SemanticGraph.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Array.hpp"
+#include "CCF/IDL2/SemanticGraph/Attribute.hpp"
+#include "CCF/IDL2/SemanticGraph/Enum.hpp"
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+#include "CCF/IDL2/SemanticGraph/Literals.hpp"
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+#include "CCF/IDL2/SemanticGraph/Name.hpp"
+#include "CCF/IDL2/SemanticGraph/Native.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+#include "CCF/IDL2/SemanticGraph/Sequence.hpp"
+#include "CCF/IDL2/SemanticGraph/String.hpp"
+#include "CCF/IDL2/SemanticGraph/Struct.hpp"
+#include "CCF/IDL2/SemanticGraph/Translation.hpp"
+#include "CCF/IDL2/SemanticGraph/TypeId.hpp"
+#include "CCF/IDL2/SemanticGraph/Union.hpp"
+#include "CCF/IDL2/SemanticGraph/ValueType.hpp"
+#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp"
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp
new file mode 100644
index 00000000000..3847a6b1ae3
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.cpp
@@ -0,0 +1,37 @@
+// file : CCF/IDL2/SemanticGraph/Array.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Array.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Array
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ array_init_ ()
+ {
+ TypeInfo ti (typeid (Array));
+ ti.add_base (
+ Access::PUBLIC, true, Specialization::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo array_ (array_init_ ());
+ }
+
+ TypeInfo const& Array::
+ static_type_info () { return array_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp
new file mode 100644
index 00000000000..baf2e5afe70
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Array.hpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticGraph/Array.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class Array : public virtual Specialization
+ {
+ public:
+ Type&
+ type () const
+ {
+ return
+ dynamic_cast<ArgumentsWithType&> (**arguments_begin ()).type ();
+ }
+
+ // You will have to iterate through Arguments edges starting
+ // from begin + 1 to get to the list of bounds. I suggest that
+ // you use traversal instead.
+ //
+
+ virtual bool
+ complete () const
+ {
+ // Is this the right semantic for arrays?
+ //
+ return type ().complete ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Array (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_ARRAY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp
new file mode 100644
index 00000000000..2b2a99b09fb
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.cpp
@@ -0,0 +1,145 @@
+// file : CCF/IDL2/SemanticGraph/Attribute.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Attribute.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Attribute
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ attribute_init_ ()
+ {
+ TypeInfo ti (typeid (Attribute));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo attribute_ (attribute_init_ ());
+ }
+
+ TypeInfo const& Attribute::
+ static_type_info () { return attribute_; }
+
+ Attribute::
+ ~Attribute ()
+ {
+ }
+
+
+ // GetRaises
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ get_raises_init_ ()
+ {
+ TypeInfo ti (typeid (GetRaises));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo get_raises_ (get_raises_init_ ());
+ }
+
+ TypeInfo const& GetRaises::
+ static_type_info () { return get_raises_; }
+
+
+ // ReadAttribute
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ read_attribute_init_ ()
+ {
+ TypeInfo ti (typeid (ReadAttribute));
+ ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo read_attribute_ (read_attribute_init_ ());
+ }
+
+ TypeInfo const& ReadAttribute::
+ static_type_info () { return read_attribute_; }
+
+
+ // SetRaises
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ set_raises_init_ ()
+ {
+ TypeInfo ti (typeid (SetRaises));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo set_raises_ (set_raises_init_ ());
+ }
+
+ TypeInfo const& SetRaises::
+ static_type_info () { return set_raises_; }
+
+
+ // WriteAttribute
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ write_attribute_init_ ()
+ {
+ TypeInfo ti (typeid (WriteAttribute));
+ ti.add_base (Access::PUBLIC, true, Attribute::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo write_attribute_ (write_attribute_init_ ());
+ }
+
+ TypeInfo const& WriteAttribute::
+ static_type_info () { return write_attribute_; }
+
+
+ // ReadWriteAttribute
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ read_write_attribute_init_ ()
+ {
+ TypeInfo ti (typeid (ReadWriteAttribute));
+ ti.add_base (
+ Access::PUBLIC, true, ReadAttribute::static_type_info ());
+ ti.add_base (
+ Access::PUBLIC, true, WriteAttribute::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo read_write_attribute_ (read_write_attribute_init_ ());
+ }
+
+ TypeInfo const& ReadWriteAttribute::
+ static_type_info () { return read_write_attribute_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp
new file mode 100644
index 00000000000..c5f041f5c3d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Attribute.hpp
@@ -0,0 +1,264 @@
+// file : CCF/IDL2/SemanticGraph/Attribute.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class Attribute : public virtual Nameable, public virtual Instance
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Attribute () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Attribute () = 0;
+ };
+
+
+ //
+ //
+ //
+ class ReadAttribute;
+
+ //
+ //
+ //
+ class GetRaises : public virtual Edge
+ {
+ public:
+ ReadAttribute&
+ attribute () const
+ {
+ return *attribute_;
+ }
+
+ Exception&
+ exception () const
+ {
+ return *exception_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ GetRaises ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (ReadAttribute& a)
+ {
+ attribute_ = &a;
+ }
+
+ void
+ set_right_node (Exception& n)
+ {
+ exception_ = &n;
+ }
+
+ private:
+ ReadAttribute* attribute_;
+ Exception* exception_;
+ };
+
+
+ //
+ //
+ //
+ class ReadAttribute : public virtual Attribute
+ {
+ typedef
+ std::vector<GetRaises*>
+ GetRaises_;
+
+ public:
+ typedef
+ GetRaises_::const_iterator
+ GetRaisesIterator;
+
+ GetRaisesIterator
+ get_raises_begin () const
+ {
+ return get_raises_.begin ();
+ }
+
+ GetRaisesIterator
+ get_raises_end () const
+ {
+ return get_raises_.end ();
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ReadAttribute (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (GetRaises& e)
+ {
+ get_raises_.push_back (&e);
+ }
+
+ private:
+ GetRaises_ get_raises_;
+ };
+
+
+ //
+ //
+ //
+ class WriteAttribute;
+
+ //
+ //
+ //
+ class SetRaises : public virtual Edge
+ {
+ public:
+ WriteAttribute&
+ attribute () const
+ {
+ return *attribute_;
+ }
+
+ Exception&
+ exception () const
+ {
+ return *exception_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ SetRaises ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (WriteAttribute& a)
+ {
+ attribute_ = &a;
+ }
+
+ void
+ set_right_node (Exception& n)
+ {
+ exception_ = &n;
+ }
+
+ private:
+ WriteAttribute* attribute_;
+ Exception* exception_;
+ };
+
+
+ class WriteAttribute : public virtual Attribute
+ {
+ typedef
+ std::vector<SetRaises*>
+ SetRaises_;
+
+ public:
+ typedef
+ SetRaises_::const_iterator
+ SetRaisesIterator;
+
+ SetRaisesIterator
+ set_raises_begin () const
+ {
+ return set_raises_.begin ();
+ }
+
+ SetRaisesIterator
+ set_raises_end () const
+ {
+ return set_raises_.end ();
+ }
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ WriteAttribute (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (SetRaises& e)
+ {
+ set_raises_.push_back (&e);
+ }
+
+ private:
+ SetRaises_ set_raises_;
+ };
+
+
+ //
+ //
+ //
+ class ReadWriteAttribute : public virtual ReadAttribute,
+ public virtual WriteAttribute
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ReadWriteAttribute (Path const& path, unsigned long line)
+ : Node (path, line),
+ ReadAttribute (path, line),
+ WriteAttribute (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_ATTRIBUTE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp
new file mode 100644
index 00000000000..824c7634404
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.cpp
@@ -0,0 +1,656 @@
+// file : CCF/IDL2/SemanticGraph/Elements.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+#include <ostream>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Edge
+ //
+ //
+ Edge::
+ ~Edge ()
+ {
+ }
+
+ Edge::
+ Edge ()
+ {
+ type_info (static_type_info ());
+ }
+
+ namespace
+ {
+ TypeInfo
+ edge_init_ ()
+ {
+ TypeInfo ti (typeid (Edge));
+ // I don't really need this information
+ // ti.add_base (Access::PUBLIC, true, Object::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo edge_ (edge_init_ ());
+ }
+
+ TypeInfo const& Edge::
+ static_type_info () { return edge_; }
+
+
+ // Node
+ //
+ //
+ Node::
+ ~Node ()
+ {
+ }
+
+ Node::
+ Node (Path const& file, unsigned long line)
+ : file_ (file), line_ (line)
+ {
+ type_info (static_type_info ());
+ }
+
+ Node::
+ Node ()
+ {
+ abort (); // This ctor should never be called.
+ }
+
+ namespace
+ {
+ TypeInfo
+ node_init_ ()
+ {
+ TypeInfo ti (typeid (Node));
+ // I don't really need this information
+ // ti.add_base (Access::PUBLIC, true, Object::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo node_ (node_init_ ());
+ }
+
+ TypeInfo const& Node::
+ static_type_info () { return node_; }
+
+
+ // Names
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ names_init_ ()
+ {
+ TypeInfo ti (typeid (Names));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo names_ (names_init_ ());
+ }
+
+ TypeInfo const& Names::
+ static_type_info () { return names_; }
+
+
+ // Defines
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ defines_init_ ()
+ {
+ TypeInfo ti (typeid (Defines));
+ ti.add_base (
+ Access::PUBLIC, true, Names::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo defines_ (defines_init_ ());
+ }
+
+ TypeInfo const& Defines::
+ static_type_info () { return defines_; }
+
+
+ // Mentions
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ mentions_init_ ()
+ {
+ TypeInfo ti (typeid (Mentions));
+ ti.add_base (Access::PUBLIC, true, Names::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo mentions_ (mentions_init_ ());
+ }
+
+ TypeInfo const& Mentions::
+ static_type_info () { return mentions_; }
+
+
+ // Aliases
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ aliases_init_ ()
+ {
+ TypeInfo ti (typeid (Aliases));
+ ti.add_base (
+ Access::PUBLIC, true, Names::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo aliases_ (aliases_init_ ());
+ }
+
+ TypeInfo const& Aliases::
+ static_type_info () { return aliases_; }
+
+
+ // Nameable
+ //
+ //
+
+ Nameable::
+ ~Nameable ()
+ {
+ }
+
+ SimpleName Nameable::
+ name () const
+ {
+ // The first entry should either be Mentions or Defines
+ // and it is the 'primary' name of the nameable entity.
+ //
+ return named_[0]->name ();
+ }
+
+ ScopedName Nameable::
+ scoped_name () const
+ {
+ // In general, scope that named us is named, in turn,
+ // by somebody else.
+ //
+ return ScopedName (named_[0]->scope ().scoped_name (), name ());
+ }
+
+ namespace
+ {
+ TypeInfo
+ nameable_init_ ()
+ {
+ TypeInfo ti (typeid (Nameable));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo nameable_ (nameable_init_ ());
+ }
+
+ TypeInfo const& Nameable::
+ static_type_info () { return nameable_; }
+
+
+ // Extends
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ extends_init_ ()
+ {
+ TypeInfo ti (typeid (Extends));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo extends_ (extends_init_ ());
+ }
+
+ TypeInfo const& Extends::
+ static_type_info () { return extends_; }
+
+
+ // Scope
+ //
+ //
+ Scope::
+ ~Scope ()
+ {
+ }
+
+ Nameables Scope::
+ lookup (Name const& name) const
+ {
+ Nameables r;
+ lookup (name, r);
+ return r;
+ }
+
+ void Scope::
+ lookup (Name const& name, Nameables& result) const
+ {
+ SimpleName first (*name.begin ());
+
+ NamesIteratorPair pair (find (first));
+
+ if (pair.first != pair.second) // Found something.
+ {
+ if (name.simple ()) // last name
+ {
+ for (NamesIterator n (pair.first); n != pair.second; ++n)
+ {
+ result.insert (&((**n).named ()));
+ }
+ }
+ else
+ {
+ Name rest (name.begin () + 1, name.end ());
+
+ for (NamesIterator n (pair.first); n != pair.second; ++n)
+ {
+ Nameable& node ((**n).named ());
+ if (Scope* s = dynamic_cast<Scope*> (&node))
+ {
+ s->lookup (rest, result);
+ }
+ }
+ }
+ }
+ else // Try scopes that we are an extension of.
+ {
+ for (ExtendsIterator i (extends_begin ()), e (extends_end ());
+ i != e; ++i)
+ {
+ (**i).extendee ().lookup (name, result);
+ }
+ }
+ }
+
+ void Scope::
+ add_edge_left (Names& e)
+ {
+ names_.push_back (&e);
+ names_map_[e.name ()].push_back (&e);
+ }
+
+ namespace
+ {
+ TypeInfo
+ scope_init_ ()
+ {
+ TypeInfo ti (typeid (Scope));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo scope_ (scope_init_ ());
+ }
+
+ TypeInfo const& Scope::
+ static_type_info () { return scope_; }
+
+
+ // Type
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ type_init_ ()
+ {
+ TypeInfo ti (typeid (Type));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo type_ (type_init_ ());
+ }
+
+ TypeInfo const& Type::
+ static_type_info () { return type_; }
+
+ Type::
+ ~Type ()
+ {
+ }
+
+ // Instance
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ instance_init_ ()
+ {
+ TypeInfo ti (typeid (Instance));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo instance_ (instance_init_ ());
+ }
+
+ TypeInfo const& Instance::
+ static_type_info () { return instance_; }
+
+ Instance::
+ ~Instance ()
+ {
+ }
+
+ // Belongs
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ belongs_init_ ()
+ {
+ TypeInfo ti (typeid (Belongs));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo belongs_ (belongs_init_ ());
+ }
+
+ TypeInfo const& Belongs::
+ static_type_info () { return belongs_; }
+
+
+ // Specialization
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ specialization_init_ ()
+ {
+ TypeInfo ti (typeid (Specialization));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo specialization_ (
+ specialization_init_ ());
+ }
+
+ TypeInfo const& Specialization::
+ static_type_info () { return specialization_; }
+
+ void Specialization::
+ add_edge_right (ArgumentsWithType& e)
+ {
+ arguments_.push_back (&e);
+ }
+
+ void Specialization::
+ add_edge_right (ArgumentsWithValue& e)
+ {
+ arguments_.push_back (&e);
+ }
+
+ Specialization::
+ ~Specialization ()
+ {
+ }
+
+
+ // Arguments
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ arguments_init_ ()
+ {
+ TypeInfo ti (typeid (Arguments));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo arguments_ (arguments_init_ ());
+ }
+
+ TypeInfo const& Arguments::
+ static_type_info () { return arguments_; }
+
+
+ // ArgumentsWithType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ arguments_with_type_init_ ()
+ {
+ TypeInfo ti (typeid (ArgumentsWithType));
+ ti.add_base (Access::PUBLIC, true, Arguments::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo arguments_with_type_ (arguments_with_type_init_ ());
+ }
+
+ TypeInfo const& ArgumentsWithType::
+ static_type_info () { return arguments_with_type_; }
+
+
+ // ArgumentsWithValue
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ arguments_with_value_init_ ()
+ {
+ TypeInfo ti (typeid (ArgumentsWithValue));
+ ti.add_base (Access::PUBLIC, true, Arguments::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo arguments_with_value_ (arguments_with_value_init_ ());
+ }
+
+ TypeInfo const& ArgumentsWithValue::
+ static_type_info () { return arguments_with_value_; }
+
+ Expression& ArgumentsWithValue::
+ value () const
+ {
+ return dynamic_cast<Expression&> (argument ());
+ }
+
+ void ArgumentsWithValue::
+ set_left_node (Expression& n)
+ {
+ Arguments::set_left_node (n);
+ }
+
+ // IsA
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ is_a_init_ ()
+ {
+ TypeInfo ti (typeid (IsA));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo is_a_ (is_a_init_ ());
+ }
+
+ TypeInfo const& IsA::
+ static_type_info () { return is_a_; }
+
+
+ // Inherits
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ inherits_init_ ()
+ {
+ TypeInfo ti (typeid (Inherits));
+ ti.add_base (Access::PUBLIC, true, IsA::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo inherits_ (inherits_init_ ());
+ }
+
+ TypeInfo const& Inherits::
+ static_type_info () { return inherits_; }
+
+
+ // Initializes
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ initializes_init_ ()
+ {
+ TypeInfo ti (typeid (Initializes));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo initializes_ (initializes_init_ ());
+ }
+
+ TypeInfo const& Initializes::
+ static_type_info () { return initializes_; }
+
+
+ // Expression
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ expression_init_ ()
+ {
+ TypeInfo ti (typeid (Expression));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo expression_ (expression_init_ ());
+ }
+
+ TypeInfo const& Expression::
+ static_type_info () { return expression_; }
+
+ Expression::
+ ~Expression ()
+ {
+ }
+
+
+ // Const
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ const_init_ ()
+ {
+ TypeInfo ti (typeid (Const));
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Expression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo const_ (const_init_ ());
+ }
+
+ TypeInfo const& Const::
+ static_type_info () { return const_; }
+
+ Const::
+ ~Const ()
+ {
+ }
+
+ // Contains
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ contains_init_ ()
+ {
+ TypeInfo ti (typeid (Contains));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo contains_ (contains_init_ ());
+ }
+
+ TypeInfo const& Contains::
+ static_type_info () { return contains_; }
+
+
+ // Container
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ container_init_ ()
+ {
+ TypeInfo ti (typeid (Container));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo container_ (container_init_ ());
+ }
+
+ TypeInfo const& Container::
+ static_type_info () { return container_; }
+
+ Container::
+ ~Container ()
+ {
+ }
+ }
+ }
+}
+
+//
+//
+std::ostream&
+operator<< (std::ostream& os, CCF::IDL2::SemanticGraph::Path const& path)
+{
+ return os << path.native_file_string ();
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp
new file mode 100644
index 00000000000..1f0c850f25e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.hpp
@@ -0,0 +1,1078 @@
+// file : CCF/IDL2/SemanticGraph/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP
+
+#include <set>
+#include <vector>
+#include <iosfwd>
+
+#include "Graph.hpp"
+
+#include "CCF/CompilerElements/FileSystem.hpp"
+#include "CCF/CompilerElements/Introspection.hpp"
+#include "CCF/CompilerElements/Context.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Name.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ typedef fs::path Path;
+
+ //
+ //
+ //
+
+ class Node;
+ class Edge;
+
+
+ // Node & Edge
+ //
+ //
+ class Edge : public virtual Introspection::Object
+ {
+ public:
+ CompilerElements::Context const&
+ context () const
+ {
+ return context_;
+ }
+
+ CompilerElements::Context&
+ context ()
+ {
+ return context_;
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ virtual
+ ~Edge ();
+
+ Edge ();
+
+ private:
+ CompilerElements::Context context_;
+ };
+
+ inline bool
+ operator== (Edge const& x, Edge const& y)
+ {
+ return &x == &y;
+ }
+
+ class Node : public virtual Introspection::Object
+ {
+ public:
+ CompilerElements::Context const&
+ context () const
+ {
+ return context_;
+ }
+
+ CompilerElements::Context&
+ context ()
+ {
+ return context_;
+ }
+
+ public:
+ Path const&
+ file () const
+ {
+ return file_;
+ }
+
+ unsigned long
+ line () const
+ {
+ return line_;
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ virtual
+ ~Node () = 0;
+
+ Node (Path const& path, unsigned long line);
+
+ Node (); // For virtual inheritance only.
+
+ // This is a bunch of experimantal sink functions that allow
+ // extensions in the form of one-way edges (see Executor stuff
+ // in CIDL for example).
+ //
+ void
+ add_edge_left (Edge&)
+ {
+ }
+
+ void
+ add_edge_right (Edge&)
+ {
+ }
+
+ private:
+ Path file_;
+ unsigned long line_;
+ CompilerElements::Context context_;
+ };
+
+ inline bool
+ operator== (Node const& x, Node const& y)
+ {
+ return &x == &y;
+ }
+
+
+ //
+ //
+ //
+ class Scope;
+ class Nameable;
+
+ class Names : public virtual Edge
+ {
+ public:
+ SimpleName
+ name () const
+ {
+ return name_;
+ }
+
+ Scope&
+ scope () const
+ {
+ return *scope_;
+ }
+
+ Nameable&
+ named () const
+ {
+ return *named_;
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Names (SimpleName const& name)
+ : name_ (name)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Scope& n)
+ {
+ scope_ = &n;
+ }
+
+ void
+ set_right_node (Nameable& n)
+ {
+ named_ = &n;
+ }
+
+ private:
+ Scope* scope_;
+ Nameable* named_;
+ SimpleName name_;
+ };
+
+ class Defines : public virtual Names
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Defines (SimpleName const& name)
+ : Names (name)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ class Mentions : public virtual Names
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Mentions (SimpleName const& name)
+ : Names (name)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ class Aliases : public virtual Names
+ {
+ public:
+ SimpleName
+ synonym () const
+ {
+ return name ();
+ }
+
+ /*
+
+ Let me know if you need this function.
+
+ ScopedName
+ eponym () const
+ {
+ }
+ */
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Aliases (SimpleName const& synonym)
+ : Names (synonym)
+
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ class Nameable : public virtual Node
+ {
+ typedef
+ std::vector<Names*>
+ Named_;
+
+ public:
+ virtual SimpleName
+ name () const;
+
+ virtual ScopedName
+ scoped_name () const;
+
+ bool
+ defined () const
+ {
+ return defined_;
+ }
+
+ typedef
+ Named_::const_iterator
+ NamedIterator;
+
+ NamedIterator
+ named_begin () const
+ {
+ return named_.begin ();
+ }
+
+ NamedIterator
+ named_end () const
+ {
+ return named_.end ();
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Nameable () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Nameable () = 0;
+
+ void
+ add_edge_right (Defines& e)
+ {
+ defined_ = true;
+ named_.push_back (&e);
+ }
+
+ void
+ add_edge_right (Names& e)
+ {
+ named_.push_back (&e);
+ }
+
+ private:
+ Named_ named_;
+ bool defined_;
+ };
+
+ typedef
+ std::set<Nameable*>
+ Nameables;
+
+ class Scope;
+
+ class Extends : public virtual Edge
+ {
+ public:
+ Scope& extender () const
+ {
+ return *extender_;
+ }
+
+ Scope& extendee () const
+ {
+ return *extendee_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Extends ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Scope& s)
+ {
+ extender_ = &s;
+ }
+
+ void
+ set_right_node (Scope& s)
+ {
+ extendee_ = &s;
+ }
+
+ private:
+ Scope* extender_;
+ Scope* extendee_;
+ };
+
+ class Scope : public virtual Nameable
+ {
+ private:
+ typedef
+ std::vector<Extends*>
+ Extends_;
+
+ typedef
+ std::vector<Names*>
+ Names_;
+
+ typedef
+ std::map<SimpleName, Names_>
+ NamesMap_;
+
+ public:
+ //
+ //
+ typedef
+ Extends_::const_iterator
+ ExtendsIterator;
+
+ ExtendsIterator
+ extends_begin () const
+ {
+ return extends_.begin ();
+ }
+
+ ExtendsIterator
+ extends_end () const
+ {
+ return extends_.end ();
+ }
+
+
+ //
+ //
+ typedef
+ Names_::const_iterator
+ NamesIterator;
+
+ typedef
+ std::pair <NamesIterator, NamesIterator>
+ NamesIteratorPair;
+
+ NamesIterator
+ names_begin () const
+ {
+ return names_.begin ();
+ }
+
+ NamesIterator
+ names_end () const
+ {
+ return names_.end ();
+ }
+
+ NamesIteratorPair
+ find (SimpleName const& name) const
+ {
+ NamesMap_::const_iterator i (names_map_.find (name));
+ if (i == names_map_.end ())
+ {
+ return NamesIteratorPair (names_.end (), names_.end ());
+ }
+ else
+ {
+ return NamesIteratorPair (i->second.begin (), i->second.end ());
+ }
+ }
+
+ Nameables
+ lookup (Name const& name) const;
+
+ void
+ lookup (Name const& name, Nameables& result) const;
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Scope () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Scope () = 0;
+
+ void
+ add_edge_left (Names& e);
+
+ void
+ add_edge_left (Extends& e)
+ {
+ extends_.push_back (&e);
+ }
+
+ void
+ add_edge_right (Extends&)
+ {
+ }
+
+ using Nameable::add_edge_right;
+
+ private:
+ Extends_ extends_;
+
+ Names_ names_;
+ NamesMap_ names_map_;
+ };
+
+
+
+ //
+ //
+ //
+ class Belongs;
+ class ArgumentsWithType;
+
+ //@@ I can make an alias Classifies for Belongs?
+ //
+
+ class Type : public virtual Nameable
+ {
+ public:
+ virtual bool
+ complete () const = 0;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Type () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Type () = 0;
+
+ using Nameable::add_edge_right;
+
+ void
+ add_edge_right (Belongs& e)
+ {
+ slassifies_.push_back (&e);
+ }
+
+ void
+ add_edge_left (ArgumentsWithType&)
+ {
+ }
+
+ using Node::add_edge_right;
+ using Node::add_edge_left;
+
+ private:
+ typedef
+ std::vector<Belongs*>
+ Classifies_;
+
+ Classifies_ slassifies_;
+ };
+
+
+ class Instance : public virtual Node
+ {
+ public:
+ Belongs&
+ belongs () const
+ {
+ return *belongs_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Instance () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Instance () = 0;
+
+ void
+ add_edge_left (Belongs& e)
+ {
+ belongs_ = &e;
+ }
+
+ private:
+ Belongs* belongs_;
+ };
+
+
+ class Belongs : public virtual Edge
+ {
+ public:
+ Instance&
+ instance () const
+ {
+ return *instance_;
+ }
+
+ Type&
+ type () const
+ {
+ return *type_;
+ }
+
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Belongs ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Instance& n)
+ {
+ instance_ = &n;
+ }
+
+ void
+ set_right_node (Type& n)
+ {
+ type_ = &n;
+ }
+
+ private:
+ Instance* instance_;
+ Type* type_;
+ };
+
+
+ //
+ //
+ class Arguments;
+ class ArgumentsWithType;
+ class ArgumentsWithValue;
+
+ class Specialization: public virtual Type
+ {
+ typedef
+ std::vector<Arguments*>
+ Arguments_;
+
+ public:
+ typedef
+ Arguments_::const_iterator
+ ArgumentsIterator;
+
+ ArgumentsIterator
+ arguments_begin () const
+ {
+ return arguments_.begin ();
+ }
+
+ ArgumentsIterator
+ arguments_end () const
+ {
+ return arguments_.end ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Specialization () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Specialization () = 0;
+
+ void
+ add_edge_right (ArgumentsWithType& e);
+
+ void
+ add_edge_right (ArgumentsWithValue& e);
+
+ private:
+ Arguments_ arguments_;
+ };
+
+
+ class Arguments: public virtual Edge
+ {
+ public:
+ Specialization&
+ specialization () const
+ {
+ return *specialization_;
+ }
+
+ Node&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Arguments ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Node& n)
+ {
+ argument_ = &n;
+ }
+
+ void
+ set_right_node (Specialization& n)
+ {
+ specialization_ = &n;
+ }
+
+ private:
+ Specialization* specialization_;
+ Node* argument_;
+ };
+
+ class ArgumentsWithType: public virtual Arguments
+ {
+ public:
+ Type&
+ type () const
+ {
+ return dynamic_cast<Type&> (argument ());
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ArgumentsWithType ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Type& n)
+ {
+ Arguments::set_left_node (n);
+ }
+ };
+
+ class Expression;
+
+ class ArgumentsWithValue: public virtual Arguments
+ {
+ public:
+ Expression&
+ value () const;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ArgumentsWithValue ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Expression& n);
+ };
+
+ //
+ //
+ //
+ class IsA : public virtual Edge
+ {
+ public:
+ virtual Type&
+ subject () const
+ {
+ return *subject_;
+ }
+
+ virtual Type&
+ object () const
+ {
+ return *object_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IsA ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Type& n)
+ {
+ subject_ = &n;
+ }
+
+ void
+ set_right_node (Type& n)
+ {
+ object_ = &n;
+ }
+
+ private:
+ Type* subject_;
+ Type* object_;
+ };
+
+
+ //
+ //
+ //
+ class Inherits : public virtual IsA
+ {
+ public:
+ virtual Type&
+ inheritor () const
+ {
+ return subject ();
+ }
+
+ virtual Type&
+ inheritee () const
+ {
+ return object ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Inherits ()
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+
+ class Expression;
+ class Const;
+
+ class Initializes: public virtual Edge
+ {
+ public:
+ Expression&
+ expression () const
+ {
+ return *expression_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Initializes ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Expression& e)
+ {
+ expression_ = &e;
+ }
+
+ void
+ set_right_node (Const&)
+ {
+ }
+
+ private:
+ Expression* expression_;
+ };
+
+
+ class Expression: public virtual Node
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Expression () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Expression () = 0;
+
+ void
+ add_edge_left (Initializes&)
+ {
+ }
+
+ void
+ add_edge_left (ArgumentsWithValue&)
+ {
+ }
+ };
+
+
+ class Const: public virtual Instance,
+ public virtual Nameable,
+ public virtual Expression
+ {
+ public:
+ Initializes&
+ initialized () const
+ {
+ return *initialized_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Const () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Const () = 0;
+
+ using Instance::add_edge_left;
+ using Expression::add_edge_left;
+
+ void
+ add_edge_right (Initializes& i)
+ {
+ initialized_ = &i;
+ }
+
+ using Nameable::add_edge_right;
+
+ private:
+ Initializes* initialized_;
+ };
+
+
+ //
+ //
+ //
+
+ class Container;
+
+ class Contains : public virtual Edge
+ {
+ public:
+ Node&
+ element () const
+ {
+ return *element_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Contains ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Container& n)
+ {
+ container_ = &n;
+ }
+
+ void
+ set_right_node (Node& n)
+ {
+ element_ = &n;
+ }
+
+ private:
+ Container* container_;
+ Node* element_;
+ };
+
+
+ class Container : public virtual Node
+ {
+ typedef
+ std::vector<Contains*>
+ Contains_;
+
+ public:
+ typedef
+ Contains_::const_iterator
+ ContainsIterator;
+
+ ContainsIterator
+ contains_begin () const
+ {
+ return contains_.begin ();
+ }
+
+ ContainsIterator
+ contains_end () const
+ {
+ return contains_.end ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Container () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Container () = 0;
+
+ void
+ add_edge_left (Contains& e)
+ {
+ contains_.push_back (&e);
+ }
+
+ private:
+ Contains_ contains_;
+ };
+ }
+ }
+}
+
+// ADL won't find it because Path is a typedef. Note that this
+// function prints in native format.
+//
+std::ostream&
+operator<< (std::ostream& os, CCF::IDL2::SemanticGraph::Path const& path);
+
+#include "CCF/IDL2/SemanticGraph/Elements.tpp"
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_ELEMENTS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp
new file mode 100644
index 00000000000..a3a1615fe85
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Elements.tpp
@@ -0,0 +1,14 @@
+// file : CCF/IDL2/SemanticGraph/Elements.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ }
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp
new file mode 100644
index 00000000000..e5de88c449e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.cpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticGraph/Enum.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Enum.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Enum
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ enum_init_ ()
+ {
+ TypeInfo ti (typeid (Enum));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo enum_ (enum_init_ ());
+ }
+
+ TypeInfo const& Enum::
+ static_type_info () { return enum_; }
+
+
+ // Enumerator
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ enumerator_init_ ()
+ {
+ TypeInfo ti (typeid (Enumerator));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo enumerator_ (enumerator_init_ ());
+ }
+
+ TypeInfo const& Enumerator::
+ static_type_info () { return enumerator_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp
new file mode 100644
index 00000000000..9179b471791
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Enum.hpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticGraph/Enum.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP
+
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Enum : public virtual Type
+ {
+ public:
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Enum (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ class Enumerator : public virtual Nameable, public virtual IntConst
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Enumerator (Path const& path, unsigned long line)
+ : Node (path, line), IntConst (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_ENUM_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp
new file mode 100644
index 00000000000..9ed3a7e494b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.cpp
@@ -0,0 +1,34 @@
+// file : CCF/IDL2/SemanticGraph/Exception.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ namespace
+ {
+ TypeInfo
+ exception_init_ ()
+ {
+ TypeInfo ti (typeid (Exception));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo exception_ (exception_init_ ());
+ }
+
+ TypeInfo const& Exception::
+ static_type_info () { return exception_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp
new file mode 100644
index 00000000000..712cdf1ca8a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Exception.hpp
@@ -0,0 +1,51 @@
+// file : CCF/IDL2/SemanticGraph/Exception.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Raises;
+
+ class Exception : public virtual Type, public virtual Scope
+ {
+ public:
+ virtual bool
+ complete () const
+ {
+ return defined ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Exception (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ using Type::add_edge_right;
+ using Scope::add_edge_left;
+
+ void
+ add_edge_right (Raises&)
+ {
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_EXCEPTION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp
new file mode 100644
index 00000000000..789accfe3b9
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp
@@ -0,0 +1,443 @@
+// file : CCF/IDL2/SemanticGraph/Fundamental.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+// Note, that this file is automatically generated!
+//
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // FundamentalType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ fundamental_type_init_ ()
+ {
+ TypeInfo ti (typeid (FundamentalType));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo fundamental_type_ (fundamental_type_init_ ());
+ }
+
+ TypeInfo const& FundamentalType::
+ static_type_info () { return fundamental_type_; }
+
+ FundamentalType::
+ ~FundamentalType ()
+ {
+ }
+
+
+ // Object
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ object_init_ ()
+ {
+ TypeInfo ti (typeid (Object));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo object_ (object_init_ ());
+ }
+
+ TypeInfo const& Object::
+ static_type_info () { return object_; }
+
+
+ // ValueBase
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_base_init_ ()
+ {
+ TypeInfo ti (typeid (ValueBase));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo value_base_ (value_base_init_ ());
+ }
+
+ TypeInfo const& ValueBase::
+ static_type_info () { return value_base_; }
+
+
+ // Any
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ any_init_ ()
+ {
+ TypeInfo ti (typeid (Any));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo any_ (any_init_ ());
+ }
+
+ TypeInfo const& Any::
+ static_type_info () { return any_; }
+
+
+ // Boolean
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ boolean_init_ ()
+ {
+ TypeInfo ti (typeid (Boolean));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo boolean_ (boolean_init_ ());
+ }
+
+ TypeInfo const& Boolean::
+ static_type_info () { return boolean_; }
+
+
+ // Char
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ char_init_ ()
+ {
+ TypeInfo ti (typeid (Char));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo char_ (char_init_ ());
+ }
+
+ TypeInfo const& Char::
+ static_type_info () { return char_; }
+
+
+ // Double
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ double_init_ ()
+ {
+ TypeInfo ti (typeid (Double));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo double_ (double_init_ ());
+ }
+
+ TypeInfo const& Double::
+ static_type_info () { return double_; }
+
+
+ // Float
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ float_init_ ()
+ {
+ TypeInfo ti (typeid (Float));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo float_ (float_init_ ());
+ }
+
+ TypeInfo const& Float::
+ static_type_info () { return float_; }
+
+
+ // Long
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ long_init_ ()
+ {
+ TypeInfo ti (typeid (Long));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo long_ (long_init_ ());
+ }
+
+ TypeInfo const& Long::
+ static_type_info () { return long_; }
+
+
+ // LongDouble
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ long_double_init_ ()
+ {
+ TypeInfo ti (typeid (LongDouble));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo long_double_ (long_double_init_ ());
+ }
+
+ TypeInfo const& LongDouble::
+ static_type_info () { return long_double_; }
+
+
+ // LongLong
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ long_long_init_ ()
+ {
+ TypeInfo ti (typeid (LongLong));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo long_long_ (long_long_init_ ());
+ }
+
+ TypeInfo const& LongLong::
+ static_type_info () { return long_long_; }
+
+
+ // Octet
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ octet_init_ ()
+ {
+ TypeInfo ti (typeid (Octet));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo octet_ (octet_init_ ());
+ }
+
+ TypeInfo const& Octet::
+ static_type_info () { return octet_; }
+
+
+ // Short
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ short_init_ ()
+ {
+ TypeInfo ti (typeid (Short));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo short_ (short_init_ ());
+ }
+
+ TypeInfo const& Short::
+ static_type_info () { return short_; }
+
+
+ // String
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ string_init_ ()
+ {
+ TypeInfo ti (typeid (String));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo string_ (string_init_ ());
+ }
+
+ TypeInfo const& String::
+ static_type_info () { return string_; }
+
+
+ // UnsignedLong
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ unsigned_long_init_ ()
+ {
+ TypeInfo ti (typeid (UnsignedLong));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo unsigned_long_ (unsigned_long_init_ ());
+ }
+
+ TypeInfo const& UnsignedLong::
+ static_type_info () { return unsigned_long_; }
+
+
+ // UnsignedLongLong
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ unsigned_long_long_init_ ()
+ {
+ TypeInfo ti (typeid (UnsignedLongLong));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo unsigned_long_long_ (unsigned_long_long_init_ ());
+ }
+
+ TypeInfo const& UnsignedLongLong::
+ static_type_info () { return unsigned_long_long_; }
+
+
+ // UnsignedShort
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ unsigned_short_init_ ()
+ {
+ TypeInfo ti (typeid (UnsignedShort));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo unsigned_short_ (unsigned_short_init_ ());
+ }
+
+ TypeInfo const& UnsignedShort::
+ static_type_info () { return unsigned_short_; }
+
+
+ // Void
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ void_init_ ()
+ {
+ TypeInfo ti (typeid (Void));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo void_ (void_init_ ());
+ }
+
+ TypeInfo const& Void::
+ static_type_info () { return void_; }
+
+
+ // Wchar
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ wchar_init_ ()
+ {
+ TypeInfo ti (typeid (Wchar));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo wchar_ (wchar_init_ ());
+ }
+
+ TypeInfo const& Wchar::
+ static_type_info () { return wchar_; }
+
+
+ // Wstring
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ wstring_init_ ()
+ {
+ TypeInfo ti (typeid (Wstring));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo wstring_ (wstring_init_ ());
+ }
+
+ TypeInfo const& Wstring::
+ static_type_info () { return wstring_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4 b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4
new file mode 100644
index 00000000000..da1d8eca574
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.cpp.m4
@@ -0,0 +1,103 @@
+divert(-1)
+
+# file : CCF/IDL2/SemanticGraph/Fundamental.cpp.m4
+# author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+# cvs-id : $Id$
+
+include(`Fundamental.m4')
+
+define(`fundamental_type',
+ `fundamental_type_impl(`make_class_name(`$1')', `make_var_name(`$1')')')
+
+
+define(`fundamental_type_impl', `
+
+ // $1
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ $2_init_ ()
+ {
+ TypeInfo ti (typeid ($1));
+ ti.add_base (
+ Access::PUBLIC, true, FundamentalType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo $2_ ($2_init_ ());
+ }
+
+ TypeInfo const& $1::
+ static_type_info () { return $2_; }')
+
+divert(0)dnl
+dnl
+dnl
+dnl
+// file : CCF/IDL2/SemanticGraph/Fundamental.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+// Note, that this file is automatically generated!
+//
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // FundamentalType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ fundamental_type_init_ ()
+ {
+ TypeInfo ti (typeid (FundamentalType));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo fundamental_type_ (fundamental_type_init_ ());
+ }
+
+ TypeInfo const& FundamentalType::
+ static_type_info () { return fundamental_type_; }
+
+ FundamentalType::
+ ~FundamentalType ()
+ {
+ }
+dnl
+fundamental_type(`object')
+fundamental_type(`value base')
+fundamental_type(`any')
+fundamental_type(`boolean')
+fundamental_type(`char')
+fundamental_type(`double')
+fundamental_type(`float')
+fundamental_type(`long')
+fundamental_type(`long double')
+fundamental_type(`long long')
+fundamental_type(`octet')
+fundamental_type(`short')
+fundamental_type(`string')
+fundamental_type(`unsigned long')
+fundamental_type(`unsigned long long')
+fundamental_type(`unsigned short')
+fundamental_type(`void')
+fundamental_type(`wchar')
+fundamental_type(`wstring')
+dnl
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp
new file mode 100644
index 00000000000..a756acc352e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp
@@ -0,0 +1,427 @@
+// file : CCF/IDL2/SemanticGraph/Fundamental.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+// Note, that this file is automatically generated!
+//
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ // @@ Object & ValueBase should be of interface & valuetype types?
+ //
+ //
+ class FundamentalType : public virtual Type
+ {
+ public:
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ FundamentalType () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~FundamentalType () = 0;
+ };
+
+
+ //
+ //
+ //
+ class Object : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Object (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class ValueBase : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueBase (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Any : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Any (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Boolean : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Boolean (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Char : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Char (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Double : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Double (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Float : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Float (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Long : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Long (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class LongDouble : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ LongDouble (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class LongLong : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ LongLong (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Octet : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Octet (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Short : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Short (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class String : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ String (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class UnsignedLong : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnsignedLong (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class UnsignedLongLong : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnsignedLongLong (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class UnsignedShort : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnsignedShort (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Void : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Void (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Wchar : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Wchar (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Wstring : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Wstring (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4 b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4
new file mode 100644
index 00000000000..864dcd76435
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.hpp.m4
@@ -0,0 +1,102 @@
+divert(-1)
+
+# file : CCF/IDL2/SemanticGraph/Fundamental.hpp.m4
+# author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+# cvs-id : $Id$
+
+include(`Fundamental.m4')
+
+define(`fundamental_type', `fundamental_type_impl(`make_class_name(`$1')', `$1')')
+
+define(`fundamental_type_impl', `
+
+ //
+ //
+ //
+ class $1 : public virtual FundamentalType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ $1 (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };')
+divert(0)dnl
+dnl
+dnl
+dnl
+// file : CCF/IDL2/SemanticGraph/Fundamental.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+// Note, that this file is automatically generated!
+//
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ // @@ Object & ValueBase should be of interface & valuetype types?
+ //
+ //
+ class FundamentalType : public virtual Type
+ {
+ public:
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ FundamentalType () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~FundamentalType () = 0;
+ };
+dnl
+fundamental_type(`Object')
+fundamental_type(`ValueBase')
+fundamental_type(`any')
+fundamental_type(`boolean')
+fundamental_type(`char')
+fundamental_type(`double')
+fundamental_type(`float')
+fundamental_type(`long')
+fundamental_type(`long double')
+fundamental_type(`long long')
+fundamental_type(`octet')
+fundamental_type(`short')
+fundamental_type(`string')
+fundamental_type(`unsigned long')
+fundamental_type(`unsigned long long')
+fundamental_type(`unsigned short')
+fundamental_type(`void')
+fundamental_type(`wchar')
+fundamental_type(`wstring')
+dnl
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_FUNDAMENTAL_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4 b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4
new file mode 100644
index 00000000000..5aaab71bd76
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Fundamental.m4
@@ -0,0 +1,17 @@
+# file : CCF/IDL2/SemanticGraph/Fundamental.m4
+# author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+# cvs-id : $Id$
+
+define(`upcase', `translit(`$*', `a-z', `A-Z')')
+
+
+define(`capitalize_word',
+ `regexp(`$1', `^\(.\)\(.*\)', `upcase(`\1')`\2'')')
+
+
+define(`capitalize',
+ `patsubst(`$1', `\w+', `capitalize_word(`\&')')')
+
+define(`make_class_name', `patsubst(capitalize(`$1'), ` ')')
+
+define(`make_var_name', `patsubst(`$1', ` ', `_')')
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp
new file mode 100644
index 00000000000..f71140569de
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.hpp
@@ -0,0 +1,91 @@
+// file : CCF/IDL2/SemanticGraph/Graph.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef ELEMENT_GRAPH_HPP
+#define ELEMENT_GRAPH_HPP
+
+#include <map>
+#include <set>
+#include <vector>
+#include <string>
+#include <memory>
+
+#include <iostream>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ template <typename N, typename E>
+ class Graph
+ {
+ public:
+ ~Graph ();
+
+ public:
+ template <typename T>
+ T&
+ new_node ();
+
+ template <typename T, typename A0>
+ T&
+ new_node (A0 const& a0);
+
+ template <typename T, typename A0, typename A1>
+ T&
+ new_node (A0 const& a0, A1 const& a1);
+
+ template <typename T, typename A0, typename A1, typename A2>
+ T&
+ new_node (A0 const& a0, A1 const& a1, A2 const& a2);
+
+ template <typename T,
+ typename A0,
+ typename A1,
+ typename A2,
+ typename A3>
+ T&
+ new_node (A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3);
+
+ void
+ delete_node (N const& n);
+
+ public:
+ template <typename T, typename X, typename Y>
+ T&
+ new_edge (X& left, Y& right);
+
+ template <typename T, typename X, typename Y,
+ typename A0>
+ T&
+ new_edge (X& left, Y& right, A0 const& a0);
+
+ template <typename T, typename X, typename Y,
+ typename A0,
+ typename A1>
+ T&
+ new_edge (X& left, Y& right, A0 const& a0, A1 const& a1);
+
+ void
+ delete_edge (E const& e);
+
+ protected:
+ typedef N* NodePtr;
+ typedef E* EdgePtr;
+
+ typedef std::set<NodePtr> Nodes_;
+ typedef std::set<EdgePtr> Edges_;
+
+ Nodes_ nodes_;
+ Edges_ edges_;
+ };
+ }
+ }
+}
+
+#include "Graph.tpp"
+
+#endif // ELEMENT_GRAPH_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp
new file mode 100644
index 00000000000..37a952a3f34
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Graph.tpp
@@ -0,0 +1,188 @@
+// file : CCF/IDL2/SemanticGraph/Graph.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ // Graph
+ //
+ //
+
+
+ template <typename N, typename E>
+ template <typename T>
+ T& Graph<N, E>::
+ new_node ()
+ {
+ T* n (new T); //@@ auto
+ nodes_.insert (n);
+ return *n;
+ }
+
+
+ template <typename N, typename E>
+ template <typename T, typename A0>
+ T& Graph<N, E>::
+ new_node (A0 const& a0)
+ {
+ T* n (new T (a0)); //@@ auto
+ nodes_.insert (n);
+ return *n;
+ }
+
+
+ template <typename N, typename E>
+ template <typename T, typename A0, typename A1>
+ T& Graph<N, E>::
+ new_node (A0 const& a0, A1 const& a1)
+ {
+ T* n (new T (a0, a1)); //@@ auto
+ nodes_.insert (n);
+ return *n;
+ }
+
+ template <typename N, typename E>
+ template <typename T, typename A0, typename A1, typename A2>
+ T& Graph<N, E>::
+ new_node (A0 const& a0, A1 const& a1, A2 const& a2)
+ {
+ T* n (new T (a0, a1, a2)); //@@ auto
+ nodes_.insert (n);
+ return *n;
+ }
+
+ template <typename N, typename E>
+ template <typename T,
+ typename A0,
+ typename A1,
+ typename A2,
+ typename A3>
+ T& Graph<N, E>::
+ new_node (A0 const& a0, A1 const& a1, A2 const& a2, A3 const& a3)
+ {
+ T* n (new T (a0, a1, a2, a3)); //@@ auto
+ nodes_.insert (n);
+ return *n;
+ }
+
+
+ template <typename N, typename E>
+ void Graph<N, E>::
+ delete_node (N const& nr)
+ {
+ N* n (&nr);
+
+ for (E* e (n->remove_edge_ ()); e != 0; e = n->remove_edge_ ())
+ {
+ // One endpoint of the edge has removed this edge from
+ // its edge set. Now handle the other endpoint.
+ //
+ if (e->left_ () == n) e->right_ ()->remove_edge_ (e);
+ else e->left_ ()->remove_edge_ (e);
+
+ // Delete the edge.
+ //
+ edges_.erase (e);
+
+ delete e; //@@ auto
+ }
+
+ nodes_.erase (n);
+
+ delete n; //@@ auto
+ }
+
+
+ template <typename N, typename E>
+ template <typename T, typename X, typename Y>
+ T& Graph<N, E>::
+ new_edge (X& left, Y& right)
+ {
+ T* e (new T); //@@ auto
+
+ e->set_left_node (left);
+ e->set_right_node (right);
+
+ left.add_edge_left (*e);
+ right.add_edge_right (*e);
+
+ edges_.insert (e);
+
+ return *e;
+ }
+
+ template <typename N, typename E>
+ template <typename T, typename X, typename Y,
+ typename A0>
+ T& Graph<N, E>::
+ new_edge (X& left, Y& right, A0 const& a0)
+ {
+ T* e (new T (a0)); //@@ auto
+
+ e->set_left_node (left);
+ e->set_right_node (right);
+
+ left.add_edge_left (*e);
+ right.add_edge_right (*e);
+
+ edges_.insert (e);
+
+ return *e;
+ }
+
+ template <typename N, typename E>
+ template <typename T, typename X, typename Y,
+ typename A0,
+ typename A1>
+ T& Graph<N, E>::
+ new_edge (X& left, Y& right, A0 const& a0, A1 const& a1)
+ {
+ T* e (new T (a0, a1)); //@@ auto
+
+ e->set_left_node (left);
+ e->set_right_node (right);
+
+ left.add_edge_left (*e);
+ right.add_edge_right (*e);
+
+ edges_.insert (e);
+
+ return *e;
+ }
+
+ template <typename N, typename E>
+ void Graph<N, E>::
+ delete_edge (E const& er)
+ {
+ E* e (&er);
+
+ e->left_ ()->remove_edge_ (e);
+ e->right_ ()->remove_edge_ (e);
+
+ edges_.erase (e);
+
+ delete e; //@@ auto
+ }
+
+
+ template <typename N, typename E>
+ Graph<N, E>::
+ ~Graph ()
+ {
+ //@@ auto
+
+ for (typename Edges_::iterator i (edges_.begin ()), end (edges_.end ());
+ i != end;
+ ++i) delete *i;
+
+ for (typename Nodes_::iterator i (nodes_.begin ()), end (nodes_.end ());
+ i != end;
+ ++i) delete *i;
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp
new file mode 100644
index 00000000000..a6633df762b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.cpp
@@ -0,0 +1,486 @@
+// file : CCF/IDL2/SemanticGraph/IntExpression.cpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // IntExpression
+ //
+ namespace
+ {
+ TypeInfo
+ int_expression_init_ ()
+ {
+ TypeInfo ti (typeid (IntExpression));
+ ti.add_base (Access::PUBLIC, true, Expression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_expression_ (int_expression_init_ ());
+ }
+
+ TypeInfo const& IntExpression::
+ static_type_info () { return int_expression_; }
+
+ IntExpression::
+ ~IntExpression ()
+ {
+ }
+
+ // IntLiteral
+ //
+ namespace
+ {
+ TypeInfo
+ int_literal_init_ ()
+ {
+ TypeInfo ti (typeid (IntLiteral));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_literal_ (int_literal_init_ ());
+ }
+
+ TypeInfo const& IntLiteral::
+ static_type_info () { return int_literal_; }
+
+
+ // IntConst
+ //
+ namespace
+ {
+ TypeInfo
+ int_const_init_ ()
+ {
+ TypeInfo ti (typeid (IntConst));
+ ti.add_base (Access::PUBLIC, true, Const::static_type_info ());
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_const_ (int_const_init_ ());
+ }
+
+ TypeInfo const& IntConst::
+ static_type_info () { return int_const_; }
+
+
+ // NEG
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_negates_init_ ()
+ {
+ TypeInfo ti (typeid (IntNegates));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_negates_ (int_negates_init_ ());
+ }
+
+ TypeInfo const& IntNegates::
+ static_type_info () { return int_negates_; }
+
+ namespace
+ {
+ TypeInfo
+ int_neg_init_ ()
+ {
+ TypeInfo ti (typeid (IntNeg));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_neg_ (int_neg_init_ ());
+ }
+
+ TypeInfo const& IntNeg::
+ static_type_info () { return int_neg_; }
+
+
+ // COM
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_complements_init_ ()
+ {
+ TypeInfo ti (typeid (IntComplements));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_complements_ (int_complements_init_ ());
+ }
+
+ TypeInfo const& IntComplements::
+ static_type_info () { return int_complements_; }
+
+ namespace
+ {
+ TypeInfo
+ int_com_init_ ()
+ {
+ TypeInfo ti (typeid (IntCom));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_com_ (int_com_init_ ());
+ }
+
+ TypeInfo const& IntCom::
+ static_type_info () { return int_com_; }
+
+
+ // MUL
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_multiplies_init_ ()
+ {
+ TypeInfo ti (typeid (IntMultiplies));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_multiplies_ (int_multiplies_init_ ());
+ }
+
+ TypeInfo const& IntMultiplies::
+ static_type_info () { return int_multiplies_; }
+
+ namespace
+ {
+ TypeInfo
+ int_mul_init_ ()
+ {
+ TypeInfo ti (typeid (IntMul));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_mul_ (int_mul_init_ ());
+ }
+
+ TypeInfo const& IntMul::
+ static_type_info () { return int_mul_; }
+
+
+ // DIV
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_divides_init_ ()
+ {
+ TypeInfo ti (typeid (IntDivides));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_divides_ (int_divides_init_ ());
+ }
+
+ TypeInfo const& IntDivides::
+ static_type_info () { return int_divides_; }
+
+ namespace
+ {
+ TypeInfo
+ int_div_init_ ()
+ {
+ TypeInfo ti (typeid (IntDiv));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_div_ (int_div_init_ ());
+ }
+
+ TypeInfo const& IntDiv::
+ static_type_info () { return int_div_; }
+
+ namespace
+ {
+ TypeInfo
+ int_rem_init_ ()
+ {
+ TypeInfo ti (typeid (IntRem));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_rem_ (int_rem_init_ ());
+ }
+
+ TypeInfo const& IntRem::
+ static_type_info () { return int_rem_; }
+
+
+ // ADD
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_adds_init_ ()
+ {
+ TypeInfo ti (typeid (IntAdds));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_adds_ (int_adds_init_ ());
+ }
+
+ TypeInfo const& IntAdds::
+ static_type_info () { return int_adds_; }
+
+ namespace
+ {
+ TypeInfo
+ int_add_init_ ()
+ {
+ TypeInfo ti (typeid (IntAdd));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_add_ (int_add_init_ ());
+ }
+
+ TypeInfo const& IntAdd::
+ static_type_info () { return int_add_; }
+
+
+ // SUB
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_subtracts_init_ ()
+ {
+ TypeInfo ti (typeid (IntSubtracts));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_subtracts_ (int_subtracts_init_ ());
+ }
+
+ TypeInfo const& IntSubtracts::
+ static_type_info () { return int_subtracts_; }
+
+ namespace
+ {
+ TypeInfo
+ int_sub_init_ ()
+ {
+ TypeInfo ti (typeid (IntSub));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_sub_ (int_sub_init_ ());
+ }
+
+ TypeInfo const& IntSub::
+ static_type_info () { return int_sub_; }
+
+
+ // RSH & LSH
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_shifts_init_ ()
+ {
+ TypeInfo ti (typeid (IntShifts));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_shifts_ (int_shifts_init_ ());
+ }
+
+ TypeInfo const& IntShifts::
+ static_type_info () { return int_shifts_; }
+
+ namespace
+ {
+ TypeInfo
+ int_rsh_init_ ()
+ {
+ TypeInfo ti (typeid (IntRsh));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_rsh_ (int_rsh_init_ ());
+ }
+
+ TypeInfo const& IntRsh::
+ static_type_info () { return int_rsh_; }
+
+ namespace
+ {
+ TypeInfo
+ int_lsh_init_ ()
+ {
+ TypeInfo ti (typeid (IntLsh));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_lsh_ (int_lsh_init_ ());
+ }
+
+ TypeInfo const& IntLsh::
+ static_type_info () { return int_lsh_; }
+
+
+ // AND
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_conjuncts_init_ ()
+ {
+ TypeInfo ti (typeid (IntConjuncts));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_conjuncts_ (int_conjuncts_init_ ());
+ }
+
+ TypeInfo const& IntConjuncts::
+ static_type_info () { return int_conjuncts_; }
+
+ namespace
+ {
+ TypeInfo
+ int_and_init_ ()
+ {
+ TypeInfo ti (typeid (IntAnd));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_and_ (int_and_init_ ());
+ }
+
+ TypeInfo const& IntAnd::
+ static_type_info () { return int_and_; }
+
+
+ // XOR
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_exclusively_disjuncts_init_ ()
+ {
+ TypeInfo ti (typeid (IntExclusivelyDisjuncts));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_exclusively_disjuncts_ (
+ int_exclusively_disjuncts_init_ ());
+ }
+
+ TypeInfo const& IntExclusivelyDisjuncts::
+ static_type_info () { return int_exclusively_disjuncts_; }
+
+ namespace
+ {
+ TypeInfo
+ int_xor_init_ ()
+ {
+ TypeInfo ti (typeid (IntXor));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_xor_ (int_xor_init_ ());
+ }
+
+ TypeInfo const& IntXor::
+ static_type_info () { return int_xor_; }
+
+
+ // OR
+ //
+
+ namespace
+ {
+ TypeInfo
+ int_inclusively_disjuncts_init_ ()
+ {
+ TypeInfo ti (typeid (IntInclusivelyDisjuncts));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_inclusively_disjuncts_ (
+ int_inclusively_disjuncts_init_ ());
+ }
+
+ TypeInfo const& IntInclusivelyDisjuncts::
+ static_type_info () { return int_inclusively_disjuncts_; }
+
+ namespace
+ {
+ TypeInfo
+ int_or_init_ ()
+ {
+ TypeInfo ti (typeid (IntOr));
+ ti.add_base (
+ Access::PUBLIC, true, IntExpression::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo int_or_ (int_or_init_ ());
+ }
+
+ TypeInfo const& IntOr::
+ static_type_info () { return int_or_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp
new file mode 100644
index 00000000000..263563e9bb6
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/IntExpression.hpp
@@ -0,0 +1,1013 @@
+// file : CCF/IDL2/SemanticGraph/IntExpression.hpp
+// author : Boris Kolpackov <boris@kolpackov.net>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ class IntExpression: public virtual Expression
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntExpression () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~IntExpression () = 0;
+ };
+
+
+ //
+ //
+ class IntLiteral: public virtual IntExpression
+ {
+ public:
+ unsigned long long
+ value () const
+ {
+ return value_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntLiteral (Path const& path,
+ unsigned long line,
+ unsigned long long value)
+ : Node (path, line), value_ (value)
+ {
+ type_info (static_type_info ());
+ }
+
+ private:
+ unsigned long long value_;
+ };
+
+
+ //
+ //
+ class IntConst: public virtual Const,
+ public virtual IntExpression
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntConst (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ // NEG
+ //
+
+ class IntNeg;
+
+ class IntNegates: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntNegates ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntNeg&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntNeg: public virtual IntExpression
+ {
+ public:
+ IntNegates&
+ negates () const
+ {
+ return *negates_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntNeg (Path const& path, unsigned long line)
+ : Node (path, line), negates_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntNegates& n)
+ {
+ negates_ = &n;
+ }
+
+ private:
+ IntNegates* negates_;
+ };
+
+
+ // COM
+ //
+
+ class IntCom;
+
+ class IntComplements: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntComplements ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntCom&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntCom: public virtual IntExpression
+ {
+ public:
+ IntComplements&
+ complements () const
+ {
+ return *complements_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntCom (Path const& path, unsigned long line)
+ : Node (path, line), complements_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntComplements& n)
+ {
+ complements_ = &n;
+ }
+
+ private:
+ IntComplements* complements_;
+ };
+
+
+ // MUL
+ //
+
+ class IntMul;
+
+ class IntMultiplies: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntMultiplies ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntMul&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntMul: public virtual IntExpression
+ {
+ public:
+ IntMultiplies&
+ first_factor () const
+ {
+ return *first_factor_;
+ }
+
+ IntMultiplies&
+ second_factor () const
+ {
+ return *second_factor_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntMul (Path const& path, unsigned long line)
+ : Node (path, line),
+ first_factor_ (0),
+ second_factor_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntMultiplies& d)
+ {
+ if (first_factor_ == 0)
+ first_factor_ = &d;
+ else
+ second_factor_ = &d;
+ }
+
+ private:
+ IntMultiplies* first_factor_;
+ IntMultiplies* second_factor_;
+ };
+
+
+ // DIV & REM
+ //
+
+ class IntDiv;
+ class IntRem;
+
+ class IntDivides: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntDivides ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntDiv&)
+ {
+ }
+
+ void
+ set_left_node (IntRem&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntDiv: public virtual IntExpression
+ {
+ public:
+ IntDivides&
+ divident () const
+ {
+ return *divident_;
+ }
+
+ IntDivides&
+ divisor () const
+ {
+ return *divisor_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntDiv (Path const& path, unsigned long line)
+ : Node (path, line),
+ divident_ (0),
+ divisor_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntDivides& d)
+ {
+ if (divident_ == 0)
+ divident_ = &d;
+ else
+ divisor_ = &d;
+ }
+
+ private:
+ IntDivides* divident_;
+ IntDivides* divisor_;
+ };
+
+ class IntRem: public virtual IntExpression
+ {
+ public:
+ IntDivides&
+ divident () const
+ {
+ return *divident_;
+ }
+
+ IntDivides&
+ divisor () const
+ {
+ return *divisor_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntRem (Path const& path, unsigned long line)
+ : Node (path, line),
+ divident_ (0),
+ divisor_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntDivides& d)
+ {
+ if (divident_ == 0)
+ divident_ = &d;
+ else
+ divisor_ = &d;
+ }
+
+ private:
+ IntDivides* divident_;
+ IntDivides* divisor_;
+ };
+
+
+ // ADD
+ //
+
+ class IntAdd;
+
+ class IntAdds: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntAdds ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntAdd&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntAdd: public virtual IntExpression
+ {
+ public:
+ IntAdds&
+ first_item () const
+ {
+ return *first_item_;
+ }
+
+ IntAdds&
+ second_item () const
+ {
+ return *second_item_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntAdd (Path const& path, unsigned long line)
+ : Node (path, line),
+ first_item_ (0),
+ second_item_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntAdds& d)
+ {
+ if (first_item_ == 0)
+ first_item_ = &d;
+ else
+ second_item_ = &d;
+ }
+
+ private:
+ IntAdds* first_item_;
+ IntAdds* second_item_;
+ };
+
+
+ // SUB
+ //
+
+ class IntSub;
+
+ class IntSubtracts: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntSubtracts ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntSub&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntSub: public virtual IntExpression
+ {
+ public:
+ IntSubtracts&
+ minuend () const
+ {
+ return *minuend_;
+ }
+
+ IntSubtracts&
+ subtrahend () const
+ {
+ return *subtrahend_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntSub (Path const& path, unsigned long line)
+ : Node (path, line),
+ minuend_ (0),
+ subtrahend_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntSubtracts& d)
+ {
+ if (minuend_ == 0)
+ minuend_ = &d;
+ else
+ subtrahend_ = &d;
+ }
+
+ private:
+ IntSubtracts* minuend_;
+ IntSubtracts* subtrahend_;
+ };
+
+
+ // RSH & LSH
+ //
+
+ class IntRsh;
+ class IntLsh;
+
+ class IntShifts: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntShifts ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntRsh&)
+ {
+ }
+
+ void
+ set_left_node (IntLsh&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntRsh: public virtual IntExpression
+ {
+ public:
+ IntShifts&
+ pattern () const
+ {
+ return *pattern_;
+ }
+
+ IntShifts&
+ factor () const
+ {
+ return *factor_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntRsh (Path const& path, unsigned long line)
+ : Node (path, line),
+ pattern_ (0),
+ factor_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntShifts& d)
+ {
+ if (pattern_ == 0)
+ pattern_ = &d;
+ else
+ factor_ = &d;
+ }
+
+ private:
+ IntShifts* pattern_;
+ IntShifts* factor_;
+ };
+
+ class IntLsh: public virtual IntExpression
+ {
+ public:
+ IntShifts&
+ pattern () const
+ {
+ return *pattern_;
+ }
+
+ IntShifts&
+ factor () const
+ {
+ return *factor_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntLsh (Path const& path, unsigned long line)
+ : Node (path, line),
+ pattern_ (0),
+ factor_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntShifts& d)
+ {
+ if (pattern_ == 0)
+ pattern_ = &d;
+ else
+ factor_ = &d;
+ }
+
+ private:
+ IntShifts* pattern_;
+ IntShifts* factor_;
+ };
+
+
+ // AND
+ //
+
+ class IntAnd;
+
+ class IntConjuncts: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntConjuncts ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntAnd&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntAnd: public virtual IntExpression
+ {
+ public:
+ IntConjuncts&
+ first_pattern () const
+ {
+ return *first_pattern_;
+ }
+
+ IntConjuncts&
+ second_pattern () const
+ {
+ return *second_pattern_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntAnd (Path const& path, unsigned long line)
+ : Node (path, line),
+ first_pattern_ (0),
+ second_pattern_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntConjuncts& d)
+ {
+ if (first_pattern_ == 0)
+ first_pattern_ = &d;
+ else
+ second_pattern_ = &d;
+ }
+
+ private:
+ IntConjuncts* first_pattern_;
+ IntConjuncts* second_pattern_;
+ };
+
+
+ // XOR
+ //
+
+ class IntXor;
+
+ class IntExclusivelyDisjuncts: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntExclusivelyDisjuncts ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntXor&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntXor: public virtual IntExpression
+ {
+ public:
+ IntExclusivelyDisjuncts&
+ first_pattern () const
+ {
+ return *first_pattern_;
+ }
+
+ IntExclusivelyDisjuncts&
+ second_pattern () const
+ {
+ return *second_pattern_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntXor (Path const& path, unsigned long line)
+ : Node (path, line),
+ first_pattern_ (0),
+ second_pattern_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntExclusivelyDisjuncts& d)
+ {
+ if (first_pattern_ == 0)
+ first_pattern_ = &d;
+ else
+ second_pattern_ = &d;
+ }
+
+ private:
+ IntExclusivelyDisjuncts* first_pattern_;
+ IntExclusivelyDisjuncts* second_pattern_;
+ };
+
+
+ // OR
+ //
+
+ class IntOr;
+
+ class IntInclusivelyDisjuncts: public virtual Edge
+ {
+ public:
+ IntExpression&
+ argument () const
+ {
+ return *argument_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntInclusivelyDisjuncts ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (IntOr&)
+ {
+ }
+
+ void
+ set_right_node (IntExpression& e)
+ {
+ argument_ = &e;
+ }
+
+ private:
+ IntExpression* argument_;
+ };
+
+
+ class IntOr: public virtual IntExpression
+ {
+ public:
+ IntInclusivelyDisjuncts&
+ first_pattern () const
+ {
+ return *first_pattern_;
+ }
+
+ IntInclusivelyDisjuncts&
+ second_pattern () const
+ {
+ return *second_pattern_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ IntOr (Path const& path, unsigned long line)
+ : Node (path, line),
+ first_pattern_ (0),
+ second_pattern_ (0)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_left (IntInclusivelyDisjuncts& d)
+ {
+ if (first_pattern_ == 0)
+ first_pattern_ = &d;
+ else
+ second_pattern_ = &d;
+ }
+
+ private:
+ IntInclusivelyDisjuncts* first_pattern_;
+ IntInclusivelyDisjuncts* second_pattern_;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_INT_EXPRESSION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp
new file mode 100644
index 00000000000..4083549f3e2
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.cpp
@@ -0,0 +1,122 @@
+// file : CCF/IDL2/SemanticGraph/Interface.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+
+ // Interface
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ interface_init_ ()
+ {
+ TypeInfo ti (typeid (Interface));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo interface_ (interface_init_ ());
+ }
+
+ TypeInfo const& Interface::
+ static_type_info () { return interface_; }
+
+ Interface::
+ ~Interface ()
+ {
+ }
+
+ // Supports
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ supports_init_ ()
+ {
+ TypeInfo ti (typeid (Supports));
+ ti.add_base (Access::PUBLIC, true, IsA::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo supports_ (supports_init_ ());
+ }
+
+ TypeInfo const& Supports::
+ static_type_info () { return supports_; }
+
+
+ // AbstractInterface
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ abstract_interface_init_ ()
+ {
+ TypeInfo ti (typeid (AbstractInterface));
+ ti.add_base (Access::PUBLIC, true, Interface::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo abstract_interface_ (abstract_interface_init_ ());
+ }
+
+ TypeInfo const& AbstractInterface::
+ static_type_info () { return abstract_interface_; }
+
+
+ // LocalInterface
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ local_interface_init_ ()
+ {
+ TypeInfo ti (typeid (LocalInterface));
+ ti.add_base (Access::PUBLIC, true, Interface::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo local_interface_ (local_interface_init_ ());
+ }
+
+ TypeInfo const& LocalInterface::
+ static_type_info () { return local_interface_; }
+
+
+ // UnconstrainedInterface
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ unconstrained_interface_init_ ()
+ {
+ TypeInfo ti (typeid (UnconstrainedInterface));
+ ti.add_base (Access::PUBLIC, true, Interface::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo unconstrained_interface_ (unconstrained_interface_init_ ());
+ }
+
+ TypeInfo const& UnconstrainedInterface::
+ static_type_info () { return unconstrained_interface_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp
new file mode 100644
index 00000000000..1335b69a6cb
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Interface.hpp
@@ -0,0 +1,181 @@
+// file : CCF/IDL2/SemanticGraph/Interface.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class Interface : public virtual Type, public virtual Scope
+ {
+ typedef
+ std::vector <Inherits*>
+ Inherits_;
+
+ public:
+ typedef
+ Inherits_::const_iterator
+ InheritsIterator;
+
+ InheritsIterator
+ inherits_begin () const
+ {
+ return inherits_.begin ();
+ }
+
+ InheritsIterator
+ inherits_end () const
+ {
+ return inherits_.end ();
+ }
+
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Interface () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Interface () = 0;
+
+ using Type::add_edge_right;
+ using Scope::add_edge_left;
+
+ void
+ add_edge_left (Inherits& e)
+ {
+ inherits_.push_back (&e);
+ }
+
+ void
+ add_edge_right (Inherits&)
+ {
+ }
+
+ private:
+ Inherits_ inherits_;
+ };
+
+
+ //
+ //
+ //
+ class Supports : public virtual IsA
+ {
+ public:
+ virtual Type&
+ supporter () const
+ {
+ return subject ();
+ }
+
+ virtual Type&
+ supportee () const
+ {
+ return object ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Supports ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_right_node (Interface& n)
+ {
+ IsA::set_right_node (n);
+ }
+ };
+
+
+ //
+ //
+ //
+ class AbstractInterface : public virtual Interface
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ AbstractInterface (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class LocalInterface : public virtual Interface
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ LocalInterface (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class UnconstrainedInterface : public virtual Interface
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnconstrainedInterface (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_INTERFACE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp
new file mode 100644
index 00000000000..86c64116b23
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.cpp
@@ -0,0 +1,24 @@
+// file : CCF/IDL2/SemanticGraph/Literals.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Literals.hpp"
+
+#include <ostream>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ }
+ }
+}
+
+std::ostream&
+operator<< (std::ostream& o,
+ CCF::IDL2::SemanticGraph::StringLiteral const& lit)
+{
+ return o << '\"' << lit.literal () << '\"';
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp
new file mode 100644
index 00000000000..b2a350027db
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Literals.hpp
@@ -0,0 +1,56 @@
+// file : CCF/IDL2/SemanticGraph/Literals.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP
+
+#include <string>
+#include <iosfwd>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class StringLiteral
+ {
+ public:
+ StringLiteral (std::string const& literal)
+ : literal_ (literal)
+ {
+ }
+
+ std::string
+ literal () const
+ {
+ return literal_;
+ }
+
+ private:
+ std::string literal_;
+ };
+
+ inline bool
+ operator== (StringLiteral const& a, StringLiteral const& b)
+ {
+ return a.literal () == b.literal ();
+ }
+
+ inline bool
+ operator!= (StringLiteral const& a, StringLiteral const& b)
+ {
+ return a.literal () != b.literal ();
+ }
+ }
+ }
+}
+
+std::ostream&
+operator<< (std::ostream&, CCF::IDL2::SemanticGraph::StringLiteral const&);
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_LITERALS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp
new file mode 100644
index 00000000000..597be660772
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.cpp
@@ -0,0 +1,34 @@
+// file : CCF/IDL2/SemanticGraph/Member.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ namespace
+ {
+ TypeInfo
+ member_init_ ()
+ {
+ TypeInfo ti (typeid (Member));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo member_ (member_init_ ());
+ }
+
+ TypeInfo const& Member::
+ static_type_info () { return member_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp
new file mode 100644
index 00000000000..d37f5a5dd74
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Member.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/SemanticGraph/Member.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Member : public virtual Nameable, public virtual Instance
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Member (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp
new file mode 100644
index 00000000000..9e7aeb542e4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.cpp
@@ -0,0 +1,33 @@
+// file : CCF/IDL2/SemanticGraph/Module.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ namespace
+ {
+ TypeInfo
+ module_init_ ()
+ {
+ TypeInfo ti (typeid (Module));
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo module_ (module_init_ ());
+ }
+
+ TypeInfo const& Module::
+ static_type_info () { return module_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp
new file mode 100644
index 00000000000..8807f2b55bc
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Module.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/SemanticGraph/Module.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Module : public virtual Scope
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Module (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_MODULE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp
new file mode 100644
index 00000000000..374446661df
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.cpp
@@ -0,0 +1,253 @@
+// file : CCF/IDL2/SemanticGraph/Name.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Name.hpp"
+
+#include <ostream>
+
+/*
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+*/
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+
+ // SimpleName
+ //
+ //
+
+ SimpleName::
+ SimpleName (char const* name) throw (InvalidName)
+ : escaped_ (name[0] == '_'),
+ name_ (escaped_ ? name + 1 : name)
+ {
+ if (name_.find (':') != std::string::npos)
+ throw InvalidName ();
+ }
+
+ SimpleName::
+ SimpleName (std::string const& name) throw (InvalidName)
+ : escaped_ (name[0] == '_'),
+ name_ (name, escaped_ ? 1 : 0)
+ {
+ if (name_.find (':') != std::string::npos)
+ throw InvalidName ();
+ }
+
+ SimpleName
+ operator+ (SimpleName const& name, std::string const& str)
+ {
+ return SimpleName (name.str () + str);
+ }
+
+ SimpleName
+ operator+ (std::string const& str, SimpleName const& name)
+ {
+ return SimpleName (str + name.str ());
+ }
+
+ // Name
+ //
+ //
+ Name::
+ Name (SimpleName const& name)
+ : name_cache_ (name.unescaped_str ())
+ {
+ name_.push_back (name);
+ }
+
+ Name::
+ Name (char const* name) throw (InvalidName)
+ {
+ init (name);
+ }
+
+ Name::
+ Name (std::string const& name) throw (InvalidName)
+ {
+ init (name);
+ }
+
+ void Name::
+ init (std::string const& name) throw (InvalidName)
+ {
+ // cerr << "parsing name \'" << name_cache_ << "\' {"<< endl;
+
+ for (std::string::size_type pos (0), next (name.find ("::", pos));;
+ next = name.find ("::", pos))
+ {
+ std::string simple_name (
+ name,
+ pos,
+ next == std::string::npos ? next : next - pos);
+
+ // cerr << "\t\'" << simple_name << '\'' << endl;
+
+ if (simple_name.empty () && !name_.empty ())
+ {
+ // Empty name (file-scope) is only valid when
+ // it is first.
+ //
+ throw InvalidName ();
+ }
+
+ name_.push_back (SimpleName (simple_name));
+ name_cache_ += (pos != 0 ? "::" : "") +
+ name_.back ().unescaped_str ();
+
+ if (next == std::string::npos)
+ break;
+
+ pos = next + 2;
+ }
+
+ // cerr << "parsing name }" << name_cache_ << endl;
+
+ if (name_.empty ())
+ throw InvalidName ();
+ }
+
+
+ Name::
+ Name (Iterator begin, Iterator end) throw (InvalidName)
+ {
+ for (Iterator i (begin); i != end; ++i)
+ {
+ name_cache_ += (i != begin ? "::" : "") + i->unescaped_str ();
+ name_.push_back (*i);
+ }
+
+ if (name_.empty ())
+ throw InvalidName ();
+ }
+
+ bool Name::
+ scoped () const
+ {
+ return name_[0] == SimpleName ("");
+ }
+
+ bool Name::
+ simple () const
+ {
+ return name_.size () == 1;
+ }
+
+ // ScopedName
+ //
+ //
+
+ ScopedName::
+ ScopedName (char const* name) throw (InvalidName)
+ : Name (name)
+ {
+ if (!scoped ()) throw InvalidName ();
+ }
+
+ ScopedName::
+ ScopedName (std::string const& name) throw (InvalidName)
+ : Name (name)
+ {
+ if (!scoped ()) throw InvalidName ();
+ }
+
+ ScopedName::
+ ScopedName (Iterator begin, Iterator end) throw (InvalidName)
+ : Name (begin, end)
+ {
+ if (!scoped ()) throw InvalidName ();
+ }
+
+ ScopedName::
+ ScopedName (Name const& name) throw (InvalidName)
+ : Name (name)
+ {
+ if (!scoped ()) throw InvalidName ();
+ }
+
+ ScopedName::
+ ScopedName (ScopedName const& scope, Name const& name)
+ throw (InvalidName)
+ : Name (scope.str () + "::" + name.str ())
+ {
+ if (!scoped ()) throw InvalidName ();
+ }
+
+ SimpleName ScopedName::
+ simple_name () const
+ {
+ return *(end () - 1);
+ }
+
+ ScopedName ScopedName::
+ scope_name () const throw (FileScope)
+ {
+ Iterator end (this->end () - 1);
+
+ if (begin () == end) throw FileScope ();
+
+ return ScopedName (begin (), end);
+ }
+
+
+ // NamePrinter
+ //
+ int const name_printer_index = std::ios_base::xalloc ();
+
+ NamePrinter::~NamePrinter ()
+ {
+ }
+
+ void NamePrinter::
+ print (std::ostream& os, Name const& n)
+ {
+ for (Name::Iterator b (n.begin ()), i (b); i != n.end (); ++i)
+ {
+ if (i != b)
+ os << "::";
+
+ print (os, *i);
+ }
+ }
+ }
+ }
+}
+
+std::ostream&
+operator << (std::ostream& o,
+ CCF::IDL2::SemanticGraph::SimpleName const& name)
+{
+ using namespace CCF::IDL2::SemanticGraph;
+
+ if (void* tmp = o.pword (name_printer_index))
+ {
+ NamePrinter* p (reinterpret_cast<NamePrinter*> (tmp));
+ p->print (o, name);
+ return o;
+ }
+ else
+ return o << name.str ();
+}
+
+std::ostream&
+operator << (std::ostream& o, CCF::IDL2::SemanticGraph::Name const& name)
+{
+ using namespace CCF::IDL2::SemanticGraph;
+
+ if (void* tmp = o.pword (name_printer_index))
+ {
+ NamePrinter* p (reinterpret_cast<NamePrinter*> (tmp));
+ p->print (o, name);
+ return o;
+ }
+ else
+ return o << name.str ();
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp
new file mode 100644
index 00000000000..50dd752aa6a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Name.hpp
@@ -0,0 +1,239 @@
+// file : CCF/IDL2/SemanticGraph/Name.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP
+
+#include <vector>
+#include <string>
+#include <iosfwd>
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //@@ better names for names: maybe SimpleName, ScopedName, FullName?
+ //
+ //
+
+ class InvalidName {};
+
+ class SimpleName
+ {
+ public:
+ SimpleName (char const* name) throw (InvalidName);
+ SimpleName (std::string const& name) throw (InvalidName);
+
+ public:
+ // Comparisons are escape-insensitive.
+ //
+ bool
+ operator< (SimpleName const& other) const
+ {
+ return name_ < other.name_;
+ }
+
+ bool
+ operator== (SimpleName const& other) const
+ {
+ return name_ == other.name_;
+ }
+
+ bool
+ operator!= (SimpleName const& other) const
+ {
+ return name_ != other.name_;
+ }
+
+ public:
+ bool
+ escaped () const
+ {
+ return escaped_;
+ }
+
+ std::string
+ str () const
+ {
+ return (escaped_ ? "_" : "") + name_;
+ }
+
+ std::string
+ unescaped_str () const
+ {
+ return name_;
+ }
+
+ private:
+ bool escaped_;
+ std::string name_;
+ };
+
+ // The following operators preserve escaping.
+ //
+ SimpleName
+ operator+ (SimpleName const& name, std::string const& str);
+
+ SimpleName
+ operator+ (std::string const& str, SimpleName const& name);
+
+
+ //
+ //
+ //
+ class Name
+ {
+ typedef
+ std::vector<SimpleName>
+ Name_;
+
+ public:
+ Name (SimpleName const& name);
+
+ Name (char const* name) throw (InvalidName);
+ Name (std::string const& name) throw (InvalidName);
+
+ typedef
+ Name_::const_iterator
+ Iterator;
+
+ Name (Iterator begin, Iterator end) throw (InvalidName);
+
+ public:
+ // Comparisons are escape-insensitive.
+ //
+ bool
+ operator< (Name const& other) const
+ {
+ return name_cache_ < other.name_cache_;
+ }
+
+ bool
+ operator== (Name const& other) const
+ {
+ return name_cache_ == other.name_cache_;
+ }
+
+ bool
+ operator!= (Name const& other) const
+ {
+ return name_cache_ != other.name_cache_;
+ }
+
+ public:
+ Iterator
+ begin () const
+ {
+ return name_.begin ();
+ }
+
+ Iterator
+ end () const
+ {
+ return name_.end ();
+ }
+
+ public:
+ bool
+ scoped () const;
+
+ bool
+ simple () const;
+
+ public:
+ std::string
+ str () const
+ {
+ std::string r;
+
+ for (Iterator b (begin ()), i (b), e (end ()); i != e; ++i)
+ r += (i != b ? "::" : "") + i->str ();
+
+ return r;
+ }
+
+ std::string
+ unescaped_str () const
+ {
+ return name_cache_;
+ }
+
+ private:
+ void
+ init (std::string const& name) throw (InvalidName);
+
+ private:
+ Name_ name_;
+ std::string name_cache_; // Unescaped name cache.
+ };
+
+ // Should always start with "::". Can be just "::" which
+ // means it's a file-scope.
+ //
+ //
+ class ScopedName : public Name
+ {
+ public:
+ ScopedName (char const* name) throw (InvalidName);
+
+ ScopedName (std::string const& name) throw (InvalidName);
+
+ ScopedName (Iterator begin, Iterator end) throw (InvalidName);
+
+ explicit
+ ScopedName (Name const& name) throw (InvalidName);
+
+ ScopedName (ScopedName const& scope, Name const& name)
+ throw (InvalidName);
+
+ public:
+ SimpleName
+ simple_name () const;
+
+ class FileScope {};
+
+ ScopedName
+ scope_name () const throw (FileScope);
+ };
+
+
+ // Name printer index for the stream's pword.
+ //
+ extern int const name_printer_index;
+
+ //
+ //
+ struct NamePrinter
+ {
+ virtual ~NamePrinter ();
+
+ virtual void
+ print (std::ostream&, SimpleName const&) = 0;
+
+ // The default implementation prints individul simple names
+ // using the print function above seperated by '::'.
+ //
+ virtual void
+ print (std::ostream&, Name const&);
+
+ };
+ }
+ }
+}
+
+// Uses the name printer (see above) If it is installed, otherwise
+// prints in the escaped form.
+//
+std::ostream&
+operator << (std::ostream&, CCF::IDL2::SemanticGraph::SimpleName const&);
+
+// Uses the name printer (see above) If it is installed, otherwise
+// prints in the escaped form.
+//
+std::ostream&
+operator << (std::ostream& o, CCF::IDL2::SemanticGraph::Name const& name);
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_NAME_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp
new file mode 100644
index 00000000000..b2c29fe2881
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.cpp
@@ -0,0 +1,33 @@
+// file : CCF/IDL2/SemanticGraph/Native.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Native.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ namespace
+ {
+ TypeInfo
+ native_init_ ()
+ {
+ TypeInfo ti (typeid (Native));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo native_ (native_init_ ());
+ }
+
+ TypeInfo const& Native::
+ static_type_info () { return native_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp
new file mode 100644
index 00000000000..89c7b3f6a0e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Native.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticGraph/Native.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Native : public virtual Type
+ {
+ public:
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Native (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_NATIVE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp
new file mode 100644
index 00000000000..690f6d8173d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.cpp
@@ -0,0 +1,228 @@
+// file : CCF/IDL2/SemanticGraph/Operation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Receives
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ receives_init_ ()
+ {
+ TypeInfo ti (typeid (Receives));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo receives_ (receives_init_ ());
+ }
+
+ TypeInfo const& Receives::
+ static_type_info () { return receives_; }
+
+
+ // Returns
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ returns_init_ ()
+ {
+ TypeInfo ti (typeid (Returns));
+ ti.add_base (Access::PUBLIC, true, Belongs::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo returns_ (returns_init_ ());
+ }
+
+ TypeInfo const& Returns::
+ static_type_info () { return returns_; }
+
+
+ // Raises
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ raises_init_ ()
+ {
+ TypeInfo ti (typeid (Raises));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo raises_ (raises_init_ ());
+ }
+
+ TypeInfo const& Raises::
+ static_type_info () { return raises_; }
+
+
+
+ // Parameter
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ parameter_init_ ()
+ {
+ TypeInfo ti (typeid (Parameter));
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo parameter_ (parameter_init_ ());
+ }
+
+ TypeInfo const& Parameter::
+ static_type_info () { return parameter_; }
+
+ Parameter::
+ ~Parameter ()
+ {
+ }
+
+
+ // InParameter
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ in_parameter_init_ ()
+ {
+ TypeInfo ti (typeid (InParameter));
+ ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo in_parameter_ (in_parameter_init_ ());
+ }
+
+ TypeInfo const& InParameter::
+ static_type_info () { return in_parameter_; }
+
+
+ // OutParameter
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ out_parameter_init_ ()
+ {
+ TypeInfo ti (typeid (OutParameter));
+ ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo out_parameter_ (out_parameter_init_ ());
+ }
+
+ TypeInfo const& OutParameter::
+ static_type_info () { return out_parameter_; }
+
+
+ // InOutParameter
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ in_out_parameter_init_ ()
+ {
+ TypeInfo ti (typeid (InOutParameter));
+ ti.add_base (Access::PUBLIC, true, Parameter::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo in_out_parameter_ (in_out_parameter_init_ ());
+ }
+
+ TypeInfo const& InOutParameter::
+ static_type_info () { return in_out_parameter_; }
+
+
+ // Operation
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ operation_init_ ()
+ {
+ TypeInfo ti (typeid (Operation));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo operation_ (operation_init_ ());
+ }
+
+ TypeInfo const& Operation::
+ static_type_info () { return operation_; }
+
+ Operation::
+ ~Operation ()
+ {
+ }
+
+
+ // OneWayOperation
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ one_way_operation_init_ ()
+ {
+ TypeInfo ti (typeid (OneWayOperation));
+ ti.add_base (Access::PUBLIC, true, Operation::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo one_way_operation_ (one_way_operation_init_ ());
+ }
+
+ TypeInfo const& OneWayOperation::
+ static_type_info () { return one_way_operation_; }
+
+
+ // TwoWayOperation
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ two_way_operation_init_ ()
+ {
+ TypeInfo ti (typeid (TwoWayOperation));
+ ti.add_base (Access::PUBLIC, true, Operation::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo two_way_operation_ (two_way_operation_init_ ());
+ }
+
+ TypeInfo const& TwoWayOperation::
+ static_type_info () { return two_way_operation_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp
new file mode 100644
index 00000000000..2f0a5d1686a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Operation.hpp
@@ -0,0 +1,359 @@
+// file : CCF/IDL2/SemanticGraph/Operation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP
+
+#include <string>
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Operation;
+ class Parameter;
+
+ // Operation receives parameter
+ //
+ //
+ class Receives : public virtual Edge
+ {
+ public:
+ Operation&
+ operation () const
+ {
+ return *operation_;
+ }
+
+ Parameter&
+ parameter () const
+ {
+ return *parameter_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Receives ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Operation& n)
+ {
+ operation_ = &n;
+ }
+
+ void
+ set_right_node (Parameter& n)
+ {
+ parameter_ = &n;
+ }
+
+ private:
+ Operation* operation_;
+ Parameter* parameter_;
+ };
+
+
+ // Operation returns
+ //
+ //
+ class Returns : public virtual Belongs
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Returns ()
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ // Raises
+ //
+ //
+ class Raises : public virtual Edge
+ {
+ public:
+ Operation&
+ operation () const
+ {
+ return *operation_;
+ }
+
+ Exception&
+ exception () const
+ {
+ return *exception_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Raises ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Operation& n)
+ {
+ operation_ = &n;
+ }
+
+ void
+ set_right_node (Exception& n)
+ {
+ exception_ = &n;
+ }
+
+ private:
+ Operation* operation_;
+ Exception* exception_;
+ };
+
+
+ //
+ //
+ //
+ class Parameter : public virtual Instance
+ {
+ public:
+ std::string
+ name () const
+ {
+ return name_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Parameter (std::string const& name) // For virtual inheritance only.
+ : name_ (name)
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Parameter () = 0;
+
+ void
+ add_edge_right (Receives&)
+ {
+ }
+
+ private:
+ std::string name_;
+ };
+
+
+ class InParameter : public virtual Parameter
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ InParameter (Path const& path,
+ unsigned long line,
+ std::string const& name)
+ : Node (path, line), Parameter (name)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+ class OutParameter : public virtual Parameter
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ OutParameter (Path const& path,
+ unsigned long line,
+ std::string const& name)
+ : Node (path, line), Parameter (name)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+ class InOutParameter : public virtual Parameter
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ InOutParameter (Path const& path,
+ unsigned long line,
+ std::string const& name)
+ : Node (path, line), Parameter (name)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Operation : public virtual Nameable, public virtual Instance
+ {
+ typedef
+ std::vector<Receives*>
+ Receives_;
+
+ typedef
+ std::vector<Raises*>
+ Raises_;
+
+ public:
+ typedef
+ Receives_::const_iterator
+ ReceivesIterator;
+
+ ReceivesIterator
+ receives_begin () const
+ {
+ return receives_.begin ();
+ }
+
+ ReceivesIterator
+ receives_end () const
+ {
+ return receives_.end ();
+ }
+
+ typedef
+ Raises_::const_iterator
+ RaisesIterator;
+
+ RaisesIterator
+ raises_begin () const
+ {
+ return raises_.begin ();
+ }
+
+ RaisesIterator
+ raises_end () const
+ {
+ return raises_.end ();
+ }
+
+ Returns&
+ returns () const
+ {
+ return dynamic_cast<Returns&> (belongs ());
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Operation () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Operation () = 0;
+
+
+ void
+ add_edge_left (Receives& e)
+ {
+ receives_.push_back (&e);
+ }
+
+ void
+ add_edge_left (Raises& e)
+ {
+ raises_.push_back (&e);
+ }
+
+ void
+ add_edge_left (Returns& e)
+ {
+ Instance::add_edge_left (e);
+ }
+
+ private:
+ Receives_ receives_;
+ Raises_ raises_;
+ };
+
+
+ //
+ //
+ //
+ class OneWayOperation : public virtual Operation
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ OneWayOperation (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class TwoWayOperation : public virtual Operation
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ TwoWayOperation (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_OPERATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp
new file mode 100644
index 00000000000..5c95be2c67c
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.cpp
@@ -0,0 +1,82 @@
+// file : CCF/IDL2/SemanticGraph/Sequence.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Sequence.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // Sequence
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ sequence_init_ ()
+ {
+ TypeInfo ti (typeid (Sequence));
+ ti.add_base (
+ Access::PUBLIC, true, Specialization::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo sequence_ (sequence_init_ ());
+ }
+
+ TypeInfo const& Sequence::
+ static_type_info () { return sequence_; }
+
+ Sequence::
+ ~Sequence ()
+ {
+ }
+
+
+ // UnboundedSequence
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ unbounded_sequence_init_ ()
+ {
+ TypeInfo ti (typeid (UnboundedSequence));
+ ti.add_base (Access::PUBLIC, true, Sequence::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo unbounded_sequence_ (unbounded_sequence_init_ ());
+ }
+
+ TypeInfo const& UnboundedSequence::
+ static_type_info () { return unbounded_sequence_; }
+
+
+ // BoundedSequence
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ bounded_sequence_init_ ()
+ {
+ TypeInfo ti (typeid (BoundedSequence));
+ ti.add_base (Access::PUBLIC, true, Sequence::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo bounded_sequence_ (bounded_sequence_init_ ());
+ }
+
+ TypeInfo const& BoundedSequence::
+ static_type_info () { return bounded_sequence_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp
new file mode 100644
index 00000000000..333b55fed2a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Sequence.hpp
@@ -0,0 +1,106 @@
+// file : CCF/IDL2/SemanticGraph/Sequence.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class Sequence : public virtual Specialization
+ {
+ public:
+ Type&
+ type () const
+ {
+ return
+ dynamic_cast<ArgumentsWithType&> (**arguments_begin ()).type ();
+ }
+
+ virtual bool
+ complete () const
+ {
+ return type ().complete ();
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Sequence () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Sequence () = 0;
+ };
+
+
+ //
+ //
+ //
+ class UnboundedSequence : public virtual Sequence
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnboundedSequence (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class BoundedSequence : public virtual Sequence
+ {
+ public:
+ IntExpression&
+ bound () const
+ {
+ ArgumentsIterator i (arguments_begin ());
+
+ ++i; // Bound is always second to the type.
+
+ return
+ dynamic_cast<IntExpression&> (
+ dynamic_cast<ArgumentsWithValue&> (**i).value ());
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ BoundedSequence (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_SEQUENCE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp
new file mode 100644
index 00000000000..578c87361d4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/String.cpp
@@ -0,0 +1,58 @@
+// file : CCF/IDL2/SemanticGraph/String.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/String.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // BoundedString
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ bounded_string_init_ ()
+ {
+ TypeInfo ti (typeid (BoundedString));
+ ti.add_base (
+ Access::PUBLIC, true, Specialization::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo bounded_string_ (bounded_string_init_ ());
+ }
+
+ TypeInfo const& BoundedString::
+ static_type_info () { return bounded_string_; }
+
+
+ // BoundedWideString
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ bounded_wide_string_init_ ()
+ {
+ TypeInfo ti (typeid (BoundedWideString));
+ ti.add_base (
+ Access::PUBLIC, true, Specialization::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo bounded_wide_string_ (bounded_wide_string_init_ ());
+ }
+
+ TypeInfo const& BoundedWideString::
+ static_type_info () { return bounded_wide_string_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp
new file mode 100644
index 00000000000..484a8a778ec
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/String.hpp
@@ -0,0 +1,87 @@
+// file : CCF/IDL2/SemanticGraph/String.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ class BoundedString : public virtual Specialization
+ {
+ public:
+ IntExpression&
+ bound () const
+ {
+ return
+ dynamic_cast<IntExpression&> (
+ dynamic_cast<ArgumentsWithValue&> (
+ **arguments_begin ()).value ());
+ }
+
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ BoundedString (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ class BoundedWideString : public virtual Specialization
+ {
+ public:
+ IntExpression&
+ bound () const
+ {
+ return
+ dynamic_cast<IntExpression&> (
+ dynamic_cast<ArgumentsWithValue&> (
+ **arguments_begin ()).value ());
+ }
+
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ BoundedWideString (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_STRING_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp
new file mode 100644
index 00000000000..46fd9b9ef3a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.cpp
@@ -0,0 +1,67 @@
+// file : CCF/IDL2/SemanticGraph/Struct.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Struct.hpp"
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ namespace
+ {
+ TypeInfo
+ struct_init_ ()
+ {
+ TypeInfo ti (typeid (Struct));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo struct_ (struct_init_ ());
+ }
+
+ TypeInfo const& Struct::
+ static_type_info () { return struct_; }
+
+ bool Struct::
+ complete () const
+ {
+ if (defined ())
+ {
+ CompilerElements::Context& ctx (
+ const_cast<CompilerElements::Context&> (context ()));
+
+ if (ctx.count ("struct-complete-test"))
+ return true;
+
+ ctx.set ("struct-complete-test", true);
+ bool c (true);
+
+ for (Scope::NamesIterator i (names_begin ());
+ c && i != names_end ();
+ ++i)
+ {
+ Member const& m (dynamic_cast<Member&> ((*i)->named ()));
+ Type const& t (m.belongs ().type ());
+
+ if (!t.complete ())
+ c = false;
+ }
+
+ ctx.remove ("struct-complete-test");
+ return c;
+ }
+
+ return false;
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp
new file mode 100644
index 00000000000..5e186bfd0ff
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Struct.hpp
@@ -0,0 +1,41 @@
+// file : CCF/IDL2/SemanticGraph/Struct.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Struct : public virtual Type, public virtual Scope
+ {
+ public:
+ virtual bool
+ complete () const;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Struct (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ using Type::add_edge_right;
+ using Scope::add_edge_left;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_STRUCT_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp
new file mode 100644
index 00000000000..b925da62259
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.cpp
@@ -0,0 +1,255 @@
+// file : CCF/IDL2/SemanticGraph/Translation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Translation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // ContainsPrincipal
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ contains_principal_init_ ()
+ {
+ TypeInfo ti (typeid (ContainsPrincipal));
+ ti.add_base (Access::PUBLIC, true, Contains::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo contains_principal_ (contains_principal_init_ ());
+ }
+
+ TypeInfo const& ContainsPrincipal::
+ static_type_info () { return contains_principal_; }
+
+
+ // ContainsImplied
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ contains_implied_init_ ()
+ {
+ TypeInfo ti (typeid (ContainsImplied));
+ ti.add_base (Access::PUBLIC, true, Contains::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo contains_implied_ (contains_implied_init_ ());
+ }
+
+ TypeInfo const& ContainsImplied::
+ static_type_info () { return contains_implied_; }
+
+
+ // ContainsRoot
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ contains_root_init_ ()
+ {
+ TypeInfo ti (typeid (ContainsRoot));
+ ti.add_base (Access::PUBLIC, true, Contains::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo contains_root_ (contains_root_init_ ());
+ }
+
+ TypeInfo const& ContainsRoot::
+ static_type_info () { return contains_root_; }
+
+
+ // Includes
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ includes_init_ ()
+ {
+ TypeInfo ti (typeid (Includes));
+ ti.add_base (Access::PUBLIC, true, Contains::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo includes_ (includes_init_ ());
+ }
+
+ TypeInfo const& Includes::
+ static_type_info () { return includes_; }
+
+
+ // QuoteIncludes
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ quote_includes_init_ ()
+ {
+ TypeInfo ti (typeid (QuoteIncludes));
+ ti.add_base (Access::PUBLIC, true, Includes::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo quote_includes_ (quote_includes_init_ ());
+ }
+
+ TypeInfo const& QuoteIncludes::
+ static_type_info () { return quote_includes_; }
+
+
+
+ // BracketIncludes
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ bracket_includes_init_ ()
+ {
+ TypeInfo ti (typeid (BracketIncludes));
+ ti.add_base (Access::PUBLIC, true, Includes::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo bracket_includes_ (bracket_includes_init_ ());
+ }
+
+ TypeInfo const& BracketIncludes::
+ static_type_info () { return bracket_includes_; }
+
+
+ // Root
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ root_init_ ()
+ {
+ TypeInfo ti (typeid (Root));
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo root_ (root_init_ ());
+ }
+
+ TypeInfo const& Root::
+ static_type_info () { return root_; }
+
+
+ // TranslationRegion
+ //
+ //
+
+ Nameables TranslationRegion::
+ lookup (ScopedName const& name) const
+ {
+ Nameables r;
+ lookup (name, r);
+ return r;
+ }
+
+ void TranslationRegion::
+ lookup (ScopedName const& name, Nameables& result) const
+ {
+ bool root (name.simple ());
+
+ Name rest (name.begin () + (root ? 0 : 1), name.end ());
+
+ for (ContainsIterator i (contains_begin ()), end (contains_end ());
+ i != end; ++i)
+ {
+ Node& node ((**i).element ());
+
+ if (Root* r = dynamic_cast<Root*> (&node))
+ {
+ if (root)
+ {
+ result.insert (r);
+ }
+ else
+ {
+ r->lookup (rest, result);
+ }
+ }
+ else
+ {
+ dynamic_cast<TranslationRegion&> (node).lookup (name, result);
+ }
+ }
+ }
+
+
+ namespace
+ {
+ TypeInfo
+ translation_region_init_ ()
+ {
+ TypeInfo ti (typeid (TranslationRegion));
+ ti.add_base (Access::PUBLIC, true, Container::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo translation_region_ (translation_region_init_ ());
+ }
+
+ TypeInfo const& TranslationRegion::
+ static_type_info () { return translation_region_; }
+
+
+ // TranslationUnit
+ //
+ //
+
+ Nameables TranslationUnit::
+ lookup (ScopedName const& name) const
+ {
+ Nameables r;
+
+ for (ContainsIterator i (contains_begin ()), end (contains_end ());
+ i != end; ++i)
+ {
+ TranslationRegion& tr (
+ dynamic_cast<TranslationRegion&>((**i).element ()));
+
+ tr.lookup (name, r);
+ }
+
+ return r;
+ }
+
+ namespace
+ {
+ TypeInfo
+ translation_unit_init_ ()
+ {
+ TypeInfo ti (typeid (TranslationUnit));
+ ti.add_base (Access::PUBLIC, true, Container::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo translation_unit_ (translation_unit_init_ ());
+ }
+
+ TypeInfo const& TranslationUnit::
+ static_type_info () { return translation_unit_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp
new file mode 100644
index 00000000000..42df2ed2c13
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.hpp
@@ -0,0 +1,287 @@
+// file : CCF/IDL2/SemanticGraph/Translation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP
+
+#include <vector>
+#include <string>
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Root;
+ class TranslationRegion;
+ class TranslationUnit;
+
+
+ //
+ //
+ //
+ class ContainsPrincipal : public virtual Contains
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ContainsPrincipal ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (TranslationUnit& n);
+
+ void
+ set_right_node (TranslationRegion& n);
+ };
+
+
+ //
+ //
+ //
+ class ContainsImplied : public virtual Contains
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ContainsImplied (std::string const& name = "")
+ : name_ (name)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (TranslationUnit& n);
+
+ void
+ set_right_node (TranslationRegion& n);
+
+ private:
+ std::string name_;
+ };
+
+
+ //
+ //
+ //
+ class ContainsRoot : public virtual Contains
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ContainsRoot ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (TranslationRegion& n);
+
+ void
+ set_right_node (Root& n);
+ };
+
+ //
+ //
+ //
+ class Includes : public virtual Contains
+ {
+ public:
+ Path
+ file () const
+ {
+ return file_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Includes (Path const& file)
+ : file_ (file)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (TranslationRegion& n);
+
+ void
+ set_right_node (TranslationRegion& n);
+
+ private:
+ Path file_;
+ };
+
+
+ //
+ //
+ //
+ class QuoteIncludes : public virtual Includes
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ QuoteIncludes (Path const& file)
+ : Includes (file)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class BracketIncludes : public virtual Includes
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ BracketIncludes (Path const& file)
+ : Includes (file)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class Root : public virtual Scope
+ {
+ public:
+ virtual SimpleName
+ name () const
+ {
+ return SimpleName ("");
+ }
+
+ virtual ScopedName
+ scoped_name () const
+ {
+ return ScopedName ("");
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Root (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_right (Contains&)
+ {
+ // TranslationRegion contains Root
+ }
+ };
+
+
+ //
+ //
+ //
+ class TranslationRegion : public virtual Container
+ {
+ public:
+ Nameables
+ lookup (ScopedName const& name) const;
+
+ void
+ lookup (ScopedName const& name, Nameables& result) const;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ TranslationRegion (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ add_edge_right (Contains&)
+ {
+ }
+ };
+
+
+ class TranslationUnit : public virtual Container,
+ public Graph<Node, Edge>
+ {
+ public:
+ TranslationUnit (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ Nameables
+ lookup (ScopedName const& name) const;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ void
+ add_edge_left (ContainsPrincipal& e)
+ {
+ Container::add_edge_left (e);
+ }
+
+ void
+ add_edge_left (ContainsImplied& e)
+ {
+ Container::add_edge_left (e);
+ }
+
+ private:
+ TranslationUnit (TranslationUnit const&);
+ void operator= (TranslationUnit const&);
+ };
+ }
+ }
+}
+
+#include "CCF/IDL2/SemanticGraph/Translation.ipp"
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_TRANSLATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp
new file mode 100644
index 00000000000..8168cd87762
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Translation.ipp
@@ -0,0 +1,73 @@
+// file : CCF/IDL2/SemanticGraph/Translation.ipp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ // ContainsPrincipal
+ //
+ //
+ inline void ContainsPrincipal::
+ set_left_node (TranslationUnit& n)
+ {
+ Contains::set_left_node (n);
+ }
+
+ inline void ContainsPrincipal::
+ set_right_node (TranslationRegion& n)
+ {
+ Contains::set_right_node (n);
+ }
+
+ // ContainsImplied
+ //
+ //
+ inline void ContainsImplied::
+ set_left_node (TranslationUnit& n)
+ {
+ Contains::set_left_node (n);
+ }
+
+ inline void ContainsImplied::
+ set_right_node (TranslationRegion& n)
+ {
+ Contains::set_right_node (n);
+ }
+
+ // ContainsRoot
+ //
+ //
+ inline void ContainsRoot::
+ set_left_node (TranslationRegion& n)
+ {
+ Contains::set_left_node (n);
+ }
+
+ inline void ContainsRoot::
+ set_right_node (Root& n)
+ {
+ Contains::set_right_node (n);
+ }
+
+
+ // Includes
+ //
+ //
+ inline void Includes::
+ set_left_node (TranslationRegion& n)
+ {
+ Contains::set_left_node (n);
+ }
+
+ inline void Includes::
+ set_right_node (TranslationRegion& n)
+ {
+ Contains::set_right_node (n);
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp
new file mode 100644
index 00000000000..7f7a1f69479
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.cpp
@@ -0,0 +1,56 @@
+// file : CCF/IDL2/SemanticGraph/TypeId.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/TypeId.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // TypeId
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ type_id_init_ ()
+ {
+ TypeInfo ti (typeid (TypeId));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo type_id_ (type_id_init_ ());
+ }
+
+ TypeInfo const& TypeId::
+ static_type_info () { return type_id_; }
+
+
+ // TypePrefix
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ type_prefix_init_ ()
+ {
+ TypeInfo ti (typeid (TypePrefix));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo type_prefix_ (type_prefix_init_ ());
+ }
+
+ TypeInfo const& TypePrefix::
+ static_type_info () { return type_prefix_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp
new file mode 100644
index 00000000000..accb6f83226
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/TypeId.hpp
@@ -0,0 +1,104 @@
+// file : CCF/IDL2/SemanticGraph/TypeId.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Literals.hpp"
+
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class TypeId : public virtual Nameable
+ {
+ public:
+ //@@ declaration is a bad name.
+ //
+ ScopedName
+ declaration () const
+ {
+ return name_;
+ }
+
+ StringLiteral
+ id () const
+ {
+ return id_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ TypeId (Path const& path,
+ unsigned long line,
+ ScopedName const& name,
+ StringLiteral const& id)
+ : Node (path, line),
+ name_ (name),
+ id_ (id)
+ {
+ type_info (static_type_info ());
+ }
+
+ private:
+ ScopedName name_;
+ StringLiteral id_;
+ };
+
+
+ //
+ //
+ //
+ class TypePrefix : public virtual Nameable
+ {
+ public:
+ ScopedName
+ declaration () const
+ {
+ return name_;
+ }
+
+ StringLiteral
+ prefix () const
+ {
+ return prefix_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ TypePrefix (Path const& path,
+ unsigned long line,
+ ScopedName const& name,
+ StringLiteral const& prefix)
+ : Node (path, line),
+ name_ (name),
+ prefix_ (prefix)
+ {
+ type_info (static_type_info ());
+ }
+
+ private:
+ ScopedName name_;
+ StringLiteral prefix_;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_TYPE_ID_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp
new file mode 100644
index 00000000000..4fccb9a0ebc
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.cpp
@@ -0,0 +1,177 @@
+// file : CCF/IDL2/SemanticGraph/Union.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/Union.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+
+ // Selects
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ selects_init_ ()
+ {
+ TypeInfo ti (typeid (Selects));
+ ti.add_base (Access::PUBLIC, true, Edge::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo selects_ (selects_init_ ());
+ }
+
+ TypeInfo const& Selects::
+ static_type_info () { return selects_; }
+
+
+ // UnionMember
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ union_member_init_ ()
+ {
+ TypeInfo ti (typeid (UnionMember));
+ ti.add_base (Access::PUBLIC, true, Member::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo union_member_ (union_member_init_ ());
+ }
+
+ TypeInfo const& UnionMember::
+ static_type_info () { return union_member_; }
+
+
+ // Selector
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ selector_init_ ()
+ {
+ TypeInfo ti (typeid (Selector));
+ ti.add_base (Access::PUBLIC, true, Node::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo selector_ (selector_init_ ());
+ }
+
+ TypeInfo const& Selector::
+ static_type_info () { return selector_; }
+
+ Selector::
+ ~Selector ()
+ {
+ }
+
+ // DefaultSelector
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ default_selector_init_ ()
+ {
+ TypeInfo ti (typeid (DefaultSelector));
+ ti.add_base (Access::PUBLIC, true, Selector::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo default_selector_ (default_selector_init_ ());
+ }
+
+ TypeInfo const& DefaultSelector::
+ static_type_info () { return default_selector_; }
+
+
+ // ValueSelector
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_selector_init_ ()
+ {
+ TypeInfo ti (typeid (ValueSelector));
+ ti.add_base (Access::PUBLIC, true, Selector::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo value_selector_ (value_selector_init_ ());
+ }
+
+ TypeInfo const& ValueSelector::
+ static_type_info () { return value_selector_; }
+
+ // Union
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ union_init_ ()
+ {
+ TypeInfo ti (typeid (Union));
+
+ ti.add_base (
+ Access::PUBLIC, true, Specialization::static_type_info ());
+
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo union_ (union_init_ ());
+ }
+
+ TypeInfo const& Union::
+ static_type_info () { return union_; }
+
+ bool Union::
+ complete () const
+ {
+ if (defined ())
+ {
+ CompilerElements::Context& ctx (
+ const_cast<CompilerElements::Context&> (context ()));
+
+ if (ctx.count ("union-complete-test"))
+ return true;
+
+ ctx.set ("union-complete-test", true);
+ bool c (true);
+
+ for (Scope::NamesIterator i (names_begin ());
+ c && i != names_end ();
+ ++i)
+ {
+ Member const& m (dynamic_cast<Member&> ((*i)->named ()));
+ Type const& t (m.belongs ().type ());
+
+ if (!t.complete ())
+ c = false;
+ }
+
+ ctx.remove ("union-complete-test");
+ return c;
+ }
+
+ return false;
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp
new file mode 100644
index 00000000000..2512358db03
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/Union.hpp
@@ -0,0 +1,158 @@
+// file : CCF/IDL2/SemanticGraph/Union.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ class Selector;
+ class UnionMember;
+
+ class Selects : public virtual Edge
+ {
+ public:
+ Selector&
+ selector () const
+ {
+ return *selector_;
+ }
+
+ UnionMember&
+ member () const
+ {
+ return *member_;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Selects ()
+ {
+ type_info (static_type_info ());
+ }
+
+ void
+ set_left_node (Selector& n)
+ {
+ selector_ = &n;
+ }
+
+ void
+ set_right_node (UnionMember& n)
+ {
+ member_ = &n;
+ }
+
+ private:
+ Selector* selector_;
+ UnionMember* member_;
+ };
+
+ class UnionMember : public virtual Member
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ UnionMember (Path const& path, unsigned long line)
+ : Node (path, line), Member (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+ class Selector : public virtual Node
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Selector () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~Selector () = 0;
+ };
+
+ class DefaultSelector : public virtual Selector
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ DefaultSelector (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+ class ValueSelector : public virtual Selector,
+ public virtual Instance
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueSelector (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+ class Union : public virtual Specialization,
+ public virtual Scope
+ {
+ public:
+ virtual bool
+ complete () const;
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ Union (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+
+ using Specialization::add_edge_left;
+ using Specialization::add_edge_right;
+ using Scope::add_edge_left;
+ using Scope::add_edge_right;
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_UNION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp
new file mode 100644
index 00000000000..1d151613dcc
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.cpp
@@ -0,0 +1,102 @@
+// file : CCF/IDL2/SemanticGraph/ValueType.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/ValueType.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+ // ValueType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_type_init_ ()
+ {
+ TypeInfo ti (typeid (ValueType));
+ ti.add_base (Access::PUBLIC, true, Type::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Scope::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo value_type_ (value_type_init_ ());
+ }
+
+ TypeInfo const& ValueType::
+ static_type_info () { return value_type_; }
+
+ ValueType::
+ ~ValueType ()
+ {
+ }
+
+ // AbstractValueType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ abstract_value_type_init_ ()
+ {
+ TypeInfo ti (typeid (AbstractValueType));
+ ti.add_base (Access::PUBLIC, true, ValueType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo abstract_value_type_ (abstract_value_type_init_ ());
+ }
+
+ TypeInfo const& AbstractValueType::
+ static_type_info () { return abstract_value_type_; }
+
+
+ // ConcreteValueType
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ concrete_value_type_init_ ()
+ {
+ TypeInfo ti (typeid (ConcreteValueType));
+ ti.add_base (Access::PUBLIC, true, ValueType::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo concrete_value_type_ (concrete_value_type_init_ ());
+ }
+
+ TypeInfo const& ConcreteValueType::
+ static_type_info () { return concrete_value_type_; }
+
+
+ // ValueTypeFactory
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_type_factory_init_ ()
+ {
+ TypeInfo ti (typeid (ValueTypeFactory));
+ ti.add_base (
+ Access::PUBLIC, true, TwoWayOperation::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo value_type_factory_ (value_type_factory_init_ ());
+ }
+
+ TypeInfo const& ValueTypeFactory::
+ static_type_info () { return value_type_factory_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp
new file mode 100644
index 00000000000..f918ee17dc6
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueType.hpp
@@ -0,0 +1,174 @@
+// file : CCF/IDL2/SemanticGraph/ValueType.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+#include "CCF/IDL2/SemanticGraph/Interface.hpp" // Supports
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ //
+ //
+ //
+ class ValueType : public virtual Type,
+ public virtual Scope
+ {
+ typedef
+ std::vector <Inherits*>
+ Inherits_;
+
+ typedef
+ std::vector <Supports*>
+ Supports_;
+
+ public:
+ typedef
+ Inherits_::const_iterator
+ InheritsIterator;
+
+ InheritsIterator
+ inherits_begin () const
+ {
+ return inherits_.begin ();
+ }
+
+ InheritsIterator
+ inherits_end () const
+ {
+ return inherits_.end ();
+ }
+
+ typedef
+ Supports_::const_iterator
+ SupportsIterator;
+
+ SupportsIterator
+ supports_begin () const
+ {
+ return supports_.begin ();
+ }
+
+ SupportsIterator
+ supports_end () const
+ {
+ return supports_.end ();
+ }
+
+ public:
+ virtual bool
+ complete () const
+ {
+ return true;
+ }
+
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueType () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~ValueType () = 0;
+
+ using Type::add_edge_right;
+ using Scope::add_edge_left;
+
+ void
+ add_edge_left (Inherits& e)
+ {
+ inherits_.push_back (&e);
+ }
+
+ void
+ add_edge_right (Inherits&)
+ {
+ }
+
+ void
+ add_edge_left (Supports& e)
+ {
+ supports_.push_back (&e);
+ }
+
+ private:
+ Inherits_ inherits_;
+ Supports_ supports_;
+ };
+
+
+ //
+ //
+ //
+ class AbstractValueType : public virtual ValueType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ AbstractValueType (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class ConcreteValueType : public virtual ValueType
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ConcreteValueType (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class ValueTypeFactory : public virtual TwoWayOperation
+ {
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueTypeFactory (Path const& path, unsigned long line)
+ : Node (path, line), TwoWayOperation (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp
new file mode 100644
index 00000000000..0afeabd5fd0
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.cpp
@@ -0,0 +1,90 @@
+// file : CCF/IDL2/SemanticGraph/ValueTypeMember.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+ using Introspection::TypeInfo;
+ using Introspection::Access;
+
+
+ // ValueTypeMember
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_type_member_init_ ()
+ {
+ TypeInfo ti (typeid (ValueTypeMember));
+ ti.add_base (Access::PUBLIC, true, Nameable::static_type_info ());
+ ti.add_base (Access::PUBLIC, true, Instance::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo
+ value_type_member_ (value_type_member_init_ ());
+ }
+
+ TypeInfo const& ValueTypeMember::
+ static_type_info () { return value_type_member_; }
+
+ ValueTypeMember::
+ ~ValueTypeMember ()
+ {
+ }
+
+
+ // ValueTypePrivateMember
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_type_private_member_init_ ()
+ {
+ TypeInfo ti (typeid (ValueTypePrivateMember));
+ ti.add_base (Access::PUBLIC,
+ true,
+ ValueTypeMember::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo
+ value_type_private_member_ (value_type_private_member_init_ ());
+ }
+
+ TypeInfo const& ValueTypePrivateMember::
+ static_type_info () { return value_type_private_member_; }
+
+
+ // ValueTypePublicMember
+ //
+ //
+ namespace
+ {
+ TypeInfo
+ value_type_public_member_init_ ()
+ {
+ TypeInfo ti (typeid (ValueTypePublicMember));
+ ti.add_base (Access::PUBLIC,
+ true,
+ ValueTypeMember::static_type_info ());
+ return ti;
+ }
+
+ TypeInfo
+ value_type_public_member_ (value_type_public_member_init_ ());
+ }
+
+ TypeInfo const& ValueTypePublicMember::
+ static_type_info () { return value_type_public_member_; }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp
new file mode 100644
index 00000000000..47649de0c6a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/SemanticGraph/ValueTypeMember.hpp
@@ -0,0 +1,107 @@
+// file : CCF/IDL2/SemanticGraph/ValueTypeMember.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP
+#define CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace SemanticGraph
+ {
+
+ //
+ //
+ //
+ class ValueTypeMember : public virtual Nameable,
+ public virtual Instance
+ {
+ public:
+ struct Access
+ {
+ enum Value
+ {
+ public_,
+ private_
+ };
+ };
+
+ virtual Access::Value
+ access () const = 0;
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ ValueTypeMember () // For virtual inheritance only.
+ {
+ type_info (static_type_info ());
+ }
+
+ virtual
+ ~ValueTypeMember () = 0;
+ };
+
+
+ //
+ //
+ //
+ class ValueTypePrivateMember : public virtual ValueTypeMember
+ {
+ public:
+ virtual Access::Value
+ access () const
+ {
+ return Access::private_;
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueTypePrivateMember (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+
+
+ //
+ //
+ //
+ class ValueTypePublicMember : public virtual ValueTypeMember
+ {
+ public:
+ virtual Access::Value
+ access () const
+ {
+ return Access::public_;
+ }
+
+ public:
+ static Introspection::TypeInfo const&
+ static_type_info ();
+
+ protected:
+ friend class Graph<Node, Edge>;
+
+ ValueTypePublicMember (Path const& path, unsigned long line)
+ : Node (path, line)
+ {
+ type_info (static_type_info ());
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_SEMANTIC_GRAPH_VALUE_TYPE_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Token.cpp b/CIAO/CCF/CCF/IDL2/Token.cpp
new file mode 100644
index 00000000000..a251329a2d8
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Token.cpp
@@ -0,0 +1,13 @@
+// file : CCF/IDL2/Token.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Token.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/Token.hpp b/CIAO/CCF/CCF/IDL2/Token.hpp
new file mode 100644
index 00000000000..078a987e4e4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Token.hpp
@@ -0,0 +1,348 @@
+// file : CCF/IDL2/Token.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TOKEN_HPP
+#define CCF_IDL2_TOKEN_HPP
+
+#include <vector>
+#include <string>
+#include <ostream>
+
+#include "CCF/CompilerElements/ReferenceCounting.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ //
+ //
+ //
+ class Token : public ReferenceCounting::DefaultImpl <>
+ {
+ protected:
+ Token (std::string lexeme, unsigned long line)
+ : lexeme_ (lexeme),
+ line_ (line)
+ {
+ }
+
+ public:
+ virtual
+ ~Token () throw () {}
+
+ virtual void
+ print (std::ostream& o)
+ {
+ o << lexeme ();
+ }
+
+ public:
+ std::string
+ lexeme () const
+ {
+ return lexeme_;
+ }
+
+ unsigned long
+ line () const
+ {
+ return line_;
+ }
+
+ private:
+ std::string lexeme_;
+ unsigned long line_;
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Token>
+ TokenPtr;
+
+ typedef
+ std::vector<TokenPtr>
+ TokenList;
+
+ //
+ //
+ //
+ class EndOfStream : public Token
+ {
+ public:
+ EndOfStream (unsigned long line)
+ : Token ("<end-of-stream>", line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<EndOfStream>
+ EndOfStreamPtr;
+
+ //
+ //
+ //
+ class Keyword : public Token
+ {
+ public:
+ Keyword (std::string lexeme, unsigned long line)
+ : Token (lexeme, line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Keyword>
+ KeywordPtr;
+
+ //
+ //
+ //
+ class Punctuation : public Token
+ {
+ public:
+ Punctuation (std::string lexeme, unsigned long line)
+ : Token (lexeme, line)
+ {
+ }
+
+ virtual
+ ~Punctuation () throw () {}
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Punctuation>
+ PunctuationPtr;
+
+
+ //
+ //
+ //
+ class Operator : public Token
+ {
+ public:
+ Operator (std::string lexeme, unsigned long line)
+ : Token (lexeme, line)
+ {
+ }
+
+ virtual
+ ~Operator () throw () {}
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Operator>
+ OperatorPtr;
+
+
+ //
+ //
+ //
+ class Identifier : public Token
+ {
+ public:
+ Identifier (std::string lexeme, unsigned long line)
+ : Token (lexeme, line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Identifier>
+ IdentifierPtr;
+
+
+ //
+ //
+ //
+ class SimpleIdentifier : public Identifier
+ {
+ public:
+ SimpleIdentifier (std::string lexeme, unsigned long line)
+ : Identifier (lexeme, line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<SimpleIdentifier>
+ SimpleIdentifierPtr;
+
+
+ //
+ //
+ //
+ class ScopedIdentifier : public Identifier
+ {
+ public:
+ ScopedIdentifier (std::string lexeme, unsigned long line)
+ : Identifier (lexeme, line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<ScopedIdentifier>
+ ScopedIdentifierPtr;
+
+
+ //
+ //
+ //
+ class Literal : public Token
+ {
+ public:
+ Literal (std::string lexeme, unsigned long line)
+ : Token (lexeme, line)
+ {
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<Literal>
+ LiteralPtr;
+
+
+ //
+ //
+ //
+ class BooleanLiteral : public Literal
+ {
+ public:
+ BooleanLiteral (std::string lexeme, unsigned long line)
+ : Literal (lexeme, line)
+ {
+ }
+
+ bool
+ value () const
+ {
+ return lexeme () == "TRUE";
+ }
+
+ virtual void
+ print (std::ostream& o)
+ {
+ o << lexeme ();
+ }
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<BooleanLiteral>
+ BooleanLiteralPtr;
+
+
+ //
+ //
+ //
+ class CharacterLiteral : public Literal
+ {
+ public:
+ CharacterLiteral (char c, std::string lexeme, unsigned long line)
+ : Literal (lexeme, line), c_ (c)
+ {
+ }
+
+ char
+ value () const
+ {
+ return c_;
+ }
+
+ virtual void
+ print (std::ostream& o)
+ {
+ //@@ todo
+ o << lexeme ();
+ }
+
+ private:
+ char c_;
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<CharacterLiteral>
+ CharacterLiteralPtr;
+
+
+ //
+ //
+ //
+ class IntegerLiteral : public Literal
+ {
+ public:
+ IntegerLiteral (unsigned long long value,
+ std::string lexeme,
+ unsigned long line)
+ : Literal (lexeme, line), value_ (value)
+ {
+ }
+
+ unsigned long long
+ value () const
+ {
+ return value_;
+ }
+
+ virtual void
+ print (std::ostream& o)
+ {
+ o << lexeme ();
+ }
+
+ private:
+ unsigned long long value_;
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<IntegerLiteral>
+ IntegerLiteralPtr;
+
+
+ //
+ //
+ //
+ class StringLiteral : public Literal
+ {
+ public:
+ virtual
+ ~StringLiteral () throw () {}
+
+ StringLiteral (std::string const& value,
+ std::string const& lexeme,
+ unsigned long line)
+ : Literal (lexeme, line), value_ (value)
+ {
+ }
+
+ std::string
+ value () const
+ {
+ return value_;
+ }
+
+ virtual void
+ print (std::ostream& o)
+ {
+ //@@ todo
+ o << lexeme ();
+ }
+
+ private:
+ std::string value_;
+ };
+
+ typedef
+ ReferenceCounting::StrictPtr<StringLiteral>
+ StringLiteralPtr;
+ }
+}
+
+inline std::ostream&
+operator<< (std::ostream& o, CCF::IDL2::TokenPtr const& t)
+{
+ if (t != 0) t->print (o);
+ return o;
+}
+
+#endif // CCF_IDL2_TOKEN_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal.hpp b/CIAO/CCF/CCF/IDL2/Traversal.hpp
new file mode 100644
index 00000000000..2c56e2b3f2b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal.hpp
@@ -0,0 +1,31 @@
+// file : CCF/IDL2/Traversal.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_HPP
+#define CCF_IDL2_TRAVERSAL_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/Traversal/Array.hpp"
+#include "CCF/IDL2/Traversal/Attribute.hpp"
+#include "CCF/IDL2/Traversal/Enum.hpp"
+#include "CCF/IDL2/Traversal/Exception.hpp"
+#include "CCF/IDL2/Traversal/Fundamental.hpp"
+#include "CCF/IDL2/Traversal/IntExpression.hpp"
+#include "CCF/IDL2/Traversal/Interface.hpp"
+#include "CCF/IDL2/Traversal/Member.hpp"
+#include "CCF/IDL2/Traversal/Module.hpp"
+#include "CCF/IDL2/Traversal/Native.hpp"
+#include "CCF/IDL2/Traversal/Operation.hpp"
+#include "CCF/IDL2/Traversal/Struct.hpp"
+#include "CCF/IDL2/Traversal/Sequence.hpp"
+#include "CCF/IDL2/Traversal/String.hpp"
+#include "CCF/IDL2/Traversal/Struct.hpp"
+#include "CCF/IDL2/Traversal/Translation.hpp"
+#include "CCF/IDL2/Traversal/TypeId.hpp"
+#include "CCF/IDL2/Traversal/Union.hpp"
+#include "CCF/IDL2/Traversal/ValueType.hpp"
+#include "CCF/IDL2/Traversal/ValueTypeMember.hpp"
+
+#endif // CCF_IDL2_TRAVERSAL_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp
new file mode 100644
index 00000000000..e142383535f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Array.cpp
@@ -0,0 +1,78 @@
+// file : CCF/IDL2/Traversal/Array.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Array.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ void Array::
+ traverse (Type& a)
+ {
+ pre (a);
+ arguments_with_type (a);
+ arguments_with_value (a);
+ name (a);
+ post (a);
+ }
+
+ void Array::
+ pre (Type&)
+ {
+ }
+
+ void Array::
+ arguments_with_type (Type& a, EdgeDispatcherBase& d)
+ {
+ d.traverse (**a.arguments_begin ());
+ }
+
+ void Array::
+ arguments_with_type (Type& a)
+ {
+ arguments_with_type (a, edge_traverser ());
+ }
+
+ void Array::
+ arguments_with_value (Type& a, EdgeDispatcherBase& d)
+ {
+ Type::ArgumentsIterator
+ b (a.arguments_begin ()), e (a.arguments_end ());
+
+ ++b; // Bounds start afterthe type.
+
+ iterate_and_traverse (b,
+ e,
+ d,
+ *this,
+ &Array::comma,
+ a);
+ }
+
+ void Array::
+ arguments_with_value (Type& a)
+ {
+ arguments_with_value (a, edge_traverser ());
+ }
+
+ void Array::
+ comma (Type&)
+ {
+ }
+
+ void Array::
+ name (Type&)
+ {
+ }
+
+ void Array::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp
new file mode 100644
index 00000000000..fb608c6df9a
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Array.hpp
@@ -0,0 +1,51 @@
+// file : CCF/IDL2/Traversal/Array.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_ARRAY_HPP
+#define CCF_IDL2_TRAVERSAL_ARRAY_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Array.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Array : Node<SemanticGraph::Array>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ arguments_with_type (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_type (Type&);
+
+ virtual void
+ arguments_with_value (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_value (Type&);
+
+ virtual void
+ comma (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_ARRAY_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp
new file mode 100644
index 00000000000..42ff8bd21bf
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.cpp
@@ -0,0 +1,280 @@
+// file : CCF/IDL2/Traversal/Attribute.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Attribute.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // Attribute
+ //
+ //
+ void Attribute::
+ traverse (Type& a)
+ {
+ pre (a);
+ belongs (a);
+ name (a);
+ post (a);
+ }
+
+ void Attribute::
+ pre (Type&)
+ {
+ }
+
+ void Attribute::
+ belongs (Type& a, EdgeDispatcherBase& d)
+ {
+ d.traverse (a.belongs ());
+ }
+
+ void Attribute::
+ belongs (Type& a)
+ {
+ belongs (a, edge_traverser ());
+ }
+
+ void Attribute::
+ name (Type&)
+ {
+ }
+
+ void Attribute::
+ post (Type&)
+ {
+ }
+
+ // ReadAttribute
+ //
+ //
+ void ReadAttribute::
+ traverse (Type& a)
+ {
+ pre (a);
+ belongs (a);
+ name (a);
+ get_raises (a);
+ post (a);
+ }
+
+ void ReadAttribute::
+ pre (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ belongs (Type& a, EdgeDispatcherBase& d)
+ {
+ d.traverse (a.belongs ());
+ }
+
+ void ReadAttribute::
+ belongs (Type& a)
+ {
+ belongs (a, edge_traverser ());
+ }
+
+ void ReadAttribute::
+ name (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ get_raises (Type& a, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (a.get_raises_begin (), a.get_raises_end (), d);
+ }
+
+ void ReadAttribute::
+ get_raises (Type& a)
+ {
+ Type::GetRaisesIterator
+ b (a.get_raises_begin ()),
+ e (a.get_raises_end ());
+
+ if (b != e)
+ {
+ get_raises_pre (a);
+ iterate_and_traverse (b,
+ e,
+ edge_traverser (),
+ *this,
+ &ReadAttribute::comma,
+ a);
+ get_raises_post (a);
+ }
+ else
+ {
+ get_raises_none (a);
+ }
+ }
+
+ void ReadAttribute::
+ get_raises_pre (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ get_raises_post (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ get_raises_none (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ post (Type&)
+ {
+ }
+
+ void ReadAttribute::
+ comma (Type&)
+ {
+ }
+
+
+ // ReadWriteAttribute
+ //
+ //
+ void ReadWriteAttribute::
+ traverse (Type& a)
+ {
+ pre (a);
+ belongs (a);
+ name (a);
+ get_raises (a);
+ set_raises (a);
+ post (a);
+ }
+
+ void ReadWriteAttribute::
+ pre (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ belongs (Type& a, EdgeDispatcherBase& d)
+ {
+ d.traverse (a.belongs ());
+ }
+
+ void ReadWriteAttribute::
+ belongs (Type& a)
+ {
+ belongs (a, edge_traverser ());
+ }
+
+ void ReadWriteAttribute::
+ name (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ get_raises (Type& a, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (a.get_raises_begin (), a.get_raises_end (), d);
+ }
+
+ void ReadWriteAttribute::
+ get_raises (Type& a)
+ {
+ Type::GetRaisesIterator
+ b (a.get_raises_begin ()),
+ e (a.get_raises_end ());
+
+ if (b != e)
+ {
+ get_raises_pre (a);
+ iterate_and_traverse (b,
+ e,
+ edge_traverser (),
+ *this,
+ &ReadWriteAttribute::comma,
+ a);
+ get_raises_post (a);
+ }
+ else
+ {
+ get_raises_none (a);
+ }
+ }
+
+ void ReadWriteAttribute::
+ get_raises_pre (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ get_raises_post (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ get_raises_none (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ set_raises (Type& a, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (a.set_raises_begin (), a.set_raises_end (), d);
+ }
+
+ void ReadWriteAttribute::
+ set_raises (Type& a)
+ {
+ Type::SetRaisesIterator
+ b (a.set_raises_begin ()),
+ e (a.set_raises_end ());
+
+ if (b != e)
+ {
+ set_raises_pre (a);
+ iterate_and_traverse (b,
+ e,
+ edge_traverser (),
+ *this,
+ &ReadWriteAttribute::comma,
+ a);
+ set_raises_post (a);
+ }
+ else
+ {
+ set_raises_none (a);
+ }
+ }
+
+ void ReadWriteAttribute::
+ set_raises_pre (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ set_raises_post (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ set_raises_none (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ post (Type&)
+ {
+ }
+
+ void ReadWriteAttribute::
+ comma (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp
new file mode 100644
index 00000000000..522671b6609
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Attribute.hpp
@@ -0,0 +1,170 @@
+// file : CCF/IDL2/Traversal/Attribute.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP
+#define CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP
+
+#include "CCF/IDL2/SemanticGraph/Attribute.hpp"
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ //
+ //
+ //
+ struct GetRaises : Edge<SemanticGraph::GetRaises>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.exception ());
+ }
+ };
+
+
+ //
+ //
+ //
+ struct SetRaises : Edge<SemanticGraph::SetRaises>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.exception ());
+ }
+ };
+
+
+ //
+ //
+ //
+ struct Attribute : Node<SemanticGraph::Attribute>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ belongs (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+
+ //
+ //
+ //
+ struct ReadAttribute : Node<SemanticGraph::ReadAttribute>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ belongs (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ get_raises (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ get_raises (Type&);
+
+ virtual void
+ get_raises_pre (Type&);
+
+ virtual void
+ get_raises_post (Type&);
+
+ virtual void
+ get_raises_none (Type&);
+
+ virtual void
+ post (Type&);
+
+ virtual void
+ comma (Type&);
+ };
+
+
+ //
+ //
+ //
+ struct ReadWriteAttribute : Node<SemanticGraph::ReadWriteAttribute>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ belongs (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ get_raises (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ get_raises (Type&);
+
+ virtual void
+ get_raises_pre (Type&);
+
+ virtual void
+ get_raises_post (Type&);
+
+ virtual void
+ get_raises_none (Type&);
+
+ virtual void
+ set_raises (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ set_raises (Type&);
+
+ virtual void
+ set_raises_pre (Type&);
+
+ virtual void
+ set_raises_post (Type&);
+
+ virtual void
+ set_raises_none (Type&);
+
+ virtual void
+ post (Type&);
+
+ virtual void
+ comma (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_ATTRIBUTE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp
new file mode 100644
index 00000000000..c7a24089a42
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.cpp
@@ -0,0 +1,16 @@
+// file : CCF/IDL2/Traversal/Elements.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp
new file mode 100644
index 00000000000..03793aafeef
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.hpp
@@ -0,0 +1,471 @@
+// file : CCF/IDL2/Traversal/Elements.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_ELEMENTS_HPP
+#define CCF_IDL2_TRAVERSAL_ELEMENTS_HPP
+
+#include <map>
+#include <set>
+
+#include "CCF/CompilerElements/Introspection.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Elements.hpp"
+
+/*
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+*/
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ //
+ //
+ //
+ template<typename T>
+ class Traverser
+ {
+ protected:
+ virtual
+ ~Traverser ();
+
+ virtual void
+ trampoline (T& n) = 0;
+
+ template <typename>
+ friend class Dispatcher;
+ };
+
+
+ //
+ //
+ //
+ template <typename T>
+ class Dispatcher
+ {
+ public:
+ virtual
+ ~Dispatcher ();
+
+ virtual void
+ traverse (T& n);
+
+ void
+ map (Introspection::TypeId id, Traverser<T>& t)
+ {
+ Traversers& traversers (traversal_map_[id]);
+ traversers.push_back (&t);
+ }
+
+ public:
+ typedef
+ std::vector<Traverser<T>*>
+ Traversers;
+
+ typedef
+ std::map<Introspection::TypeId, Traversers>
+ TraversalMap;
+
+ typedef
+ typename TraversalMap::const_iterator
+ Iterator;
+
+ Iterator
+ begin () const
+ {
+ return traversal_map_.begin ();
+ }
+
+ Iterator
+ end () const
+ {
+ return traversal_map_.end ();
+ }
+
+ private:
+ struct TypeInfoComparator
+ {
+ bool
+ operator () (Introspection::TypeInfo const& x,
+ Introspection::TypeInfo const& y) const
+ {
+ return x.type_id () < y.type_id ();
+ }
+ };
+
+ typedef
+ std::map<Introspection::TypeInfo, unsigned long, TypeInfoComparator>
+ LevelMap;
+
+ typedef
+ std::set<Introspection::TypeInfo, TypeInfoComparator>
+ TypeInfoSet;
+
+ static unsigned long
+ compute_levels (Introspection::TypeInfo const& ti,
+ unsigned long cur,
+ LevelMap& map);
+
+ static void
+ flatten_tree (Introspection::TypeInfo const& ti, TypeInfoSet& set);
+
+ private:
+ TraversalMap traversal_map_;
+ };
+
+
+ //
+ //
+ //
+ typedef
+ Dispatcher<SemanticGraph::Node>
+ NodeDispatcherBase;
+
+ typedef
+ Dispatcher<SemanticGraph::Edge>
+ EdgeDispatcherBase;
+
+
+ //
+ //
+ //
+ class NodeDispatcher : public virtual NodeDispatcherBase
+ {
+ public:
+ void
+ edge_traverser (EdgeDispatcherBase& d)
+ {
+ //@@ this should be done in Dispatcher in merge() function?
+ //
+ for (EdgeDispatcherBase::Iterator i (d.begin ()), end (d.end ());
+ i != end; ++i)
+ {
+ for (EdgeDispatcherBase::Traversers::const_iterator
+ t (i->second.begin ()), end (i->second.end ());
+ t != end; ++t)
+ {
+ dispatcher_.map (i->first, **t);
+ }
+ }
+ }
+
+ protected:
+ template <typename I>
+ void
+ iterate_and_traverse (I begin, I end, EdgeDispatcherBase& d)
+ {
+ for (; begin != end; ++begin)
+ {
+ d.traverse (**begin);
+ }
+ }
+
+ template <typename I, typename X, typename A>
+ void
+ iterate_and_traverse (I begin,
+ I end,
+ EdgeDispatcherBase& d,
+ X& x,
+ void (X::*f)(A&),
+ A& a)
+ {
+ for (I i (begin); i != end;)
+ {
+ d.traverse (**i);
+
+ if (++i != end) (x.*f) (a);
+ }
+ }
+
+ EdgeDispatcherBase&
+ edge_traverser ()
+ {
+ return dispatcher_;
+ }
+
+ protected:
+ EdgeDispatcherBase dispatcher_;
+ };
+
+
+ class EdgeDispatcher : public virtual EdgeDispatcherBase
+ {
+ public:
+ //@@ this should be done in Dispatcher in merge() function?
+ //
+ void
+ node_traverser (NodeDispatcherBase& d)
+ {
+ for (NodeDispatcherBase::Iterator i (d.begin ()), end (d.end ());
+ i != end; ++i)
+ {
+ for (NodeDispatcherBase::Traversers::const_iterator
+ t (i->second.begin ()), end (i->second.end ());
+ t != end; ++t)
+ {
+ dispatcher_.map (i->first, **t);
+ }
+ }
+ }
+
+ protected:
+ NodeDispatcherBase&
+ node_traverser ()
+ {
+ return dispatcher_;
+ }
+
+ protected:
+ NodeDispatcherBase dispatcher_;
+ };
+
+
+ //
+ //
+ //
+ template <typename T>
+ struct Node : Traverser<SemanticGraph::Node>, virtual NodeDispatcher
+ {
+ typedef
+ T
+ Type;
+
+ Node ()
+ {
+ map (typeid (Type), *this);
+ }
+
+ virtual void
+ trampoline (SemanticGraph::Node& n)
+ {
+ //cerr << "trampoline for " << &n << " to type "
+ // << typeid (Type).name () << endl;
+
+ traverse (dynamic_cast<Type&> (n));
+ }
+
+ virtual void
+ traverse (Type&) = 0;
+ };
+
+
+ template <typename T>
+ struct Edge : Traverser <SemanticGraph::Edge>, virtual EdgeDispatcher
+ {
+ typedef
+ T
+ Type;
+
+ Edge ()
+ {
+ map (typeid (Type), *this);
+ }
+
+ virtual void
+ trampoline (SemanticGraph::Edge& e)
+ {
+ traverse (dynamic_cast<Type&> (e));
+ }
+
+
+ virtual void
+ traverse (Type& e) = 0;
+ };
+
+ // Edges
+ //
+ //
+ struct Names : Edge<SemanticGraph::Names>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.named ());
+ }
+ };
+
+
+ struct Defines : Edge<SemanticGraph::Defines>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.named ());
+ }
+ };
+
+
+ struct Mentions : Edge<SemanticGraph::Mentions>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.named ());
+ }
+ };
+
+
+
+ struct Aliases : Edge<SemanticGraph::Aliases>
+ {
+ virtual void
+ traverse (Type& a)
+ {
+ pre (a);
+ type (a);
+ name (a);
+ post (a);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ type (Type& e)
+ {
+ node_traverser ().traverse (e.named ());
+ }
+
+ virtual void
+ name (Type&)
+ {
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ struct Belongs : Edge<SemanticGraph::Belongs>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.type ());
+ }
+ };
+
+
+ struct Arguments : Edge<SemanticGraph::Arguments>
+ {
+ virtual void
+ traverse (Type& a)
+ {
+ node_traverser ().traverse (a.argument ());
+ }
+ };
+
+ struct ArgumentsWithType : Edge<SemanticGraph::ArgumentsWithType>
+ {
+ virtual void
+ traverse (Type& a)
+ {
+ node_traverser ().traverse (a.type ());
+ }
+ };
+
+ struct ArgumentsWithValue : Edge<SemanticGraph::ArgumentsWithValue>
+ {
+ virtual void
+ traverse (Type& a)
+ {
+ node_traverser ().traverse (a.value ());
+ }
+ };
+
+ struct Inherits : Edge<SemanticGraph::Inherits>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.inheritee ());
+ }
+ };
+
+
+ struct Contains : Edge<SemanticGraph::Contains>
+ {
+ };
+
+
+ // Nodes
+ //
+ //
+ struct Nameable : Node<SemanticGraph::Nameable>
+ {
+ };
+
+
+ template <typename T>
+ struct ScopeTemplate : Node<T>
+ {
+ public:
+ /* GCC#13590/DR#39
+ using Node<T>::edge_traverser;
+ */
+
+ virtual void
+ traverse (T& s)
+ {
+ names (s);
+ }
+
+ virtual void
+ names (T& s)
+ {
+ names_pre (s);
+ names (s, this->edge_traverser ());
+ names_post (s);
+ }
+
+ virtual void
+ names (T& s, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (s.names_begin (), s.names_end (), d);
+ }
+
+ virtual void
+ names_pre (T&)
+ {
+ }
+
+ virtual void
+ names_post (T&)
+ {
+ }
+ };
+
+
+ //
+ //
+ //
+ typedef
+ ScopeTemplate<SemanticGraph::Scope>
+ Scope;
+
+
+ //
+ //
+ //
+ struct Type : Node<SemanticGraph::Type>
+ {
+ virtual void
+ traverse (SemanticGraph::Type&) = 0;
+ };
+ }
+ }
+}
+
+#include "CCF/IDL2/Traversal/Elements.tpp"
+
+#endif // CCF_IDL2_TRAVERSAL_ELEMENTS_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp
new file mode 100644
index 00000000000..60cace27f69
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Elements.tpp
@@ -0,0 +1,128 @@
+// file : CCF/IDL2/Traversal/Elements.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include <iostream>
+
+using std::cerr;
+using std::endl;
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // Traverser
+ //
+ //
+
+ template<typename T>
+ Traverser<T>::
+ ~Traverser ()
+ {
+ }
+
+ // Dispatcher
+ //
+ //
+
+ template <typename T>
+ Dispatcher<T>::
+ ~Dispatcher ()
+ {
+ }
+
+ template <typename T>
+ void Dispatcher<T>::
+ traverse (T& n)
+ {
+ LevelMap levels;
+
+ unsigned long max = compute_levels (n.type_info (), 0, levels);
+
+
+ //cerr << "starting dispatch process for "
+ // << n.type_info ().type_id () << " with "
+ // << max << " levels" << endl;
+
+ for (unsigned long l = 0; l < max + 1; ++l)
+ {
+ TypeInfoSet dispatched;
+
+ for (typename LevelMap::const_iterator
+ i (levels.begin ()), e (levels.end ());
+ i != e; ++i)
+ {
+ if (i->second == l)
+ {
+ typename TraversalMap::const_iterator v (
+ traversal_map_.find (i->first.type_id ()));
+
+ if (v != traversal_map_.end ())
+ {
+ //cerr << "dispatching traversers for "
+ // << n.type_info ().type_id () << " as "
+ // << i->first.type_id () << endl;
+
+ Traversers const& traversers (v->second);
+ for (typename Traversers::const_iterator
+ ti (traversers.begin ()), te (traversers.end ());
+ ti != te; ++ti)
+ {
+ (*ti)->trampoline (n);
+ }
+
+ flatten_tree (i->first, dispatched);
+ }
+ }
+ }
+
+ // Remove traversed types from level map.
+ //
+ for (typename TypeInfoSet::const_iterator i = dispatched.begin ();
+ i != dispatched.end ();
+ ++i)
+ {
+ levels.erase (*i);
+ }
+ }
+ }
+
+ template <typename T>
+ unsigned long Dispatcher<T>::
+ compute_levels (Introspection::TypeInfo const& ti,
+ unsigned long cur,
+ LevelMap& map)
+ {
+ unsigned long ret = cur;
+
+ if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur;
+
+ for (Introspection::TypeInfo::BaseIterator i = ti.begin_base ();
+ i != ti.end_base ();
+ i++)
+ {
+ unsigned long t = compute_levels (i->type_info (), cur + 1, map);
+ if (t > ret) ret = t;
+ }
+
+ return ret;
+ }
+
+ template <typename T>
+ void Dispatcher<T>::
+ flatten_tree (Introspection::TypeInfo const& ti, TypeInfoSet& set)
+ {
+ set.insert (ti);
+
+ for (Introspection::TypeInfo::BaseIterator i = ti.begin_base ();
+ i != ti.end_base ();
+ i++)
+ {
+ flatten_tree (i->type_info (), set);
+ }
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp
new file mode 100644
index 00000000000..35df538f85b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Enum.cpp
@@ -0,0 +1,16 @@
+// file : CCF/IDL2/Traversal/Enum.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Enum.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp
new file mode 100644
index 00000000000..d789f30b1b0
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Enum.hpp
@@ -0,0 +1,30 @@
+// file : CCF/IDL2/Traversal/Enum.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_ENUM_HPP
+#define CCF_IDL2_TRAVERSAL_ENUM_HPP
+
+#include "CCF/IDL2/SemanticGraph/Enum.hpp"
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // Minimal support for now. Talk to me if you need more.
+ //
+ struct Enum : Node<SemanticGraph::Enum>
+ {
+ };
+
+ struct Enumerator : Node<SemanticGraph::Enumerator>
+ {
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_ENUM_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp
new file mode 100644
index 00000000000..21e41784c71
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Exception.cpp
@@ -0,0 +1,38 @@
+// file : CCF/IDL2/Traversal/Exception.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Exception.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ void Exception::
+ traverse (Type& s)
+ {
+ pre (s);
+ name (s);
+ names (s);
+ post (s);
+ }
+
+ void Exception::
+ pre (Type&)
+ {
+ }
+
+ void Exception::
+ name (Type&)
+ {
+ }
+
+ void Exception::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp
new file mode 100644
index 00000000000..23eda73f1a7
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Exception.hpp
@@ -0,0 +1,36 @@
+// file : CCF/IDL2/Traversal/Exception.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_EXCEPTION_HPP
+#define CCF_IDL2_TRAVERSAL_EXCEPTION_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Exception.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Exception : ScopeTemplate<SemanticGraph::Exception>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_EXCEPTION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp
new file mode 100644
index 00000000000..4dd6760cebe
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.cpp
@@ -0,0 +1,16 @@
+// file : CCF/IDL2/Traversal/Fundamental.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Fundamental.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp
new file mode 100644
index 00000000000..c4e10d18057
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Fundamental.hpp
@@ -0,0 +1,101 @@
+// file : CCF/IDL2/Traversal/Fundamental.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP
+#define CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Fundamental.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ typedef
+ Node<SemanticGraph::FundamentalType>
+ FundamentalType;
+
+ typedef
+ Node<SemanticGraph::Object>
+ Object;
+
+ typedef
+ Node<SemanticGraph::ValueBase>
+ ValueBase;
+
+ typedef
+ Node<SemanticGraph::Any>
+ Any;
+
+ typedef
+ Node<SemanticGraph::Boolean>
+ Boolean;
+
+ typedef
+ Node<SemanticGraph::Char>
+ Char;
+
+ typedef
+ Node<SemanticGraph::Double>
+ Double;
+
+ typedef
+ Node<SemanticGraph::Float>
+ Float;
+
+ typedef
+ Node<SemanticGraph::Long>
+ Long;
+
+ typedef
+ Node<SemanticGraph::LongDouble>
+ LongDouble;
+
+ typedef
+ Node<SemanticGraph::LongLong>
+ LongLong;
+
+ typedef
+ Node<SemanticGraph::Octet>
+ Octet;
+
+ typedef
+ Node<SemanticGraph::Short>
+ Short;
+
+ typedef
+ Node<SemanticGraph::String>
+ String;
+
+ typedef
+ Node<SemanticGraph::UnsignedLong>
+ UnsignedLong;
+
+ typedef
+ Node<SemanticGraph::UnsignedLongLong>
+ UnsignedLongLong;
+
+ typedef
+ Node<SemanticGraph::UnsignedShort>
+ UnsignedShort;
+
+ typedef
+ Node<SemanticGraph::Void>
+ Void;
+
+ typedef
+ Node<SemanticGraph::Wchar>
+ Wchar;
+
+ typedef
+ Node<SemanticGraph::Wstring>
+ Wstring;
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_FUNDAMENTAL_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp b/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp
new file mode 100644
index 00000000000..8e111874251
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/IntExpression.hpp
@@ -0,0 +1,757 @@
+// file : CCF/IDL2/Traversal/IntExpression.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP
+#define CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/IntExpression.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ //
+ //
+ typedef
+ Node<SemanticGraph::IntExpression>
+ IntExpression;
+
+ //
+ //
+ typedef
+ Node<SemanticGraph::IntLiteral>
+ IntLiteral;
+
+ //
+ //
+ typedef
+ Node<SemanticGraph::IntConst>
+ IntConst;
+
+
+ // NEG
+ //
+
+ struct IntNegates: Edge<SemanticGraph::IntNegates>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntNeg: Node<SemanticGraph::IntNeg>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ negates (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ negates (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.negates ());
+ }
+
+ virtual void
+ negates (Type& n)
+ {
+ negates (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // COM
+ //
+
+ struct IntComplements: Edge<SemanticGraph::IntComplements>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntCom: Node<SemanticGraph::IntCom>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ complements (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ complements (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.complements ());
+ }
+
+ virtual void
+ complements (Type& n)
+ {
+ complements (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // MUL
+ //
+
+ struct IntMultiplies: Edge<SemanticGraph::IntMultiplies>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntMul: Node<SemanticGraph::IntMul>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ multiplies_first_factor (n);
+ sign (n);
+ multiplies_second_factor (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ multiplies_first_factor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.first_factor ());
+ }
+
+ virtual void
+ multiplies_first_factor (Type& n)
+ {
+ multiplies_first_factor (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ multiplies_second_factor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. second_factor ());
+ }
+
+ virtual void
+ multiplies_second_factor (Type& n)
+ {
+ multiplies_second_factor (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // DIV & REM
+ //
+
+ struct IntDivides: Edge<SemanticGraph::IntDivides>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntDiv: Node<SemanticGraph::IntDiv>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ divides_divident (n);
+ sign (n);
+ divides_divisor (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ divides_divident (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.divident ());
+ }
+
+ virtual void
+ divides_divident (Type& n)
+ {
+ divides_divident (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ divides_divisor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. divisor ());
+ }
+
+ virtual void
+ divides_divisor (Type& n)
+ {
+ divides_divisor (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+ struct IntRem: Node<SemanticGraph::IntRem>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ divides_divident (n);
+ sign (n);
+ divides_divisor (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ divides_divident (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.divident ());
+ }
+
+ virtual void
+ divides_divident (Type& n)
+ {
+ divides_divident (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ divides_divisor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. divisor ());
+ }
+
+ virtual void
+ divides_divisor (Type& n)
+ {
+ divides_divisor (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // ADD
+ //
+
+ struct IntAdds: Edge<SemanticGraph::IntAdds>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntAdd: Node<SemanticGraph::IntAdd>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ adds_first_item (n);
+ sign (n);
+ adds_second_item (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ adds_first_item (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.first_item ());
+ }
+
+ virtual void
+ adds_first_item (Type& n)
+ {
+ adds_first_item (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ adds_second_item (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. second_item ());
+ }
+
+ virtual void
+ adds_second_item (Type& n)
+ {
+ adds_second_item (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // SUB
+ //
+
+ struct IntSubtracts: Edge<SemanticGraph::IntSubtracts>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntSub: Node<SemanticGraph::IntSub>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ subtracts_minuend (n);
+ sign (n);
+ subtracts_subtrahend (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ subtracts_minuend (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.minuend ());
+ }
+
+ virtual void
+ subtracts_minuend (Type& n)
+ {
+ subtracts_minuend (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ subtracts_subtrahend (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. subtrahend ());
+ }
+
+ virtual void
+ subtracts_subtrahend (Type& n)
+ {
+ subtracts_subtrahend (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // RSH & LSH
+ //
+
+ struct IntShifts: Edge<SemanticGraph::IntShifts>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntRsh: Node<SemanticGraph::IntRsh>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ shifts_pattern (n);
+ sign (n);
+ shifts_factor (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ shifts_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.pattern ());
+ }
+
+ virtual void
+ shifts_pattern (Type& n)
+ {
+ shifts_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ shifts_factor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. factor ());
+ }
+
+ virtual void
+ shifts_factor (Type& n)
+ {
+ shifts_factor (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+ struct IntLsh: Node<SemanticGraph::IntLsh>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ shifts_pattern (n);
+ sign (n);
+ shifts_factor (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ shifts_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.pattern ());
+ }
+
+ virtual void
+ shifts_pattern (Type& n)
+ {
+ shifts_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ shifts_factor (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. factor ());
+ }
+
+ virtual void
+ shifts_factor (Type& n)
+ {
+ shifts_factor (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // AND
+ //
+
+ struct IntConjuncts: Edge<SemanticGraph::IntConjuncts>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntAnd: Node<SemanticGraph::IntAnd>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ conjuncts_first_pattern (n);
+ sign (n);
+ conjuncts_second_pattern (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ conjuncts_first_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.first_pattern ());
+ }
+
+ virtual void
+ conjuncts_first_pattern (Type& n)
+ {
+ conjuncts_first_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ conjuncts_second_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. second_pattern ());
+ }
+
+ virtual void
+ conjuncts_second_pattern (Type& n)
+ {
+ conjuncts_second_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // Xor
+ //
+
+ struct IntExclusivelyDisjuncts:
+ Edge<SemanticGraph::IntExclusivelyDisjuncts>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntXor: Node<SemanticGraph::IntXor>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ exclusively_disjuncts_first_pattern (n);
+ sign (n);
+ exclusively_disjuncts_second_pattern (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ exclusively_disjuncts_first_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.first_pattern ());
+ }
+
+ virtual void
+ exclusively_disjuncts_first_pattern (Type& n)
+ {
+ exclusively_disjuncts_first_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ exclusively_disjuncts_second_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. second_pattern ());
+ }
+
+ virtual void
+ exclusively_disjuncts_second_pattern (Type& n)
+ {
+ exclusively_disjuncts_second_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+
+
+ // Or
+ //
+
+ struct IntInclusivelyDisjuncts:
+ Edge<SemanticGraph::IntInclusivelyDisjuncts>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.argument ());
+ }
+ };
+
+ struct IntOr: Node<SemanticGraph::IntOr>
+ {
+ virtual void
+ traverse (Type& n)
+ {
+ pre (n);
+ inclusively_disjuncts_first_pattern (n);
+ sign (n);
+ inclusively_disjuncts_second_pattern (n);
+ post (n);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ inclusively_disjuncts_first_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n.first_pattern ());
+ }
+
+ virtual void
+ inclusively_disjuncts_first_pattern (Type& n)
+ {
+ inclusively_disjuncts_first_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ sign (Type&)
+ {
+ }
+
+ virtual void
+ inclusively_disjuncts_second_pattern (Type& n, EdgeDispatcherBase& d)
+ {
+ d.traverse (n. second_pattern ());
+ }
+
+ virtual void
+ inclusively_disjuncts_second_pattern (Type& n)
+ {
+ inclusively_disjuncts_second_pattern (n, edge_traverser ());
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_INT_EXPRESSION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp
new file mode 100644
index 00000000000..fb6cbf9686c
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.cpp
@@ -0,0 +1,15 @@
+// file : CCF/IDL2/Traversal/Interface.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Interface.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp
new file mode 100644
index 00000000000..b0c05f36b80
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.hpp
@@ -0,0 +1,89 @@
+// file : CCF/IDL2/Traversal/Interface.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_INTERFACE_HPP
+#define CCF_IDL2_TRAVERSAL_INTERFACE_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Interface.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Supports : Edge<SemanticGraph::Supports>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.supportee ());
+ }
+ };
+
+
+ template <typename T>
+ struct InterfaceTemplate : ScopeTemplate<T>
+ {
+ /* GCC#13590/DR#39
+ using ScopeTemplate<T>::edge_traverser;
+ */
+
+ virtual void
+ traverse (T&);
+
+ virtual void
+ pre (T&);
+
+ virtual void
+ name (T&);
+
+ virtual void
+ inherits (T&, EdgeDispatcherBase& d);
+
+ virtual void
+ inherits (T&);
+
+ virtual void
+ inherits_pre (T&);
+
+ virtual void
+ inherits_post (T&);
+
+ virtual void
+ inherits_none (T&);
+
+ virtual void
+ post (T&);
+
+ virtual void
+ comma (T&);
+ };
+
+
+ typedef
+ InterfaceTemplate<SemanticGraph::Interface>
+ Interface;
+
+
+ typedef
+ InterfaceTemplate<SemanticGraph::AbstractInterface>
+ AbstractInterface;
+
+ typedef
+ InterfaceTemplate<SemanticGraph::LocalInterface>
+ LocalInterface;
+
+ typedef
+ InterfaceTemplate<SemanticGraph::UnconstrainedInterface>
+ UnconstrainedInterface;
+ }
+ }
+}
+
+#include "CCF/IDL2/Traversal/Interface.tpp"
+
+#endif // CCF_IDL2_TRAVERSAL_INTERFACE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp
new file mode 100644
index 00000000000..23d2bfd922d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Interface.tpp
@@ -0,0 +1,99 @@
+// file : CCF/IDL2/Traversal/Interface.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ template <typename T>
+ void InterfaceTemplate<T>::
+ traverse (T& i)
+ {
+ pre (i);
+ name (i);
+ inherits (i);
+ names (i);
+ post (i);
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ pre (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ name (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ inherits (T& i, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (i.inherits_begin (),
+ i.inherits_end (),
+ d);
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ inherits (T& i)
+ {
+ typename T::InheritsIterator
+ b (i.inherits_begin ()), e (i.inherits_end ());
+
+ if (b != e)
+ {
+ inherits_pre (i);
+ iterate_and_traverse (b,
+ e,
+ this->edge_traverser (),
+ *this,
+ &InterfaceTemplate::comma,
+ i);
+ inherits_post (i);
+ }
+ else
+ {
+ inherits_none (i);
+ }
+
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ inherits_pre (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ inherits_post (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ inherits_none (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ post (T&)
+ {
+ }
+
+ template <typename T>
+ void InterfaceTemplate<T>::
+ comma (T&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp
new file mode 100644
index 00000000000..01299a0b00c
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Member.cpp
@@ -0,0 +1,50 @@
+// file : CCF/IDL2/Traversal/Member.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Member.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ void Member::
+ traverse (Type& m)
+ {
+ pre (m);
+ belongs (m);
+ name (m);
+ post (m);
+ }
+
+ void Member::
+ pre (Type&)
+ {
+ }
+
+ void Member::
+ belongs (Type& m, EdgeDispatcherBase& d)
+ {
+ d.traverse (m.belongs ());
+ }
+
+ void Member::
+ belongs (Type& m)
+ {
+ belongs (m, edge_traverser ());
+ }
+
+ void Member::
+ name (Type&)
+ {
+ }
+
+ void Member::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp
new file mode 100644
index 00000000000..a0f05e6f33f
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Member.hpp
@@ -0,0 +1,42 @@
+// file : CCF/IDL2/Traversal/Member.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_MEMBER_HPP
+#define CCF_IDL2_TRAVERSAL_MEMBER_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Member.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Member : Node<SemanticGraph::Member>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ belongs (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp
new file mode 100644
index 00000000000..62f5d70aa9c
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Module.cpp
@@ -0,0 +1,15 @@
+// file : CCF/IDL2/Traversal/Module.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Module.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp
new file mode 100644
index 00000000000..994c40dd590
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Module.hpp
@@ -0,0 +1,48 @@
+// file : CCF/IDL2/Traversal/Module.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_MODULE_HPP
+#define CCF_IDL2_TRAVERSAL_MODULE_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Module.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Module : ScopeTemplate<SemanticGraph::Module>
+ {
+ virtual void
+ traverse (Type& m)
+ {
+ pre (m);
+ name (m);
+ names (m);
+ post (m);
+ }
+
+ virtual void
+ pre (Type&)
+ {
+ }
+
+ virtual void
+ name (Type&)
+ {
+ }
+
+ virtual void
+ post (Type&)
+ {
+ }
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_MODULE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp
new file mode 100644
index 00000000000..59a99bec8ad
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Native.cpp
@@ -0,0 +1,16 @@
+// file : CCF/IDL2/Traversal/Native.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Native.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp
new file mode 100644
index 00000000000..ad70473c234
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Native.hpp
@@ -0,0 +1,24 @@
+// file : CCF/IDL2/Traversal/Native.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_NATIVE_HPP
+#define CCF_IDL2_TRAVERSAL_NATIVE_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Native.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ typedef
+ Node<SemanticGraph::Native>
+ Native;
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_NATIVE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp
new file mode 100644
index 00000000000..2fca9de465b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.cpp
@@ -0,0 +1,15 @@
+// file : CCF/IDL2/Traversal/Operation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Operation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp
new file mode 100644
index 00000000000..04a426301f0
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.hpp
@@ -0,0 +1,178 @@
+// file : CCF/IDL2/Traversal/Operation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_OPERATION_HPP
+#define CCF_IDL2_TRAVERSAL_OPERATION_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Operation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ //
+ //
+ //
+ struct Receives : Edge<SemanticGraph::Receives>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.parameter ());
+ }
+ };
+
+
+ //
+ //
+ //
+ struct Returns : Edge<SemanticGraph::Returns>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.type ());
+ }
+ };
+
+ //
+ //
+ //
+ struct Raises : Edge<SemanticGraph::Raises>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.exception ());
+ }
+ };
+
+ //
+ //
+ //
+ template<typename T>
+ struct ParameterTemplate : Node<T>
+ {
+ /* GCC#13590/DR#39
+ using Node<T>::edge_traverser;
+ */
+
+ virtual void
+ traverse (T&);
+
+ virtual void
+ pre (T&);
+
+ virtual void
+ belongs (T&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (T&);
+
+ virtual void
+ name (T&);
+
+ virtual void
+ post (T&);
+ };
+
+ typedef
+ ParameterTemplate<SemanticGraph::Parameter>
+ Parameter;
+
+ typedef
+ ParameterTemplate<SemanticGraph::InParameter>
+ InParameter;
+
+ typedef
+ ParameterTemplate<SemanticGraph::InOutParameter>
+ InOutParameter;
+
+ typedef
+ ParameterTemplate<SemanticGraph::OutParameter>
+ OutParameter;
+
+ //
+ //
+ //
+ template <typename T>
+ struct OperationTemplate : Node<T>
+ {
+ /* GCC#13590/DR#39
+ using Node<T>::edge_traverser;
+ */
+
+ virtual void
+ traverse (T&);
+
+ virtual void
+ pre (T&);
+
+ virtual void
+ returns (T&, EdgeDispatcherBase&);
+
+ virtual void
+ returns (T&);
+
+ virtual void
+ name (T&);
+
+ virtual void
+ receives (T&, EdgeDispatcherBase&);
+
+ virtual void
+ receives (T&);
+
+ virtual void
+ receives_pre (T&);
+
+ virtual void
+ receives_post (T&);
+
+ virtual void
+ receives_none (T&);
+
+ virtual void
+ raises (T&, EdgeDispatcherBase&);
+
+ virtual void
+ raises (T&);
+
+ virtual void
+ raises_pre (T&);
+
+ virtual void
+ raises_post (T&);
+
+ virtual void
+ raises_none (T&);
+
+ virtual void
+ post (T&);
+
+ virtual void
+ comma (T&);
+ };
+
+ typedef
+ OperationTemplate<SemanticGraph::Operation>
+ Operation;
+
+ typedef
+ OperationTemplate<SemanticGraph::OneWayOperation>
+ OneWayOperation;
+
+ typedef
+ OperationTemplate<SemanticGraph::TwoWayOperation>
+ TwoWayOperation;
+ }
+ }
+}
+
+#include "CCF/IDL2/Traversal/Operation.tpp"
+
+#endif // CCF_IDL2_TRAVERSAL_OPERATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp b/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp
new file mode 100644
index 00000000000..bcb3760ec3b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Operation.tpp
@@ -0,0 +1,201 @@
+// file : CCF/IDL2/Traversal/Operation.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // ParameterTemplate
+ //
+ //
+ template<typename T>
+ void ParameterTemplate<T>::
+ traverse (T& p)
+ {
+ pre (p);
+ belongs (p);
+ name (p);
+ post (p);
+ }
+
+ template<typename T>
+ void ParameterTemplate<T>::
+ pre (T&)
+ {
+ }
+
+ template<typename T>
+ void ParameterTemplate<T>::
+ belongs (T& p, EdgeDispatcherBase& d)
+ {
+ d.traverse (p.belongs ());
+ }
+
+ template<typename T>
+ void ParameterTemplate<T>::
+ belongs (T& p)
+ {
+ belongs (p, this->edge_traverser ());
+ }
+
+ template<typename T>
+ void ParameterTemplate<T>::
+ name (T&)
+ {
+ }
+
+ template<typename T>
+ void ParameterTemplate<T>::
+ post (T&)
+ {
+ }
+
+
+ // OperationTemplate
+ //
+ //
+ template<typename T>
+ void OperationTemplate<T>::
+ traverse (T& o)
+ {
+ pre (o);
+ returns (o);
+ name (o);
+ receives (o);
+ raises (o);
+ post (o);
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ pre (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ returns (T& o, EdgeDispatcherBase& d)
+ {
+ d.traverse (o.returns ());
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ returns (T& o)
+ {
+ returns (o, this->edge_traverser ());
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ name (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ receives (T& o, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (o.receives_begin (), o.receives_end (), d);
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ receives (T& o)
+ {
+ typename T::ReceivesIterator
+ b (o.receives_begin ()), e (o.receives_end ());
+
+ if (b != e)
+ {
+ receives_pre (o);
+ iterate_and_traverse (
+ b, e, this->edge_traverser (), *this, &OperationTemplate<T>::comma, o);
+ receives_post (o);
+ }
+ else
+ {
+ receives_none (o);
+ }
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ receives_pre (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ receives_post (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ receives_none (T&)
+ {
+ }
+
+
+ template<typename T>
+ void OperationTemplate<T>::
+ raises (T& o, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (o.raises_begin (), o.raises_end (), d);
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ raises (T& o)
+ {
+ typename T::RaisesIterator b (o.raises_begin ()), e (o.raises_end ());
+
+ if (b != e)
+ {
+ raises_pre (o);
+ iterate_and_traverse (
+ b, e, this->edge_traverser (), *this, &OperationTemplate<T>::comma, o);
+ raises_post (o);
+ }
+ else
+ {
+ raises_none (o);
+ }
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ raises_pre (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ raises_post (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ raises_none (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ post (T&)
+ {
+ }
+
+ template<typename T>
+ void OperationTemplate<T>::
+ comma (T&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp
new file mode 100644
index 00000000000..c781cdcfb97
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.cpp
@@ -0,0 +1,111 @@
+// file : CCF/IDL2/Traversal/Sequence.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Sequence.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+
+ // UnboundedSequence
+ //
+
+ void UnboundedSequence::
+ traverse (Type& us)
+ {
+ pre (us);
+ arguments_with_type (us);
+ name (us);
+ post (us);
+ }
+
+ void UnboundedSequence::
+ pre (Type&)
+ {
+ }
+
+ void UnboundedSequence::
+ arguments_with_type (Type& us, EdgeDispatcherBase& d)
+ {
+ d.traverse (**us.arguments_begin ());
+ }
+
+ void UnboundedSequence::
+ arguments_with_type (Type& us)
+ {
+ arguments_with_type (us, edge_traverser ());
+ }
+
+ void UnboundedSequence::
+ name (Type&)
+ {
+ }
+
+ void UnboundedSequence::
+ post (Type&)
+ {
+ }
+
+
+ // BoundedSequence
+ //
+
+ void BoundedSequence::
+ traverse (Type& bs)
+ {
+ pre (bs);
+ arguments_with_type (bs);
+ arguments_with_value (bs);
+ name (bs);
+ post (bs);
+ }
+
+ void BoundedSequence::
+ pre (Type&)
+ {
+ }
+
+ void BoundedSequence::
+ arguments_with_type (Type& bs, EdgeDispatcherBase& d)
+ {
+ d.traverse (**bs.arguments_begin ());
+ }
+
+ void BoundedSequence::
+ arguments_with_type (Type& bs)
+ {
+ arguments_with_type (bs, edge_traverser ());
+ }
+
+ void BoundedSequence::
+ arguments_with_value (Type& bs, EdgeDispatcherBase& d)
+ {
+ Type::ArgumentsIterator i (bs.arguments_begin ());
+
+ ++i; // Bound is always second to the type.
+
+ d.traverse (**i);
+ }
+
+ void BoundedSequence::
+ arguments_with_value (Type& bs)
+ {
+ arguments_with_value (bs, edge_traverser ());
+ }
+
+ void BoundedSequence::
+ name (Type&)
+ {
+ }
+
+ void BoundedSequence::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp
new file mode 100644
index 00000000000..8011ff85c38
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Sequence.hpp
@@ -0,0 +1,69 @@
+// file : CCF/IDL2/Traversal/Sequence.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_SEQUENCE_HPP
+#define CCF_IDL2_TRAVERSAL_SEQUENCE_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Sequence.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct UnboundedSequence : Node<SemanticGraph::UnboundedSequence>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ arguments_with_type (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_type (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+
+ struct BoundedSequence : Node<SemanticGraph::BoundedSequence>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ arguments_with_type (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_type (Type&);
+
+ virtual void
+ arguments_with_value (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_value (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_SEQUENCE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/String.cpp b/CIAO/CCF/CCF/IDL2/Traversal/String.cpp
new file mode 100644
index 00000000000..0d1e23883ed
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/String.cpp
@@ -0,0 +1,93 @@
+// file : CCF/IDL2/Traversal/String.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/String.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // BoundedString
+ //
+
+ void BoundedString::
+ traverse (Type& s)
+ {
+ pre (s);
+ arguments_with_value (s);
+ name (s);
+ post (s);
+ }
+
+ void BoundedString::
+ pre (Type&)
+ {
+ }
+
+ void BoundedString::
+ arguments_with_value (Type& s, EdgeDispatcherBase& d)
+ {
+ d.traverse (**s.arguments_begin ());
+ }
+
+ void BoundedString::
+ arguments_with_value (Type& s)
+ {
+ arguments_with_value (s, edge_traverser ());
+ }
+
+ void BoundedString::
+ name (Type&)
+ {
+ }
+
+ void BoundedString::
+ post (Type&)
+ {
+ }
+
+
+ // BoundedWideString
+ //
+
+ void BoundedWideString::
+ traverse (Type& s)
+ {
+ pre (s);
+ arguments_with_value (s);
+ name (s);
+ post (s);
+ }
+
+ void BoundedWideString::
+ pre (Type&)
+ {
+ }
+
+ void BoundedWideString::
+ arguments_with_value (Type& s, EdgeDispatcherBase& d)
+ {
+ d.traverse (**s.arguments_begin ());
+ }
+
+ void BoundedWideString::
+ arguments_with_value (Type& s)
+ {
+ arguments_with_value (s, edge_traverser ());
+ }
+
+ void BoundedWideString::
+ name (Type&)
+ {
+ }
+
+ void BoundedWideString::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/String.hpp b/CIAO/CCF/CCF/IDL2/Traversal/String.hpp
new file mode 100644
index 00000000000..7fca6eb7972
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/String.hpp
@@ -0,0 +1,64 @@
+// file : CCF/IDL2/Traversal/String.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_STRING_HPP
+#define CCF_IDL2_TRAVERSAL_STRING_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/String.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct BoundedString : Node<SemanticGraph::BoundedString>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ arguments_with_value (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_value (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+
+
+ struct BoundedWideString : Node<SemanticGraph::BoundedWideString>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ arguments_with_value (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ arguments_with_value (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_STRING_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp
new file mode 100644
index 00000000000..c9e4a23ee0d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Struct.cpp
@@ -0,0 +1,38 @@
+// file : CCF/IDL2/Traversal/Struct.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Struct.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ void Struct::
+ traverse (Type& s)
+ {
+ pre (s);
+ name (s);
+ names (s);
+ post (s);
+ }
+
+ void Struct::
+ pre (Type&)
+ {
+ }
+
+ void Struct::
+ name (Type&)
+ {
+ }
+
+ void Struct::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp
new file mode 100644
index 00000000000..0ab61f8ef85
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Struct.hpp
@@ -0,0 +1,35 @@
+// file : CCF/IDL2/Traversal/Struct.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_STRUCT_HPP
+#define CCF_IDL2_TRAVERSAL_STRUCT_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Struct.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ struct Struct : ScopeTemplate<SemanticGraph::Struct>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_STRUCT_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp
new file mode 100644
index 00000000000..e3fcd58e272
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Translation.cpp
@@ -0,0 +1,37 @@
+// file : CCF/IDL2/Traversal/Translation.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Translation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // TranslationRegion
+ //
+ //
+ void TranslationRegion::
+ traverse (SemanticGraph::TranslationRegion& r)
+ {
+ iterate_and_traverse (r.contains_begin (),
+ r.contains_end (),
+ edge_traverser ());
+ }
+
+
+ // TranslationUnit
+ //
+ //
+ void TranslationUnit::
+ traverse (SemanticGraph::TranslationUnit& u)
+ {
+ iterate_and_traverse (u.contains_begin (),
+ u.contains_end (),
+ edge_traverser ());
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp
new file mode 100644
index 00000000000..7fc3f58c5d4
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Translation.hpp
@@ -0,0 +1,107 @@
+// file : CCF/IDL2/Traversal/Translation.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_TRANSLATION_HPP
+#define CCF_IDL2_TRAVERSAL_TRANSLATION_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/Translation.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // Some edges.
+ //
+ //
+ struct ContainsPrincipal : Edge<SemanticGraph::ContainsPrincipal>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+ struct ContainsImplied : Edge<SemanticGraph::ContainsImplied>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+ struct ContainsRoot : Edge<SemanticGraph::ContainsRoot>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+ struct Includes : Edge<SemanticGraph::Includes>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+ struct QuoteIncludes : Edge<SemanticGraph::QuoteIncludes>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+ struct BracketIncludes : Edge<SemanticGraph::BracketIncludes>
+ {
+ virtual void
+ traverse (Type& e)
+ {
+ node_traverser ().traverse (e.element ());
+ }
+ };
+
+
+ //
+ //
+ //
+ typedef
+ ScopeTemplate <SemanticGraph::Root>
+ Root;
+
+
+ //
+ //
+ //
+ struct TranslationRegion : Node<SemanticGraph::TranslationRegion>
+ {
+ virtual void
+ traverse (SemanticGraph::TranslationRegion&);
+ };
+
+
+ //
+ //
+ //
+ struct TranslationUnit : Node<SemanticGraph::TranslationUnit>
+ {
+ virtual void
+ traverse (SemanticGraph::TranslationUnit&);
+ };
+
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_TRANSLATION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp
new file mode 100644
index 00000000000..1e42505b5d7
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.cpp
@@ -0,0 +1,16 @@
+// file : CCF/IDL2/Traversal/TypeId.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/TypeId.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
+
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp
new file mode 100644
index 00000000000..eb917dd69cb
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/TypeId.hpp
@@ -0,0 +1,34 @@
+// file : CCF/IDL2/Traversal/TypeId.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_TYPE_ID_HPP
+#define CCF_IDL2_TRAVERSAL_TYPE_ID_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/TypeId.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // Typeid and typeprefix are two idiotic constructs of IDL.
+ // They normally should not result in any directly generated
+ // code so only minimal (and most generic) support is provided.
+ //
+
+ struct TypeId : Node<SemanticGraph::TypeId>
+ {
+ };
+
+ struct TypePrefix : Node<SemanticGraph::TypePrefix>
+ {
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_TYPE_ID_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp b/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp
new file mode 100644
index 00000000000..b14f518983e
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Union.cpp
@@ -0,0 +1,81 @@
+// file : CCF/IDL2/Traversal/Union.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/Union.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ // UnionMember
+ //
+ //
+ void UnionMember::
+ traverse (Type& m)
+ {
+ pre (m);
+ belongs (m);
+ name (m);
+ post (m);
+ }
+
+ void UnionMember::
+ pre (Type&)
+ {
+ }
+
+ void UnionMember::
+ belongs (Type& m, EdgeDispatcherBase& d)
+ {
+ d.traverse (m.belongs ());
+ }
+
+ void UnionMember::
+ belongs (Type& m)
+ {
+ belongs (m, edge_traverser ());
+ }
+
+ void UnionMember::
+ name (Type&)
+ {
+ }
+
+ void UnionMember::
+ post (Type&)
+ {
+ }
+
+
+ // Union
+ //
+ //
+ void Union::
+ traverse (Type& s)
+ {
+ pre (s);
+ name (s);
+ names (s);
+ post (s);
+ }
+
+ void Union::
+ pre (Type&)
+ {
+ }
+
+ void Union::
+ name (Type&)
+ {
+ }
+
+ void Union::
+ post (Type&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp b/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp
new file mode 100644
index 00000000000..2bcad1eb4ea
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/Union.hpp
@@ -0,0 +1,63 @@
+// file : CCF/IDL2/Traversal/Union.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_UNION_HPP
+#define CCF_IDL2_TRAVERSAL_UNION_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+#include "CCF/IDL2/SemanticGraph/Union.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ //
+ //
+ //
+ struct UnionMember : Node<SemanticGraph::UnionMember>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ belongs (Type&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+
+
+ //
+ //
+ //
+ struct Union : ScopeTemplate<SemanticGraph::Union>
+ {
+ virtual void
+ traverse (Type&);
+
+ virtual void
+ pre (Type&);
+
+ virtual void
+ name (Type&);
+
+ virtual void
+ post (Type&);
+ };
+ }
+ }
+}
+
+#endif // CCF_IDL2_TRAVERSAL_UNION_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp
new file mode 100644
index 00000000000..63dce1325df
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.cpp
@@ -0,0 +1,15 @@
+// file : CCF/IDL2/Traversal/ValueType.cpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#include "CCF/IDL2/Traversal/ValueType.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp
new file mode 100644
index 00000000000..a99ee48e814
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.hpp
@@ -0,0 +1,89 @@
+// file : CCF/IDL2/Traversal/ValueType.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP
+#define CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+#include "CCF/IDL2/Traversal/Operation.hpp"
+#include "CCF/IDL2/SemanticGraph/ValueType.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ template <typename T>
+ struct ValueTypeTemplate : ScopeTemplate<T>
+ {
+ virtual void
+ traverse (T&);
+
+ virtual void
+ pre (T&);
+
+ virtual void
+ name (T&);
+
+ virtual void
+ inherits (T&, EdgeDispatcherBase& d);
+
+ virtual void
+ inherits (T&);
+
+ virtual void
+ inherits_pre (T&);
+
+ virtual void
+ inherits_post (T&);
+
+ virtual void
+ inherits_none (T&);
+
+ virtual void
+ supports (T&, EdgeDispatcherBase& d);
+
+ virtual void
+ supports (T&);
+
+ virtual void
+ supports_pre (T&);
+
+ virtual void
+ supports_post (T&);
+
+ virtual void
+ supports_none (T&);
+
+ virtual void
+ post (T&);
+
+ virtual void
+ comma (T&);
+ };
+
+
+ typedef
+ ValueTypeTemplate<SemanticGraph::ValueType>
+ ValueType;
+
+ typedef
+ ValueTypeTemplate<SemanticGraph::AbstractValueType>
+ AbstractValueType;
+
+ typedef
+ ValueTypeTemplate<SemanticGraph::ConcreteValueType>
+ ConcreteValueType;
+
+ typedef
+ OperationTemplate<SemanticGraph::ValueTypeFactory>
+ ValueTypeFactory;
+ }
+ }
+}
+
+#include "CCF/IDL2/Traversal/ValueType.tpp"
+
+#endif // CCF_IDL2_TRAVERSAL_VALUE_TYPE_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp
new file mode 100644
index 00000000000..e5582c4c61b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueType.tpp
@@ -0,0 +1,150 @@
+// file : CCF/IDL2/Traversal/ValueType.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ traverse (T& v)
+ {
+ pre (v);
+ name (v);
+ inherits (v);
+ supports (v);
+ names (v);
+ post (v);
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ pre (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ name (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ inherits (T& v, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (v.inherits_begin (),
+ v.inherits_end (),
+ d);
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ inherits (T& v)
+ {
+ typename T::InheritsIterator
+ b (v.inherits_begin ()), e (v.inherits_end ());
+
+ if (b != e)
+ {
+ inherits_pre (v);
+ iterate_and_traverse (b,
+ e,
+ this->edge_traverser (),
+ *this,
+ &ValueTypeTemplate::comma,
+ v);
+ inherits_post (v);
+ }
+ else
+ {
+ inherits_none (v);
+ }
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ inherits_pre (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ inherits_post (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ inherits_none (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ supports (T& v, EdgeDispatcherBase& d)
+ {
+ iterate_and_traverse (v.supports_begin (),
+ v.supports_end (),
+ d);
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ supports (T& v)
+ {
+ typename T::SupportsIterator
+ b (v.supports_begin ()), e (v.supports_end ());
+
+ if (b != e)
+ {
+ supports_pre (v);
+ iterate_and_traverse (b,
+ e,
+ this->edge_traverser (),
+ *this,
+ &ValueTypeTemplate::comma,
+ v);
+ supports_post (v);
+ }
+ else
+ {
+ supports_none (v);
+ }
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ supports_pre (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ supports_post (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ supports_none (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ post (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeTemplate<T>::
+ comma (T&)
+ {
+ }
+ }
+ }
+}
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp
new file mode 100644
index 00000000000..f579f7d765d
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.hpp
@@ -0,0 +1,59 @@
+// file : CCF/IDL2/Traversal/ValueTypeMember.hpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+#ifndef CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP
+#define CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP
+
+#include "CCF/IDL2/Traversal/Elements.hpp"
+
+#include "CCF/IDL2/SemanticGraph/ValueTypeMember.hpp"
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ template <typename T>
+ struct ValueTypeMemberTemplate : Node<T>
+ {
+ virtual void
+ traverse (T&);
+
+ virtual void
+ pre (T&);
+
+ virtual void
+ belongs (T&, EdgeDispatcherBase&);
+
+ virtual void
+ belongs (T&);
+
+ virtual void
+ name (T&);
+
+ virtual void
+ post (T&);
+
+ using Node<T>::edge_traverser;
+ };
+
+ typedef
+ ValueTypeMemberTemplate<SemanticGraph::ValueTypeMember>
+ ValueTypeMember;
+
+ typedef
+ ValueTypeMemberTemplate<SemanticGraph::ValueTypePrivateMember>
+ ValueTypePrivateMember;
+
+ typedef
+ ValueTypeMemberTemplate<SemanticGraph::ValueTypePublicMember>
+ ValueTypePublicMember;
+ }
+ }
+}
+
+#include "CCF/IDL2/Traversal/ValueTypeMember.tpp"
+
+#endif // CCF_IDL2_TRAVERSAL_VALUE_TYPE_MEMBER_HPP
diff --git a/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp
new file mode 100644
index 00000000000..9629a9e056b
--- /dev/null
+++ b/CIAO/CCF/CCF/IDL2/Traversal/ValueTypeMember.tpp
@@ -0,0 +1,54 @@
+// file : CCF/IDL2/Traversal/ValueTypeMember.tpp
+// author : Boris Kolpackov <boris@dre.vanderbilt.edu>
+// cvs-id : $Id$
+
+namespace CCF
+{
+ namespace IDL2
+ {
+ namespace Traversal
+ {
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ traverse (T& m)
+ {
+ pre (m);
+ belongs (m);
+ name (m);
+ post (m);
+ }
+
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ pre (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ belongs (T& m, EdgeDispatcherBase& d)
+ {
+ d.traverse (m.belongs ());
+ }
+
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ belongs (T& m)
+ {
+ belongs (m, edge_traverser ());
+ }
+
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ name (T&)
+ {
+ }
+
+ template <typename T>
+ void ValueTypeMemberTemplate<T>::
+ post (T&)
+ {
+ }
+ }
+ }
+}