diff options
32 files changed, 598 insertions, 278 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index 33674bedfdb..ad332222bec 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,42 @@ +Mon Aug 30 11:20:00 1999 Michael Kircher <Michael.Kircher@mchp.siemens.de> + + * TAO_IDL/be/be_operation.cpp + TAO_IDL/be/be_visitor_factory.cpp + TAO_IDL/be/be_visitor_scope.cpp + TAO_IDL/be/be_visitor_attribute/attribute.cpp + TAO_IDL/be/be_visitor_interface/interface.cpp + TAO_IDL/be/be_visitor_interface/interface_ch.cpp + TAO_IDL/be/be_visitor_interface/interface_ci.cpp + TAO_IDL/be/be_visitor_interface/interface_cs.cpp + TAO_IDL/be/be_visitor_interface/interface_sh.cpp + TAO_IDL/be/be_visitor_interface/interface_ss.cpp + TAO_IDL/be/be_visitor_interface/tie_sh.cpp + TAO_IDL/be/be_visitor_operation/ami_arglist.cpp + TAO_IDL/be/be_visitor_operation/ami_ch.cpp + TAO_IDL/be/be_visitor_operation/ami_cs.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_servant_operation_ss.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_skeleton_cs.cpp + TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp + TAO_IDL/be/be_visitor_operation/argument.cpp + TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp + TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp + TAO_IDL/be_include/be_codegen.h + TAO_IDL/be_include/be_operation.h + TAO_IDL/be_include/be_visitor_scope.h + TAO_IDL/be_include/be_visitor_interface/tie_sh.h + TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h: + Renamed the Code Generation enums to make it more clear what + is actually meant. I also added support for attributes, though still work needs + to be done in that area. Besides that I fixed bugs in the code generation. + + * tao/Transport_Mux_Strategy.cpp: + Fixed a bug concerning an uninitialized message state. + Mon Aug 30 10:21:16 1999 Ossama Othman <othman@cs.wustl.edu> * PROBLEM-REPORT-FORM: diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index 76f834dd1ab..89d1b325b6a 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -58,23 +58,23 @@ be_operation::compute_argument_attr (void) { // instantiate a scope iterator. UTL_ScopeActiveIterator *si = - new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); + new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); while (!(si->is_done ())) { // get the next AST decl node - AST_Decl *d = si->item (); + AST_Decl *d = si->item (); if (d->node_type () == AST_Decl::NT_argument) - { - this->argument_count_++; - be_argument *arg = be_argument::narrow_from_decl (d); - be_type* type = - be_type::narrow_from_decl (arg->field_type ()); - - if (type->base_node_type () == AST_Decl::NT_native) - this->has_native_ = 1; - } + { + this->argument_count_++; + be_argument *arg = be_argument::narrow_from_decl (d); + be_type* type = + be_type::narrow_from_decl (arg->field_type ()); + + if (type->base_node_type () == AST_Decl::NT_native) + this->has_native_ = 1; + } si->next (); } // end of while delete si; // free the iterator object @@ -87,6 +87,18 @@ be_operation::compute_argument_attr (void) return 0; } + +int +be_operation::void_return_type () +{ + be_type* type = be_type::narrow_from_decl (this->return_type ()); + if (type->node_type () == AST_Decl::NT_pre_defined + && (be_predefined_type::narrow_from_decl (type)->pt () + == AST_PredefinedType::PT_void)) + return 1; + else + return 0; +} // return the member count int be_operation::argument_count (void) diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index 78c24582e13..163c94bb8be 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -74,6 +74,7 @@ be_visitor_attribute::visit_attribute (be_attribute *node) op = new be_operation (node->field_type (), AST_Operation::OP_noflags, node->name (), 0); op->set_name (node->name ()); + op->set_defined_in (node->defined_in ()); be_visitor_context ctx (*this->ctx_); // this switch statement eliminates the need for different classes that have @@ -116,6 +117,34 @@ be_visitor_attribute::visit_attribute (be_attribute *node) case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI: ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); break; + // AMI Reply Handler code generation + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_TIE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH); + break; default: // error ACE_ERROR_RETURN ((LM_ERROR, @@ -158,6 +187,7 @@ be_visitor_attribute::visit_attribute (be_attribute *node) op = new be_operation (rt, AST_Operation::OP_noflags, node->name (), 0); op->set_name (node->name ()); + op->set_defined_in (node->defined_in ()); op->add_argument_to_scope (arg); ctx = *this->ctx_; @@ -201,6 +231,34 @@ be_visitor_attribute::visit_attribute (be_attribute *node) case TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI: ctx.state (TAO_CodeGen::TAO_OPERATION_TIE_SI); break; + // AMI Reply Handler code generation + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_TIE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH); + break; default: // error ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index 291fda1be5c..c18444ec95e 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -158,7 +158,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_interface_cs (new_ctx); case TAO_CodeGen::TAO_INTERFACE_SH: - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: return new be_visitor_interface_sh (new_ctx); case TAO_CodeGen::TAO_INTERFACE_IH: @@ -168,7 +168,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_interface_si (new_ctx); case TAO_CodeGen::TAO_INTERFACE_SS: - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: return new be_visitor_interface_ss (new_ctx); case TAO_CodeGen::TAO_INTERFACE_IS: @@ -195,6 +195,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: return new be_visitor_interface_any_op_cs (new_ctx); case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return new be_visitor_interface_tie_sh (new_ctx); case TAO_CodeGen::TAO_INTERFACE_TIE_SI: return new be_visitor_interface_tie_si (new_ctx); @@ -428,6 +429,15 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SS: case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_COLLOCATED_SH: case TAO_CodeGen::TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_TIE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SS: return new be_visitor_attribute (new_ctx); case TAO_CodeGen::TAO_EXCEPTION_CH: @@ -469,32 +479,32 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_ARRAY_CDR_OP_CS: return new be_visitor_array_cdr_op_cs (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_AMI: + case TAO_CodeGen::TAO_AMI_ARGUMENT: // @@ Alex: I am not sure about this case, yet (Alex). // noop. return new be_visitor_decl (new_ctx); // @@ Michael: With the strategy we can use the default one. - case TAO_CodeGen::TAO_AMI_HANDLER_FWD_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_FWD_CH: return new be_visitor_interface_ami_handler_fwd_ch (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_FWD_CI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_FWD_CI: return new be_visitor_interface_ami_handler_fwd_ci (new_ctx); // @@ Michael: We use 1:1 the server servant code, but // use different operations. #if 0 - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: return new be_visitor_interface_ami_handler_servant_ch (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: return new be_visitor_interface_ami_handler_servant_cs (new_ctx); #endif /* 0 */ - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: return new be_visitor_interface_ami_handler_stub_ch (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: return new be_visitor_interface_ami_handler_stub_cs (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RESULT_ARG: @@ -653,38 +663,36 @@ TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_SS: return new be_visitor_args_post_marshal_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_CH: + case TAO_CodeGen::TAO_AMI_OPERATION_CH: return new be_visitor_operation_ami_ch (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_CS: + case TAO_CodeGen::TAO_AMI_OPERATION_CS: return new be_interpretive_visitor_operation_ami_cs (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH: - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CS: return new be_visitor_operation_ami_arglist (new_ctx); - // case TAO_CodeGen::TAO_OPERATION_ARG_AMI: - // return new be_visitor_operation_argument (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CH: return new be_visitor_args_ami_arglist (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CS: return new be_visitor_args_ami_arglist (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SH: - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: return new be_visitor_operation_ami_handler_operation_ch (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CS: + // @@ Michael: I think we do not need that any more + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CS: return new be_interpretive_visitor_operation_ami_handler_operation_cs (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS: return new be_visitor_operation_ami_handler_arglist (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CH: - case TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CS: return new be_visitor_args_ami_handler_arglist (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_SKELETON_CS: @@ -859,23 +867,20 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) // this is a NO-OP return new be_visitor_decl (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_CS: + case TAO_CodeGen::TAO_AMI_OPERATION_CS: return new be_compiled_visitor_operation_ami_cs (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_CH: + case TAO_CodeGen::TAO_AMI_OPERATION_CH: return new be_visitor_operation_ami_ch (new_ctx); - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH: - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CS: return new be_visitor_operation_ami_arglist (new_ctx); - // case TAO_CodeGen::TAO_OPERATION_ARG_AMI: - // return new be_visitor_operation_argument (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CH: return new be_visitor_args_ami_arglist (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CS: return new be_visitor_args_ami_arglist (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_VARDECL_CS: @@ -889,25 +894,26 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_MARSHAL_CS: return new be_visitor_args_ami_handler_compiled_marshal_cs (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SH: - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: return new be_visitor_operation_ami_handler_operation_ch (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CS: return new be_compiled_visitor_operation_ami_handler_operation_cs (new_ctx); - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SS: return new be_compiled_visitor_operation_ami_handler_servant_operation_ss (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS: return new be_visitor_operation_ami_handler_arglist (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_AMI_HANDLER: + case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST: return new be_visitor_args_ami_handler_arglist (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CH: - case TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CS: return new be_visitor_args_ami_handler_arglist (new_ctx); case TAO_CodeGen::TAO_AMI_HANDLER_SKELETON_CS: diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index d7533f1e1a3..ea19e6a6b7b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -100,6 +100,33 @@ be_visitor_interface::visit_attribute (be_attribute *node) case TAO_CodeGen::TAO_INTERFACE_TIE_SI: ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_TIE_SI); break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_CS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SH); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SS); + break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ATTRIBUTE_TIE_SH); + break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH: @@ -179,6 +206,13 @@ be_visitor_interface::visit_constant (be_constant *node) case TAO_CodeGen::TAO_INTERFACE_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { @@ -261,6 +295,13 @@ be_visitor_interface::visit_enum (be_enum *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { @@ -345,6 +386,13 @@ be_visitor_interface::visit_exception (be_exception *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { @@ -430,17 +478,17 @@ be_visitor_interface::visit_operation (be_operation *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: ctx.state (TAO_CodeGen::TAO_OPERATION_DIRECT_COLLOCATED_SS); break; - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SH); + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH); break; - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SS); + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SS); break; - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_CH: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CH); + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH); break; - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_CS: - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CS); + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CS); break; case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SS); @@ -448,6 +496,9 @@ be_visitor_interface::visit_operation (be_operation *node) case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH); break; + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH); + break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH: @@ -504,11 +555,11 @@ be_visitor_interface::visit_operation (be_operation *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - ctx.state (TAO_CodeGen::TAO_OPERATION_AMI_CH); + ctx.state (TAO_CodeGen::TAO_AMI_OPERATION_CH); break; case TAO_CodeGen::TAO_INTERFACE_CS: - ctx.state (TAO_CodeGen::TAO_OPERATION_AMI_CS); + ctx.state (TAO_CodeGen::TAO_AMI_OPERATION_CS); break; default: @@ -591,6 +642,13 @@ be_visitor_interface::visit_structure (be_structure *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { @@ -675,6 +733,13 @@ be_visitor_interface::visit_union (be_union *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { @@ -759,6 +824,13 @@ be_visitor_interface::visit_typedef (be_typedef *node) case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: case TAO_CodeGen::TAO_INTERFACE_TIE_SH: case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH: return 0; // nothing to be done default: { 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 2e8f3a3779d..16f96517ed7 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -61,7 +61,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_FWD_CH); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_FWD_CH); // Create the visitor. be_visitor *visitor = tao_cg->make_visitor (&ctx); @@ -225,6 +225,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node) // generate code for the interface definition by traversing thru the // elements of its scope. We depend on the front-end to have made sure // that only legal syntactic elements appear in our scope. + if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -296,7 +297,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_STUB_CH); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CH); // Create the visitor. be_visitor *visitor = tao_cg->make_visitor (&ctx); diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp index 2030f023947..69a4cd1fb40 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ci.cpp @@ -112,7 +112,7 @@ be_visitor_interface_ci::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_FWD_CI); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_FWD_CI); // Create the visitor. be_visitor *visitor = tao_cg->make_visitor (&ctx); 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 f0ce44a0016..c36393fe791 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp @@ -215,7 +215,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_STUB_CS); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_CS); // Create the visitor. be_visitor *visitor = tao_cg->make_visitor (&ctx); 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 67f87e2ae36..5477e22acea 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp @@ -208,7 +208,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // generate the collocated class if (idl_global->gen_thru_poa_collocation ()) { - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH) ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH); else ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH); @@ -229,7 +229,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) if (idl_global->gen_direct_collocation ()) { ctx = *this->ctx_; - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH) ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SH); else ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH); @@ -252,7 +252,10 @@ be_visitor_interface_sh::visit_interface (be_interface *node) { // generate the TIE class. ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH); + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH) + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH); + else + ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH); visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { @@ -277,7 +280,7 @@ be_visitor_interface_sh::visit_interface (be_interface *node) // = Generate the Servant Skeleton code. ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SH); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SH); visitor = tao_cg->make_visitor (&ctx); if (!visitor) { 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 bbc99a74ef9..73cf1cd05a4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -435,7 +435,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) if (idl_global->gen_thru_poa_collocation ()) { be_visitor_context ctx (*this->ctx_); - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS); else ctx.state (TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS); @@ -463,7 +463,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) if (idl_global->gen_direct_collocation ()) { be_visitor_context ctx (*this->ctx_); - if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS); else ctx.state (TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS); @@ -493,7 +493,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) // Generate code for the AMI Reply Handler. if (idl_global->ami_call_back () == I_TRUE - && this->ctx_->state () != TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS) + && this->ctx_->state () != TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS) { be_interface_type_strategy *old_strategy = node->set_strategy (new be_interface_ami_handler_strategy (node)); @@ -504,7 +504,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node) be_visitor_context ctx (*this->ctx_); // Set the state. - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_SS); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_SS); // Create the visitor. be_visitor *visitor = tao_cg->make_visitor (&ctx); diff --git a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp index 0a0abe97cda..f466e56c0d2 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/tie_sh.cpp @@ -120,15 +120,30 @@ be_visitor_interface_tie_sh::visit_interface (be_interface *node) << be_uidt << be_uidt_nl << ");" << be_uidt << "\n"; - if (node->traverse_inheritance_graph (be_visitor_interface_tie_sh::method_helper, os) == -1) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH) { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_tie_sh_ss::" - "visit_interface - " - "traversal of inhertance graph failed\n"), - -1); + if (node->traverse_inheritance_graph (be_visitor_interface_tie_sh::ami_handler_method_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_tie_sh_ss::" + "visit_interface - " + "traversal of inhertance graph failed\n"), + -1); + } + } + else + { + if (node->traverse_inheritance_graph (be_visitor_interface_tie_sh::method_helper, os) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_tie_sh_ss::" + "visit_interface - " + "traversal of inhertance graph failed\n"), + -1); + } } + *os << be_uidt << "private:" << be_idt_nl << "T *ptr_;" << be_nl << "PortableServer::POA_var poa_;" << be_nl @@ -153,6 +168,28 @@ be_visitor_interface_tie_sh::method_helper (be_interface *, { be_visitor_context ctx; ctx.state (TAO_CodeGen::TAO_INTERFACE_TIE_SH); + + ctx.stream (os); + be_visitor* visitor = tao_cg->make_visitor (&ctx); + if (visitor == 0 || visitor->visit_scope (node) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_interface_tie_sh::" + "method_helper\n"), -1); + } + delete visitor; + return 0; +} + +int +be_visitor_interface_tie_sh::ami_handler_method_helper (be_interface *, + be_interface *node, + TAO_OutStream *os) +{ + be_visitor_context ctx; + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_INTERFACE_TIE_SH); + ctx.stream (os); be_visitor* visitor = tao_cg->make_visitor (&ctx); if (visitor == 0 || visitor->visit_scope (node) == -1) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_arglist.cpp index fa0efac3f45..fcf5904ab8e 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_arglist.cpp @@ -96,7 +96,7 @@ be_visitor_operation_ami_arglist::visit_operation (be_operation *node) *os << "CORBA::Environment &ACE_TRY_ENV"; - if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH) { *os << " = " << be_idt_nl << "TAO_default_environment ()" @@ -106,7 +106,7 @@ be_visitor_operation_ami_arglist::visit_operation (be_operation *node) // Done with the argument list. *os << be_uidt_nl << ")" << be_uidt; - if (this->ctx_->state () == TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH) + if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH) *os << ";"; *os << "\n"; @@ -155,12 +155,12 @@ be_visitor_operation_ami_arglist::visit_argument (be_argument *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CH); + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH: + ctx.state (TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CH); break; - case TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_AMI_ARGLIST_CS); + case TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CS: + ctx.state (TAO_CodeGen::TAO_AMI_ARGUMENT_ARGLIST_CS); break; default: diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp index dc8aa70a9af..11f7e9e4cbf 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp @@ -72,7 +72,7 @@ be_visitor_operation_ami_ch::visit_operation (be_operation *node) // mapping. For these we grab a visitor that generates the // parameter listing. be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CH); + ctx.state (TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CH); be_visitor *visitor = tao_cg->make_visitor (&ctx); if (!visitor) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp index 4a46c106c85..8820a07184e 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp @@ -93,7 +93,7 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) // Generate the argument list with the appropriate mapping (same as // in the header file) ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_AMI_ARGLIST_CS); + ctx.state (TAO_CodeGen::TAO_AMI_OPERATION_ARGLIST_CS); visitor = tao_cg->make_visitor (&ctx); if ((!visitor) || (node->accept (visitor) == -1)) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp index 4670062f2df..cbb919ea578 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist.cpp @@ -266,10 +266,10 @@ be_visitor_operation_ami_handler_arglist::visit_argument (be_argument *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CH: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CH); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CH); break; case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CS); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CS); break; default: { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp index 121f7509a5b..ad510501fdb 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_arglist_ch.cpp @@ -129,7 +129,7 @@ be_visitor_operation_ami_handler_arglist_ch::visit_argument (be_argument *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_AMI_HANDLER_ARGLIST); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_ARGUMENT_ARGLIST); break; default: { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp index 30f38acf344..e171415a018 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation.cpp @@ -133,7 +133,7 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no << ");" << be_uidt << "\n\n"; break; - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: *os << "TAO_InputCDR &_tao_reply_cdr, " << be_nl << "Messaging::ReplyHandler_ptr _tao_reply_handler, " << be_nl << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp index ea3ecea5600..a8609c9dc01 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_ch.cpp @@ -59,7 +59,7 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no *os << "void "; // STEP 2: generate the operation name. - *os << " " << node->local_name (); + *os << node->local_name (); // STEP 3: generate the argument list with the appropriate // mapping. For these we grab a visitor that generates the @@ -91,7 +91,8 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no // Skeleton not necessary for collocated class. if (this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH - || this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH) + || this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH + || this->ctx_->state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_TIE_SH) { return 0; /* NOT REACHED */ @@ -101,13 +102,14 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no // operation only if there was no "native" type. if (!node->has_native ()) { - // Next line. - *os << be_nl; - + // Indent. os->indent (); - *os << "static void "; + // Next line. + *os << be_nl + << "static void "; + // Check if we are an attribute node in disguise if (this->ctx_->attribute ()) { @@ -117,14 +119,14 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no else *os << "_get_"; } - *os << node->local_name () << - "_skel (" << be_idt << be_idt_nl; + *os << node->local_name () + << "_skel (" << be_idt << be_idt_nl; // Different skeletons for the AMI Handler class and the servant // class. switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_AMI_HANDLER_SERVANT_OPERATION_SH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_SH: *os << "CORBA::ServerRequest &_tao_req, " << be_nl << "void *_tao_obj, " << be_nl << "void *_tao_context, " << be_nl @@ -134,7 +136,7 @@ be_visitor_operation_ami_handler_operation_ch::visit_operation (be_operation *no << ");" << be_uidt << "\n\n"; break; - case TAO_CodeGen::TAO_AMI_HANDLER_STUB_OPERATION_CH: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_CH: *os << "TAO_InputCDR &_tao_reply_cdr, " << be_nl << "Messaging::ReplyHandler_ptr _tao_reply_handler, " << be_nl << "CORBA::Environment &ACE_TRY_ENV = " << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp index f58cf14e9d1..a50f71569da 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_operation_cs.cpp @@ -93,17 +93,8 @@ be_visitor_operation_ami_handler_operation_cs::visit_operation (be_operation *no // Here we do not have our overridden be_interface methods, // so the interface type strategy does not work here. // We have to go by foot. - { - char *full_name = 0; - - parent->compute_full_name ("AMI_", - "_Handler", - full_name); - // Genereate scope name. - *os << full_name; - - delete full_name; - } + // Genereate scope name. + *os << parent->compute_name ("AMI_", "_Handler"); // Generate the operation name. *os << "::" << node->local_name (); @@ -709,34 +700,36 @@ gen_marshal_and_invoke (be_operation *node, << be_nl << "if (!(\n" << be_idt << be_idt << be_idt; - // demarshal - be_visitor_context ctx (*this->ctx_); - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) + if (!this->void_return_type (bt)) { + // demarshal + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); + ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_cs::" + "gen_demarshal_params - " + "codegen for demarshal failed\n"), + -1); + } delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_operation_cs::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); - } - delete visitor; - - // Print the && if there are OUT or INOUT arguements in the - // signature. - if (this->has_param_type (node, AST_Argument::dir_OUT) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - *os << " &&\n"; + // Print the && if there are OUT or INOUT arguements in the + // signature. + if (this->has_param_type (node, AST_Argument::dir_OUT) || + this->has_param_type (node, AST_Argument::dir_INOUT)) + *os << " &&\n"; + } // Marshal each out and inout argument. - ctx = *this->ctx_; + be_visitor_context ctx (*this->ctx_); ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_MARSHAL_CS); ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT); - visitor = tao_cg->make_visitor (&ctx); + be_visitor *visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { delete visitor; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_servant_operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_servant_operation_ss.cpp index c966237390a..5301033d275 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_servant_operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_servant_operation_ss.cpp @@ -97,17 +97,8 @@ be_visitor_operation_ami_handler_servant_operation_ss::visit_operation (be_opera // Default implementation os->indent (); - *os << "void " << intf->full_skel_name () << "::"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () << " "; + *os << "void " << intf->full_skel_name () << "::" + << node->local_name () << " "; be_visitor_context ctx (*this->ctx_); ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARGLIST_CS); be_visitor *visitor = tao_cg->make_visitor (&ctx); @@ -229,6 +220,9 @@ be_visitor_operation_ami_handler_servant_operation_ss::visit_operation (be_opera ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS); + if (this->has_param_type (node, AST_Argument::dir_INOUT) + || this->has_param_type (node, AST_Argument::dir_OUT)) + ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS); visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { @@ -622,27 +616,30 @@ be_compiled_visitor_operation_ami_handler_servant_operation_ss::gen_demarshal_pa // demarshal the inout and out arguments and return values *os << "if (!(\n" << be_idt; - // demarshal - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); - ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) + if (!this->void_return_type (bt)) { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_compiled_visitor_operation_ami_handler_servant_operation_ss::" - "gen_demarshal_params - " - "codegen for demarshal failed\n"), - -1); + // demarshal + ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS); + ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT); + visitor = tao_cg->make_visitor (&ctx); + if (!visitor || (node->accept (visitor) == -1)) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_compiled_visitor_operation_ami_handler_servant_operation_ss::" + "gen_demarshal_params - " + "codegen for demarshal failed\n"), + -1); + } + + // Print the && if there are OUT or INOUT arguements in the + // signature. + if (this->has_param_type (node, AST_Argument::dir_OUT) || + this->has_param_type (node, AST_Argument::dir_INOUT)) + *os << " &&\n"; } - // Print the && if there are OUT or INOUT arguements in the - // signature. - if (this->has_param_type (node, AST_Argument::dir_OUT) || - this->has_param_type (node, AST_Argument::dir_INOUT)) - *os << " &&\n"; - // marshal each in and inout argument ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_DEMARSHAL_CS); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_skeleton_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_skeleton_cs.cpp index d88846b4e0b..f46c704e60e 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_skeleton_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_skeleton_cs.cpp @@ -95,7 +95,17 @@ be_visitor_operation_ami_handler_skeleton_cs::visit_operation (be_operation *nod *os << parent->compute_name ("AMI_", "_Handler"); // Generate the operation name. - *os << "::" << node->local_name () << "_skel (" << be_idt_nl; + *os << "::"; + // Check if we are an attribute node in disguise + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + *os << "_set_"; + else + *os << "_get_"; + } + *os << node->local_name () << "_skel (" << be_idt_nl; // Generate the argument list. *os << "TAO_InputCDR &_tao_in, " << be_nl @@ -391,8 +401,8 @@ be_compiled_visitor_operation_ami_handler_skeleton_cs::gen_pre_stub_info (be_ope int be_compiled_visitor_operation_ami_handler_skeleton_cs:: -gen_marshal_and_invoke (be_operation *node, - be_type *bt) + gen_marshal_and_invoke (be_operation *node, + be_type *bt) { TAO_OutStream *os = this->ctx_->stream (); be_visitor *visitor = 0; @@ -424,13 +434,15 @@ gen_marshal_and_invoke (be_operation *node, -1); } delete visitor; + + if (this->has_param_type (node, AST_Argument::dir_INOUT) || + this->has_param_type (node, AST_Argument::dir_OUT)) + *os << " &&\n"; } if (this->has_param_type (node, AST_Argument::dir_INOUT) || this->has_param_type (node, AST_Argument::dir_OUT)) { - *os << " &&\n"; - // demarshal each in and inout argument ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_DEMARSHAL_CS); @@ -454,16 +466,24 @@ gen_marshal_and_invoke (be_operation *node, // Invoke the callback method *os << "// Invoke the call back method." << be_nl - << "_tao_reply_handler_object->" - << node->local_name () << " (" << be_idt_nl; + << "_tao_reply_handler_object->"; + *os << node->local_name () << " (" << be_idt_nl; + // if we have a non-void return type then pass it as the first argument if (!this->void_return_type (bt)) - *os << "_tao_retval,\n"; + { + *os << "_tao_retval,\n"; + + } - // generate the argument list containing the inout and inout arguments ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS); + + if (this->has_param_type (node, AST_Argument::dir_INOUT) + || this->has_param_type (node, AST_Argument::dir_OUT)) + ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS); + // generate the argument list containing the inout and inout arguments visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp index a867498e201..ae3079dd271 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_thru_poa_collocated_ss.cpp @@ -168,6 +168,9 @@ int be_visitor_operation_ami_handler_thru_poa_collocated_ss::gen_invoke (be_visi ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_CS); + if (this->has_param_type (node, AST_Argument::dir_INOUT) + || this->has_param_type (node, AST_Argument::dir_OUT)) + ctx.sub_state (TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS); be_visitor *visitor = tao_cg->make_visitor (&ctx); if (!visitor || (node->accept (visitor) == -1)) { @@ -198,3 +201,32 @@ be_visitor_operation_ami_handler_thru_poa_collocated_ss::void_return_type (be_ty else return 0; } + +int +be_visitor_operation_ami_handler_thru_poa_collocated_ss::has_param_type (be_operation *node, + AST_Argument::Direction dir) +{ + // proceed if the number of members in our scope is greater than 0 + if (node->nmembers () > 0) + { + // initialize an iterator to iterate thru our scope + UTL_ScopeActiveIterator *si; + ACE_NEW_RETURN (si, + UTL_ScopeActiveIterator (node, + UTL_Scope::IK_decls), + 0); + // continue until each element is visited + while (!si->is_done ()) + { + be_argument *bd = be_argument::narrow_from_decl (si->item ()); + if (bd && (bd->direction () == dir)) + return 1; + + si->next (); + } // end of while loop + delete si; + } // end of if + + // not of the type we are looking for + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp index c50bd87c007..96161ae9b4b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp @@ -48,38 +48,38 @@ be_visitor_operation_argument::post_process (be_decl *bd) { TAO_OutStream *os = this->ctx_->stream (); + // if we are not the last parameter, we insert a comma. This is only // applicable for the upcalls or the call to (de)marshal that we use in the // interpreted marshaling. - if (!this->last_node (bd)) + switch (this->ctx_->state ()) { - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: + case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: + if (!this->last_node (bd)) *os << ",\n"; - break; - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_CS: - case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS: - { - // @@ Michael - // In the case of of AMI, we do not want to - // print a comma for in arguments. - // This is due to the concept of post processing, - // which I was not able to prevent to be executed - // in the case of in arguments. Post processing - // does always write a comma, though. - be_argument *arg = this->ctx_->be_node_as_argument (); - ACE_ASSERT (arg != 0); - if (arg->direction () != AST_Argument::dir_IN) - *os << ",\n"; - } - break; - default: - break; + break; + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_CS: + case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS: + if (!this->last_inout_or_out_node (bd)) + { + // @@ Michael + // In the case of of AMI, we do not want to + // print a comma for in arguments. + // This is due to the concept of post processing, + // which I was not able to prevent to be executed + // in the case of in arguments. Post processing + // does always write a comma, though. + be_argument *arg = this->ctx_->be_node_as_argument (); + ACE_ASSERT (arg != 0); + if (arg->direction () != AST_Argument::dir_IN) + *os << ",\n"; } + break; + default: + break; } return 0; } @@ -109,18 +109,28 @@ be_visitor_operation_argument::visit_operation (be_operation *node) case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: // applicable only to these cases where the actual upcall is made - // last argument is the environment if (node->argument_count () > 0) - // insert a comma only if there were previous parameters - *os << ",\n"; + { + // insert a comma only if there were previous parameters + *os << ",\n"; + } + + // last argument is the environment os->indent (); *os << "ACE_TRY_ENV"; break; case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_CS: case TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS: + // applicable only to these cases where the actual upcall is made + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS) + { + // insert a comma only if there were previous parameters + *os << ",\n"; + } + // last argument is the environment os->indent (); *os << "ACE_TRY_ENV"; - break; + break; default: break; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp index 1861f81be63..22b4fcf87e5 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp @@ -296,7 +296,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_predefined_type (be_pre default: ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_array - " + "visit_predefined_type - " "Bad predefined type\n"), -1); } @@ -337,7 +337,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_predefined_type (be_pre default: ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_array - " + "visit_predefined_type - " "Bad predefined type\n"), -1); } @@ -346,7 +346,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_predefined_type (be_pre { ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_array - " + "visit_predefined_type - " "Bad substate\n"), -1); } @@ -369,7 +369,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_sequence (be_sequence * { ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " + "visit_sequence - " "Bad substate\n"), -1); } @@ -427,7 +427,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_string (be_string *node { ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " + "visit_string - " "Bad substate\n"), -1); } @@ -456,7 +456,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_structure (be_structure { ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " + "visit_structure - " "Bad substate\n"), -1); } @@ -485,7 +485,7 @@ int be_visitor_operation_rettype_compiled_marshal::visit_union (be_union *node) { ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " + "visit_union - " "Bad substate\n"), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp index 874c8fa989b..c19d19f9dfc 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_collocated_ss.cpp @@ -100,8 +100,8 @@ int be_visitor_operation_thru_poa_collocated_ss::visit_operation (be_operation * } delete visitor; - *os << " " << intf->full_coll_name (be_interface::THRU_POA) << "::" - << node->local_name () << " "; + *os << " " << intf->full_coll_name (be_interface::THRU_POA) << "::"; + *os << node->local_name () << " "; // STEP 4: generate the argument list with the appropriate mapping (same as // in the header file) diff --git a/TAO/TAO_IDL/be/be_visitor_scope.cpp b/TAO/TAO_IDL/be/be_visitor_scope.cpp index c9dc965c01b..f0fb402ab42 100644 --- a/TAO/TAO_IDL/be/be_visitor_scope.cpp +++ b/TAO/TAO_IDL/be/be_visitor_scope.cpp @@ -243,3 +243,29 @@ be_visitor_scope::last_node (be_decl *bd) // I am the last one return 1; } + +idl_bool +be_visitor_scope::last_inout_or_out_node (be_decl *bd) +{ + // Return true if we are the last inout or out argument + be_decl *next = 0; + this->next_elem (this->ctx_->node (), + next); + while (next) + { + be_argument *arg = be_argument::narrow_from_decl (next); + + if (arg->direction () == AST_Argument::dir_INOUT + || arg->direction () == AST_Argument::dir_OUT) + // not the last + return 0; + + be_decl *next_next = 0; + this->next_elem (next, next_next); + + next = next_next; + } + // I am the last one + return 1; +} + diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index be8569e9deb..9b96be762a9 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -87,11 +87,11 @@ public: TAO_ATTRIBUTE_IH, // in implementation header TAO_ATTRIBUTE_SS, // in server skeletons TAO_ATTRIBUTE_IS, // in implementation skeletons - TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SH, // in server header for collocated - TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SS, // in server skeletons for + TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SH, // in server header for collocated + TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SS, // in server skeletons for // collocated - TAO_ATTRIBUTE_DIRECT_COLLOCATED_SH, // in server header for collocated - TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS, // in server skeletons for + TAO_ATTRIBUTE_DIRECT_COLLOCATED_SH, // in server header for collocated + TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS, // in server skeletons for // collocated TAO_ATTRIBUTE_TIE_SH, TAO_ATTRIBUTE_TIE_SI, @@ -286,88 +286,77 @@ public: TAO_OBV_OPERATION_ARGLIST_OTHERS, // ... for all other cases // Emitting code for AMI. - TAO_OPERATION_AMI_CH, // AMI stub generation. - TAO_OPERATION_AMI_CS, // AMI stub generation. - TAO_OPERATION_AMI_ARGLIST_CH, // AMI stubs in client header - TAO_OPERATION_AMI_ARGLIST_CS, // AMI stubs in client cpp. - TAO_OPERATION_ARG_AMI, // AMI stub. - TAO_ARGUMENT_AMI, // Argument in AMI stub. - TAO_ARGUMENT_AMI_ARGLIST_CH, // Arg list in AMI stub. - TAO_ARGUMENT_AMI_ARGLIST_CS, // Arg list in AMI stub. - TAO_AMI_HANDLER_FWD_CH, // FWD decl for AMI handler. - TAO_AMI_HANDLER_FWD_CI, // FWD decl for AMI handler. - - TAO_AMI_HANDLER_SERVANT_SH, // POA_AMI_*_Handler. - TAO_AMI_HANDLER_SERVANT_SS, // POA_AMI_*_Handler. - - TAO_AMI_HANDLER_STUB_CH, // AMI_*_Handler class visitor. - - TAO_AMI_HANDLER_STUB_CS, // AMI_*_Handler class visitor. - - TAO_AMI_HANDLER_SERVANT_OPERATION_SS, - TAO_AMI_HANDLER_SERVANT_OPERATION_SH, // Operation in POA_AMI_*_Handler. - TAO_AMI_HANDLER_STUB_OPERATION_CH, // Operation in AMI_*_Handler. - TAO_AMI_HANDLER_OPERATION_ARGLIST_CH, - TAO_AMI_HANDLER_OPERATION_ARGLIST_CS, - TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CH, - TAO_ARGUMENT_AMI_HANDLER_ARGLIST_CS, - TAO_ARGUMENT_ARGLIST_AMI_HANDLER, - TAO_AMI_HANDLER_OPERATION_RESULT_ARG, - - TAO_AMI_HANDLER_TYPECODE_DECL, // Typecode decl for the AMI_*_Handler. - - TAO_AMI_HANDLER_STUB_OPERATION_CS, - - TAO_AMI_HANDLER_TYPECODE_DEFN, // Typecode definition for AMI Handler class. - + TAO_AMI_OPERATION_CH, // AMI stub generation. + TAO_AMI_OPERATION_CS, // AMI stub generation. + TAO_AMI_OPERATION_ARGLIST_CH, // AMI stubs in client header + TAO_AMI_OPERATION_ARGLIST_CS, // AMI stubs in client cpp. TAO_AMI_OPERATION_ARG_INVOKE_CS, // Invoke arguments for AMI's sendc method. + TAO_AMI_ARGUMENT, // Argument in AMI stub. + TAO_AMI_ARGUMENT_ARGLIST_CH, // Arg list in AMI stub. + TAO_AMI_ARGUMENT_ARGLIST_CS, // Arg list in AMI stub. TAO_AMI_ARGUMENT_INVOKE_CS, - TAO_AMI_HANDLER_SKELETON_CS, - - TAO_AMI_HANDLER_OPERATION_RETVAL_DECL_CS, // Result argument declaration. + // Code generation for the AMI Reply Handler - TAO_AMI_HANDLER_OPERATION_ARG_DECL_CS, // Argument declartion. + TAO_AMI_HANDLER_INTERFACE_FWD_CH, // FWD decl for AMI handler. + TAO_AMI_HANDLER_INTERFACE_FWD_CI, // FWD decl for AMI handler. + TAO_AMI_HANDLER_INTERFACE_SH, // POA_AMI_*_Handler. + TAO_AMI_HANDLER_INTERFACE_SS, // POA_AMI_*_Handler. + TAO_AMI_HANDLER_INTERFACE_CH, // AMI_*_Handler class visitor. + TAO_AMI_HANDLER_INTERFACE_CS, // AMI_*_Handler class visitor. + TAO_AMI_HANDLER_INTERFACE_TIE_SH, + TAO_AMI_HANDLER_SKELETON_CS, TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SH, - TAO_AMI_HANDLER_INTERFACE_THRU_POA_COLLOCATED_SS, - TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SH, - TAO_AMI_HANDLER_INTERFACE_DIRECT_COLLOCATED_SS, + TAO_AMI_HANDLER_OPERATION_CH, // Operation in AMI_*_Handler. + TAO_AMI_HANDLER_OPERATION_CS, + TAO_AMI_HANDLER_OPERATION_SS, + TAO_AMI_HANDLER_OPERATION_SH, // Operation in POA_AMI_*_Handler. TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SH, - TAO_AMI_HANDLER_OPERATION_THRU_POA_COLLOCATED_SS, - TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SH, - TAO_AMI_HANDLER_OPERATION_DIRECT_COLLOCATED_SS, - - TAO_AMI_HANDLER_ARGUMENT_VARDECL_CS, // State derived out of the above - TAO_AMI_HANDLER_OPERATION_COLLOCATED_ARG_UPCALL_CS, // Argument list for the upcall - - TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_CS, // State derived out of the above - - TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS, // Argument list for the upcall - // (only out and inout arguments) - TAO_AMI_HANDLER_ARGUMENT_UPCALL_CS, // State derived out of the above - - TAO_AMI_HANDLER_OPERATION_RETVAL_MARSHAL_CS, // Marshalling the return value - - TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS, // Demarshalling the return value - - TAO_AMI_HANDLER_OPERATION_ARG_MARSHAL_CS, // Marshalling the inout and out arguments - + TAO_AMI_HANDLER_OPERATION_ARG_DECL_CS, // Argument declartion. + TAO_AMI_HANDLER_OPERATION_ARG_UPCALL_CS, // Argument list for the upcall + TAO_AMI_HANDLER_OPERATION_ARG_MARSHAL_CS, // Marshalling the inout and out arguments + TAO_AMI_HANDLER_OPERATION_ARG_DEMARSHAL_CS, // Demarshalling the inout and out arguments + TAO_AMI_HANDLER_OPERATION_RETVAL_DECL_CS, // Result argument declaration. + TAO_AMI_HANDLER_OPERATION_RETVAL_MARSHAL_CS, // Marshalling the return value + TAO_AMI_HANDLER_OPERATION_RETVAL_DEMARSHAL_CS, // Demarshalling the return value + TAO_AMI_HANDLER_OPERATION_ARGLIST_CH, + TAO_AMI_HANDLER_OPERATION_ARGLIST_CS, + TAO_AMI_HANDLER_OPERATION_RESULT_ARG, + TAO_AMI_HANDLER_OPERATION_TIE_SH, + + TAO_AMI_HANDLER_ATTRIBUTE_CH, + TAO_AMI_HANDLER_ATTRIBUTE_CS, + TAO_AMI_HANDLER_ATTRIBUTE_SH, + TAO_AMI_HANDLER_ATTRIBUTE_SS, + TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SH, + TAO_AMI_HANDLER_ATTRIBUTE_THRU_POA_COLLOCATED_SS, + TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SH, + TAO_AMI_HANDLER_ATTRIBUTE_DIRECT_COLLOCATED_SS, + TAO_AMI_HANDLER_ATTRIBUTE_TIE_SH, + + TAO_AMI_HANDLER_ARGUMENT_ARGLIST, + TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CH, + TAO_AMI_HANDLER_ARGUMENT_ARGLIST_CS, + + TAO_AMI_HANDLER_ARGUMENT_VARDECL_CS, + TAO_AMI_HANDLER_ARGUMENT_COLLOCATED_UPCALL_CS, + TAO_AMI_HANDLER_ARGUMENT_UPCALL_CS, TAO_AMI_HANDLER_ARGUMENT_MARSHAL_CS, // State derived out of the above - - TAO_AMI_HANDLER_OPERATION_ARG_DEMARSHAL_CS, // Demarshalling the inout and out arguments - TAO_AMI_HANDLER_ARGUMENT_DEMARSHAL_CS, // State derived out of the above + TAO_AMI_HANDLER_TYPECODE_DECL, // Typecode decl for the AMI_*_Handler. + TAO_AMI_HANDLER_TYPECODE_DEFN, // Typecode definition for AMI Handler class. + // Emitting code for root. TAO_ROOT_CH, TAO_ROOT_CI, @@ -501,6 +490,9 @@ public: TAO_AMI_HANDLER_TC_DEFN_TYPECODE, // For AMI Handler interface. + // means the upcall has arguments. + TAO_AMI_HANDLER_OPERATION_HAS_ARGUMENTS, + // means we are not generating the assignment operator TAO_UNION_COPY_CONSTRUCTOR, diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index 4a7556d2f6b..561aa99a63d 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -48,6 +48,9 @@ public: UTL_StrList *p); // constructor + int void_return_type (); + // Returns 1 if the operation has a void return type. + virtual int argument_count (void); // return the count of members diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h index bd2fbfbae13..ea1475ec148 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/tie_sh.h @@ -45,6 +45,10 @@ public: static int method_helper (be_interface *, be_interface *, TAO_OutStream *os); + + static int ami_handler_method_helper (be_interface *, + be_interface *, + TAO_OutStream *os); // helper method to generate method declaration in the TIE classes. }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h index 1ab2a005968..878db449adf 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/ami_handler_thru_poa_collocated_ss.h @@ -53,6 +53,9 @@ public: virtual int void_return_type (be_type *bt); // is my return type void? + + virtual int has_param_type (be_operation *, AST_Argument::Direction); + // does any of the argument node have the specified direct }; #endif /* _BE_VISITOR_OPERATION_AMI_HANDLER_THRU_POA_COLLOCATED_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_scope.h b/TAO/TAO_IDL/be_include/be_visitor_scope.h index 095dee0ae32..82e244fabce 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_scope.h +++ b/TAO/TAO_IDL/be_include/be_visitor_scope.h @@ -60,6 +60,9 @@ public: virtual idl_bool last_node (be_decl *bd); // Is bd the last node in the scope + idl_bool last_inout_or_out_node (be_decl *bd); + // Is bd the last inout or out in the scope + protected: int elem_number_; }; diff --git a/TAO/tao/Transport_Mux_Strategy.cpp b/TAO/tao/Transport_Mux_Strategy.cpp index 58f872de9b8..7d837cc2540 100644 --- a/TAO/tao/Transport_Mux_Strategy.cpp +++ b/TAO/tao/Transport_Mux_Strategy.cpp @@ -106,8 +106,15 @@ TAO_GIOP_Message_State * TAO_Exclusive_TMS::get_message_state (void) { if (this->rd_ != 0) - return this->rd_->message_state (); - + { + TAO_GIOP_Message_State* rd_message_state = this->rd_->message_state (); + if (rd_message_state == 0) + { + // The Reply Dispatcher does not have one (the Asynch guys + // don't) so go ahead and pass yours. + return &this->message_state_; + } + } return &this->message_state_; } |