summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-03-09 09:28:44 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-03-09 09:28:44 +0000
commit1b2011afec93b9586ee53b0490d6cd6ca8f1eb13 (patch)
tree880f7a17027482fdf686a2edd9a6538efa3bb216
parent2f39456fe4697b12afb82160a0fa129ffd6096cf (diff)
downloadATCD-1b2011afec93b9586ee53b0490d6cd6ca8f1eb13.tar.gz
*** empty log message ***
-rw-r--r--TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp95
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp490
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h61
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h18
11 files changed, 427 insertions, 267 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
index 0bb8eb73e98..b1bc30e927d 100644
--- a/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_enum/enum_cs.cpp
@@ -18,7 +18,7 @@
//
// ============================================================================
-#include "be_visitor_typecode/typecode_defn.h"
+#include "be_visitor_typecode/enum_typecode.h"
ACE_RCSID (be_visitor_enum,
enum_cs,
@@ -52,10 +52,10 @@ be_visitor_enum_cs::visit_enum (be_enum *node)
if (be_global->tc_support ())
{
be_visitor_context ctx (*this->ctx_);
- ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- be_visitor_typecode_defn visitor (&ctx);
+ // ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
+ TAO::be_visitor_enum_typecode visitor (&ctx);
- if (node->accept (&visitor) == -1)
+ if (visitor.visit_enum (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_enum_cs::"
diff --git a/TAO/TAO_IDL/be/be_visitor_exception.cpp b/TAO/TAO_IDL/be/be_visitor_exception.cpp
index acbbc850b2e..bd305d0ba08 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception.cpp
@@ -38,6 +38,7 @@
#include "be_visitor_exception.h"
#include "be_visitor_context.h"
#include "be_visitor_field.h"
+#include "be_visitor_typecode.h"
#include "ace/Log_Msg.h"
#include "be_visitor_exception/exception.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index 0809846369b..f07ddc6fbd2 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -456,7 +456,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
be_visitor_context ctx = *this->ctx_;
// ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- TAO::be_visitor_objref_typecode tc_visitor (&ctx, node);
+ TAO::be_visitor_objref_typecode tc_visitor (&ctx);
if (node->accept (&tc_visitor) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
index aae8862c8cc..f0aa274237f 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
@@ -49,6 +49,7 @@
#include "be_visitor_typecode/typecode_defn.cpp"
#include "be_visitor_typecode/alias_typecode.cpp"
+#include "be_visitor_typecode/enum_typecode.cpp"
#include "be_visitor_typecode/objref_typecode.cpp"
#include "be_visitor_typecode/struct_typecode.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
new file mode 100644
index 00000000000..a87e2f40d34
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file enum_typecode.cpp
+ *
+ * $Id$
+ *
+ * Enumeration TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+
+#include "utl_scope.h"
+
+#include <string>
+
+
+TAO::be_visitor_enum_typecode::be_visitor_enum_typecode (
+ be_visitor_context * ctx)
+ : be_visitor_typecode_defn (ctx)
+{
+}
+
+int
+TAO::be_visitor_enum_typecode::visit_enum (be_enum * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ os << be_nl << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+
+ std::string const enumerators_name (std::string ("_tao_enumerators_")
+ + node->flat_name ());
+
+ // Generate array containing enum field characteristics.
+ os << "static TAO::TypeCode::Enumerator<char const *> const "
+ << enumerators_name.c_str ()
+ << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
+
+ if (this->visit_members (node) != 0)
+ return -1;
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl << be_nl;
+
+ // Generate the TypeCode instantiation.
+ os
+ << "static TAO::TypeCode::Enum<char const *," << be_nl
+ << " TAO::TypeCode::Enumerator<char const *> const *," << be_nl
+ << " TAO::Null_RefCount_Policy> const"
+ << be_idt_nl
+ << "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
+ << "\"" << node->repoID () << "\"," << be_nl
+ << "\"" << node->original_local_name () << "\"," << be_nl
+ << "_tao_enumerators_" << node->flat_name () << "," << be_nl
+ << node->member_count () << ");" << be_uidt_nl
+ << be_uidt_nl;
+
+ return this->gen_typecode_ptr (node);
+}
+
+int
+TAO::be_visitor_enum_typecode::visit_members (be_enum * node)
+{
+ TAO_OutStream & os = *this->ctx_->stream ();
+
+ size_t const count = node->member_count ();
+ size_t n = 0;
+
+ for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
+ !i.is_done ();
+ i.next ())
+ {
+ AST_Decl * const d = i.item ();
+ AST_EnumVal * const item = AST_EnumVal::narrow_from_decl (d);
+
+ // os << item->name ();
+ os << "\"" << item->original_local_name () << "\"";
+
+ if (n < count - 1)
+ os << ",";
+
+ os << be_nl;
+
+ ++n;
+ }
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
index 41c6483a5d0..442541773ba 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
@@ -25,7 +25,7 @@ TAO::be_visitor_struct_typecode::be_visitor_struct_typecode (
}
int
-TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
+TAO::be_visitor_struct_typecode::visit_structure (AST_Structure * node)
{
TAO_OutStream & os = *this->ctx_->stream ();
@@ -40,7 +40,7 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
// Generate array containing struct field characteristics.
os << "static TAO::TypeCode::Field<char const *> const "
<< fields_name.c_str ()
- << " =" << be_idt_nl
+ << "[] =" << be_idt_nl
<< "{" << be_idt_nl;
if (this->visit_members (node) != 0)
@@ -54,7 +54,7 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
<< "static TAO::TypeCode::Struct<char const *," << be_nl
<< " TAO::TypeCode::Field<char const *> const *," << be_nl
<< " CORBA::tk_"
- << (this->is_exception_ ? "except" : "struct") << ">," << be_nl
+ << (this->is_exception_ ? "except" : "struct") << be_nl
<< " TAO::Null_RefCount_Policy> const"
<< be_idt_nl
<< "_tao_tc_" << node->flat_name () << " (" << be_idt_nl
@@ -64,11 +64,12 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
<< node->nfields () << ");" << be_uidt_nl
<< be_uidt_nl;
- return this->gen_typecode_ptr (node);
+ return
+ this->gen_typecode_ptr (be_type::narrow_from_decl (node));
}
int
-TAO::be_visitor_struct_typecode::visit_members (be_structure * node)
+TAO::be_visitor_struct_typecode::visit_members (AST_Structure * node)
{
AST_Field ** member_ptr = 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
index 0cdb2825737..c4f403e0661 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -474,61 +474,61 @@ be_visitor_typecode_defn::visit_array (be_array *node)
-1);
}
-int
-be_visitor_typecode_defn::visit_enum (be_enum *node)
-{
- switch (this->ctx_->sub_state ())
- {
- case TAO_CodeGen::TAO_TC_DEFN_TYPECODE:
- return this->visit_type (node);
- case TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED:
- return this->gen_typecode (node);
+// int
+// be_visitor_typecode_defn::visit_enum (be_enum *node)
+// {
+// switch (this->ctx_->sub_state ())
+// {
+// case TAO_CodeGen::TAO_TC_DEFN_TYPECODE:
+// return this->visit_type (node);
+// case TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED:
+// return this->gen_typecode (node);
- case TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION:
- return this->gen_encapsulation (node);
+// case TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION:
+// return this->gen_encapsulation (node);
- case TAO_CodeGen::TAO_TC_DEFN_TC_SIZE:
- this->computed_tc_size_ = this->compute_tc_size (node);
- return ((this->computed_tc_size_ > 0) ? 0 : -1);
- case TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN:
- this->computed_encap_len_ = this->compute_encap_length (node);
- return ((this->computed_encap_len_ > 0) ? 0 : -1);
- case TAO_CodeGen::TAO_TC_DEFN_SCOPE:
- case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN:
- return this->visit_scope (node);
- default:
- // error
- break;
- }
+// case TAO_CodeGen::TAO_TC_DEFN_TC_SIZE:
+// this->computed_tc_size_ = this->compute_tc_size (node);
+// return ((this->computed_tc_size_ > 0) ? 0 : -1);
+// case TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN:
+// this->computed_encap_len_ = this->compute_encap_length (node);
+// return ((this->computed_encap_len_ > 0) ? 0 : -1);
+// case TAO_CodeGen::TAO_TC_DEFN_SCOPE:
+// case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN:
+// return this->visit_scope (node);
+// default:
+// // error
+// break;
+// }
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::")
- ACE_TEXT ("visit - bad sub state ")
- ACE_TEXT ("in visitor context\n")),
- -1);
-}
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::")
+// ACE_TEXT ("visit - bad sub state ")
+// ACE_TEXT ("in visitor context\n")),
+// -1);
+// }
-int
-be_visitor_typecode_defn::visit_enum_val (be_enum_val *node)
-{
- switch (this->ctx_->sub_state ())
- {
- case TAO_CodeGen::TAO_TC_DEFN_SCOPE:
- return this->gen_encapsulation (node);
- case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN:
- this->computed_encap_len_ = this->compute_encap_length (node);
- return ((this->computed_encap_len_ > 0) ? 0 : -1);
- default:
- // error
- break;
- }
+// int
+// be_visitor_typecode_defn::visit_enum_val (be_enum_val *node)
+// {
+// switch (this->ctx_->sub_state ())
+// {
+// case TAO_CodeGen::TAO_TC_DEFN_SCOPE:
+// return this->gen_encapsulation (node);
+// case TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN:
+// this->computed_encap_len_ = this->compute_encap_length (node);
+// return ((this->computed_encap_len_ > 0) ? 0 : -1);
+// default:
+// // error
+// break;
+// }
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::")
- ACE_TEXT ("visit - bad sub state ")
- ACE_TEXT ("in visitor context\n")),
- -1);
-}
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn::")
+// ACE_TEXT ("visit - bad sub state ")
+// ACE_TEXT ("in visitor context\n")),
+// -1);
+// }
int
be_visitor_typecode_defn::visit_exception (be_exception *node)
@@ -1010,130 +1010,130 @@ be_visitor_typecode_defn::gen_encapsulation (be_array *node)
return 0;
}
-int
-be_visitor_typecode_defn::gen_typecode (be_enum *node)
-{
- TAO_OutStream *os = this->ctx_->stream ();
+// int
+// be_visitor_typecode_defn::gen_typecode (be_enum *node)
+// {
+// TAO_OutStream *os = this->ctx_->stream ();
- os->indent ();
+// os->indent ();
- // Check if we are repeated.
- const be_visitor_typecode_defn::QNode *qnode =
- this->queue_lookup (this->tc_queue_, node);
+// // Check if we are repeated.
+// const be_visitor_typecode_defn::QNode *qnode =
+// this->queue_lookup (this->tc_queue_, node);
- if (qnode && be_global->opt_tc ())// encapsulation length)
- {
- // We are repeated, so we must generate an indirection here.
- *os << "0xffffffff, // indirection" << be_nl;
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// if (qnode && be_global->opt_tc ())// encapsulation length)
+// {
+// // We are repeated, so we must generate an indirection here.
+// *os << "0xffffffff, // indirection" << be_nl;
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- // The offset must point to the tc_kind value of the first occurrence of
- // this type.
- os->print ("0x%x, // negative offset (%ld)\n",
- (qnode->offset - this->tc_offset_),
- (qnode->offset - this->tc_offset_));
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
- }
- else
- {
- if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::"
- "visit_type - "
- "queue insert failed\n"),
- -1);
- }
+// // The offset must point to the tc_kind value of the first occurrence of
+// // this type.
+// os->print ("0x%x, // negative offset (%ld)\n",
+// (qnode->offset - this->tc_offset_),
+// (qnode->offset - this->tc_offset_));
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// }
+// else
+// {
+// if (this->queue_insert (this->tc_queue_, node, this->tc_offset_) == 0)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::"
+// "visit_type - "
+// "queue insert failed\n"),
+// -1);
+// }
- *os << "CORBA::tk_enum, // typecode kind" << be_nl;
+// *os << "CORBA::tk_enum, // typecode kind" << be_nl;
- // Size of the enum.
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// // Size of the enum.
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- {
- Scoped_Compute_Queue_Guard guard (this);
+// {
+// Scoped_Compute_Queue_Guard guard (this);
- // Emit the encapsulation length.
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
+// // Emit the encapsulation length.
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
- if (node->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) - be_visitor_typecode_defn")
- ACE_TEXT ("gen_typecode (enum) - ")
- ACE_TEXT ("Failed to get encap length\n")),
- -1);
- }
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) - be_visitor_typecode_defn")
+// ACE_TEXT ("gen_typecode (enum) - ")
+// ACE_TEXT ("Failed to get encap length\n")),
+// -1);
+// }
+// }
- *os << this->computed_encap_len_ << ", // encapsulation length"
- << be_idt << "\n";
+// *os << this->computed_encap_len_ << ", // encapsulation length"
+// << be_idt << "\n";
- // Size of the encap length.
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// // Size of the encap length.
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- // Now emit the encapsulation.
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION);
+// // Now emit the encapsulation.
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAPSULATION);
- if (node->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::gen_typecode (enum) - ")
- ACE_TEXT ("failed to generate encapsulation\n")),
- -1);
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::gen_typecode (enum) - ")
+// ACE_TEXT ("failed to generate encapsulation\n")),
+// -1);
+// }
- *os << be_uidt << "\n";
- }
+// *os << be_uidt << "\n";
+// }
- return 0;
-}
+// return 0;
+// }
-int
-be_visitor_typecode_defn::gen_encapsulation (be_enum *node)
-{
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+// int
+// be_visitor_typecode_defn::gen_encapsulation (be_enum *node)
+// {
+// TAO_OutStream *os = this->ctx_->stream (); // output stream
- *os << "TAO_ENCAP_BYTE_ORDER, // byte order" << be_nl;
- // size of the encapsulation byte order flag. Although it is 1 byte, the
- // aligned size is 4 bytes
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// *os << "TAO_ENCAP_BYTE_ORDER, // byte order" << be_nl;
+// // size of the encapsulation byte order flag. Although it is 1 byte, the
+// // aligned size is 4 bytes
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- // generate repoID
- this->gen_repoID (node);
+// // generate repoID
+// this->gen_repoID (node);
- // generate name
- this->gen_name (node);
+// // generate name
+// this->gen_name (node);
- // generate the member count
- *os << node->member_count () << ", // member count" << be_nl;
- // size of the member length
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// // generate the member count
+// *os << node->member_count () << ", // member count" << be_nl;
+// // size of the member length
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- // hand over to the scope to generate the typecode for elements
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
+// // hand over to the scope to generate the typecode for elements
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
- if (node->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::gen_encapsulation (enum) - ")
- ACE_TEXT ("cannot generate typecode for members\n")),
- -1);
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::gen_encapsulation (enum) - ")
+// ACE_TEXT ("cannot generate typecode for members\n")),
+// -1);
+// }
- return 0;
-}
+// return 0;
+// }
-int
-be_visitor_typecode_defn::gen_encapsulation (be_enum_val *node)
-{
- // generate name
- this->gen_name (node);
+// int
+// be_visitor_typecode_defn::gen_encapsulation (be_enum_val *node)
+// {
+// // generate name
+// this->gen_name (node);
- return 0;
-}
+// return 0;
+// }
int
be_visitor_typecode_defn::gen_typecode (be_exception *node)
@@ -2480,119 +2480,119 @@ be_visitor_typecode_defn::compute_encap_length (be_array *node)
return this->computed_encap_len_;
}
-ACE_CDR::Long
-be_visitor_typecode_defn::compute_tc_size (be_enum *node)
-{
- // while computing the encapsulation length we must keep in mind the typecode
- // that has gotten generated until this point. Hence, we must first check the
- // "tc_queue" to ensure if are already there somewhere in a previous
- // encapsulation in which case we must count only the bytes for the
- // indirection. If we are not already generated, we must then check if we
- // have already been counted in the current computation or not by checking
- // for our presence in the compute queue. In both cases, we only include the
- // 8 bytes in the computation
- if (be_global->opt_tc ()
- && (this->queue_lookup (this->tc_queue_, node)
- || this->queue_lookup (this->compute_queue_, node)))
- {
- this->computed_tc_size_ = 4 + 4;
- }
- else
- {
- // Insert node into tc_queue_ in case the node is involved in
- // some form of recursion.
- if (this->queue_insert (this->compute_queue_,
- node,
- this->tc_offset_)
- == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::"
- "compute_tc_size (enum) - "
- "queue insert failed\n"),
- -1);
- }
+// ACE_CDR::Long
+// be_visitor_typecode_defn::compute_tc_size (be_enum *node)
+// {
+// // while computing the encapsulation length we must keep in mind the typecode
+// // that has gotten generated until this point. Hence, we must first check the
+// // "tc_queue" to ensure if are already there somewhere in a previous
+// // encapsulation in which case we must count only the bytes for the
+// // indirection. If we are not already generated, we must then check if we
+// // have already been counted in the current computation or not by checking
+// // for our presence in the compute queue. In both cases, we only include the
+// // 8 bytes in the computation
+// if (be_global->opt_tc ()
+// && (this->queue_lookup (this->tc_queue_, node)
+// || this->queue_lookup (this->compute_queue_, node)))
+// {
+// this->computed_tc_size_ = 4 + 4;
+// }
+// else
+// {
+// // Insert node into tc_queue_ in case the node is involved in
+// // some form of recursion.
+// if (this->queue_insert (this->compute_queue_,
+// node,
+// this->tc_offset_)
+// == 0)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::"
+// "compute_tc_size (enum) - "
+// "queue insert failed\n"),
+// -1);
+// }
- // 4 bytes for enumeration, 4 bytes for storing encap length val, followed by the
- // actual encapsulation
+// // 4 bytes for enumeration, 4 bytes for storing encap length val, followed by the
+// // actual encapsulation
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
- if (node->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::compute_tc_size (enum) - ")
- ACE_TEXT ("cannot compute encap len\n")),
- -1);
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::compute_tc_size (enum) - ")
+// ACE_TEXT ("cannot compute encap len\n")),
+// -1);
+// }
- this->computed_tc_size_ = 4 + 4 + this->computed_encap_len_;
- }
- return this->computed_tc_size_;
-}
+// this->computed_tc_size_ = 4 + 4 + this->computed_encap_len_;
+// }
+// return this->computed_tc_size_;
+// }
-ACE_CDR::Long
-be_visitor_typecode_defn::compute_encap_length (be_enum *node)
-{
- ACE_CDR::Long encap_len;
- encap_len = 4; // holds the byte order flag
+// ACE_CDR::Long
+// be_visitor_typecode_defn::compute_encap_length (be_enum *node)
+// {
+// ACE_CDR::Long encap_len;
+// encap_len = 4; // holds the byte order flag
- encap_len +=
- this->repoID_encap_len (node); // repoID storage
+// encap_len +=
+// this->repoID_encap_len (node); // repoID storage
- // do the same thing for the local name
- encap_len += this->name_encap_len (node);
+// // do the same thing for the local name
+// encap_len += this->name_encap_len (node);
- encap_len += 4; // to hold the member count
+// encap_len += 4; // to hold the member count
- // save the current value of scope len and start with a fresh one for our
- // scope length computation
- if (this->push (this->computed_scope_encap_len_) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::compute_encap_len (enum) - ")
- ACE_TEXT ("push failed\n")),
- -1);
- }
+// // save the current value of scope len and start with a fresh one for our
+// // scope length computation
+// if (this->push (this->computed_scope_encap_len_) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::compute_encap_len (enum) - ")
+// ACE_TEXT ("push failed\n")),
+// -1);
+// }
- this->computed_scope_encap_len_ = 0;
+// this->computed_scope_encap_len_ = 0;
- // compute encap length for members
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN);
+// // compute encap length for members
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE_LEN);
- if (node->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::compute_encap_len (enum) - ")
- ACE_TEXT ("cannot compute scope tc size\n")),
- -1);
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::compute_encap_len (enum) - ")
+// ACE_TEXT ("cannot compute scope tc size\n")),
+// -1);
+// }
- this->computed_encap_len_ = encap_len + this->computed_scope_encap_len_;
+// this->computed_encap_len_ = encap_len + this->computed_scope_encap_len_;
- // pop off the previous value of computed_scope_len_
- if (this->pop (this->computed_scope_encap_len_) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::compute_encap_len (enum) - ")
- ACE_TEXT ("pop failed\n")),
- -1);
- }
+// // pop off the previous value of computed_scope_len_
+// if (this->pop (this->computed_scope_encap_len_) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::compute_encap_len (enum) - ")
+// ACE_TEXT ("pop failed\n")),
+// -1);
+// }
- return this->computed_encap_len_;
-}
+// return this->computed_encap_len_;
+// }
-ACE_CDR::Long
-be_visitor_typecode_defn::compute_encap_length (be_enum_val *node)
-{
- this->computed_encap_len_ = this->name_encap_len (node);
- return this->computed_encap_len_;
-}
+// ACE_CDR::Long
+// be_visitor_typecode_defn::compute_encap_length (be_enum_val *node)
+// {
+// this->computed_encap_len_ = this->name_encap_len (node);
+// return this->computed_encap_len_;
+// }
ACE_CDR::Long
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
index 0864d86b7da..ed01936046c 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
@@ -29,6 +29,7 @@
#include "be_visitor_typecode/typecode_defn.h"
#include "be_visitor_typecode/alias_typecode.h"
+#include "be_visitor_typecode/enum_typecode.h"
#include "be_visitor_typecode/objref_typecode.h"
#include "be_visitor_typecode/struct_typecode.h"
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h
new file mode 100644
index 00000000000..2f59ba11665
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/enum_typecode.h
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file enum_typecode.h
+ *
+ * $Id$
+ *
+ * Enumeration TypeCode generation visitor.
+ *
+ * @author Ossama Othman <ossama@dre.vanderbilt.edu>
+ */
+//=============================================================================
+
+#ifndef TAO_BE_VISITOR_ENUM_TYPECODE_H
+#define TAO_BE_VISITOR_ENUM_TYPECODE_H
+
+#include "ace/pre.h"
+
+#include "typecode_defn.h"
+
+namespace TAO
+{
+
+ /**
+ * @class be_visitor_enum_typecode
+ *
+ * @brief Enumeration TypeCode generation visitor.
+ *
+ * Enumeration TypeCode generation visitor.
+ */
+ class be_visitor_enum_typecode
+ : public be_visitor_typecode_defn
+ {
+ public:
+
+ /// Constructor.
+ be_visitor_enum_typecode (be_visitor_context * ctx);
+
+ /// Visit an enumeration.
+ /**
+ * @todo The legacy method name "@c visit_enum()" is
+ * redundant since it is obvious from the argument what kind
+ * of TypeCode is being visited. It will be changed once
+ * the rest of the legacy method names and their call sites
+ * are updated accordingly.
+ */
+ virtual int visit_enum (be_enum * node);
+
+ private:
+
+ /// Generate structure field related TypeCode code.
+ int visit_members (be_enum * node);
+
+ };
+
+}
+
+#include "ace/post.h"
+
+#endif /* TAO_BE_VISITOR_ENUM_TYPECODE_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h
index 87f4378843c..a58fa8fd932 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h
@@ -6,7 +6,7 @@
*
* $Id$
*
- * Object reference TypeCode generation visitor.
+ * Structure TypeCode generation visitor.
*
* @author Ossama Othman <ossama@dre.vanderbilt.edu>
*/
@@ -44,12 +44,12 @@ namespace TAO
* the rest of the legacy method names and their call sites
* are updated accordingly.
*/
- virtual int visit_structure (be_structure * node);
+ virtual int visit_structure (AST_Structure * node);
private:
/// Generate structure field related TypeCode code.
- int visit_members (be_structure * node);
+ int visit_members (AST_Structure * node);
private:
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
index e8a18701e71..99ec920e01d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
@@ -63,7 +63,7 @@ public:
virtual int visit_array (be_array *node);
// visit a array
- virtual int visit_enum (be_enum *node);
+// virtual int visit_enum (be_enum *node);
// visit an enum
virtual int visit_exception (be_exception *node);
@@ -102,8 +102,8 @@ public:
// = visit methods for the scope elements
- virtual int visit_enum_val (be_enum_val *node);
- // visit the enumeration values
+// virtual int visit_enum_val (be_enum_val *node);
+// // visit the enumeration values
virtual int visit_field (be_field *node);
// visit the field (struct and exception member)
@@ -123,7 +123,7 @@ public:
int gen_typecode (be_array *node);
- int gen_typecode (be_enum *node);
+// int gen_typecode (be_enum *node);
int gen_typecode (be_exception *node);
@@ -149,9 +149,9 @@ public:
int gen_encapsulation (be_array *node);
- int gen_encapsulation (be_enum *node);
+// int gen_encapsulation (be_enum *node);
- int gen_encapsulation (be_enum_val *node);
+// int gen_encapsulation (be_enum_val *node);
int gen_encapsulation (be_exception *node);
@@ -181,7 +181,7 @@ public:
ACE_CDR::Long compute_tc_size (be_array *node);
- ACE_CDR::Long compute_tc_size (be_enum *node);
+// ACE_CDR::Long compute_tc_size (be_enum *node);
ACE_CDR::Long compute_tc_size (be_exception *node);
@@ -207,9 +207,9 @@ public:
ACE_CDR::Long compute_encap_length (be_array *node);
- ACE_CDR::Long compute_encap_length (be_enum *node);
+// ACE_CDR::Long compute_encap_length (be_enum *node);
- ACE_CDR::Long compute_encap_length (be_enum_val *node);
+// ACE_CDR::Long compute_encap_length (be_enum_val *node);
ACE_CDR::Long compute_encap_length (be_exception *node);