diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp | 185 |
1 files changed, 98 insertions, 87 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp index 37aa726e00b..4cea8a38b26 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -122,129 +122,140 @@ be_visitor_operation_cs::visit_operation (be_operation *node) -1); } - *os << "{" << be_idt_nl; - *os << this->gen_environment_var (); - - if (be_global->exception_support ()) - { - *os << be_nl << be_nl; - } - - // For what follows, the return type node nust be unaliased. - if (bt->node_type () == AST_Decl::NT_typedef) + // @@@ (JP) No collocation for abstract interface operations yet. We + // are generating the code as if there were no proxies, and using + // the (concrete interface's) stub info that we got over the wire. + if (intf->is_abstract ()) { - be_typedef *btd = be_typedef::narrow_from_decl (bt); - bt = btd->primitive_base_type (); + return this->gen_stub_operation_body (node, + bt); } - - AST_Decl::NodeType bnt = bt->base_node_type (); - be_predefined_type *bpt = 0; - AST_PredefinedType::PredefinedType pdt = AST_PredefinedType::PT_void; - - if (bnt == AST_Decl::NT_pre_defined) + else { - bpt = be_predefined_type::narrow_from_decl (bt); - pdt = bpt->pt (); + *os << "{" << be_idt_nl; + *os << this->gen_environment_var (); - if (pdt == AST_PredefinedType::PT_longlong) + if (be_global->exception_support ()) { - *os << "CORBA::LongLong _tao_check_retval = " - << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl; + *os << be_nl << be_nl; } - else if (pdt == AST_PredefinedType::PT_longdouble) + + // For what follows, the return type node nust be unaliased. + if (bt->node_type () == AST_Decl::NT_typedef) { - *os << "CORBA::LongDouble _tao_check_retval = " - << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl; + be_typedef *btd = be_typedef::narrow_from_decl (bt); + bt = btd->primitive_base_type (); } - } - // Generate code that retrieves the proper proxy implementation - // using the proxy broker available, and perform the call - // using the proxy implementation provided by the broker. + AST_Decl::NodeType bnt = bt->base_node_type (); + be_predefined_type *bpt = 0; + AST_PredefinedType::PredefinedType pdt = AST_PredefinedType::PT_void; - *os << intf->base_proxy_impl_name () << " &proxy = " << be_idt_nl - << "this->the" << intf->base_proxy_broker_name () - << "_->select_proxy (this ACE_ENV_ARG_PARAMETER);" << be_uidt_nl; - - if (!this->void_return_type (bt)) - { - *os << "ACE_CHECK_RETURN ("; - - if (bnt == AST_Decl::NT_enum) - { - // The enum is a unique type, so we must cast. - *os << "(" << bt->name () << ")0);"; - } - else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union) + if (bnt == AST_Decl::NT_pre_defined) { - if (bt->size_type () == AST_Type::FIXED) + bpt = be_predefined_type::narrow_from_decl (bt); + pdt = bpt->pt (); + + if (pdt == AST_PredefinedType::PT_longlong) { - // For a fixed size struct or union the return value - // is not a pointer, so we call the default constructor - // and return the result. - *os << bt->name () << " ());"; + *os << "CORBA::LongLong _tao_check_retval = " + << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl; } - else + else if (pdt == AST_PredefinedType::PT_longdouble) { - *os << "0);"; + *os << "CORBA::LongDouble _tao_check_retval = " + << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl; } } - else if (bnt == AST_Decl::NT_pre_defined) + + // Generate code that retrieves the proper proxy implementation + // using the proxy broker available, and perform the call + // using the proxy implementation provided by the broker. + + *os << intf->base_proxy_impl_name () << " &proxy = " << be_idt_nl + << "this->the" << intf->base_proxy_broker_name () + << "_->select_proxy (this ACE_ENV_ARG_PARAMETER);" << be_uidt_nl; + + if (!this->void_return_type (bt)) { - if (pdt == AST_PredefinedType::PT_longlong - || pdt == AST_PredefinedType::PT_longdouble) + *os << "ACE_CHECK_RETURN ("; + + if (bnt == AST_Decl::NT_enum) { - *os << "_tao_check_retval);" << be_nl - << "ACE_UNUSED_ARG (_tao_check_retval);"; + // The enum is a unique type, so we must cast. + *os << "(" << bt->name () << ")0);"; + } + else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union) + { + if (bt->size_type () == AST_Type::FIXED) + { + // For a fixed size struct or union the return value + // is not a pointer, so we call the default constructor + // and return the result. + *os << bt->name () << " ());"; + } + else + { + *os << "0);"; + } + } + else if (bnt == AST_Decl::NT_pre_defined) + { + if (pdt == AST_PredefinedType::PT_longlong + || pdt == AST_PredefinedType::PT_longdouble) + { + *os << "_tao_check_retval);" << be_nl + << "ACE_UNUSED_ARG (_tao_check_retval);"; + } + else + { + *os << "0);"; + } } else { *os << "0);"; } + + *os << be_nl << be_nl + << "return "; } else { - *os << "0);"; + *os << "ACE_CHECK;" << be_nl << be_nl; } - *os << be_nl << be_nl - << "return "; - } - else - { - *os << "ACE_CHECK;" << be_nl << be_nl; - } + *os << "proxy." << node->local_name () + << " (" << be_idt << be_idt_nl << "this"; - *os << "proxy." << node->local_name () - << " (" << be_idt << be_idt_nl << "this"; + for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); + !si.is_done (); + si.next ()) + { + AST_Decl *d = si.item (); - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - AST_Decl *d = si.item (); + if (d == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_scope::visit_scope - " + "bad node in this scope\n"), + -1); + } - if (d == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_scope::visit_scope - " - "bad node in this scope\n"), - -1); - } + be_decl *decl = be_decl::narrow_from_decl (d); - be_decl *decl = be_decl::narrow_from_decl (d); + *os << "," << be_nl + << decl->local_name(); + } - *os << "," << be_nl - << decl->local_name(); - } + if (!be_global->exception_support ()) + { + *os << " ACE_ENV_ARG_PARAMETER"; + } - if (!be_global->exception_support ()) - { - *os << " ACE_ENV_ARG_PARAMETER"; + *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}\n\n"; } - *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}\n\n"; - return 0; } |