diff options
Diffstat (limited to 'TAO/TAO_IDL/be')
44 files changed, 615 insertions, 743 deletions
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp index b00d7d35941..652a768516c 100644 --- a/TAO/TAO_IDL/be/be_attribute.cpp +++ b/TAO/TAO_IDL/be/be_attribute.cpp @@ -25,8 +25,8 @@ #include "global_extern.h" -ACE_RCSID (be, - be_attribute, +ACE_RCSID (be, + be_attribute, "$Id$") be_attribute::be_attribute (void) @@ -77,15 +77,9 @@ be_attribute::be_attribute (idl_bool ro, be_operation_default_strategy (0)); this->set_strategy_ = bods; - // TAO_IDL generated attribute methods currently have an exception - // specification containing CORBA::SystemException. Make sure we - // generate a "tao/SystemException.h" include directive. - ACE_SET_BITS (idl_global->decls_seen_info_, - idl_global->decls_seen_masks.operation_seen_); - if (!this->imported () && !this->is_local ()) { - // For the return types of the two operations + // For the return types of the two operations // generated from this attribute. this->set_arg_seen_bit (be_type::narrow_from_decl (ft)); ACE_SET_BITS (idl_global->decls_seen_info_, diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index d1a72b65667..7cf18dcfe6e 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -462,7 +462,7 @@ TAO_CodeGen::start_server_header (const char *fname) if (be_global->gen_amh_classes ()) { this->gen_standard_include (this->server_header_, - "tao/Messaging/AMH_Response_Handler.h"); + "tao/PortableServer/AMH_Response_Handler.h"); } *this->server_header_ << be_nl << be_nl @@ -885,12 +885,6 @@ TAO_CodeGen::start_implementation_header (const char *fname) << "#pragma once\n" << "#endif /* ACE_LACKS_PRAGMA_ONCE */\n\n"; - if (ACE_BIT_ENABLED (idl_global->decls_seen_info_, - idl_global->decls_seen_masks.local_iface_seen_)) - { - *this->implementation_header_ << "#include \"tao/LocalObject.h\"\n\n"; - } - return 0; } @@ -1169,10 +1163,7 @@ TAO_CodeGen::end_server_skeletons (void) int TAO_CodeGen::end_anyop_source (void) { - if (!be_global->gen_tmplinst ()) - { - *this->anyop_source_ << "\n"; - } + *this->anyop_source_ << "\n\n"; return 0; } @@ -1383,24 +1374,19 @@ TAO_CodeGen::gen_stub_hdr_includes (void) this->gen_standard_include (this->client_header_, "tao/ORB.h"); - this->gen_cond_file_include ( - idl_global->decls_seen_masks.operation_seen_, - "tao/SystemException.h", - this->client_header_ - ); - - // Not needed at the moment, since UserException.h is pulled in by - // ORB.h, which is included in the stub header file. May change if - // ORB.h is rearranged to make a lighter include for applications. - // System exception throw spec for every operation may change soon. + // Not needed at the moment, since Exception.h is pulled in by ORB.h, + // included at the top of the stub header file. May change if ORB.h + // is rearranged to make a lighter include for applications. #if 0 + // System exception throw spec for every operation may change soon. // For IDL exception, we need full knowledge of CORBA::UserException. this->gen_cond_file_include ( - idl_global->decls_seen_masks.exception_seen_, - "tao/UserException.h", + idl_global->decls_seen_masks.operation_seen_ + | idl_global->decls_seen_masks.exception_seen_, + "tao/Exception.h", this->client_header_ ); -#endif /* 0 */ +#endif this->gen_standard_include (this->client_header_, "tao/Environment.h"); @@ -1570,22 +1556,6 @@ TAO_CodeGen::gen_stub_src_includes (void) "tao/Typecode.h"); } - // The UserException::_tao_{en,de}code() methods can throw a - // CORBA::MARSHAL exception so make sure that system exception is - // fully declared/defined by including "tao/SystemException.h". - // However, only include "tao/SystemException.h" if a user exception - // was encountered and if we're not already including it in the stub - // header. - if (ACE_BIT_ENABLED (idl_global->decls_seen_info_, - idl_global->decls_seen_masks.exception_seen_) - && ACE_BIT_DISABLED (idl_global->decls_seen_info_, - idl_global->decls_seen_masks.operation_seen_)) - { - this->gen_standard_include (this->client_stubs_, - "tao/SystemException.h"); - } - - // Includes whatever Any template classes that may be needed. this->gen_any_file_includes (); diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 7d30f48bfd2..c4644d48969 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -83,8 +83,7 @@ BE_GlobalData::BE_GlobalData (void) lookup_strategy_ (TAO_PERFECT_HASH), void_type_ (0), ccmobject_ (0), - gen_anyop_files_ (I_FALSE), - do_ccm_preproc_ (I_TRUE) + gen_anyop_files_ (I_FALSE) { } @@ -993,18 +992,6 @@ BE_GlobalData::gen_anyop_files (idl_bool val) this->gen_anyop_files_ = val; } -idl_bool -BE_GlobalData::do_ccm_preproc (void) const -{ - return this->do_ccm_preproc_; -} - -void -BE_GlobalData::do_ccm_preproc (idl_bool val) -{ - this->do_ccm_preproc_ = val; -} - ACE_CString BE_GlobalData::spawn_options (void) { @@ -1369,6 +1356,11 @@ BE_GlobalData::parse_args (long &i, char **av) // generating Direct collocated stubs. be_global->gen_direct_collocation (1); } + else if (av[i][2] == 'v') + { + // enable OBV (Valuetype) support. + idl_global->obv_support (1); + } else if (av[i][2] == 'I') { size_t options = ACE_OS::strlen(av[i]) - 3; @@ -1451,34 +1443,34 @@ BE_GlobalData::parse_args (long &i, char **av) if (av[i][2] == 'a') { // suppress Any support - be_global->any_support (I_FALSE); + be_global->any_support (0); } else if (av[i][2] == 't') { // suppress typecode support // Anys must be suppressed as well - be_global->tc_support (I_FALSE); - be_global->any_support (I_FALSE); + be_global->tc_support (0); + be_global->any_support (0); } else if (av[i][2] == 'p') { // suppress generating Thru_POA collocated stubs - be_global->gen_thru_poa_collocation (I_FALSE); + be_global->gen_thru_poa_collocation (0); } else if (av[i][2] == 'd') { // suppress generating Direct collocated stubs - be_global->gen_direct_collocation (I_FALSE); + be_global->gen_direct_collocation (0); } else if (av[i][2] == 'c') { // suppress generating tie classes and files be_global->gen_tie_classes (0); } - else if (av[i][2] == 'm') + else if (av[i][2] == 'v') { - // disable IDL3 to IDL2 preprocessing. - be_global->do_ccm_preproc (I_FALSE); + // disable OBV (Valuetype) support + idl_global->obv_support (0); } else { @@ -1844,7 +1836,7 @@ BE_GlobalData::usage (void) const )); ACE_DEBUG (( LM_DEBUG, - ACE_TEXT (" -Sm\t\t\tdisable IDL3 equivalent IDL preprocessing") + ACE_TEXT (" -Sv\t\t\tdisable OBV (Valuetype) support") ACE_TEXT (" (enabled by default)\n") )); } diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 58760041cfe..2856108bf60 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -520,7 +520,7 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) << ")" << be_nl << ": "; - if (this->has_mixed_parentage_) + if (this->has_mixed_parentage_ && ! this->is_abstract ()) { *os << "ACE_NESTED_CLASS (CORBA, AbstractBase) (" << be_idt << be_idt << be_idt_nl @@ -553,7 +553,19 @@ be_interface::gen_stub_ctor (TAO_OutStream *os) *os << be_idt; } - if (!is_abstract_) + if (is_abstract_) + { + if (this->pd_n_inherits == 0) + { + *os << "ACE_NESTED_CLASS (CORBA, AbstractBase) (" + << be_idt << be_idt_nl + << "objref," << be_nl + << "_tao_collocated," << be_nl + << "servant" << be_uidt_nl + << ")" << be_uidt; + } + } + else { *os << "ACE_NESTED_CLASS (CORBA, Object) (" << be_idt << be_idt_nl @@ -1356,31 +1368,19 @@ be_interface::gen_collocated_skel_body (be_interface *derived, void be_interface::analyze_parentage (void) { - if (this->has_mixed_parentage_ != -1) - { - return; - } - this->has_mixed_parentage_ = 0; for (long i = 0; i < this->pd_n_inherits; ++i) { - be_interface *parent = - be_interface::narrow_from_decl (this->pd_inherits[i]); - - if (parent->is_abstract () || parent->has_mixed_parentage ()) + if (this->pd_inherits[i]->is_abstract ()) { this->has_mixed_parentage_ = 1; break; } } - - AST_Decl::NodeType nt = this->node_type (); - idl_bool can_be_mixed = nt == AST_Decl::NT_interface - || nt == AST_Decl::NT_component - || nt == AST_Decl::NT_home; - if (this->has_mixed_parentage_ == 1 && can_be_mixed) + if (this->has_mixed_parentage_ == 1 + && this->node_type () == AST_Decl::NT_interface) { be_global->mixed_parentage_interfaces.enqueue_tail (this); } @@ -1456,8 +1456,6 @@ be_interface::traverse_inheritance_graph ( // If we are doing a component, we check for a parent. if (intf->node_type () == AST_Decl::NT_component) { - (void) this->insert_non_dup (be_global->ccmobject ()); - AST_Component *base = AST_Component::narrow_from_decl (intf)->base_component (); @@ -1474,6 +1472,10 @@ be_interface::traverse_inheritance_graph ( abstract_paths_only); } } + else + { + (void) this->insert_non_dup (be_global->ccmobject ()); + } } (void) this->insert_non_dup (intf, abstract_paths_only); diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp index 9936f760de0..4f1527cfcd8 100644 --- a/TAO/TAO_IDL/be/be_produce.cpp +++ b/TAO/TAO_IDL/be/be_produce.cpp @@ -121,22 +121,19 @@ BE_produce (void) BE_abort (); } - if (be_global->do_ccm_preproc ()) - { - // Make a pass over the AST and introduce - // CCM specific nodes. - be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx); + // Make a pass over the AST and introduce + // CCM specific nodes. + be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx); - if (root->accept (&ccm_preproc_visitor) == -1) - { - ACE_ERROR ((LM_ERROR, - "(%N:%l) be_produce - " - "CCM preprocessing for Root failed\n")); - BE_abort (); - } + if (root->accept (&ccm_preproc_visitor) == -1) + { + ACE_ERROR ((LM_ERROR, + "(%N:%l) be_produce - " + "CCM preprocessing for Root failed\n")); + BE_abort (); } - if (be_global->ami_call_back ()) + if (be_global->ami_call_back () == I_TRUE) { // Make a pass over the AST and introduce // AMI specific interfaces, methods and valuetypes. @@ -151,7 +148,7 @@ BE_produce (void) } } - if (be_global->gen_amh_classes ()) + if (be_global->gen_amh_classes () == I_TRUE) { // Make a pass over the AST and introduce // AMH specific code diff --git a/TAO/TAO_IDL/be/be_tmplinst.cpp b/TAO/TAO_IDL/be/be_tmplinst.cpp index 2edee73bf39..e14b08e765a 100644 --- a/TAO/TAO_IDL/be/be_tmplinst.cpp +++ b/TAO/TAO_IDL/be/be_tmplinst.cpp @@ -52,7 +52,7 @@ template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>; #pragma instantiate ACE_Unbounded_Queue <be_interface_fwd *> #pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface_fwd *> -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#elif defined (__GNUC__) && (defined (_AIX) || defined (__hpux)) template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<TAO_OutStream_Factory,ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<TAO_Visitor_Factory,ACE_SYNCH_RECURSIVE_MUTEX>; diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index 60445e0aebc..844bd5704ee 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -755,7 +755,7 @@ be_valuetype::traverse_supports_list_graphs ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_valuetype::" - "traverse_supports_list_graphs - " + "traverse_supports_graph_list - " "error generating entries\n"), -1); } @@ -809,7 +809,29 @@ be_valuetype::abstract_supports_helper (be_interface *, *os << "," << be_nl << "public virtual " << base->name (); +/* + if (base->is_nested ()) + { + UTL_Scope *parent_scope = base->defined_in (); + AST_Decl *parent_decl = ScopeAsDecl (parent_scope); + + *os << "ACE_NESTED_CLASS (" + << parent_decl->name () << ", " + << base->local_name () << ")"; + } + else + { + *os << base->local_name (); + } +*/ + return 0; +} +int +be_valuetype::gen_abstract_init_helper (be_interface *, + be_interface *, + TAO_OutStream *) +{ return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp index f557bb052c8..09aa699302e 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -569,6 +569,90 @@ be_visitor_amh_pre_proc::visit_operation (be_operation *node) return 0; } +// @@@ (JP) I think this can be removed. It is doing nothing +// that the generic visit_scope() is not doing. +int +be_visitor_amh_pre_proc::visit_scope (be_scope *node) +{ + // proceed if the number of members in our scope is greater than 0 + if (node->nmembers () > 0) + { + int number_of_elements = 0; + + { + // initialize an iterator to iterate thru our scope + for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); + !si.is_done (); + si.next ()) + { + ++number_of_elements; + } + } + + AST_Decl **elements; + ACE_NEW_RETURN (elements, + AST_Decl *[number_of_elements], + -1); + + { + int position = 0; + // initialize an iterator to iterate thru our scope + for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); + !si.is_done (); + si.next ()) + { + elements[position++] = si.item (); + } + } + + + int elem_number = 0; + + // continue until each element is visited + while (elem_number < number_of_elements) + { + AST_Decl *d = elements[elem_number]; + + if (!d) + { + delete [] elements; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_scope::visit_scope - " + "bad node in this scope\n"), + -1); + + } + + 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 node to be visited + this->ctx_->node (bd); + ++elem_number; + + + // Send the visitor. + if (bd == 0 || bd->accept (this) == -1) + { + delete [] elements; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_scope::visit_scope - " + "codegen for scope failed\n"), + -1); + + } + } // end of while loop + + delete [] elements; + } // end of if + + return 0; +} + be_valuetype * be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) { diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp index 0eea91ba50e..3548c50705a 100644 --- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp @@ -107,8 +107,6 @@ be_visitor_arg_traits::visit_interface (be_interface *node) if (node->seen_in_operation ()) { TAO_OutStream *os = this->ctx_->stream (); - idl_bool stub = (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CS); - BE_GlobalData *b = be_global; // This should be generated even for imported nodes. The ifdef guard prevents // multiple declarations. @@ -116,9 +114,8 @@ be_visitor_arg_traits::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl - << "class " - << (stub ? b->stub_export_macro () : b->skel_export_macro ()) - << " " << this->S_ << "Arg_Traits<" + << "class " << be_global->stub_export_macro () << " " + << this->S_ << "Arg_Traits<" << node->name () << ">" << be_idt_nl << ": public" << be_idt << be_idt_nl << "Object_" << this->S_ << "Arg_Traits_T<" << be_idt << be_idt_nl @@ -486,40 +483,7 @@ be_visitor_arg_traits::visit_array (be_array *node) // This should be generated even for imported nodes. The ifdef guard prevents // multiple declarations. -// os->gen_ifdef_macro (node->flat_name (), "arg_traits"); - - // Generate the array traits specialization definitions, - // guarded by #ifdef on unaliased array element type and length. - - ACE_CString unique; - be_type *bt = be_type::narrow_from_decl (node->base_type ()); - AST_Decl::NodeType nt = bt->node_type (); - - if (nt == AST_Decl::NT_typedef) - { - be_typedef *td = be_typedef::narrow_from_decl (bt); - unique = td->primitive_base_type ()->flat_name (); - } - else - { - unique = bt->flat_name (); - } - - char buf[NAMEBUFSIZE]; - - for (unsigned long i = 0; i < node->n_dims (); ++i) - { - ACE_OS::memset (buf, - '\0', - NAMEBUFSIZE); - ACE_OS::sprintf (buf, - "_%ld", - node->dims ()[i]->ev ()->u.ulval); - unique += buf; - } - - unique += "_traits"; - os->gen_ifdef_macro (unique.fast_rep ()); + os->gen_ifdef_macro (node->flat_name (), "arg_traits"); *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp index fbb5e7613cd..2fa4e527ac7 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp @@ -101,12 +101,11 @@ int be_visitor_args_paramlist::visit_argument (be_argument *node) *os << " _tao_forany_" << node->local_name () << " ("; *os << this->type_name (bt, "_dup"); *os << " ("; - + // This is to placate some compilers which have + // trouble with IN args that are multidimensional arrays. + //if (node->n_dims () > 1) cant do this here since dont have a be_array node if (this->direction () != AST_Argument::dir_IN) - { - *os << "(const ::" << bt->name () << "_slice *) "; - } - + *os << "(const ::" << bt->name () << "_slice *) "; *os << "this->"; *os << node->local_name () << "_));" << be_nl; *os << "(*parameter_list)[len].argument <<= _tao_forany_" ; diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp index 9923d6f7ee9..f4097be8b7e 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp @@ -276,7 +276,7 @@ int be_visitor_array_ch::visit_array (be_array *node) } else { - storage_class = "TAO_EXPORT_MACRO "; + storage_class = ""; } if (td != 0) diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp index a0ef398247a..2ffa66396f2 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp @@ -195,7 +195,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << fname << "," << be_nl << fname << "_slice," << be_nl << fname << "_tag" << be_uidt_nl - << ">::free ("<< be_idt_nl + << ">::tao_free ("<< be_idt_nl << fname << "_slice * _tao_slice" << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl @@ -210,7 +210,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << fname << "," << be_nl << fname << "_slice," << be_nl << fname << "_tag" << be_uidt_nl - << ">::dup (" << be_idt_nl + << ">::tao_dup (" << be_idt_nl << "const " << fname << "_slice * _tao_slice" << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl @@ -225,7 +225,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << fname << "," << be_nl << fname << "_slice," << be_nl << fname << "_tag" << be_uidt_nl - << ">::copy (" << be_idt_nl + << ">::tao_copy (" << be_idt_nl << fname << "_slice * _tao_to," << be_nl << "const " << fname << "_slice * _tao_from" << be_uidt_nl << ")" << be_uidt_nl @@ -241,7 +241,7 @@ int be_visitor_array_ci::visit_array (be_array *node) << fname << "," << be_nl << fname << "_slice," << be_nl << fname << "_tag" << be_uidt_nl - << ">::alloc (void)" << be_uidt_nl + << ">::tao_alloc (void)" << be_uidt_nl << "{" << be_idt_nl << "return " << fname << "_alloc ();" << be_uidt_nl << "}"; diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp index 826b7082b6e..666e3e0b896 100644 --- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp @@ -58,8 +58,6 @@ be_exception *EXCEPS[N_EXCEPS]; be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx) : be_visitor_scope (ctx), module_id_ ("Components"), - connection_ (0), - connections_ (0), cookie_ (0), already_connected_ (0), invalid_connection_ (0), @@ -358,15 +356,6 @@ be_visitor_ccm_pre_proc::gen_uses (be_component *node) } else { - if (this->create_uses_multiple_stuff (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "gen_uses - " - "create_uses_multiple_stuff failed\n"), - -1); - } - if (this->gen_connect_multiple (node, pd) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -1466,152 +1455,6 @@ be_visitor_ccm_pre_proc::lookup_one_exception (be_component *node, } int -be_visitor_ccm_pre_proc::create_uses_multiple_stuff ( - be_component *node, - AST_Component::port_description *pd - ) -{ - if (this->create_uses_multiple_struct (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_stuff - " - "create_uses_multiple_struct failed\n"), - -1); - } - - if (this->create_uses_multiple_sequence (node, pd) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_stuff - " - "create_uses_multiple_sequence failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_ccm_pre_proc::create_uses_multiple_struct ( - be_component *node, - AST_Component::port_description *pd - ) -{ - UTL_ScopedName *full_name = - this->create_scoped_name (0, - pd->id->get_string (), - "Connection", - node); - ACE_NEW_RETURN (this->connection_, - be_structure (0, - 0, - 0), - -1); - this->connection_->set_defined_in (node); - this->connection_->set_imported (node->imported ()); - this->connection_->set_name (full_name); - - Identifier o_id ("objref"); - UTL_ScopedName o_sn (&o_id, - 0); - AST_Field *m_objref = 0; - ACE_NEW_RETURN (m_objref, - be_field (pd->impl, - &o_sn), - -1); - o_id.destroy (); - - if (this->connection_->be_add_field (m_objref) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_field failed\n"), - -1); - } - - Identifier v_id ("ck"); - UTL_ScopedName v_sn (&v_id, - 0); - AST_Field *m_ck = 0; - ACE_NEW_RETURN (m_ck, - be_field (this->cookie_, - &v_sn), - -1); - - if (this->connection_->be_add_field (m_ck) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_field failed\n"), - -1); - } - - if (node->be_add_structure (this->connection_) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_struct - " - "be_add_structure failed\n"), - -1); - } - - return 0; -} - -int -be_visitor_ccm_pre_proc::create_uses_multiple_sequence ( - be_component *node, - AST_Component::port_description *pd - ) -{ - ACE_UINT64 bound = 0; - ACE_NEW_RETURN ( - this->connections_, - be_sequence ( - idl_global->gen ()->create_expr ( - bound, - AST_Expression::EV_ulong - ), - this->connection_, - 0, - 0, - 0 - ), - -1 - ); - - UTL_ScopedName *sn = - this->create_scoped_name (0, - pd->id->get_string (), - "Connections", - node); - AST_Typedef *td = 0; - ACE_NEW_RETURN (td, - be_typedef (this->connections_, - 0, - 0, - 0), - -1); - td->set_defined_in (node); - td->set_imported (node->imported ()); - td->set_name (sn); - - if (node->be_add_typedef (td) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_ccm_pre_proc::" - "create_uses_multiple_sequence - " - "be_add_typedef failed\n"), - -1); - } - - return 0; -} - -int be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) { AST_Interface *event_consumer = 0; @@ -1624,11 +1467,6 @@ be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) "Consumer", ScopeAsDecl (node->defined_in ())); - // We're at global scope here so we need to fool the scope stack - // for a minute so the correct repo id can be calculated at - // interface construction time. - idl_global->scopes ().push (node->defined_in ()); - if (node->n_inherits () == 0 || node->inherits ()[0]->node_type () == AST_Decl::NT_valuetype) { @@ -1639,13 +1477,13 @@ be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) &parent_local_name); UTL_NameList parent_list (&parent_full_name, 0); - FE_InterfaceHeader header (consumer_name, + FE_InterfaceHeader header (0, &parent_list, I_FALSE, I_FALSE, I_TRUE); ACE_NEW_RETURN (event_consumer, - be_interface (header.name (), + be_interface (0, header.inherits (), header.n_inherits (), header.inherits_flat (), @@ -1676,13 +1514,13 @@ be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) parent_full_name->nconc (parent_local_name); UTL_NameList parent_list (parent_full_name, 0); - FE_InterfaceHeader header (consumer_name, + FE_InterfaceHeader header (0, &parent_list, I_FALSE, I_FALSE, I_TRUE); ACE_NEW_RETURN (event_consumer, - be_interface (header.name (), + be_interface (0, header.inherits (), header.n_inherits (), header.inherits_flat (), @@ -1693,21 +1531,9 @@ be_visitor_ccm_pre_proc::create_event_consumer (be_eventtype *node) parent_full_name->destroy (); } - // Back to reality. - idl_global->scopes ().pop (); - event_consumer->set_defined_in (s); event_consumer->set_imported (node->imported ()); event_consumer->set_name (consumer_name); - - // Set repo id to 0, so it will be recomputed on the next access, - // and set the prefix to the eventtype's prefix. All this is - // necessary in case the eventtype's prefix was modified after - // its declaration. We assume 'implied IDL' means that the - // derived event consumer interface should have the same prefix. - event_consumer->repoID (0); - event_consumer->prefix (const_cast<char*> (node->prefix ())); - be_type::narrow_from_decl (event_consumer)->gen_fwd_helper_name (); m->be_add_interface (event_consumer); return this->gen_push_op (node, diff --git a/TAO/TAO_IDL/be/be_visitor_component/component.cpp b/TAO/TAO_IDL/be/be_visitor_component/component.cpp index 70b53838e1f..80bf5a90a14 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component.cpp @@ -45,11 +45,16 @@ be_visitor_component::visit_attribute (be_attribute *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_INTERFACE_CH: + case TAO_CodeGen::TAO_ROOT_CH: + break; case TAO_CodeGen::TAO_ROOT_CS: + break; case TAO_CodeGen::TAO_ROOT_SH: + break; case TAO_CodeGen::TAO_ROOT_IH: + break; case TAO_CodeGen::TAO_ROOT_SS: + break; case TAO_CodeGen::TAO_ROOT_IS: break; default: @@ -84,7 +89,7 @@ be_visitor_component::visit_operation (be_operation *node) { // These first two cases may have the context state changed // by a strategy, so we use the visitor factory below. - case TAO_CodeGen::TAO_INTERFACE_CH: + case TAO_CodeGen::TAO_ROOT_CH: ctx.state (TAO_CodeGen::TAO_OPERATION_CH); break; case TAO_CodeGen::TAO_ROOT_CS: @@ -218,7 +223,7 @@ be_visitor_component::visit_structure (be_structure *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_INTERFACE_CH: + case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_structure_ch visitor (&ctx); status = node->accept (&visitor); @@ -287,7 +292,7 @@ be_visitor_component::visit_typedef (be_typedef *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_INTERFACE_CH: + case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_typedef_ch visitor (&ctx); status = node->accept (&visitor); diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp index c2f85d715ff..b168399f32d 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp @@ -153,21 +153,6 @@ be_visitor_component_ch::visit_component (be_component *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - if (! node->is_abstract ()) - { - node->analyze_parentage (); - } - - // If we inherit from both CORBA::Object and CORBA::AbstractBase, - // we have to override _add_ref() to avoid ambiguity. A comopnent - // can have mixed parentage if it supports an abstract or mixed- - // parentage interface. - if (node->has_mixed_parentage ()) - { - *os << be_nl << be_nl - << "virtual void _add_ref (void);"; - } - *os << be_nl << be_nl << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl << "const char *type_id" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp index cc46761452b..f35f7eab081 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp @@ -68,7 +68,7 @@ be_visitor_component_cs::visit_component (be_component *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << node->name () << "_ptr" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::duplicate (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_duplicate (" << be_idt << be_idt_nl << node->name () << "_ptr p" << be_uidt_nl << ")" << be_uidt_nl @@ -79,7 +79,7 @@ be_visitor_component_cs::visit_component (be_component *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "void" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::release (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_release (" << be_idt << be_idt_nl << node->name () << "_ptr p" << be_uidt_nl << ")" << be_uidt_nl @@ -90,7 +90,7 @@ be_visitor_component_cs::visit_component (be_component *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << node->name () << "_ptr" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::nil (void)" + << "TAO::Objref_Traits<" << node->name () << ">::tao_nil (void)" << be_nl << "{" << be_idt_nl << "return " << node->name () << "::_nil ();" << be_uidt_nl @@ -99,7 +99,7 @@ be_visitor_component_cs::visit_component (be_component *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "CORBA::Boolean" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::marshal (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_marshal (" << be_idt << be_idt_nl << node->name () << "_ptr p," << be_nl << "TAO_OutputCDR & cdr" << be_uidt_nl @@ -109,29 +109,6 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; } - if (node->has_mixed_parentage ()) - { - *os << be_nl << be_nl - << "void" << be_nl - << "CORBA::release (" - << node->name () - << "_ptr p)" << be_nl - << "{" << be_idt_nl - << "CORBA::AbstractBase_ptr abs = p;" << be_nl - << "CORBA::release (abs);" << be_uidt_nl - << "}"; - - *os << be_nl << be_nl - << "CORBA::Boolean" << be_nl - << "CORBA::is_nil (" - << node->name () - << "_ptr p)" << be_nl - << "{" << be_idt_nl - << "CORBA::Object_ptr obj = p;" << be_nl - << "return CORBA::is_nil (obj);" << be_uidt_nl - << "}"; - } - // Generate the proxy broker factory function pointer definition. *os << be_nl << be_nl << "// Function pointer for collocation factory initialization." @@ -195,16 +172,6 @@ be_visitor_component_cs::visit_component (be_component *node) << "}" << be_nl << be_nl; } - if (node->has_mixed_parentage ()) - { - *os << "void" << be_nl - << node->name () << "::_add_ref (void)" << be_nl - << "{" << be_idt_nl - << "this->ACE_NESTED_CLASS (CORBA, Object)::_add_ref ();" - << be_uidt_nl - << "}" << be_nl << be_nl; - } - // The _narrow method. *os << node->full_name () << "_ptr" << be_nl << node->full_name () << "::_narrow (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp index 146ae4a0524..107adfc34af 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_sh.cpp @@ -83,8 +83,7 @@ be_visitor_component_sh::visit_component (be_component *node) class_name += node->local_name (); } - *os << be_nl << be_nl - << "// TAO_IDL - Generated from" << be_nl + *os << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; // Generate the skeleton class name. diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp index 66bf273b6b2..e2b980bd77e 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_cs.cpp @@ -282,7 +282,7 @@ be_visitor_field_cdr_op_cs::visit_interface (be_interface *node) } else { - *os << "TAO::Objref_Traits<" << node->name () << ">::marshal (" + *os << "TAO::Objref_Traits<" << node->name () << ">::tao_marshal (" << be_idt << be_idt_nl << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl << "strm" << be_uidt_nl @@ -362,7 +362,7 @@ be_visitor_field_cdr_op_cs::visit_interface_fwd (be_interface_fwd *node) *os << parent->name () << "::"; } - *os << "TAO::Objref_Traits<" << node->name () << ">::marshal (" + *os << "TAO::Objref_Traits<" << node->name () << ">::tao_marshal (" << be_idt << be_idt_nl << "_tao_aggregate." << f->local_name () << ".in ()," << be_nl << "strm" << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp index b6863cc1822..85503801aad 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp @@ -129,7 +129,7 @@ be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -149,7 +149,7 @@ be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_thru_poa_proxy_" - "impl_sh::gen_abstract_ops_helper - " + "impl_sh::abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp index be617ef34ce..1986eae1270 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp @@ -63,7 +63,7 @@ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -83,7 +83,7 @@ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_direct_proxy" - "_impl_ss::gen_abstract_ops_helper - " + "_impl_ss::abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp index a040a8a5e89..3ffceb381fc 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interceptors_ss.cpp @@ -90,7 +90,7 @@ be_visitor_interface_interceptors_ss::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -110,7 +110,7 @@ be_visitor_interface_interceptors_ss::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_interceptors_ss::" - "gen_abstract_ops_helper - " + "abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index b02cd9a48e1..c9ae586fb1d 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -116,13 +116,10 @@ be_visitor_interface::visit_scope (be_scope *node) return 0; } - // 'abstract_paths_only' arg is FALSE here because we want to traverse - // through concrete parents to get to all the abstract ones. The helper - // will do nothing unless the base interface passed to it is abstract. int status = intf->traverse_inheritance_graph (helper, this->ctx_->stream (), - I_FALSE); + I_TRUE); if (status == -1) { diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 675f9e648d5..a0e3ce9f913 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -213,7 +213,8 @@ be_visitor_interface_ch::visit_interface (be_interface *node) } // If we inherit from both CORBA::Object and CORBA::AbstractBase, - // we have to override _add_ref() to avoid ambiguity. + // we have to override _add_ref() to avoid ambiguity, because it is + // called in _tao_Queryinterface(). if (node->has_mixed_parentage ()) { *os << "virtual void _add_ref (void);" << be_nl << be_nl; @@ -378,7 +379,7 @@ be_visitor_interface_ch::gen_abstract_ops_helper (be_interface *node, be_interface *base, TAO_OutStream *os) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -397,7 +398,7 @@ be_visitor_interface_ch::gen_abstract_ops_helper (be_interface *node, { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_interface::" - "gen_abstract_ops_helper - " + "abstract_base_ops_helper - " "bad node in this scope\n"), -1); } 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 071136f1ee2..dbed26ff19a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -67,7 +67,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << node->name () << "_ptr" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::duplicate (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_duplicate (" << be_idt << be_idt_nl << node->name () << "_ptr p" << be_uidt_nl << ")" << be_uidt_nl @@ -78,7 +78,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "void" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::release (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_release (" << be_idt << be_idt_nl << node->name () << "_ptr p" << be_uidt_nl << ")" << be_uidt_nl @@ -89,7 +89,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << node->name () << "_ptr" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::nil (void)" + << "TAO::Objref_Traits<" << node->name () << ">::tao_nil (void)" << be_nl << "{" << be_idt_nl << "return " << node->name () << "::_nil ();" << be_uidt_nl @@ -98,7 +98,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION" << be_nl << "CORBA::Boolean" << be_nl - << "TAO::Objref_Traits<" << node->name () << ">::marshal (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_marshal (" << be_idt << be_idt_nl << node->name () << "_ptr p," << be_nl << "TAO_OutputCDR & cdr" << be_uidt_nl @@ -562,7 +562,7 @@ be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node, be_interface *base, TAO_OutStream *os) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -581,7 +581,7 @@ be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node, { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_cs::" - "gen_abstract_ops_helper - " + "abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp index 7bb033fb1df..42246e077a4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp @@ -77,16 +77,7 @@ be_visitor_interface_ih::visit_interface (be_interface *node) *os << node->full_skel_name (); } - *os << ", public virtual "; - - if (node->is_local ()) - { - *os << "TAO_Local_RefCounted_Object"; - } - else - { - *os << "PortableServer::RefCountServantBase"; - } + *os << ", public virtual PortableServer::RefCountServantBase"; *os << be_nl << "{" << be_nl @@ -95,7 +86,7 @@ be_visitor_interface_ih::visit_interface (be_interface *node) << be_global->impl_class_prefix () << namebuf << be_global->impl_class_suffix () << " (void);" << be_nl << be_nl; - if (be_global->gen_copy_ctor () && !node->is_local ()) + if (be_global->gen_copy_ctor ()) { *os << "//Copy Constructor"<<be_nl << be_global->impl_class_prefix () << namebuf diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp index fa25566ca54..ed87e053a6f 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp @@ -76,7 +76,7 @@ be_visitor_interface_is::visit_interface (be_interface *node) *os << "{" <<be_nl; *os << "}" << be_nl << be_nl; - if (be_global->gen_copy_ctor () && !node->is_local ()) + if (be_global->gen_copy_ctor ()) { *os << "//Implementation Skeleton Copy Constructor" << be_nl; @@ -88,7 +88,7 @@ be_visitor_interface_is::visit_interface (be_interface *node) << be_global->impl_class_suffix () << "& rhs)" << be_idt_nl << ": TAO_Abstract_ServantBase (rhs)," << be_nl << " TAO_ServantBase (rhs)"; - + if (node->traverse_inheritance_graph (be_interface::copy_ctor_helper, os) == -1) @@ -99,22 +99,19 @@ be_visitor_interface_is::visit_interface (be_interface *node) -1); } - if (!node->is_local ()) + *os << "," << be_nl; + + if (node->is_nested ()) + { + be_decl *scope; + scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); + + *os << " ACE_NESTED_CLASS (POA_" << scope->name () << ", " + << node->local_name () << ") (rhs)"; + } + else { - *os << "," << be_nl; - - if (node->is_nested ()) - { - be_decl *scope; - scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); - - *os << " ACE_NESTED_CLASS (POA_" << scope->name () << ", " - << node->local_name () << ") (rhs)"; - } - else - { - *os << " " << node->full_skel_name () << " (rhs)"; - } + *os << " " << node->full_skel_name () << " (rhs)"; } *os << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp index e8d950f4d1f..1e798193964 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -39,221 +39,225 @@ int be_visitor_interface_sh::visit_interface (be_interface *node) { if (node->srv_hdr_gen () - || node->imported () - || node->is_abstract ()) + || node->imported ()) { return 0; } - // If this node is a AMH-RH node, then generate code for it - if (node->is_local ()) + // For abstract interfaces, we just generated the collocation stuff + // (see below). + if (! node->is_abstract ()) { - if (this->is_amh_rh_node (node)) - { - // Create amh_rh_visitors. - be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_); - amh_rh_intf.visit_interface (node); - } - - return 0; - } - - if (this->generate_amh_classes (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for AMH classes failed\n"), - -1); - } - - TAO_OutStream *os = this->ctx_->stream (); - ACE_CString class_name; - - // We shall have a POA_ prefix only if we are at the topmost level. - if (!node->is_nested ()) - { - // We are outermost. - class_name += "POA_"; - class_name += node->local_name (); - } - else - { - class_name += node->local_name (); - } - - *os << be_nl << be_nl - << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - // Generate the skeleton class name. - *os << "class " << class_name.c_str () << ";" << be_nl; - - // Generate the _ptr declaration. - *os << "typedef " << class_name.c_str () << " *" << class_name.c_str () - << "_ptr;" << be_nl << be_nl; - - // Forward class declarations. - if (be_global->gen_thru_poa_collocation ()) - { - *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; - } - - if (be_global->gen_direct_collocation ()) - { - *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; - } - - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) - { - *os << "class " << node->strategized_proxy_broker_name () - << ";" << be_nl; - } - - *os << be_nl; - - // Now generate the class definition. - *os << "class " << be_global->skel_export_macro () - << " " << class_name.c_str () << be_idt_nl << ": " << be_idt; - - long n_parents = node->n_inherits (); - AST_Interface *parent = 0; - int has_concrete_parent = 0; - - for (int i = 0; i < n_parents; ++i) - { - parent = node->inherits ()[i]; - - if (parent->is_abstract ()) - { - continue; - } - - if (has_concrete_parent == 1) - { - *os << "," << be_nl; - } - - *os << "public virtual " << "POA_" - << parent->name (); - - has_concrete_parent = 1; - } - - if (has_concrete_parent == 0) - { - // We don't inherit from another user defined object, hence our - // base class is the ServantBase class. - *os << "public virtual PortableServer::ServantBase"; - } - - *os << be_uidt << be_uidt_nl - << "{" << be_nl - << "protected:" << be_idt_nl; - - // Default constructor. - *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl - << "public:" << be_idt_nl; - - // Some useful typedefs. - *os << "// Useful for template programming." << be_nl - << "typedef ::" << node->name () << " _stub_type;" << be_nl - << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl - << "typedef ::" << node->name () << "_var _stub_var_type;" - << be_nl << be_nl; - - // Copy constructor and destructor. - *os << class_name.c_str () << " (const " - << class_name.c_str () << "& rhs);" << be_nl - << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; - - // _is_a - *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_nl - << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // _downcast - *os << "virtual void* _downcast (" << be_idt << be_idt_nl - << "const char* logical_type_id" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _is_a method. - *os << "static void _is_a_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _non_existent method. - *os << "static void _non_existent_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _interface method. - *os << "static void _interface_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *servant," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add a skeleton for our _component method. - *os << "static void _component_skel (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *obj," << be_nl - << "void *servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - // Add the dispatch method. - *os << "virtual void _dispatch (" << be_idt << be_idt_nl - << "TAO_ServerRequest &req," << be_nl - << "void *_servant_upcall" << be_nl - << "ACE_ENV_ARG_DECL" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - this->this_method (node); - - // The _interface_repository_id method. - *os << be_nl - << "virtual const char* _interface_repository_id " - << "(void) const;"; - - // Generate code for elements in the scope (e.g., operations). - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "codegen for scope failed\n"), - -1); - } - - // Generate skeletons for operations of our base classes. These - // skeletons just cast the pointer to the appropriate type - // before invoking the call. - int status = - node->traverse_inheritance_graph ( - be_interface::gen_skel_helper, - os - ); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_sh::" - "visit_interface - " - "inheritance graph traversal failed\n"), - -1); - } - - *os << be_uidt_nl << "};"; + // If this node is a AMH-RH node, then generate code for it + if (node->is_local ()) + { + if (this->is_amh_rh_node (node)) + { + // Create amh_rh_visitors. + be_visitor_amh_rh_interface_sh amh_rh_intf (this->ctx_); + amh_rh_intf.visit_interface (node); + } + + return 0; + } + + if (this->generate_amh_classes (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for AMH classes failed\n"), + -1); + } + + TAO_OutStream *os = this->ctx_->stream (); + ACE_CString class_name; + + // We shall have a POA_ prefix only if we are at the topmost level. + if (!node->is_nested ()) + { + // We are outermost. + class_name += "POA_"; + class_name += node->local_name (); + } + else + { + class_name += node->local_name (); + } + + *os << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + + // Generate the skeleton class name. + *os << "class " << class_name.c_str () << ";" << be_nl; + + // Generate the _ptr declaration. + *os << "typedef " << class_name.c_str () << " *" << class_name.c_str () + << "_ptr;" << be_nl << be_nl; + + // Forward class declarations. + if (be_global->gen_thru_poa_collocation ()) + { + *os << "class " << node->thru_poa_proxy_impl_name () << ";" << be_nl; + } + + if (be_global->gen_direct_collocation ()) + { + *os << "class " << node->direct_proxy_impl_name () << ";" << be_nl; + } + + if (be_global->gen_thru_poa_collocation () + || be_global->gen_direct_collocation ()) + { + *os << "class " << node->strategized_proxy_broker_name () + << ";" << be_nl; + } + + *os << be_nl; + + // Now generate the class definition. + *os << "class " << be_global->skel_export_macro () + << " " << class_name.c_str () << be_idt_nl << ": " << be_idt; + + long n_parents = node->n_inherits (); + AST_Interface *parent = 0; + int has_concrete_parent = 0; + + for (int i = 0; i < n_parents; ++i) + { + parent = node->inherits ()[i]; + + if (parent->is_abstract ()) + { + continue; + } + + if (has_concrete_parent == 1) + { + *os << "," << be_nl; + } + + *os << "public virtual " << "POA_" + << parent->name (); + + has_concrete_parent = 1; + } + + if (has_concrete_parent == 0) + { + // We don't inherit from another user defined object, hence our + // base class is the ServantBase class. + *os << "public virtual PortableServer::ServantBase"; + } + + *os << be_uidt << be_uidt_nl + << "{" << be_nl + << "protected:" << be_idt_nl; + + // Default constructor. + *os << class_name.c_str () << " (void);" << be_uidt_nl << be_nl + << "public:" << be_idt_nl; + + // Some useful typedefs. + *os << "// Useful for template programming." << be_nl + << "typedef ::" << node->name () << " _stub_type;" << be_nl + << "typedef ::" << node->name () << "_ptr _stub_ptr_type;" << be_nl + << "typedef ::" << node->name () << "_var _stub_var_type;" + << be_nl << be_nl; + + // Copy constructor and destructor. + *os << class_name.c_str () << " (const " + << class_name.c_str () << "& rhs);" << be_nl + << "virtual ~" << class_name.c_str () << " (void);" << be_nl << be_nl; + + // _is_a + *os << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_nl + << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // _downcast + *os << "virtual void* _downcast (" << be_idt << be_idt_nl + << "const char* logical_type_id" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _is_a method. + *os << "static void _is_a_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _non_existent method. + *os << "static void _non_existent_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _interface method. + *os << "static void _interface_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *servant," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add a skeleton for our _component method. + *os << "static void _component_skel (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *obj," << be_nl + << "void *servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + // Add the dispatch method. + *os << "virtual void _dispatch (" << be_idt << be_idt_nl + << "TAO_ServerRequest &req," << be_nl + << "void *_servant_upcall" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl << be_nl; + + this->this_method (node); + + // The _interface_repository_id method. + *os << be_nl + << "virtual const char* _interface_repository_id " + << "(void) const;"; + + // Generate code for elements in the scope (e.g., operations). + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "codegen for scope failed\n"), + -1); + } + + // Generate skeletons for operations of our base classes. These + // skeletons just cast the pointer to the appropriate type + // before invoking the call. + int status = + node->traverse_inheritance_graph ( + be_interface::gen_skel_helper, + os + ); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_sh::" + "visit_interface - " + "inheritance graph traversal failed\n"), + -1); + } + + *os << be_uidt_nl << "};"; + } // if ! node->is_abstract () be_visitor_context ctx (*this->ctx_); @@ -327,7 +331,7 @@ be_visitor_interface_sh::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -347,7 +351,7 @@ be_visitor_interface_sh::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_sh::" - "gen_abstract_ops_helper - " + "abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 4945b3676f5..aca20597312 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -443,7 +443,7 @@ be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node, be_interface *base, TAO_OutStream *os) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -463,7 +463,7 @@ be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node, { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_ss::" - "gen_abstract_ops_helper - " + "abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp index 2224b0189af..18ac8f0907a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp @@ -133,7 +133,7 @@ be_visitor_interface_thru_poa_proxy_impl_sh::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -153,7 +153,7 @@ be_visitor_interface_thru_poa_proxy_impl_sh::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_thru_poa_proxy_" - "impl_sh::gen_abstract_ops_helper - " + "impl_sh::abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp index a37f93b2d50..255e4b12a32 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp @@ -70,7 +70,7 @@ be_visitor_interface_thru_poa_proxy_impl_ss::gen_abstract_ops_helper ( TAO_OutStream *os ) { - if (!base->is_abstract ()) + if (node == base) { return 0; } @@ -90,7 +90,7 @@ be_visitor_interface_thru_poa_proxy_impl_ss::gen_abstract_ops_helper ( { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_interface_thru_poa_proxy" - "_impl_ss::gen_abstract_ops_helper - " + "_impl_ss::abstract_base_ops_helper - " "bad node in this scope\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index 7505969be27..d7427e01555 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -715,8 +715,6 @@ be_visitor_module::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_component_ch visitor (&ctx); - // So we can pick up the abstract ops helpers. - ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); status = node->accept (&visitor); break; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index ea8ac913eea..9ed75f883b7 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -400,6 +400,10 @@ int be_visitor_root::visit_root (be_root *node) case TAO_CodeGen::TAO_ROOT_CH: (void) tao_cg->end_client_header (); break; + case TAO_CodeGen::TAO_ROOT_CI: + case TAO_CodeGen::TAO_ROOT_CS: + *os << "\n\n"; + break; case TAO_CodeGen::TAO_ROOT_SH: (void) tao_cg->end_server_header (); break; @@ -436,9 +440,6 @@ int be_visitor_root::visit_root (be_root *node) break; } - // Make sure each file ends with a newline. - *os << "\n"; - return 0; } @@ -1104,8 +1105,6 @@ be_visitor_root::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_component_ch visitor (&ctx); - // This is the only context state involved in strategies. - ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); status = node->accept (&visitor); break; } @@ -1669,8 +1668,6 @@ be_visitor_root::gen_explicit_tmplinst (be_root *node, if (be_global->gen_anyop_files ()) { tao_cg->anyop_source ()->gen_endif_AHETI (); - - *tao_cg->anyop_source () << "\n"; } } else if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SS) diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp index 3a27523ade3..3a35cfdb386 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp @@ -838,7 +838,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt) } else { - *os << "TAO::Objref_Traits<" << bt->name () << ">::marshal (" + *os << "TAO::Objref_Traits<" << bt->name () << ">::tao_marshal (" << be_idt << be_idt_nl << "_tao_sequence[i].in (), strm" << be_uidt_nl << ");" << be_uidt << be_uidt; diff --git a/TAO/TAO_IDL/be/be_visitor_traits.cpp b/TAO/TAO_IDL/be/be_visitor_traits.cpp index 159e95ef9bd..30db4880b9c 100644 --- a/TAO/TAO_IDL/be/be_visitor_traits.cpp +++ b/TAO/TAO_IDL/be/be_visitor_traits.cpp @@ -116,15 +116,15 @@ be_visitor_traits::visit_interface (be_interface *node) << "struct " << be_global->stub_export_macro () << " Objref_Traits<" << " ::" << node->name () << ">" << be_nl << "{" << be_idt_nl - << "static ::" << node->name () << "_ptr duplicate (" + << "static ::" << node->name () << "_ptr tao_duplicate (" << be_idt << be_idt_nl << "::" << node->name () << "_ptr" << be_uidt_nl << ");" << be_uidt_nl - << "static void release (" << be_idt << be_idt_nl + << "static void tao_release (" << be_idt << be_idt_nl << "::" << node->name () << "_ptr" << be_uidt_nl << ");" << be_uidt_nl - << "static ::" << node->name () << "_ptr nil (void);" << be_nl - << "static CORBA::Boolean marshal (" << be_idt << be_idt_nl + << "static ::" << node->name () << "_ptr tao_nil (void);" << be_nl + << "static CORBA::Boolean tao_marshal (" << be_idt << be_idt_nl << "::" << node->name () << "_ptr p," << be_nl << "TAO_OutputCDR & cdr" << be_uidt_nl << ");" << be_uidt << be_uidt_nl @@ -191,10 +191,10 @@ be_visitor_traits::visit_valuetype (be_valuetype *node) << "struct " << be_global->stub_export_macro () << " Value_Traits<" << node->name () << ">" << be_nl << "{" << be_idt_nl - << "static void add_ref (" << node->name () << " *);" << be_nl - << "static void remove_ref (" << node->name () << " *);" + << "static void tao_add_ref (" << node->name () << " *);" << be_nl + << "static void tao_remove_ref (" << node->name () << " *);" << be_nl - << "static void release (" << node->name () << " *);" + << "static void tao_release (" << node->name () << " *);" << be_uidt_nl << "};"; @@ -388,6 +388,39 @@ be_visitor_traits::visit_array (be_array *node) TAO_OutStream *os = this->ctx_->stream (); + // Generate the array traits specialization definitions, + // guarded by #ifdef on unaliased array element type and length. + + ACE_CString unique; + be_type *bt = be_type::narrow_from_decl (node->base_type ()); + AST_Decl::NodeType nt = bt->node_type (); + + if (nt == AST_Decl::NT_typedef) + { + be_typedef *td = be_typedef::narrow_from_decl (bt); + unique = td->primitive_base_type ()->flat_name (); + } + else + { + unique = bt->flat_name (); + } + + char buf[NAMEBUFSIZE]; + + for (unsigned long i = 0; i < node->n_dims (); ++i) + { + ACE_OS::memset (buf, + '\0', + NAMEBUFSIZE); + ACE_OS::sprintf (buf, + "_%ld", + node->dims ()[i]->ev ()->u.ulval); + unique += buf; + } + + unique += "_traits"; +// os->gen_ifdef_macro (unique.fast_rep ()); + *os << be_nl << be_nl << "ACE_TEMPLATE_SPECIALIZATION" << be_nl << "struct " << be_global->stub_export_macro () << " Array_Traits<" @@ -397,20 +430,20 @@ be_visitor_traits::visit_array (be_array *node) << name << "_tag" << be_uidt_nl << ">" << be_uidt_nl << "{" << be_idt_nl - << "static void free (" << be_idt << be_idt_nl + << "static void tao_free (" << be_idt << be_idt_nl << name << "_slice * _tao_slice" << be_uidt_nl << ");" << be_uidt_nl - << "static " << name << "_slice * dup (" + << "static " << name << "_slice * tao_dup (" << be_idt << be_idt_nl << "const " << name << "_slice * _tao_slice" << be_uidt_nl << ");" << be_uidt_nl - << "static void copy (" << be_idt << be_idt_nl + << "static void tao_copy (" << be_idt << be_idt_nl << name << "_slice * _tao_to," << be_nl << "const " << name << "_slice * _tao_from" << be_uidt_nl << ");" << be_uidt_nl - << "static " << name << "_slice * alloc (void);" + << "static " << name << "_slice * tao_alloc (void);" << be_uidt_nl << "};"; diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp index f9574060652..664e9a660f5 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp @@ -145,7 +145,7 @@ be_visitor_union_branch_cdr_op_cs::visit_array (be_array *node) { case TAO_CodeGen::TAO_CDR_INPUT: *os << fname << " _tao_union_tmp;" << be_nl - << fname << "_forany _tao_union_helper (" + << fname << "_forany _tao_union_helper (" << be_idt << be_idt_nl << "_tao_union_tmp" << be_uidt_nl << ");" << be_uidt_nl @@ -301,7 +301,7 @@ be_visitor_union_branch_cdr_op_cs::visit_interface (be_interface *node) { if (f->is_abstract ()) { - *os << "(strm << _tao_union." + *os << "(strm << _tao_union." << f->local_name () << " ());"; } else @@ -315,7 +315,7 @@ be_visitor_union_branch_cdr_op_cs::visit_interface (be_interface *node) else { *os << "result =" << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::marshal (" + << "TAO::Objref_Traits<" << node->name () << ">::tao_marshal (" << be_idt << be_idt_nl << "_tao_union." << f->local_name () << " ()," << be_nl << "strm" << be_uidt_nl @@ -698,7 +698,7 @@ be_visitor_union_branch_cdr_op_cs::visit_sequence (be_sequence *node) -1); } } - + // Now generate the CDR stream operators for the sequence as a // union branch. @@ -849,7 +849,7 @@ be_visitor_union_branch_cdr_op_cs::visit_structure (be_structure *node) -1); } } - + // How generate the CDR stream operators for the structure as // a union branch. @@ -945,7 +945,7 @@ be_visitor_union_branch_cdr_op_cs::visit_union (be_union *node) -1); } } - + // Now generate the CDR stream operators for the union as // a union branch. @@ -1040,3 +1040,4 @@ be_visitor_union_branch_cdr_op_cs::explicit_default (void) return 0; } + diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp index 1b5a9f15141..0a94b45ac15 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp @@ -47,7 +47,7 @@ be_visitor_union_branch_public_assign_cs::visit_union_branch ( ) { TAO_OutStream *os = this->ctx_->stream (); - + *os << be_nl; // This visitor is used when we are generating the copy ctor and @@ -257,15 +257,15 @@ be_visitor_union_branch_public_assign_cs::visit_interface (be_interface *node) if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (" << be_idt << be_idt_nl + *os << "_duplicate (" << be_idt << be_idt_nl << "u.u_." << ub->local_name () << "_->ptr ()" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ");" << be_uidt << be_uidt_nl; @@ -279,17 +279,17 @@ be_visitor_union_branch_public_assign_cs::visit_interface (be_interface *node) if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (" << be_idt << be_idt_nl + *os << "_duplicate (" << be_idt << be_idt_nl << "u.u_." << ub->local_name () - << "_->ptr ()" << be_uidt_nl + << "_->ptr ()" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ")," << be_uidt_nl << "*this" << be_uidt_nl << ");" << be_uidt << be_uidt_nl; @@ -354,15 +354,15 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd ( if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (" << be_idt << be_idt_nl + *os << "_duplicate (" << be_idt << be_idt_nl << "u.u_." << ub->local_name () << "_->ptr ()" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ");" << be_uidt << be_uidt_nl; @@ -376,17 +376,17 @@ be_visitor_union_branch_public_assign_cs::visit_interface_fwd ( if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (" << be_idt << be_idt_nl + *os << "_duplicate (" << be_idt << be_idt_nl << "u.u_." << ub->local_name () - << "_->ptr ()" << be_uidt_nl + << "_->ptr ()" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ")," << be_uidt_nl << "*this" << be_uidt_nl << ");" << be_uidt << be_uidt_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp index 24909678547..5b45fd9505d 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp @@ -363,15 +363,15 @@ be_visitor_union_branch_public_ci::visit_interface (be_interface *node) if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl + *os << "_duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; @@ -460,15 +460,15 @@ be_visitor_union_branch_public_ci::visit_interface_fwd (be_interface_fwd *node) if (bt_is_defined) { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << bt->name () << "::_"; + << bt->name () << "::"; } else { *os << "OBJECT_FIELD (" << be_idt << be_idt_nl - << "TAO::Objref_Traits<" << node->name () << ">::"; + << "TAO::Objref_Traits<" << node->name () << ">::tao"; } - *os << "duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl + *os << "_duplicate (val)" << be_uidt_nl << ")" << be_uidt << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; @@ -690,7 +690,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( << "ACE_INLINE" << be_nl << "void" << be_nl << bu->name () << "::" << ub->local_name () << " ("; - + AST_PredefinedType::PredefinedType pt = node->pt (); @@ -712,7 +712,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( << bt->name () << " &"; } - else + else { *os << bt->name (); } @@ -762,7 +762,7 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( break; case AST_PredefinedType::PT_value: *os << "CORBA::add_ref (val);" << be_nl - << "this->u_." << ub->local_name () + << "this->u_." << ub->local_name () << "_ = val;" << be_uidt_nl; break; @@ -900,7 +900,7 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node) // (1) Set from a const. *os << "// Accessor to set the member." << be_nl - << "ACE_INLINE" << be_nl + << "ACE_INLINE" << be_nl << "void" << be_nl << bu->name () << "::" << ub->local_name () << " (const " << bt->name () << " &val)" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp index 461a6b53a4c..dd078a1390a 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp @@ -432,11 +432,11 @@ be_visitor_valuetype_field_ch::visit_predefined_type (be_predefined_type *node) // Get method (read-only). *os << pre_op () << "const " << bt->name () << " &" << ub->local_name () << " (void) const" - << post_op () << be_nl; + << post_op (); // Get method (read/write). *os << pre_op () << bt->name () << " &" << ub->local_name () << " (void)" - << post_op (); + << post_op () << be_nl << be_nl; break; case AST_PredefinedType::PT_void: break; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp index 6292d08fa71..6f04adbbb06 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp @@ -160,13 +160,25 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) *os << "public virtual CORBA::ValueBase"; } - - // Generate the supported interfaces. - for (i = 0; i < node->n_supports (); ++i) + + if (node->supports_abstract ()) { - *os << "," << be_nl - << "public virtual " - << node->supports ()[i]->name (); + status = + node->traverse_supports_list_graphs ( + be_valuetype::abstract_supports_helper, + os, + I_TRUE, + I_FALSE + ); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "traversal of supported interfaces failed\n"), + -1); + } } // Generate the body. @@ -237,10 +249,9 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) + // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase, + // we have to add this to avoid ambiguity. + if (node->supports_abstract ()) { *os << be_uidt_nl << be_nl << "public:" << be_idt_nl; *os << be_nl << "virtual void _add_ref (void) = 0;" << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp index 2ee88358c20..3b86f08e4b1 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp @@ -56,8 +56,35 @@ be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node) << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; *os << "ACE_INLINE" << be_nl; - *os << node->name () << "::" << node->local_name () << " (void)" << be_nl - << "{}" << be_nl << be_nl; + *os << node->name () << "::" << node->local_name () << " (void)" << be_nl; + + if (node->supports_abstract ()) + { + *os << "{" << be_idt; + + int status = + node->traverse_supports_list_graphs ( + be_valuetype::gen_abstract_init_helper, + os, + I_TRUE, + I_FALSE + ); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ci::" + "visit_valuetype - " + "traversal of supported interfaces failed\n"), + -1); + } + + *os << be_uidt_nl << "}" << be_nl << be_nl; + } + else + { + *os << "{}" << be_nl << be_nl; + } *os << "ACE_INLINE" << be_nl; *os << node->name () << "::~" << node->local_name () << " (void)" << be_nl; 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 869e85a1e6b..daa6e078b36 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp @@ -70,7 +70,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::add_ref (" + << "TAO::Value_Traits<" << node->name () << ">::tao_add_ref (" << be_idt << be_idt_nl << node->name () << " * p" << be_uidt_nl << ")" << be_uidt_nl @@ -81,7 +81,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::remove_ref (" + << "TAO::Value_Traits<" << node->name () << ">::tao_remove_ref (" << be_idt << be_idt_nl << node->name () << " * p" << be_uidt_nl << ")" << be_uidt_nl @@ -92,7 +92,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) *os << be_nl << be_nl << "ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION " << be_nl << "void" << be_nl - << "TAO::Value_Traits<" << node->name () << ">::release (" + << "TAO::Value_Traits<" << node->name () << ">::tao_release (" << be_idt << be_idt_nl << node->name () << " * p" << be_uidt_nl << ")" << be_uidt_nl @@ -232,10 +232,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) << "return retval;" << be_uidt_nl << "}"; - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) + if (node->supports_abstract ()) { *os << be_nl << be_nl << "CORBA::ValueBase *" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp index 0d89ded2a01..0d5d5836734 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp @@ -180,10 +180,9 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) -1); } - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) + // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase, + // we have to add this to avoid ambiguity. + if (node->supports_abstract ()) { *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ ; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp index fc0202f10a6..e415120ef58 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_cs.cpp @@ -107,10 +107,9 @@ be_visitor_valuetype_obv_cs::visit_valuetype (be_valuetype *node) -1); } - // If we inherit from CORBA::Object and/or CORBA::AbstractBase - // (in addition to CORBA::ValueBase) we have to add these - // to avoid ambiguity. - if (node->n_supports () > 0) + // If we inherit from both CORBA::ValueBase and CORBA::AbstractBase, + // we have to add this to avoid ambiguity. + if (node->supports_abstract ()) { *os << be_nl << be_nl << "void" << be_nl << node->full_obv_skel_name () diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp index e3f63a051a7..f7db8a0ca0f 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ss.cpp @@ -98,7 +98,7 @@ be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node) *os << be_idt_nl << ": TAO_Abstract_ServantBase (rhs)," << be_nl - << " TAO_ServantBase (rhs)," << be_idt_nl; + << " TAO_ServantBase (rhs)," << be_nl; if (concrete->is_nested ()) { @@ -113,8 +113,22 @@ be_visitor_valuetype_ss::visit_valuetype (be_valuetype *node) *os << bd->full_skel_name () << " (rhs)," << be_nl; } - *os << "ValueBase (rhs)" << be_uidt << be_uidt_nl - << "{}" << be_nl << be_nl; + *os << " ValueBase (rhs)," << be_nl; + + if (node->is_nested ()) + { + AST_Decl *scope = ScopeAsDecl (node->defined_in ()); + + *os << " ACE_NESTED_CLASS (" << scope->name () << ", " + << node->local_name () << ") ()"; + } + else + { + be_interface *bd = be_interface::narrow_from_decl (node); + *os << bd->full_skel_name () << " ()"; + } + + *os << be_uidt_nl << "{}" << be_nl << be_nl; *os << full_skel_name << "::~" << local_name_prefix << node_local_name |