From 18b2eff052816bd0c993c7b4b7a0eb35d48c637b Mon Sep 17 00:00:00 2001 From: parsons Date: Fri, 14 Feb 2003 20:44:38 +0000 Subject: ChangeLogTag: Fri Feb 14 14:37:55 2003 Jeff Parsons --- TAO/ChangeLog | 15 +++ TAO/TAO_IDL/be/be_predefined_type.cpp | 12 +- .../be/be_visitor_typecode/typecode_defn.cpp | 134 +++++++++++---------- 3 files changed, 85 insertions(+), 76 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index a2abdaf83d1..87069327e25 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,18 @@ +Fri Feb 14 14:37:55 2003 Jeff Parsons + + * TAO_IDL/be/be_predefined_type.cpp (compute_repoID): + + Fixed function to catch a reference to CORBA::Object + in an IDL file. The repository ID must be handled as + a special case, since this node type is not looked up + in the AST. + + * TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp: + + Fixed incorrect typecode generation for members of type + CORBA::Object. Thanks to Ferran Boladeres Salvadó + for sending in the example code that uncovered the bug. + Fri Feb 14 18:39:01 UTC 2003 Craig Rodrigues * tao/RTCORBA/RT_ORBInitializer.cpp: diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index b5520ef1995..7c092c7f5cd 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -161,16 +161,8 @@ be_predefined_type::compute_repoID (void) { switch (this->pt ()) { - case AST_PredefinedType::PT_pseudo: - if (!ACE_OS::strcmp (this->local_name ()->get_string (), "Object")) - { - this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0"); - } - else - { - AST_Decl::compute_repoID (); - } - + case AST_PredefinedType::PT_object: + this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0"); break; default: AST_Decl::compute_repoID (); 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 a3d720f5608..9d927d4f7d6 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -1463,83 +1463,85 @@ be_visitor_typecode_defn::gen_typecode (be_predefined_type *node) case AST_PredefinedType::PT_wchar: *os << "CORBA::tk_wchar,\n\n"; break; - case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: { - if (!ACE_OS::strcmp (node->local_name ()->get_string (), "TypeCode")) - *os << "CORBA::tk_TypeCode,\n\n"; + // Check if we are repeated. + const be_visitor_typecode_defn::QNode *qnode = + this->queue_lookup (this->tc_queue_, node); + + if (qnode) + { + // 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 (!ACE_OS::strcmp (node->local_name ()->get_string (), "Object")) + { + // 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) { - // check if we are repeated - const be_visitor_typecode_defn::QNode *qnode = - this->queue_lookup (this->tc_queue_, node); - if (qnode) - { - // 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 + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_typecode_defn::" + "visit_type - " + "queue insert failed\n"), + -1); + } + + *os << "CORBA::tk_objref," << be_nl; + + { + Scoped_Compute_Queue_Guard guard (this); + + // emit the encapsulation length + this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_ENCAP_LEN); + if (node->accept (this) == -1) { - // 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_objref," << be_nl; - - { - Scoped_Compute_Queue_Guard guard (this); - - // 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 (predefined) - ") - 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); - - // 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 (predefined objref) - ") - ACE_TEXT ("failed to generate encapsulation\n")), - -1); - } - *os << be_uidt << "\n"; + ACE_ERROR_RETURN (( + LM_ERROR, + ACE_TEXT ("(%N:%l) - be_visitor_typecode_defn") + ACE_TEXT ("gen_typecode (predefined) - ") + 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); + + // 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 (predefined objref)") + ACE_TEXT (" - failed to generate ") + ACE_TEXT ("encapsulation\n")), + -1); + } + + *os << be_uidt << "\n"; + } + + break; } + case AST_PredefinedType::PT_pseudo: + *os << "CORBA::tk_TypeCode,\n\n"; break; default: break; } + return 0; } -- cgit v1.2.1