summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-03-17 07:02:02 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-03-17 07:02:02 +0000
commite959aa4c9eb2b0cfb9e0f5bddb1f1ec8f042b4d1 (patch)
tree51e445d0bf00867625631a7a2b8ebca06a1e0e1e
parent5c5227af6bf5b8cab821d02e610e0e2bb85f70c7 (diff)
downloadATCD-e959aa4c9eb2b0cfb9e0f5bddb1f1ec8f042b4d1.tar.gz
*** empty log message ***
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp726
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp81
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h18
-rw-r--r--TAO/tao/TypeCode/Value_TypeCode.h4
-rw-r--r--TAO/tao/TypeCode/Value_TypeCode.inl8
8 files changed, 438 insertions, 403 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
index f111ac1a5e1..3ff1f795d96 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp
@@ -52,6 +52,7 @@
#include "be_visitor_typecode/enum_typecode.cpp"
#include "be_visitor_typecode/objref_typecode.cpp"
#include "be_visitor_typecode/struct_typecode.cpp"
+#include "be_visitor_typecode/value_typecode.cpp"
ACE_RCSID (be,
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 4270e9ecd18..a5bc4e7f15b 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -147,77 +147,77 @@ be_visitor_typecode_defn::~be_visitor_typecode_defn (void)
// return 0;
// }
-int
-be_visitor_typecode_defn::visit_members (be_valuetype *node)
-{
- this->elem_number_ = 0;
+// int
+// be_visitor_typecode_defn::visit_members (be_valuetype *node)
+// {
+// this->elem_number_ = 0;
- for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next())
- {
- AST_Decl *d = si.item ();
+// for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
+// !si.is_done ();
+// si.next())
+// {
+// AST_Decl *d = si.item ();
- if (!d)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::visit_members - "
- "bad node in this scope\n"),
- -1);
- }
+// if (!d)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::visit_members - "
+// "bad node in this scope\n"),
+// -1);
+// }
- AST_Field *field = AST_Field::narrow_from_decl (d);
+// AST_Field *field = AST_Field::narrow_from_decl (d);
- if (!field)
- {
- continue;
- }
+// if (!field)
+// {
+// continue;
+// }
- be_decl *bd = be_decl::narrow_from_decl (d);
+// be_decl *bd = be_decl::narrow_from_decl (d);
- // Set the scope node as "node" in which the code is being
- // generated so that elements in the node's scope can use it
- // for code generation
- this->ctx_->scope (node->decl ());
+// // Set the scope node as "node" in which the code is being
+// // generated so that elements in the node's scope can use it
+// // for code generation
+// this->ctx_->scope (node->decl ());
- // Set the node to be visited.
- this->ctx_->node (bd);
- this->elem_number_++;
+// // Set the node to be visited.
+// this->ctx_->node (bd);
+// this->elem_number_++;
- // Do any pre processing using the next item info.
- if (this->pre_process (bd) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::"
- "visit_members - "
- "pre processing failed\n"
- ),
- -1);
- }
+// // Do any pre processing using the next item info.
+// if (this->pre_process (bd) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::"
+// "visit_members - "
+// "pre processing failed\n"
+// ),
+// -1);
+// }
- // Send the visitor.
- if (bd == 0 || bd->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::"
- "visit_members - "
- "codegen for scope failed\n"
- ), -1);
- }
+// // Send the visitor.
+// if (bd == 0 || bd->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::"
+// "visit_members - "
+// "codegen for scope failed\n"
+// ), -1);
+// }
- // Do any post processing using this item info.
- if (this->post_process (bd) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typecode_defn::"
- "visit_members - "
- "post processing failed\n"
- ), -1);
- }
- }
+// // Do any post processing using this item info.
+// if (this->post_process (bd) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// "(%N:%l) be_visitor_typecode_defn::"
+// "visit_members - "
+// "post processing failed\n"
+// ), -1);
+// }
+// }
- return 0;
-}
+// return 0;
+// }
// The following needs to be done to deal until the MSVC compiler's broken
@@ -330,30 +330,30 @@ be_visitor_typecode_defn::visit_type (be_type *node)
case AST_Decl::NT_array:
*os << "CORBA::tk_array";
break;
- case AST_Decl::NT_enum:
- *os << "CORBA::tk_enum";
- break;
- case AST_Decl::NT_except:
- *os << "CORBA::tk_except";
- break;
+// case AST_Decl::NT_enum:
+// *os << "CORBA::tk_enum";
+// break;
+// case AST_Decl::NT_except:
+// *os << "CORBA::tk_except";
+// break;
// case AST_Decl::NT_interface:
// *os << "CORBA::tk_objref";
// break;
- case AST_Decl::NT_valuetype:
- *os << "CORBA::tk_value";
- break;
- case AST_Decl::NT_eventtype:
- *os << "CORBA::tk_event";
- break;
- case AST_Decl::NT_component:
- *os << "CORBA::tk_component";
- break;
+// case AST_Decl::NT_valuetype:
+// *os << "CORBA::tk_value";
+// break;
+// case AST_Decl::NT_eventtype:
+// *os << "CORBA::tk_event";
+// break;
+// case AST_Decl::NT_component:
+// *os << "CORBA::tk_component";
+// break;
case AST_Decl::NT_sequence:
*os << "CORBA::tk_sequence";
break;
- case AST_Decl::NT_struct:
- *os << "CORBA::tk_struct";
- break;
+// case AST_Decl::NT_struct:
+// *os << "CORBA::tk_struct";
+// break;
// case AST_Decl::NT_typedef:
// *os << "CORBA::tk_alias";
// break;
@@ -808,43 +808,43 @@ be_visitor_typecode_defn::visit_union (be_union *node)
-1);
}
-int
-be_visitor_typecode_defn::visit_valuetype (be_valuetype *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_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_members (node);
- default:
- // error
- break;
- }
+// int
+// be_visitor_typecode_defn::visit_valuetype (be_valuetype *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_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_members (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_eventtype (be_eventtype *node)
-{
- return this->visit_valuetype (node);
-}
+// int
+// be_visitor_typecode_defn::visit_eventtype (be_eventtype *node)
+// {
+// return this->visit_valuetype (node);
+// }
int
be_visitor_typecode_defn::visit_union_branch (be_union_branch *node)
@@ -2249,174 +2249,174 @@ be_visitor_typecode_defn::gen_encapsulation (be_union_branch *node)
return 0;
}
-int
-be_visitor_typecode_defn::gen_typecode (be_valuetype *node)
-{
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+// int
+// be_visitor_typecode_defn::gen_typecode (be_valuetype *node)
+// {
+// TAO_OutStream *os = this->ctx_->stream (); // output stream
- os->indent (); // start from whatever indentation level we were at
+// os->indent (); // start from whatever indentation level we were at
- // 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);
- ACE_Unbounded_Queue<AST_Type *> list;
+// ACE_Unbounded_Queue<AST_Type *> list;
- if (qnode && (be_global->opt_tc () || node->in_recursion (list)))
- {
- // 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
- {
- // Insert node into tc_queue_ in case the node is involved in
- // some form of recursion.
- 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);
- }
+// if (qnode && (be_global->opt_tc () || node->in_recursion (list)))
+// {
+// // 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
+// {
+// // Insert node into tc_queue_ in case the node is involved in
+// // some form of recursion.
+// 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_value, // typecode kind" << be_nl;
- // size of the enum
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// *os << "CORBA::tk_value, // typecode kind" << be_nl;
+// // 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 (valuetype) - ")
- 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 (valuetype) - ")
+// ACE_TEXT ("Failed to get encap length\n")),
+// -1);
+// }
+// }
- *os << this->computed_encap_len_ << ", // encapsulation length"
- << be_idt << "\n";
- // size of the encap length
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// *os << this->computed_encap_len_ << ", // encapsulation length"
+// << be_idt << "\n";
+// // 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 (valuetype) - ")
- 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 (valuetype) - ")
+// 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_valuetype *node)
-{
- TAO_OutStream *os = this->ctx_->stream (); // output stream
+// int
+// be_visitor_typecode_defn::gen_encapsulation (be_valuetype *node)
+// {
+// TAO_OutStream *os = this->ctx_->stream (); // output stream
- os->indent (); // start from whatever indentation level we were at
+// os->indent (); // start from whatever indentation level we were at
- *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);
- // STEP 1: generate repoID
- this->gen_repoID (node);
+// // STEP 1: generate repoID
+// this->gen_repoID (node);
- // STEP 2: generate name
- os->indent ();
- this->gen_name (node);
+// // STEP 2: generate name
+// os->indent ();
+// this->gen_name (node);
- // STEP 3: generate ValueModifier
+// // STEP 3: generate ValueModifier
- // By spec ValueModifier is UShort but aligned size
- // seems always to be 4.
- os->indent ();
+// // By spec ValueModifier is UShort but aligned size
+// // seems always to be 4.
+// os->indent ();
- // TAO doesn't support neither CUSTOM nor TRUNCATABLE
- // valuetypes. So basically need to choose between
- // VM_NONE = 0 and VM_ABSTRACT = 2
- ACE_CDR::ULong value_modifier = node->is_abstract () ? 2 : 0;
+// // TAO doesn't support neither CUSTOM nor TRUNCATABLE
+// // valuetypes. So basically need to choose between
+// // VM_NONE = 0 and VM_ABSTRACT = 2
+// ACE_CDR::ULong value_modifier = node->is_abstract () ? 2 : 0;
- *os << value_modifier << ", // value modifier" << "\n";
+// *os << value_modifier << ", // value modifier" << "\n";
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- //STEP 4: generate TypeCode of concrete base
+// //STEP 4: generate TypeCode of concrete base
- AST_ValueType *concrete_inherited = node->inherits_concrete ();
+// AST_ValueType *concrete_inherited = node->inherits_concrete ();
- if (concrete_inherited != 0)
- {
- // Got non-abstract base valuetype. Now emit its typecode
- be_valuetype *vt = be_valuetype::narrow_from_decl(concrete_inherited);
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
+// if (concrete_inherited != 0)
+// {
+// // Got non-abstract base valuetype. Now emit its typecode
+// be_valuetype *vt = be_valuetype::narrow_from_decl(concrete_inherited);
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED);
- if (!vt || vt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::gen_encapsulation (valuetype) - ")
- ACE_TEXT ("failed to generate typecode\n")),
- -1);
- }
+// if (!vt || vt->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::gen_encapsulation (valuetype) - ")
+// ACE_TEXT ("failed to generate typecode\n")),
+// -1);
+// }
- // revert the state to what it was before
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
- }
- else
- {
- // emit tk_null
- os->indent ();
- *os << "CORBA::tk_null, // no stateful base valuetype"
- << "\n\n";
+// // revert the state to what it was before
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
+// }
+// else
+// {
+// // emit tk_null
+// os->indent ();
+// *os << "CORBA::tk_null, // no stateful base valuetype"
+// << "\n\n";
- // size of the enum
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
- }
+// // size of the enum
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// }
- // STEP 5: generate the member count
- *os << node->data_members_count () << ", // member count" << be_nl;
+// // STEP 5: generate the member count
+// *os << node->data_members_count () << ", // member count" << be_nl;
- // Size of the member count.
- this->tc_offset_ += sizeof (ACE_CDR::ULong);
+// // Size of the member count.
+// this->tc_offset_ += sizeof (ACE_CDR::ULong);
- // STEP 6: hand over to the scope to generate the typecode for elements
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_SCOPE);
+// // STEP 6: 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,
- "be_valuetype: cannot generate typecode for members\n"), -1);
- }
+// if (node->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN((
+// LM_ERROR,
+// "be_valuetype: cannot generate typecode for members\n"), -1);
+// }
- return 0;
-}
+// return 0;
+// }
// = methods for computing typecode and encapsulation sizes
@@ -3297,145 +3297,145 @@ be_visitor_typecode_defn::compute_encap_length (be_union_branch *node)
return this->computed_encap_len_;
}
-ACE_CDR::Long
-be_visitor_typecode_defn::compute_tc_size (be_valuetype *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
- ACE_Unbounded_Queue<AST_Type *> list;
+// ACE_CDR::Long
+// be_visitor_typecode_defn::compute_tc_size (be_valuetype *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
+// ACE_Unbounded_Queue<AST_Type *> list;
- if ((be_global->opt_tc () || node->in_recursion (list))
- && (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 (valuetype) - "
- "queue insert failed\n"),
- -1);
- }
+// if ((be_global->opt_tc () || node->in_recursion (list))
+// && (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 (valuetype) - "
+// "queue insert failed\n"),
+// -1);
+// }
- 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 (valuetype) - ")
- 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 (valuetype) - ")
+// ACE_TEXT ("cannot compute encap len\n")),
+// -1);
+// }
- this->computed_tc_size_ = 4 + 4 + this->computed_encap_len_;
- }
+// this->computed_tc_size_ = 4 + 4 + this->computed_encap_len_;
+// }
- return this->computed_tc_size_;
-}
+// return this->computed_tc_size_;
+// }
-ACE_CDR::Long
-be_visitor_typecode_defn::compute_encap_length (be_valuetype *node)
-{
- // STEP 1:
- ACE_CDR::Long encap_len = 4; // holds the byte order flag
+// ACE_CDR::Long
+// be_visitor_typecode_defn::compute_encap_length (be_valuetype *node)
+// {
+// // STEP 1:
+// ACE_CDR::Long encap_len = 4; // holds the byte order flag
- // STEP 2:
- encap_len += this->repoID_encap_len (node); // repoID
+// // STEP 2:
+// encap_len += this->repoID_encap_len (node); // repoID
- //STEP 3: do the same thing for the local name
- encap_len += this->name_encap_len (node);
+// //STEP 3: do the same thing for the local name
+// encap_len += this->name_encap_len (node);
- // STEP 4:
- encap_len += 4; // to hold the ValueModifier
+// // STEP 4:
+// encap_len += 4; // to hold the ValueModifier
- // STEP 5: get encapsulation length for concrete base valuetype
- AST_ValueType *concrete_inherited = node->inherits_concrete ();
+// // STEP 5: get encapsulation length for concrete base valuetype
+// AST_ValueType *concrete_inherited = node->inherits_concrete ();
- if (concrete_inherited != 0)
- {
- // Got non-abstract base valuetype.
+// if (concrete_inherited != 0)
+// {
+// // Got non-abstract base valuetype.
- this->computed_tc_size_ = 0;
+// this->computed_tc_size_ = 0;
- be_valuetype *vt = be_valuetype::narrow_from_decl (concrete_inherited);
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TC_SIZE);
+// be_valuetype *vt = be_valuetype::narrow_from_decl (concrete_inherited);
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TC_SIZE);
- if (!vt || vt->accept (this) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
- ACE_TEXT ("::compute_encap_len (valuetype) - ")
- ACE_TEXT ("failed to compute len\n")),
- -1);
- }
- // revert the state to what it was before
- this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
+// if (!vt || vt->accept (this) == -1)
+// {
+// ACE_ERROR_RETURN ((LM_ERROR,
+// ACE_TEXT ("(%N:%l) be_visitor_typecode_defn")
+// ACE_TEXT ("::compute_encap_len (valuetype) - ")
+// ACE_TEXT ("failed to compute len\n")),
+// -1);
+// }
+// // revert the state to what it was before
+// this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN);
- encap_len += this->computed_tc_size_;
- }
- else
- {
- encap_len += 4; // to hold the CORBA::tk_null
- }
+// encap_len += this->computed_tc_size_;
+// }
+// else
+// {
+// encap_len += 4; // to hold the CORBA::tk_null
+// }
- //STEP 6:
- encap_len += 4; // to hold the member count
+// //STEP 6:
+// 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 (struct) - ")
- ACE_TEXT ("push failed\n")),
- -1);
- }
- this->computed_scope_encap_len_ = 0;
+// // 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 (struct) - ")
+// ACE_TEXT ("push failed\n")),
+// -1);
+// }
+// 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 (valuetype) - ")
- 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 (valuetype) - ")
+// 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 (valuetype) - ")
- 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 (valuetype) - ")
+// ACE_TEXT ("pop failed\n")),
+// -1);
+// }
- return this->computed_encap_len_;
-}
+// return this->computed_encap_len_;
+// }
// helpers that accomplish a common task - that of generating the repository
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
index 2cb30286172..eecc25f598a 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
@@ -74,30 +74,67 @@ TAO::be_visitor_value_typecode::visit_valuetype (be_valuetype * node)
// Generate array containing struct field characteristics.
os << "static TAO::TypeCode::Value_Field<char const *> const "
- << fields_name.c_str ()
- << "[] =" << be_idt_nl
- << "{" << be_idt_nl;
+ << fields_name.c_str ();
- if (this->visit_members (node) != 0)
- return -1;
+ if (count == 0)
+ {
+ os << " * const = 0;" << be_nl;
+ }
+ else
+ {
+ os << "[] =" << be_idt_nl
+ << "{" << be_idt_nl;
- os << be_uidt_nl
- << "};" << be_uidt_nl << be_nl;
+ if (this->visit_members (node) != 0)
+ return -1;
+
+ os << be_uidt_nl
+ << "};" << be_uidt_nl;
+ }
// Generate the TypeCode instantiation.
- os
- << "static TAO::TypeCode::Value<char const *," << be_nl
- << " TAO::TypeCode::Value_Field<char const *> const *," << be_nl
- << " CORBA::tk_"
- << (dynamic_cast<be_eventtype *> (node) ? "event" : "value") << "," << 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_fields_" << node->flat_name () << "," << be_nl
- << count << ");" << be_uidt_nl
- << be_uidt_nl;
+
+ os << be_nl
+ << "static TAO::TypeCode::Value<char const *," << be_nl
+ << " TAO::TypeCode::Value_Field<char const *> const *," << be_nl
+ << " CORBA::tk_"
+ << (dynamic_cast<be_eventtype *> (node) ? "event" : "value") << "," << 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;
+
+ // ValueModifier
+ //
+ // TAO doesn't support CUSTOM or TRUNCATABLE valuetypes. Go
+ // with VM_NONE or VM_ABSTRACT.
+ os << "CORBA::"
+ << (node->is_abstract () ? "VM_ABSTRACT" : "VM_NONE") << "," << be_nl;
+
+ // Concrete base type.
+ AST_ValueType * const concrete_base =
+ node->inherits_concrete ();
+
+ if (concrete_base)
+ {
+ be_type * const base_type =
+ be_type::narrow_from_decl (concrete_base);
+
+ ACE_ASSERT (base_type);
+
+ os << "&" << base_type->tc_name () << "," << be_nl;
+ }
+ else
+ {
+ // No concrete base.
+ os << "&CORBA::tk_null," << be_nl;
+ }
+
+ // Fields
+ os << "_tao_fields_" << node->flat_name () << "," << be_nl
+ << count << ");" << be_uidt_nl
+ << be_uidt_nl;
}
return
@@ -163,9 +200,7 @@ TAO::be_visitor_value_typecode::visit_members (be_valuetype * node)
-1);
};
- os
- <<
- << " }";
+ os << " }";
if (i < count - 1)
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
index 9a219bc8a01..4dd092cefc7 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
@@ -48,7 +48,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
{
be_visitor_context ctx (*this->ctx_);
// ctx.sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE);
- be_visitor_valuetype_typecode tc_visitor (&ctx);
+ TAO::be_visitor_value_typecode tc_visitor (&ctx);
if (tc_visitor.visit_valuetype (node) == -1)
{
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
index ed01936046c..1132de3cbb7 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h
@@ -32,6 +32,7 @@
#include "be_visitor_typecode/enum_typecode.h"
#include "be_visitor_typecode/objref_typecode.h"
#include "be_visitor_typecode/struct_typecode.h"
+#include "be_visitor_typecode/value_typecode.h"
#endif /* TAO_BE_VISITOR_TYPECODE_H */
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 a1fc84d4b99..d9674eef9f3 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
@@ -51,7 +51,7 @@ public:
//virtual int visit_members (AST_Structure *node);
// for use with structs, exceptions, and unions.
- virtual int visit_members (be_valuetype *node);
+// virtual int visit_members (be_valuetype *node);
// for use with valuetypes.
virtual int visit_type (be_type *node);
@@ -92,11 +92,11 @@ public:
virtual int visit_union (be_union *node);
// visit a union
- virtual int visit_valuetype (be_valuetype *node);
- // visit a valuetype
+// virtual int visit_valuetype (be_valuetype *node);
+// // visit a valuetype
- virtual int visit_eventtype (be_eventtype *node);
- // visit a valuetype
+// virtual int visit_eventtype (be_eventtype *node);
+// // visit a valuetype
// = visit methods for the scope elements
@@ -142,7 +142,7 @@ public:
int gen_typecode (be_union *node);
- int gen_typecode (be_valuetype *node);
+// int gen_typecode (be_valuetype *node);
// = methods to generate encapsulations for typecodes
@@ -174,7 +174,7 @@ public:
int gen_encapsulation (be_union_branch *node);
- int gen_encapsulation (be_valuetype *node);
+// int gen_encapsulation (be_valuetype *node);
// = methods for computing typecode sizes
@@ -200,7 +200,7 @@ public:
ACE_CDR::Long compute_tc_size (be_union *node);
- ACE_CDR::Long compute_tc_size (be_valuetype *node);
+// ACE_CDR::Long compute_tc_size (be_valuetype *node);
// methods for computing the encapsulation length
@@ -232,7 +232,7 @@ public:
ACE_CDR::Long compute_encap_length (be_union_branch *node);
- ACE_CDR::Long compute_encap_length (be_valuetype *node);
+// ACE_CDR::Long compute_encap_length (be_valuetype *node);
// helpers to generate the repoID and name
diff --git a/TAO/tao/TypeCode/Value_TypeCode.h b/TAO/tao/TypeCode/Value_TypeCode.h
index e5f7ee54d5f..d0702893a2e 100644
--- a/TAO/tao/TypeCode/Value_TypeCode.h
+++ b/TAO/tao/TypeCode/Value_TypeCode.h
@@ -58,9 +58,7 @@ namespace TAO
CORBA::ValueModifer modifier,
CORBA::TypeCode_ptr * concrete_base,
Value_Field<StringType> const * fields,
- CORBA::ULong nfields,
- CORBA::ValueModifier type_modifier,
- CORBA::TypeCode_ptr concrete_base_type);
+ CORBA::ULong nfields);
/**
* @name TAO-specific @c CORBA::TypeCode Methods
diff --git a/TAO/tao/TypeCode/Value_TypeCode.inl b/TAO/tao/TypeCode/Value_TypeCode.inl
index 92d30c7dfff..f10676a12b1 100644
--- a/TAO/tao/TypeCode/Value_TypeCode.inl
+++ b/TAO/tao/TypeCode/Value_TypeCode.inl
@@ -13,13 +13,13 @@ ACE_INLINE
TAO::TypeCode::Value<StringType, FieldArrayType, Kind, RefCountPolicy>::Value (
char const * id,
char const * name,
- CORBA::ValueModifier type_modifier,
- CORBA::TypeCode_ptr * concrete_base_type,
+ CORBA::ValueModifier modifier,
+ CORBA::TypeCode_ptr * concrete_base,
Field<StringType> const * fields,
CORBA::ULong nfields)
: base_attributes_ (id, name)
- , type_modifier_ (type_modifier)
- , concrete_base_ (concrete_base_type)
+ , type_modifier_ (modifier)
+ , concrete_base_ (concrete_base)
, nfields_ (nfields)
, fields_ (fields)
{