From b162fb998d183c5bd7dec539b172b7c35b30c326 Mon Sep 17 00:00:00 2001 From: parsons Date: Fri, 24 Oct 2003 20:56:18 +0000 Subject: ChangeLogTag: Fri Oct 24 15:47:21 2003 Jeff Parsons --- TAO/ChangeLog_ref | 25 ++ .../be/be_visitor_tmplinst/arg_tmplinst.cpp | 7 +- TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp | 62 ++-- TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp | 317 ++++++++++++++++++++- .../be_include/be_visitor_tmplinst/tmplinst_ss.h | 12 + TAO/tao/PortableServer/TAO_PortableServer.dsp | 2 +- TAO/tao/Sequence_T.cpp | 6 +- TAO/tao/Valuetype/AbstractBase.cpp | 21 -- TAO/tao/Valuetype/AbstractBase.h | 1 - 9 files changed, 388 insertions(+), 65 deletions(-) diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref index 27087cf1b18..88738924374 100644 --- a/TAO/ChangeLog_ref +++ b/TAO/ChangeLog_ref @@ -1,3 +1,28 @@ +Fri Oct 24 15:47:21 2003 Jeff Parsons + + * tao/Sequence_T.cpp: + + Cosmetic changes. + + * tao/PortableServer/TAO_PortableServer.dsp: + + Removed illegal preprocessor argument. + + * tao/Valuetype/AbstractBase.cpp: + * tao/Valuetype/AbstractBase.h: + + Removed _tao_QueryInterface() method - not used by _narrow() + or _unchecked_narrow() and removed from all other interface + implementations in TAO. + + * TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp: + * TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp: + * TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp: + * TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_ss.h: + + Made small corrections in logic, and added full support for + explicit template instantiation on the skeleton side. + Fri Oct 24 11:00:06 2003 Balachandran Natarajan * TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp: diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp index 18b71a2f495..5ea7ca6a4d9 100644 --- a/TAO/TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp +++ b/TAO/TAO_IDL/be/be_visitor_tmplinst/arg_tmplinst.cpp @@ -187,6 +187,7 @@ be_visitor_arg_tmplinst::visit_sequence (be_sequence *node) } TAO_OutStream *os = this->ctx_->stream (); + be_typedef *alias = this->ctx_->alias (); *os << be_nl << be_nl << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl @@ -196,17 +197,17 @@ be_visitor_arg_tmplinst::visit_sequence (be_sequence *node) *os << "_Var_Size_" << this->S_ << "Argument_T<" << this->linebreak_ << be_idt << be_idt_nl - << node->name (); + << alias->name (); switch (this->dir_) { case _tao_OUT: *os << "," << this->linebreak_ << be_nl - << node->name () << "_out"; + << alias->name () << "_out"; break; case _tao_RET: *os << "," << this->linebreak_ << be_nl - << node->name () << "_var"; + << alias->name () << "_var"; break; default: break; diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp index a3e8d5c4c01..c2778c85eab 100644 --- a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_cs.cpp @@ -82,13 +82,11 @@ be_visitor_tmplinst_cs::visit_interface (be_interface *node) *os << be_nl << be_nl << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl << "TAO_Objref_Var_T<" << this->linebreak_ << be_idt << be_idt_nl - << node->name () << be_nl - << be_uidt_nl + << node->name () << be_uidt_nl << ">" << this->suffix_ << be_uidt << be_uidt_nl << be_uidt_nl << this->prefix_<< this->linebreak_ << be_idt << be_idt_nl << "TAO_Objref_Out_T<" << this->linebreak_ << be_idt << be_idt_nl - << node->name () << be_nl - << be_uidt_nl + << node->name () << be_uidt_nl << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; // Called by _narrow() for non-local interfaces. @@ -170,45 +168,36 @@ be_visitor_tmplinst_cs::visit_valuetype (be_valuetype *node) os->gen_endif (); } - if (this->visit_scope (node) != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_tmplinst_cs::" - "visit_valuetype - visit scope failed\n"), - -1); - } - - if (node->imported ()) + if (node->imported () || !node->is_defined ()) { this->this_mode_generated (node, I_TRUE); return 0; } - // For traits template class. - // @@@ (JP) This condition may change or go away once we - // regenerate the ORB hand-crafted code. - if (!node->is_defined ()) + if (this->visit_scope (node) != 0) { - *os << be_nl << be_nl - << this->prefix_ << " TAO::Value_Traits<" << node->name () - << ">" << this->suffix_; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_tmplinst_cs::" + "visit_valuetype - visit scope failed\n"), + -1); } // For _var and _out template classes. - if (node->is_defined ()) - { - *os << be_nl << be_nl - << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl - << "TAO_Value_Var_T<" << this->linebreak_ << be_idt << be_idt_nl - << node->name () << this->linebreak_ << be_nl - << be_uidt_nl - << ">" << this->suffix_ << be_uidt << be_uidt_nl << be_uidt_nl - << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl - << "TAO_Value_Out_T<" << this->linebreak_ << be_idt << be_idt_nl - << node->name () << this->linebreak_ << be_nl - << be_uidt_nl - << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; - } + *os << be_nl << be_nl + << this->prefix_ << " TAO::Value_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO_Value_Var_T<" << this->linebreak_ << be_idt << be_idt_nl + << node->name () << this->linebreak_ << be_nl + << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt_nl << be_uidt_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO_Value_Out_T<" << this->linebreak_ << be_idt << be_idt_nl + << node->name () << this->linebreak_ << be_nl + << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; // For Any impl template class. if (be_global->any_support ()) @@ -227,7 +216,7 @@ be_visitor_tmplinst_cs::visit_valuetype (be_valuetype *node) int be_visitor_tmplinst_cs::visit_operation (be_operation *node) { - if (node->imported ()) + if (this->this_mode_generated (node) || node->imported ()) { return 0; } @@ -272,6 +261,7 @@ be_visitor_tmplinst_cs::visit_operation (be_operation *node) } } + this->this_mode_generated (node, I_TRUE); return 0; } @@ -287,6 +277,8 @@ be_visitor_tmplinst_cs::visit_sequence (be_sequence *node) be_typedef *alias = this->ctx_->alias (); // For arg/return type helper template classes. + // If the node is anonymous, it can't have been seen in an operation, + // so no check is necessary for alias == 0. if (node->seen_in_operation ()) { os->gen_ifdef_macro (node->flat_name (), "arg_traits_tmplinst"); diff --git a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp index da3d78016f7..f7409e89445 100644 --- a/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_tmplinst/tmplinst_ss.cpp @@ -29,6 +29,39 @@ be_visitor_tmplinst_ss::visit_interface (be_interface *node) return 0; } + TAO_OutStream *os = this->ctx_->stream (); + + // For arg/return type helper template classes. This must come before + // the check for an imported or undefined node because such a node + // could still be used in an operation and thus cause the use of + // an arg helper template class. + if (node->seen_in_operation ()) + { + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::Object_SArg_Traits_T<" << this->linebreak_ + << be_idt << be_idt_nl + << node->name () << "_ptr," << this->linebreak_ << be_nl + << node->name () << "_var," << this->linebreak_ << be_nl + << node->name () << "_out," << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + } + + // If one of these is true we can skip the rest. + if (node->imported () || !node->is_defined ()) + { + this->this_mode_generated (node, I_TRUE); + return 0; + } + if (this->visit_scope (node) != 0) { ACE_ERROR_RETURN ((LM_ERROR, @@ -49,6 +82,35 @@ be_visitor_tmplinst_ss::visit_valuetype (be_valuetype *node) return 0; } + TAO_OutStream *os = this->ctx_->stream (); + + // For arg/return type helper template classes. + if (node->seen_in_operation ()) + { + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::Arg_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::Object_SArg_Traits_T<" << this->linebreak_ + << be_idt << be_idt_nl + << node->name () << " *," << this->linebreak_ << be_nl + << node->name () << "_var," << this->linebreak_ << be_nl + << node->name () << "_out," << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + } + + if (node->imported () || !node->is_defined ()) + { + this->this_mode_generated (node, I_TRUE); + return 0; + } + if (this->visit_scope (node) != 0) { ACE_ERROR_RETURN ((LM_ERROR, @@ -64,7 +126,9 @@ be_visitor_tmplinst_ss::visit_valuetype (be_valuetype *node) int be_visitor_tmplinst_ss::visit_operation (be_operation *node) { - if (node->imported ()) + if (this->this_mode_generated (node) + || node->imported () + || node->is_local ()) { return 0; } @@ -109,6 +173,257 @@ be_visitor_tmplinst_ss::visit_operation (be_operation *node) } } + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_sequence (be_sequence *node) +{ + if (this->this_mode_generated (node)) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + be_typedef *alias = this->ctx_->alias (); + + // For arg/return type helper template classes. + // If the node is anonymous, it can't have been seen in an operation, + // so no check is necessary for alias == 0. + if (node->seen_in_operation ()) + { + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traits<" << alias->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::Var_Size_SArg_Traits_T<" << this->linebreak_ + << be_idt << be_idt_nl + << alias->name () << "," << this->linebreak_ << be_nl + << alias->name () << "_var," << this->linebreak_ << be_nl + << alias->name () << "_out" << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + } + + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_string (be_string *node) +{ + if (this->this_mode_generated (node) || !node->seen_in_operation ()) + { + return 0; + } + + unsigned long bound = node->max_size ()->ev ()->u.ulval; + be_typedef *alias = this->ctx_->alias (); + + // Unbounded (w)string args are handled as a predefined type. + // Bounded (w)strings must come in as a typedef - they can't + // be used directly as arguments or return types. + if (bound == 0 || alias == 0) + { + this->this_mode_generated (node, I_TRUE); + return 0; + } + + // For arg/return type helper template classes. + + idl_bool wide = (node->width () != 1); + + TAO_OutStream *os = this->ctx_->stream (); + + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traitslocal_name () + << "_" << bound << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << " TAO::BD_" << (wide ? "W" : "") + << "String_SArg_Traits<" << bound << ">" << this->suffix_; + + os->gen_endif (); + + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_array (be_array *node) +{ + if (this->this_mode_generated (node) || !node->seen_in_operation ()) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + // For arg/return type helper template classes. + idl_bool variable = (node->size_type () == AST_Type::VARIABLE); + + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl << this->prefix_ << " TAO::SArg_Traits<" + << node->name () << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::" << (variable ? "Var" : "Fixed") << "_Array_SArg_Traits_T<" + << this->linebreak_ << be_idt << be_idt_nl + << node->name () << "," << this->linebreak_ << be_nl + << node->name () << "_slice," << this->linebreak_ << be_nl + << node->name () << "_var," << this->linebreak_ << be_nl; + + if (variable) + { + *os << node->name () << "_out," << this->linebreak_ << be_nl; + } + + *os << node->name () << "_forany" << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_enum (be_enum *node) +{ + if (this->this_mode_generated (node) || !node->seen_in_operation ()) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + // For arg/return type helper template classes. + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << " TAO::Basic_SArg_Traits_T<" << node->name () + << ">" << this->suffix_; + + os->gen_endif (); + + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_structure (be_structure *node) +{ + if (this->this_mode_generated (node)) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + // For arg/return type helper template classes. + if (node->seen_in_operation ()) + { + idl_bool variable = (node->size_type () == AST_Type::VARIABLE); + + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::" << (variable ? "Var" : "Fixed") << "_Size_SArg_Traits_T<" + << this->linebreak_ << be_idt << be_idt_nl + << node->name (); + + if (variable) + { + *os << "," << this->linebreak_ << be_nl + << node->name () << "_var," << this->linebreak_ << be_nl + << node->name () << "_out"; + } + + *os << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + } + + if (this->visit_scope (node) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_tmplinst_ss::" + "visit_structure - visit scope failed\n"), + -1); + } + + this->this_mode_generated (node, I_TRUE); + return 0; +} + +int +be_visitor_tmplinst_ss::visit_union (be_union *node) +{ + if (this->this_mode_generated (node)) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + if (node->seen_in_operation ()) + { + idl_bool variable = (node->size_type () == AST_Type::VARIABLE); + + os->gen_ifdef_macro (node->flat_name (), "sarg_traits_tmplinst"); + + *os << be_nl << be_nl + << this->prefix_ << " TAO::SArg_Traits<" << node->name () + << ">" << this->suffix_; + + *os << be_nl << be_nl + << this->prefix_ << this->linebreak_ << be_idt << be_idt_nl + << "TAO::" << (variable ? "Var" : "Fixed") << "_Size_SArg_Traits_T<" + << this->linebreak_ << be_idt << be_idt_nl + << node->name (); + + if (variable) + { + *os << "," << this->linebreak_ << be_nl + << node->name () << "_var," << this->linebreak_ << be_nl + << node->name () << "_out"; + } + + *os << this->linebreak_ << be_uidt_nl + << ">" << this->suffix_ << be_uidt << be_uidt << be_uidt; + + os->gen_endif (); + } + + if (this->visit_scope (node) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_tmplinst_ss::" + "visit_structure - visit scope failed\n"), + -1); + } + + this->this_mode_generated (node, I_TRUE); return 0; } diff --git a/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_ss.h b/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_ss.h index 0e69f45a777..38764460355 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_tmplinst/tmplinst_ss.h @@ -28,12 +28,24 @@ public: virtual ~be_visitor_tmplinst_ss (void); + virtual int visit_array (be_array *node); + + virtual int visit_enum (be_enum *node); + virtual int visit_interface (be_interface *node); virtual int visit_valuetype (be_valuetype *node); virtual int visit_operation (be_operation *node); + virtual int visit_sequence (be_sequence *node); + + virtual int visit_string (be_string *node); + + virtual int visit_structure (be_structure *node); + + virtual int visit_union (be_union *node); + protected: virtual idl_bool this_mode_generated (be_decl *node) const; virtual void this_mode_generated (be_decl *node, diff --git a/TAO/tao/PortableServer/TAO_PortableServer.dsp b/TAO/tao/PortableServer/TAO_PortableServer.dsp index 69263a521bc..e07b382d982 100644 --- a/TAO/tao/PortableServer/TAO_PortableServer.dsp +++ b/TAO/tao/PortableServer/TAO_PortableServer.dsp @@ -72,7 +72,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PortableServer_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../" /I "../../" /I "../../../" /D "_DEBUG" /D "TAO_PORTABLESERVER_BUILD_DLL" /D "WIN32" /D "_WINDOWS" /FD /Y3 /c +# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /Zi /Od /I "../" /I "../../" /I "../../../" /D "_DEBUG" /D "TAO_PORTABLESERVER_BUILD_DLL" /D "WIN32" /D "_WINDOWS" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" diff --git a/TAO/tao/Sequence_T.cpp b/TAO/tao/Sequence_T.cpp index 754b95a65b7..315abd74ca9 100644 --- a/TAO/tao/Sequence_T.cpp +++ b/TAO/tao/Sequence_T.cpp @@ -154,19 +154,19 @@ TAO_Unbounded_Sequence::get_buffer (CORBA::Boolean orphan) { result = TAO_Unbounded_Sequence::allocbuf (this->length_); this->buffer_ = result; - this->release_ = 1; + this->release_ = 1; } } else { result = ACE_reinterpret_cast (T *, - this->buffer_); + this->buffer_); } } else { result = ACE_reinterpret_cast (T *, - this->buffer_); + this->buffer_); if (this->release_ != 0) { diff --git a/TAO/tao/Valuetype/AbstractBase.cpp b/TAO/tao/Valuetype/AbstractBase.cpp index 8c00ba892bb..b2739986957 100644 --- a/TAO/tao/Valuetype/AbstractBase.cpp +++ b/TAO/tao/Valuetype/AbstractBase.cpp @@ -139,27 +139,6 @@ CORBA::AbstractBase::_unchecked_narrow (CORBA::AbstractBase_ptr obj return ret; } -void * -CORBA::AbstractBase::_tao_QueryInterface (ptrdiff_t type) -{ - void *retv = 0; - - if (type == ACE_reinterpret_cast ( - ptrdiff_t, - &CORBA::AbstractBase::_tao_class_id) - ) - { - retv = ACE_reinterpret_cast (void*, this); - } - - if (retv != 0) - { - this->_add_ref (); - } - - return retv; -} - // These are non-pure virtual no-ops so we can instantiate the // class in the CDR extraction operator. The actual management // of the refcount will always be done in the derived class. diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h index 543a41c016d..ea0929815c7 100644 --- a/TAO/tao/Valuetype/AbstractBase.h +++ b/TAO/tao/Valuetype/AbstractBase.h @@ -98,7 +98,6 @@ namespace CORBA virtual const char* _interface_repository_id (void) const; /// TAO specific operation - virtual void *_tao_QueryInterface (ptrdiff_t type); virtual const char* _tao_obv_repository_id (void) const; virtual void *_tao_obv_narrow (ptrdiff_t type_id); virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &strm); -- cgit v1.2.1