summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_operation
diff options
context:
space:
mode:
authorbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-10-28 18:31:01 +0000
committerbala <bala@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-10-28 18:31:01 +0000
commitcdb6fd66611283a0314ab23e08472d11dae4f0e4 (patch)
treefd6ae8c3db752254802dfaafd1543974a4741e47 /TAO/TAO_IDL/be/be_visitor_operation
parentf984aa2bff444f381570d2f97ac9ba958926fb6b (diff)
downloadATCD-cdb6fd66611283a0314ab23e08472d11dae4f0e4.tar.gz
ChangeLogTag:Tue Oct 28 12:02:47 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp160
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/argument.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp174
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp26
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp37
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp1037
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp157
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp112
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp69
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp212
14 files changed, 632 insertions, 1395 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
index 2158f9fc565..d49e70e859f 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
@@ -219,7 +219,8 @@ be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
-1);
}
- *os << be_uidt_nl << "))" << be_nl;
+ *os << be_uidt_nl << "))" << be_nl
+ << "{" << be_idt_nl;
// If marshaling fails, raise exception.
if (this->gen_raise_exception (0,
@@ -231,7 +232,8 @@ be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
-1);
}
- *os << be_uidt_nl;
+ *os << be_uidt_nl
+ << "}" << be_uidt_nl;
}
return 0;
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 1078d5da757..ece5d802667 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp
@@ -1,6 +1,5 @@
//
// $Id$
-//
// ============================================================================
//
@@ -71,6 +70,18 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__;
+ // Retrieve the operation return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ami_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
// Generate the return type mapping. Return type is simply void.
*os << be_nl << be_nl
<< "void" << be_nl;
@@ -131,13 +142,10 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
if (be_global->exception_support ())
{
- *os << be_nl
+ *os << be_nl
<< "ACE_DECLARE_NEW_CORBA_ENV;";
}
- be_type *bt =
- be_type::narrow_from_decl (node->arguments ()->return_type ());
-
// Generate any pre stub info if and only if none of our parameters is of the
// native type.
if (!node->has_native ())
@@ -159,7 +167,10 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
if (node->has_native ()) // native exists => no stub
{
- int status = this->gen_raise_exception (bt,
+ be_predefined_type bpt (AST_PredefinedType::PT_void,
+ 0);
+
+ int status = this->gen_raise_exception (&bpt,
"CORBA::MARSHAL",
"");
@@ -174,45 +185,122 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node)
}
else
{
- // Generate code that retrieves the underlying stub object and then
- // invokes do_static_call on it.
- *os << be_nl
- << "TAO_Stub *istub = this->_stubobj ();" << be_nl << be_nl
- << "if (istub == 0)" << be_idt_nl
- << "{" << be_idt_nl;
+ *os << "if (!this->is_evaluated ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
- // If the stub object was bad, then we raise a system exception.
- if (this->gen_raise_exception (bt, "CORBA::INV_OBJREF",
- "") == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ami_cs::"
- "visit_operation - "
- "codegen for checking exception failed\n"),
- -1);
+ *os << "if (this->the_TAO_" << parent->local_name ()
+ << "_Proxy_Broker_ == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << parent->flat_name () << "_setup_collocation ("
+ << be_idt << be_idt_nl
+ << "this->ACE_NESTED_CLASS (CORBA, Object)::_is_collocated ()"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt;
+ }
- }
+ const char *lname = node->local_name ()->get_string ();
+ long opname_len = ACE_OS::strlen (lname);
+ ACE_CString opname;
+ int nargs = node->argument_count ();
- *os << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
+ *os << be_nl<< be_nl
+ << "TAO::Arg_Traits<";
+
+ this->gen_arg_template_param_name (bt,
+ os);
- // Generate the code for marshaling in the parameters and transmitting
- // them.
- if (this->gen_marshal_and_invoke (node, bt) == -1)
+ *os << ">::ret_val _tao_retval;";
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
+ {
+ // Declare return type helper class.
+
+ // If we are a attribute node, add the length of the operation
+ // name.
+ opname_len += 5;
+
+ // Count the return value.
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ami_cs::"
- "visit_operation - "
- "codegen for marshal and invoke failed\n"),
- -1);
+ opname = "_set_";
+ }
+ else
+ {
+ opname = "_get_";
+ }
+ }
+
+ opname += lname;
+ // Declare the argument helper classes.
+ this->gen_stub_body_arglist (node, os, I_TRUE);
+
+ *os << be_nl << be_nl
+ << "TAO::Argument *_tao_signature [] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&_tao_retval";
+
+ AST_Argument *arg = 0;
+
+ for (UTL_ScopeActiveIterator arg_list_iter (node, UTL_Scope::IK_decls);
+ ! arg_list_iter.is_done ();
+ arg_list_iter.next ())
+ {
+ arg = AST_Argument::narrow_from_decl (arg_list_iter.item ());
+
+ if (arg->direction () == AST_Argument::dir_OUT)
+ {
+ nargs--;
+ continue;
}
+ *os << "," << be_nl
+ << "&_tao_" << arg->local_name ();
+ }
+
+ *os << be_uidt_nl
+ << "};" << be_uidt;
+
+ be_interface *intf = be_interface::narrow_from_decl (parent);
+
+ *os << be_nl << be_nl
+ << "TAO::Asynch_Invocation_Adapter _tao_call (" << be_idt << be_idt_nl
+ << "this," << be_nl
+ << "_tao_signature," << be_nl
+ << nargs + 1 << "," << be_nl
+ << "\"" << opname.fast_rep () << "\"," << be_nl
+ << opname_len << "," << be_nl
+ << "this->the" << intf->base_proxy_broker_name () << "_"
+ << be_uidt_nl
+ << ");" << be_uidt;
+
+ *os << be_nl << be_nl
+ << "_tao_call.invoke (" << be_idt << be_idt_nl
+ << "ami_handler," << be_nl
+ << "&";
+
+ if (parent->is_nested ())
+ {
+ be_decl *gparent =
+ be_scope::narrow_from_scope (parent->defined_in ())->decl ();
+
+ *os << gparent->name () << "::";
+ }
- // No return values.
- *os << be_nl << "return;";
- } // end of if (!native)
+ *os << "AMI_" << parent->local_name () << "Handler::"
+ << opname.fast_rep () + (this->ctx_->attribute () != 0)
+ << "_reply_stub" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt_nl
+ << "ACE_CHECK;";
- *os << be_uidt_nl << "}";
+ *os << be_uidt_nl
+ << "}";
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
index daba6c407e4..2f8525957e1 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_exception_holder_operation_cs.cpp
@@ -18,8 +18,8 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_operation,
- ami_exception_holder_operation_cs,
+ACE_RCSID (be_visitor_operation,
+ ami_exception_holder_operation_cs,
"$Id$")
// ************************************************************
@@ -69,7 +69,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
*os << "void " << be_nl;
// Get the scope name.
- be_decl *parent =
+ be_decl *parent =
be_scope::narrow_from_scope (node->defined_in ())->decl ();
if (parent == 0)
@@ -85,7 +85,7 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
}
be_interface *parent_interface = be_interface::narrow_from_decl (parent);
- AST_Decl::NodeType nt =
+ AST_Decl::NodeType nt =
parent_interface->defined_in ()->scope_node_type ();
if (parent_interface->is_nested () && nt == AST_Decl::NT_module)
@@ -145,12 +145,12 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
// Don't do anything if the exception list is empty.
if (node->exceptions ())
{
- *os << "static TAO_Exception_Data " << "exceptions_data [] = " << be_nl;
+ *os << "static TAO::Exception_Data " << "exceptions_data [] = " << be_nl;
*os << "{" << be_idt_nl;
int excep_count = 0;
- AST_Decl *d = 0;
+ be_exception *ex = 0;
// Initialize an iterator to iterate thru the exception list.
// Continue until each element is visited.
@@ -158,12 +158,13 @@ be_visitor_operation_ami_exception_holder_operation_cs::visit_operation (
for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
!ei.is_done ();)
{
- d = ei.item ();
+ ex = be_exception::narrow_from_decl (ei.item ());
*os << "{" << be_idt_nl
- << "\"" << d->repoID () << "\"," << be_nl;
+ << "\"" << ex->repoID () << "\"," << be_nl;
// Allocator method.
- *os << d->name () << "::_alloc" << be_uidt_nl
+ *os << ex->name () << "::_alloc," << be_nl
+ << ex->tc_name () << be_uidt_nl
<< "}";
++excep_count;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index b9644f1b5f1..09e8092875e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -51,7 +51,6 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH:
case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS:
*os << "CORBA::Object *_collocated_tao_target_";
@@ -116,7 +115,6 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
*os << ";";
break;
- case TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH:
case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH:
// Each method is pure virtual in the server header.
*os << " = 0;";
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
index bf614658014..527d3d27916 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp
@@ -160,24 +160,12 @@ be_visitor_operation_argument::visit_argument (be_argument *node)
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS:
- {
- be_visitor_args_pre_invoke_cs visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
case TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS:
{
be_visitor_args_invoke_cs visitor (&ctx);
status = node->accept (&visitor);
break;
}
- case TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS:
- {
- be_visitor_args_post_invoke_cs visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS:
{
be_visitor_args_vardecl_ss visitor (&ctx);
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
index 62ba04ab3ec..576364a450c 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp
@@ -1,7 +1,7 @@
// $Id$
-ACE_RCSID (be_visitor_operation,
- direct_proxy_impl_ss,
+ACE_RCSID (be_visitor_operation,
+ direct_proxy_impl_ss,
"$Id$")
be_visitor_operation_direct_proxy_impl_ss::
@@ -38,74 +38,94 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (
-1);
}
- be_type *bt = be_type::narrow_from_decl (node->return_type ());
+ *os << "// TAO_IDL - Generated from " << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- if (!bt)
+ *os << "void" << be_nl
+ << intf->full_direct_proxy_impl_name () << "::";
+
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_direct_collocated_ss::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
}
- os->indent ();
- // STEP 2: generate the return type mapping (same as in the header file)
- be_visitor_context ctx (*this->ctx_);
- be_visitor_operation_rettype oro_visitor (&ctx);
+ *os << node->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument **";
- if (bt->accept (&oro_visitor) == -1)
+ if (!node->void_return_type () || node->nmembers () > 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_direct_collocated_ss::"
- "visit_operation - "
- "codegen for return type failed\n"),
- -1);
+ *os << " args";
}
- *os << " " << intf->full_direct_proxy_impl_name () << "::"
- << node->local_name () << " ";
-
- // STEP 4: generate the argument list with the appropriate mapping (same as
- // in the header file)
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
- be_visitor_operation_arglist oapi_visitor (&ctx);
+ *os << "," << be_nl
+ << "int " << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")";
- if (node->accept (&oapi_visitor) == -1)
+ if (this->gen_throw_spec (node) != 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
+ return -1;
}
- *os << "{" << be_idt << "\n";
+ *os << be_uidt_nl
+ << "{" << be_idt_nl;
+
+#if 0
+ << "TAO_Object_Adapter::Servant_Upcall servant_upcall ("
+ << be_idt << be_idt_nl
+ << "obj->_stubobj ()"
+ << "->servant_orb_var ()->orb_core ()"
+ << be_uidt_nl
+ << ");" << be_uidt_nl << be_nl;
+#endif /*if 0*/
+
+ if (!node->void_return_type ())
+ {
+ *os << "((TAO::Arg_Traits<";
- os->indent ();
+ this->gen_arg_template_param_name (node->return_type (),
+ os);
- if (!this->void_return_type (bt))
- {
- *os << "return ";
+ *os << ">::ret_val *) args[0])->arg () =" << be_idt_nl;
}
- *os << "ACE_reinterpret_cast ("
- << be_idt << be_idt_nl //idt = 3
- << intf->full_skel_name () << "_ptr,"
- << be_nl
- <<"_collocated_tao_target_->_servant ()->_downcast ("
- << "\"" << intf->repoID () << "\"" << ")"
- << be_uidt_nl // idt = 2
- << ")";
+ *os << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
+ << intf->full_skel_name () << "_ptr," << be_nl
+ << "servant->_downcast (" << be_idt << be_idt_nl
+ << "\"" << intf->repoID () << "\"" << be_uidt_nl
+ << ")" << be_uidt << be_uidt_nl
+ << ")" << be_uidt;
+
+ be_visitor_context ctx;
if (this->gen_invoke (ctx, node) == -1)
{
return -1;
}
+ if (!node->void_return_type ())
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_uidt << be_uidt_nl;
+
+ if (!be_global->exception_support ())
+ {
+ *os << "ACE_CHECK;";
+ }
*os << be_uidt_nl
- << "}" << be_nl << be_nl;
+ << "}";
return 0;
}
@@ -114,31 +134,63 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation (
int
be_visitor_operation_direct_proxy_impl_ss::gen_invoke (
- be_visitor_context &ctx,
+ be_visitor_context & /*ctx*/,
be_operation *node
)
{
TAO_OutStream *os = this->ctx_->stream ();
*os << "->" << node->local_name () << " ("
- << be_idt << be_idt << be_idt_nl ;
+ << be_idt << be_idt << be_idt;
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
- be_visitor_operation_argument visitor (&ctx);
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
- if (node->accept (&visitor) == -1)
+ if (si.is_done ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_direct_collocated_ss::"
- "gen_invoke - "
- "codegen for making upcall failed\n"),
- -1);
+ *os << be_nl
+ << "ACE_ENV_SINGLE_ARG_PARAMETER" << be_uidt_nl
+ << ");";
+
+ return 0;
}
- *os << be_uidt_nl
- << ");" << be_uidt << be_uidt << be_uidt_nl;
+ AST_Argument *arg = 0;
+ int index = 1;
+
+ for (; !si.is_done (); si.next (), ++index)
+ {
+ arg = AST_Argument::narrow_from_decl (si.item ());
+
+ *os << (index == 1 ? "" : ",") << be_nl
+ << "((TAO::Arg_Traits<";
+
+ this->gen_arg_template_param_name (arg->field_type (),
+ os);
+
+ *os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val *) args[" << index << "])->arg ()";
+ }
+
+ // End the upcall
+ *os << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");";
return 0;
}
-
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
index 0a8a34ad455..44049b7f684 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/exceptlist_cs.cpp
@@ -19,8 +19,8 @@
//
// ============================================================================
-ACE_RCSID (be_visitor_operation,
- exceptlist_cs,
+ACE_RCSID (be_visitor_operation,
+ exceptlist_cs,
"$Id$")
// ****************************************************************************
@@ -46,13 +46,13 @@ be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node)
// Don't do anything if the exception list is empty.
if (node->exceptions ())
{
- os->indent ();
-
- *os << "static TAO_Exception_Data " << "_tao_" << node->flat_name ()
- << "_exceptiondata [] = " << be_nl;
+ *os << be_nl << be_nl
+ << "static TAO::Exception_Data" << be_nl
+ << "_tao_" << node->flat_name ()
+ << "_exceptiondata [] = " << be_idt_nl;
*os << "{" << be_idt_nl;
- AST_Decl *d = 0;
+ be_exception *ex = 0;
// Initialize an iterator to iterate thru the exception list.
// Continue until each element is visited.
@@ -60,23 +60,23 @@ be_visitor_operation_exceptlist_cs::visit_operation (be_operation *node)
for (UTL_ExceptlistActiveIterator ei (node->exceptions ());
!ei.is_done ();)
{
- d = ei.item ();
+ ex = be_exception::narrow_from_decl (ei.item ());
*os << "{" << be_idt_nl
- << "\"" << d->repoID () << "\"," << be_nl;
- // Allocator method.
- *os << d->name () << "::_alloc" << be_uidt_nl
+ << "\"" << ex->repoID () << "\"," << be_nl
+ << ex->name () << "::_alloc," << be_nl
+ << ex->tc_name () << be_uidt_nl
<< "}";
ei.next ();
if (!ei.is_done ())
{
- *os << "," << be_nl;
+ *os << "," << be_nl << be_nl;
}
}
- *os << be_uidt_nl << "};\n\n";
+ *os << be_uidt_nl << "};" << be_uidt;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
index 2af9183d4b0..b68edb7616c 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_arglist.cpp
@@ -59,26 +59,21 @@ be_visitor_operation_interceptors_arglist::visit_operation (
{
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
break;
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS:
{
*os << be_nl << "ACE_ENV_ARG_PARAMETER";
break;
}
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
{
// Last argument - is always CORBA::Environment.
*os << be_nl << "ACE_ENV_ARG_DECL_NOT_USED";
break;
}
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
{
// @@ Do it for all cases i.e arg count > = 0
@@ -124,10 +119,6 @@ be_visitor_operation_interceptors_arglist::pre_process (be_decl *bd)
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
@@ -139,7 +130,6 @@ be_visitor_operation_interceptors_arglist::pre_process (be_decl *bd)
*os << ",";
break;
}
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH:
break;
@@ -210,8 +200,6 @@ be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node)
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
{
@@ -219,26 +207,6 @@ be_visitor_operation_interceptors_arglist::visit_argument (be_argument *node)
status = node->accept (&visitor);
break;
}
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
- {
- be_visitor_args_request_info_ch visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
- {
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS);
- be_visitor_args_request_info_cs visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
- {
- ctx.state (TAO_CodeGen::TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS);
- be_visitor_args_request_info_cs visitor (&ctx);
- status = node->accept (&visitor);
- break;
- }
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
{
be_visitor_args_paramlist visitor (&ctx);
@@ -309,13 +277,8 @@ be_visitor_operation_interceptors_arglist::post_process (be_decl *bd)
switch (this->ctx_->state ())
{
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_PARAMLIST:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CH:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_CS:
- case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SH:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS:
case TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_ARGLIST_SS:
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
index 47364de4493..591da0bf7dd 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_exceptlist.cpp
@@ -114,8 +114,8 @@ be_visitor_operation_interceptors_exceptlist::gen_exceptlist (
<< "{" << be_idt_nl
<< "CORBA::TypeCode_ptr tcp = _tao_" << node->flat_name ()
<< "_exceptiondata[i];" << be_nl
- << "TAO_Pseudo_Object_Manager<CORBA::TypeCode, "
- << "CORBA::TypeCode_var> tcp_object (&tcp, 1);" << be_nl
+ << "TAO_Pseudo_Object_Manager<CORBA::TypeCode> tcp_object (&tcp, 1);"
+ << be_nl
<< "(*exception_list)[i] = tcp_object;" << be_uidt_nl
<< "}\n" << be_uidt;
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index 995840b607f..d8ee84959d2 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -27,14 +27,12 @@ ACE_RCSID (be_visitor_operation,
// ************************************************************
be_visitor_operation::be_visitor_operation (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
- operation_name_ (0)
+ : be_visitor_scope (ctx)
{
}
be_visitor_operation::~be_visitor_operation (void)
{
- delete [] operation_name_;
}
// Is the operation return type void?
@@ -220,7 +218,6 @@ be_visitor_operation::gen_environment_decl (int argument_emitted,
TAO_CodeGen::CG_STATE cgs = this->ctx_->state ();
if (node->argument_count () > 0
- || cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH
|| cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH
|| cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS)
{
@@ -381,64 +378,23 @@ be_visitor_operation::gen_stub_operation_body (
be_type *return_type
)
{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor_context ctx;
- const char *target = "_collocated_tao_target_";
+ be_interface *intf = this->ctx_->attribute ()
+ ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ())
+ : be_interface::narrow_from_scope (node->defined_in ());
- if (node->defined_in ()->is_abstract ())
- {
- target = "this";
- }
-
- *os << be_nl << "{" << be_idt_nl;
-
- const char *env = this->gen_environment_var ();
-
- if (ACE_OS::strcmp ("", env) != 0)
- {
- *os << env << be_nl;
- }
-
- // Generate the actual code for the stub. However, if any of the argument
- // types is "native", we flag a MARSHAL exception.
- // last argument - is always ACE_ENV_ARG_PARAMETER
- if (!node->has_native ())
- {
- // native type does not exist.
-
- // Generate any "pre" stub information such as tables or declarations
- // This is a template method and the actual work will be done by the
- // derived class
- if (this->gen_pre_stub_info (node) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "gen_pre_stub_info failed\n"
- ),
- -1
- );
- }
- }
-
- // Declare return type.
- ctx = *this->ctx_;
- be_visitor_operation_rettype_vardecl_cs rd_visitor (&ctx);
-
- if (return_type->accept (&rd_visitor) == -1)
+ if (!intf)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
"visit_operation - "
- "codegen for return var decl failed\n"),
+ "bad interface scope\n"),
-1);
}
- if (node->void_return_type () == 0)
- {
- *os << be_nl;
- }
+ TAO_OutStream *os = this->ctx_->stream ();
+ be_visitor_context ctx;
+
+ *os << be_nl << "{" << be_idt_nl;
if (node->has_native ()) // native exists => no stub
{
@@ -448,838 +404,188 @@ be_visitor_operation::gen_stub_operation_body (
{
ACE_ERROR_RETURN ((
LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for return var failed\n"
- ),
- -1
- );
- }
- }
- else
- {
- // Generate code that retrieves the underlying stub object and then
- // invokes do_static_call on it.
- *os << "TAO_Stub *istub = " << target << "->_stubobj ();"
- << be_nl << be_nl
- << "if (istub == 0)" << be_idt_nl
- << "{" << be_idt_nl;
-
- // If the stub object was bad, then we raise a system exception.
- if (this->gen_raise_exception (return_type, "CORBA::INTERNAL", "") == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
+ "(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
- "codegen for checking exception failed\n"
+ "codegen for native exception failed\n"
),
-1
);
}
- *os << be_uidt_nl << "}" << be_uidt_nl;
-
- // Do any pre marshal and invoke processing with return type. This
- // includes allocating memory, initialization.
- ctx = *this->ctx_;
- be_visitor_operation_rettype_pre_invoke_cs rpi_visitor (&ctx);
-
- if (return_type->accept (&rpi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for retval pre invoke failed\n"
- ),
- -1
- );
- }
-
- // Do any pre marshal and invoke stuff with arguments.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS);
- be_visitor_operation_argument api_visitor (&ctx);
-
- if (node->accept (&api_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for argument pre invoke failed\n"
- ),
- -1
- );
- }
-
- // Generate the code for marshaling in the parameters and transmitting
- // them.
- if (this->gen_marshal_and_invoke (node, return_type) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for marshal and invoke failed\n"
- ),
- -1
- );
-
- }
-
- if (!this->void_return_type (return_type))
- {
- AST_Decl::NodeType nt = return_type->node_type ();
-
- if (nt == AST_Decl::NT_typedef)
- {
- AST_Typedef *td = AST_Typedef::narrow_from_decl (return_type);
- AST_Type *t = td->primitive_base_type ();
- nt = t->node_type ();
- }
-
- *os << be_nl << be_nl;
-
- // Now generate the normal successful return statement.
- if (return_type->size_type () == AST_Type::VARIABLE
- || nt == AST_Decl::NT_array)
- {
- *os << "return _tao_retval._retn ();";
- }
- else
- {
- *os << "return _tao_retval;";
- }
- }
- } // end of if (!native)
-
- *os << be_uidt_nl << "}";
+ *os << be_uidt_nl << "}";
- return 0;
-}
-
-int
-be_visitor_operation::gen_pre_stub_info (
- be_operation *node
- )
-{
- be_visitor_context ctx = *this->ctx_;
- be_visitor_operation_exceptlist_cs visitor (&ctx);
-
- if (node->accept (&visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) "
- "be_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "Exceptionlist generation error\n"),
- -1);
- }
-
- return 0;
-}
-
-int
-be_visitor_operation::gen_marshal_and_invoke (
- be_operation *node,
- be_type *bt
- )
-{
- TAO_OutStream *os = this->ctx_->stream ();
- be_visitor_context ctx;
- const char *target = "_collocated_tao_target_";
-
- if (node->defined_in ()->is_abstract ())
- {
- target = "this";
+ return 0;
}
-
- os->indent ();
-
- *os << be_nl;
-
- // Create the GIOP_Invocation and grab the outgoing CDR stream.
- switch (node->flags ())
+ if (!node->is_abstract ())
{
- case AST_Operation::OP_oneway:
- *os << "TAO_GIOP_Oneway_Invocation _tao_call ";
- break;
- default:
- *os << "TAO_GIOP_Twoway_Invocation _tao_call ";
+ // If the object is lazily evaluated the proxy brker might well
+ // be null. Initialize it now.
+ *os << "if (!this->is_evaluated ())" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)"
+ << be_idt_nl
+ << "{" << be_idt_nl
+ << intf->flat_name () << "_setup_collocation ("
+ << be_idt << be_idt_nl
+ << "this->ACE_NESTED_CLASS (CORBA, Object)::_is_collocated ()"
+ << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl;
}
- // Do we have "_set_" or "_get_" prepended?
- size_t ext = this->ctx_->attribute () ? 5 : 0;
-
- // Do we have any arguments in the operation that needs marshalling
- int flag =
- node->count_arguments_with_direction (AST_Argument::dir_IN
- | AST_Argument::dir_INOUT);
-
- *os << "(" << be_idt << be_idt_nl
- << "istub," << be_nl
- << this->compute_operation_name (node)
- << "," << be_nl
- << ACE_OS::strlen (node->original_local_name ()->get_string ()) + ext
- << "," << be_nl
- << flag
- << "," <<be_nl
- << "istub->orb_core ()" << be_uidt_nl
- << ");" << be_uidt_nl;
-
- *os << be_nl
- << "int _invoke_status;" << be_nl;
-
- // Generate code to obtain the client request interceptors from the
- // ORB.
- *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
- *os << "TAO_ClientRequestInterceptor_Adapter _tao_vfr ("
- << be_idt << be_idt_nl
- << "istub->orb_core ()->client_request_interceptors ()," << be_nl
- << "&_tao_call," << be_nl
- << "_invoke_status"
- << be_uidt_nl
- << ");" << be_uidt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- // The connection retry loop.
- *os << be_nl
- << "for (;;)" << be_idt_nl
- << "{" << be_idt_nl
- << "_invoke_status = TAO_INVOKE_EXCEPTION;" << be_nl;
-
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- *os << "TAO_ClientRequestInfo_" << node->flat_name ();
+ const char *env = this->gen_environment_var ();
- // We need the interface node in which this operation was defined. However,
- // if this operation node was an attribute node in disguise, we get this
- // information from the context and add a "_get"/"_set" to the flat
- // name to get around the problem of overloaded methods which are
- // generated for attributes.
- if (this->ctx_->attribute ())
+ if (ACE_OS::strcmp ("", env) != 0)
{
- bt = be_type::narrow_from_decl (node->return_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interceptors_ch::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
- }
-
- // Grab the right visitor to generate the return type if its not
- // void it means it is not the accessor.
- if (!this->void_return_type (bt))
- {
- *os << "_get";
- }
- else
- {
- *os << "_set";
- }
+ *os << env << be_nl;
}
- *os << " _tao_ri (" << be_idt << be_idt_nl
- << "&_tao_call," << be_nl
- << target;
+ // Declare return type helper class.
- // Generate the formal argument fields which are passed
- // to the RequestInfo object.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS);
- be_visitor_operation_interceptors_arglist iia_visitor (&ctx);
+ *os << "TAO::Arg_Traits<";
- if (node->accept (&iia_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for arglist failed\n"),
- -1);
- }
+ this->gen_arg_template_param_name (return_type,
+ os);
- *os << be_uidt_nl << ");" << be_uidt_nl;
+ *os << ">::ret_val _tao_retval;";
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
+ // Declare the argument helper classes.
+ this->gen_stub_body_arglist (node, os);
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
+ *os << be_nl << be_nl
+ << "TAO::Argument *_tao_signature [] =" << be_idt_nl
+ << "{" << be_idt_nl
+ << "&_tao_retval";
- // Prepare the request header.
- *os << be_nl << "CORBA::Short _tao_response_flag = ";
+ AST_Argument *arg = 0;
- switch (node->flags ())
+ for (UTL_ScopeActiveIterator arg_list_iter (node, UTL_Scope::IK_decls);
+ ! arg_list_iter.is_done ();
+ arg_list_iter.next ())
{
- case AST_Operation::OP_oneway:
- *os << "_tao_call.sync_scope ();" << be_nl
- << "TAO_INTERCEPTOR (_tao_ri.response_expected (0));" << be_nl;
- break;
- default:
- *os << "TAO_TWOWAY_RESPONSE_FLAG;" << be_nl
- << "TAO_INTERCEPTOR (_tao_ri.response_expected (1));" << be_nl;
- }
+ arg = AST_Argument::narrow_from_decl (arg_list_iter.item ());
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- *os << be_nl << "ACE_TRY" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Invoke send_request() interception point.
- // This is done before the Invocation::start() call so that a
- // connection can be avoided if send_request() throws an exception,
- // i.e. this is an optimization.
- *os << "_tao_vfr.send_request (" << be_idt << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- // _invoke_status is potentially set (via a reference) in
- // TAO_ClientRequestInterceptor_Adapter::send_request() so check its
- // value. If a location forward or transport retry occured, then we
- // need to restart the loop so that the ClientRequestInfo object is
- // setup for the re-issued request.
- //
- // Note that since we're invoking the send_request() interception
- // point before the Invocation::start() call, i.e. before a
- // connection is ever made, we're actually able to forward requests
- // for oneways via the PortableInterceptor::ForwardRequest exception
- // too!
- *os << be_nl
- << "if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
- << "{" << be_idt_nl
- << "_tao_call.restart_flag (1);" << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
-
- *os << be_nl
- << "_tao_call.start (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_nl;
-
- // Check if there is an exception.
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
+ *os << "," << be_nl
+ << "&_tao_" << arg->local_name ();
}
- *os << be_nl
- << "_tao_call.prepare_header (" << be_idt << be_idt_nl
- << "ACE_static_cast (CORBA::Octet, _tao_response_flag)" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl;
+ *os << be_uidt_nl
+ << "};" << be_uidt;
- // Check if there is an exception.
- if (this->gen_check_interceptor_exception (bt) == -1)
+ if (this->gen_pre_stub_info (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for exceptiondata failed\n"),
-1);
}
- // Now make sure that we have some in and inout parameters. Otherwise, there
- // is nothing to be marshaled in.
- if (this->has_param_type (node, AST_Argument::dir_IN) ||
- this->has_param_type (node, AST_Argument::dir_INOUT))
- {
- *os << be_nl
- << "TAO_OutputCDR &_tao_out = _tao_call.out_stream ();"
- << be_nl << be_nl
- << "if (!(" << be_idt << be_idt_nl;
-
- // Marshal each in and inout argument.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
- be_visitor_operation_argument_invoke oai_visitor (&ctx);
- if (node->accept (&oai_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var in "
- "do_static_call failed\n"),
- -1);
- }
+ long tmp_len =
+ ACE_OS::strlen (node->local_name ()->get_string ());
- *os << be_nl
- << "))" << be_uidt_nl
- << "{" << be_idt_nl;
-
- // If marshaling fails, raise exception (codesetting has various minors)
- *os << "TAO_OutputCDR::throw_stub_exception (errno "
- << "ACE_ENV_ARG_PARAMETER); "
- << be_nl;
-
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
+ *os << be_nl << be_nl
+ << "TAO::" << (node->is_abstract () ? "AbstractBase_" : "" )
+ << "Invocation_Adapter _tao_call (" << be_idt << be_idt_nl
+ << "this," << be_nl
+ << "_tao_signature," << be_nl
+ << node->argument_count () + 1 << "," << be_nl
+ << "\"";
- *os << be_uidt_nl;
- *os << "}" << be_uidt_nl << be_nl;
- }
- else
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
{
- *os << be_nl << be_nl;
- }
-
- *os << "_invoke_status =" << be_idt_nl;
+ // If we are a attribute node, add th elength of the operation
+ // name.
+ tmp_len += 5;
- if (node->flags () == AST_Operation::OP_oneway)
- {
- // Oneway operation.
- *os << "_tao_call.invoke (ACE_ENV_SINGLE_ARG_PARAMETER);";
- }
- else
- {
- if (node->exceptions ())
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
{
- *os << "_tao_call.invoke (_tao_" << node->flat_name ()
- << "_exceptiondata, "
- << node->exceptions ()->length ()
- << " ACE_ENV_ARG_PARAMETER);";
+ *os << "_set_";
}
else
{
- *os << "_tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);";
+ *os << "_get_";
}
}
- *os << be_uidt_nl;
+ *os << node->local_name () << "\"," << be_nl
+ << tmp_len << "," << be_nl
+ << "this->the" << intf->base_proxy_broker_name () << "_";
- // Check if there is an exception.
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << be_nl
- << "if (_invoke_status == TAO_INVOKE_EXCEPTION)" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Unlisted user exception received by client.
- int status = this->gen_raise_interceptor_exception (
- bt,
- "CORBA::UNKNOWN",
- "CORBA::OMGVMCID | 1, CORBA::COMPLETED_YES"
- );
-
- if (status == -1)
+ if (node->flags () == AST_Operation::OP_oneway)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and invoke - "
- "codegen for return var failed\n"),
- -1);
+ *os << "," << be_nl
+ << "TAO::TAO_ONEWAY_INVOCATION";
}
- *os << be_uidt_nl << "}" << be_uidt_nl;
-
- // Note that we no longer turn this code generation off if it's a
- // one way operation since the sync scope policy may actually allow
- // things such as LOCATION_FORWARD replies to be propagated back to
- // the client (e.g. SYNC_WITH_TARGET).
-
- *os << "else if (_invoke_status == TAO_INVOKE_RESTART)" << be_idt_nl
- << "{" << be_idt_nl
- << "_tao_call.restart_flag (1);" << be_nl
- << "TAO_INTERCEPTOR (" << be_idt << be_idt_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_other (" << be_idt << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_uidt_nl
- << ")" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl
- << "else" << be_idt_nl
- << "{" << be_idt;
-
- // If we reach here, we are ready to proceed.
- // the code below this is for twoway operations only.
-
- if (!this->void_return_type (bt)
- || this->has_param_type (node, AST_Argument::dir_INOUT)
- || this->has_param_type (node, AST_Argument::dir_OUT))
-
- {
- // Do any post_invoke stuff that might be necessary.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- be_visitor_operation_argument oapi_visitor (&ctx);
-
- if (node->accept (&oapi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for args in post do_static_call\n"),
- -1);
- }
-
- // Generate any temporary variables to demarshal the arguments.
- be_visitor_args_decl vis1 (&ctx);
-
- if (node->accept (&vis1) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "codegen for pre args failed\n"),
- -1);
- }
-
- if (!this->void_return_type (bt))
- {
- // Generate any temporary variables to demarshal the return value.
- be_visitor_operation_rettype_post_invoke_cs vis2 (&ctx);
-
- if (bt->accept (&vis2) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_pre_stub_info - "
- "codegen rettype [post invoke] failed\n"),
- -1);
- }
- }
-
- // Check if there was a user exception, else demarshal the
- // return val (if any) and parameters (if any) that came with
- // the response message.
- *os << be_nl << be_nl
- << "TAO_InputCDR &_tao_in = _tao_call.inp_stream ();"
- << be_nl ;
-
- // Added so codeset translators may be used to decode reply
- *os << "_tao_call.transport()->assign_translators (&_tao_in,0);"
- << be_nl << be_nl;
-
- // reply
- *os << "if (!(" << be_idt << be_idt;
-
- if (!this->void_return_type (bt))
- {
- // Demarshal the return value.
- ctx = *this->ctx_;
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- be_visitor_operation_rettype_marshal_ss ori_visitor (&ctx);
-
- if (node->accept (&ori_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var failed\n"),
- -1);
- }
- }
-
- if (this->has_param_type (node, AST_Argument::dir_INOUT)
- || this->has_param_type (node, AST_Argument::dir_OUT))
- {
- if (!this->void_return_type (bt))
- {
- *os << " &&" << be_nl;
- }
-
- // Demarshal each out and inout argument.
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);
- ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- be_visitor_operation_argument_invoke oai_visitor (&ctx);
-
- if (node->accept (&oai_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for return var failed\n"),
- -1);
- }
- }
-
- *os << be_nl
- << "))" << be_uidt_nl
- << "{" << be_idt_nl;
-
- // If marshaling fails, raise exception (codesetting has various minors)
- *os << "TAO_InputCDR::throw_stub_exception (errno "
- << "ACE_ENV_ARG_PARAMETER); "
- << be_nl;
- if (this->gen_check_interceptor_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
-
- *os << be_nl;
-
- if (status == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and invoke - "
- "codegen for return var failed\n"),
- -1);
- }
-
- *os << be_uidt_nl << "}" << be_uidt_nl;
- }
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl;
-
- // Populate the ClientRequestInfo object with result, if any, of the
- // invocation.
- if (!this->void_return_type (bt))
- {
- // Here's what we are going to do to have a uniform way of getting the
- // return value updated for the Request Info:
- // declare a operation_retval type object and assign the
- // _tao_retval._retn () to it.
- // We pass this to the result updation method (note: it hasnt
- // got destroyed)
- // We then put it back into the original _tao_retval
- // object.
- // And finally the _retn () is returned from the operation w.o
- // causing any problems.
-
- // Generate the return type mapping (same as in the header file)
- ctx = *this->ctx_;
- be_visitor_operation_rettype oro_visitor (&ctx);
-
- if (bt->accept (&oro_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_remote_proxy_impl_cs::"
- "visit_operation - "
- "codegen for return type failed\n"
- ),
- -1
- );
- }
+ *os << be_uidt_nl
+ << ");" << be_uidt;
- if (bt->size_type () == AST_Type::VARIABLE
- || bt->node_type () == AST_Decl::NT_array)
- {
- *os << " _tao_retval_info =" << be_idt_nl
- << "_tao_retval._retn ();" << be_uidt_nl
- << "_tao_ri.result (_tao_retval_info);" << be_nl
- << "_tao_retval = _tao_retval_info;" << be_nl;
- }
- else
- {
- *os << " _tao_retval_info =" << be_idt_nl
- << "_tao_retval;" << be_uidt_nl
- << "_tao_ri.result (_tao_retval_info);" << be_nl;
- }
- }
+ *os << be_nl << be_nl;
- // Oneway operations don't have receive_reply() interception since
- // once the request goes over the wire, its the end of the story!
- // However, we still need to call an ending interception point
- // (receive_other()) to satisfy the General Flow Rules.
- if (node->flags () != AST_Operation::OP_oneway)
+ // Since oneways cannot raise user exceptions, we have that
+ // case covered as well.
+ if (node->exceptions ())
{
- // If we get this far (in the generated code) then we
- // successfully completed the request, i.e. no connection retry
- // will occur, nor will a LOCATION_FORWARD.
- // Invoke receive_reply() interception point.
- *os << be_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_reply (" << be_idt << be_idt_nl
- << "&_tao_ri" << be_nl
+ *os << "_tao_call.invoke (" << be_idt << be_idt_nl
+ << "_tao_" << node->flat_name ()
+ << "_exceptiondata," << be_nl
+ << node->exceptions ()->length () << be_nl
<< "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl;
+ << ");" << be_uidt;
}
- else if (node->flags () == AST_Operation::OP_oneway)
+ else
{
- // Invoke receive_other() interception point.
- *os << be_nl
- << "_tao_ri.reply_status (_invoke_status);" << be_nl
- << "_tao_vfr.receive_other (" << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_nl;
+ *os << "_tao_call.invoke (0, 0 ACE_ENV_ARG_PARAMETER);";
}
- *os << "ACE_TRY_CHECK;"
- << be_uidt_nl;
-
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- *os << "}" << be_uidt << be_uidt_nl; // End inner "else" block.
-
- // Note that we do NOT catch the PortableInterceptor::ForwardRequest
- // exception here. It is caught in the
- // TAO_ClientRequestInterceptor_Adapter class. This is necessary to
- // prevent applications from being able to throw the exception in an
- // effort to get an easy (but illegal) way to forward a request.
-
- *os << "\n#if TAO_HAS_INTERCEPTORS == 1" << be_nl
- << "}" << be_uidt << be_uidt_nl // End outer "else" block.
- << "}" << be_uidt_nl
- << "ACE_CATCHANY" << be_idt_nl
- << "{" << be_idt_nl;
-
- // Update the exception field of the ClientRequestInfo.
- *os << "_tao_ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl;
-
- *os << "_tao_vfr.receive_exception (" << be_idt << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- // The receive_exception() interception point may have thrown a
- // PortableInterceptor::ForwardRequest exception. In that event,
- // the connection retry loop must be restarted so do not rethrow the
- // caught exception.
- *os << be_nl
- << "const PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
- << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- *os << be_nl
- << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl
- << " || _tao_status == PortableInterceptor::USER_EXCEPTION)"
- << be_idt_nl
- << "{" << be_idt_nl;
+ *os << be_nl;
- if (be_global->use_raw_throw ())
+ if (this->void_return_type (return_type))
{
- *os << "throw;";
+ *os << "ACE_CHECK;";
}
else
{
- *os << "ACE_RE_THROW;";
+ *os << "ACE_CHECK_RETURN (_tao_retval.excp ());";
}
- *os << be_uidt_nl
- << "}" << be_uidt << be_uidt_nl;
-
- *os << "}" << be_uidt_nl;
-
- // Convert non-CORBA C++ exceptions to CORBA::UNKNOWN.
- *os << "\n# if defined (ACE_HAS_EXCEPTIONS) \\\n"
- << " && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)" << be_nl
- << "ACE_CATCHALL" << be_idt_nl
- << "{" << be_idt_nl
- << "CORBA::UNKNOWN ex;" << be_nl
- << be_nl
- << "_tao_ri.exception (&ex);"<< be_nl
- << "_tao_vfr.receive_exception (" << be_idt << be_idt_nl
- << "&_tao_ri" << be_nl
- << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
- << ");" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- // The receive_exception() interception point may have thrown a
- // PortableInterceptor::ForwardRequest exception. In that event,
- // the connection retry loop must be restarted so do not throw the
- // CORBA::UNKNOWN exception to convert the unhandled C++ exception.
- *os << be_nl
- << "const PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
- << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl
- << "ACE_TRY_CHECK;" << be_nl;
-
- *os << be_nl
- << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION)"
- << be_idt_nl;
-
- if (be_global->use_raw_throw ())
+ if (!this->void_return_type (return_type))
{
- *os << "throw ";
- }
- else
- {
- *os << "ACE_TRY_THROW ";
+ *os << be_nl << be_nl
+ << "return _tao_retval.retn ();";
}
- *os << "(ex);" << be_uidt << be_uidt_nl
- << "}" << be_uidt
- << "\n# endif /* ACE_HAS_EXCEPTIONS"
- << " && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */" << be_nl << be_nl;
+ *os << be_uidt_nl << "}";
- *os << "ACE_ENDTRY;" << be_nl;
+ return 0;
+}
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
- -1);
- }
+int
+be_visitor_operation::gen_pre_stub_info (
+ be_operation *node
+ )
+{
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_operation_exceptlist_cs visitor (&ctx);
- // The receive_exception() or receive_other() interception point may
- // have thrown a PortableInterceptor::ForwardRequest exception. In
- // that event, the connection retry loop must be restarted. Note
- // that the _invoke_status variable is not set by the interceptor
- // support code, so we must explicitly check the status in the
- // ClientRequestInfo object.
- *os << be_nl
- << "const PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl
- << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl;
-
- if (this->gen_check_exception (bt) == -1)
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for checking exception failed\n"),
+ "(%N:%l) "
+ "be_visitor_operation_cs::"
+ "gen_pre_stub_info - "
+ "Exceptionlist generation error\n"),
-1);
}
- *os << be_nl
- << "if (_tao_status != PortableInterceptor::LOCATION_FORWARD" << be_nl
- << " && _tao_status != PortableInterceptor::TRANSPORT_RETRY)"
- << be_idt_nl;
- // Continue to below break statement."
- *os << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl;
-
- *os << be_nl
- << "if (_invoke_status != TAO_INVOKE_RESTART)" << be_idt_nl
- << "break;" << be_uidt << be_uidt << be_uidt_nl
- << "}" << be_uidt << be_uidt;
-
return 0;
}
@@ -1333,47 +639,96 @@ be_visitor_operation::gen_raise_interceptor_exception (
return 0;
}
-const char*
-be_visitor_operation::compute_operation_name (
- be_operation *node
- )
+void
+be_visitor_operation::gen_stub_body_arglist (be_operation *node,
+ TAO_OutStream *os,
+ idl_bool ami)
{
- if (this->operation_name_ == 0)
+ AST_Argument *arg = 0;
+
+ for (UTL_ScopeActiveIterator arg_decl_iter (node, UTL_Scope::IK_decls);
+ ! arg_decl_iter.is_done ();
+ arg_decl_iter.next ())
{
- // Length for two double quotes and the null termination char.
- size_t len = 3;
+ arg = AST_Argument::narrow_from_decl (arg_decl_iter.item ());
- if (this->ctx_->attribute ())
+ if (ami && arg->direction () == AST_Argument::dir_OUT)
{
- // "Added length for "_set_" or "_get_".
- len += 5;
+ continue;
}
- len += ACE_OS::strlen (node->original_local_name ()->get_string ());
+ *os << be_nl
+ << "TAO::Arg_Traits<";
- ACE_NEW_RETURN (this->operation_name_,
- char [len],
- 0);
+ this->gen_arg_template_param_name (arg->field_type (),
+ os);
- ACE_OS::strcpy (this->operation_name_, "\"");
+ *os << ">::";
- if (this->ctx_->attribute ())
+ switch (arg->direction ())
{
- // Now check if we are a "get" or "set" operation.
- if (node->nmembers () == 1)
- {
- ACE_OS::strcat (this->operation_name_, "_set_");
- }
- else
- {
- ACE_OS::strcat (this->operation_name_, "_get_");
- }
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val _tao_" << arg->local_name () << " ("
+ << arg->local_name () << ");";
+ }
+}
+
+void
+be_visitor_operation::gen_arg_template_param_name (AST_Type *bt,
+ TAO_OutStream *os)
+{
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ // If we're here, we must have a bounded string, if unbounded, it
+ // would be a predefined type.
+ if (nt == AST_Decl::NT_string)
+ {
+ AST_String *s = AST_String::narrow_from_decl (bt);
+ unsigned long bound = s->max_size ()->ev ()->u.ulval;
+ AST_Typedef *alias = this->ctx_->alias ();
+
+ if (bound > 0)
+ {
+ *os << "TAO::" << alias->local_name () << "_" << bound;
+ return;
}
+ }
+
+ // For the four predefined types below, we use the helper struct
+ // type, in order to disambiguate the template parameter.
+ if (nt == AST_Decl::NT_pre_defined)
+ {
+ AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (bt);
- ACE_OS::strcat (this->operation_name_,
- node->original_local_name ()->get_string ());
- ACE_OS::strcat (this->operation_name_, "\"");
+ switch (pdt->pt ())
+ {
+ case AST_PredefinedType::PT_boolean:
+ *os << "ACE_InputCDR::to_boolean";
+ return;
+ case AST_PredefinedType::PT_octet:
+ *os << "ACE_InputCDR::to_octet";
+ return;
+ case AST_PredefinedType::PT_char:
+ *os << "ACE_InputCDR::to_char";
+ return;
+ case AST_PredefinedType::PT_wchar:
+ *os << "ACE_InputCDR::to_wchar";
+ return;
+ default:
+ break;
+ }
}
- return this->operation_name_;
+ *os << bt->name ();
}
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 9b080c5c111..f9304464aef 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -28,13 +28,11 @@ ACE_RCSID (be_visitor_operation,
be_visitor_operation_cs::be_visitor_operation_cs (be_visitor_context *ctx)
: be_visitor_operation (ctx)
-// operation_name_ (0)
{
}
be_visitor_operation_cs::~be_visitor_operation_cs (void)
{
-// delete[] operation_name_;
}
// Processing to be done after every element in the scope is processed.
@@ -62,7 +60,7 @@ be_visitor_operation_cs::visit_operation (be_operation *node)
if (!intf)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
+ "(%N:%l) be_visitor_operation_cs::"
"visit_operation - "
"bad interface scope\n"),
-1);
@@ -121,157 +119,8 @@ be_visitor_operation_cs::visit_operation (be_operation *node)
-1);
}
- *os << be_nl;
-
- // @@@ (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 ())
- {
- return this->gen_stub_operation_body (node,
- bt);
- }
- else
- {
- *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)
- {
- be_typedef *btd = be_typedef::narrow_from_decl (bt);
- bt = btd->primitive_base_type ();
- }
-
- 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)
- {
- bpt = be_predefined_type::narrow_from_decl (bt);
- pdt = bpt->pt ();
-
- if (pdt == AST_PredefinedType::PT_longlong)
- {
- *os << "CORBA::LongLong _tao_check_retval = "
- << "ACE_CDR_LONGLONG_INITIALIZER;" << be_nl << be_nl;
- }
- else if (pdt == AST_PredefinedType::PT_longdouble)
- {
- *os << "CORBA::LongDouble _tao_check_retval = "
- << "ACE_CDR_LONG_DOUBLE_INITIALIZER;" << be_nl << be_nl;
- }
- }
-
- // If the object is lazily evaluated the proxy brker might well
- // be null. Initialize it now
- *os << "if (!this->is_evaluated ())" << be_idt_nl
- << "{" << be_idt_nl
- << "ACE_NESTED_CLASS (CORBA, Object)::tao_object_initialize (this);" << be_uidt_nl << be_nl
- << "}" << be_uidt_nl
- << "if (this->the" << intf->base_proxy_broker_name () << "_ == 0)"<< be_idt_nl
- << "{" << be_idt_nl
- << intf->flat_name () << "_setup_collocation (" << be_idt << be_idt_nl
- << "this->ACE_NESTED_CLASS (CORBA, Object)::_is_collocated ()"
- << be_uidt_nl
- << ");" << be_uidt << be_uidt_nl
- << "}" << be_uidt_nl << be_nl;
-
- // 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))
- {
- *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 (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 << "ACE_CHECK;" << be_nl << be_nl;
- }
-
- *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 ();
-
- 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);
-
- *os << "," << be_nl
- << decl->local_name ();
- }
-
- if (!be_global->exception_support ())
- {
- *os << be_nl << "ACE_ENV_ARG_PARAMETER";
- }
-
- *os << be_uidt_nl << ");" << be_uidt << be_uidt_nl << "}";
- }
-
- return 0;
+ return this->gen_stub_operation_body (node,
+ bt);
}
int
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
index a03d77e4b03..80c95f31c63 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp
@@ -27,14 +27,12 @@ ACE_RCSID (be_visitor_operation,
// ************************************************************
be_visitor_operation_ss::be_visitor_operation_ss (be_visitor_context *ctx)
- : be_visitor_operation (ctx),
- operation_name_ (0)
+ : be_visitor_operation (ctx)
{
}
be_visitor_operation_ss::~be_visitor_operation_ss (void)
{
- delete [] this->operation_name_;
}
// Processing to be done after every element in the scope is processed.
@@ -126,7 +124,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// Generate the actual code for the skeleton. However, if any of the
// argument types is "native", we do not generate any skeleton
// last argument - is always CORBA::Environment.
- *os << "{\n" << be_idt;
+ *os << "{" << be_idt_nl;
// Generate all the tables and other pre-skel info.
if (this->gen_pre_skel_info (node) == -1)
@@ -138,8 +136,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- os->indent ();
-
// Get the right object implementation.
*os << intf->full_skel_name () << " *_tao_impl =" << be_idt_nl
<< "ACE_static_cast (" << be_idt << be_idt_nl
@@ -198,13 +194,15 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
// Fish out the interceptors.
- *os << "\n\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
+ *os << be_nl
+ << "\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
// Cast the Servant_Upcall pointer.
*os << "TAO_Object_Adapter::Servant_Upcall *_tao_upcall =" << be_idt_nl
- << "ACE_static_cast (TAO_Object_Adapter::Servant_Upcall *, "
- << "_tao_servant_upcall);"
- << be_uidt_nl << be_nl;
+ << "ACE_static_cast (" << be_idt << be_idt_nl
+ << "TAO_Object_Adapter::Servant_Upcall *," << be_nl
+ << "_tao_servant_upcall" << be_uidt_nl
+ << ");" << be_uidt_nl << be_uidt_nl;
*os << "TAO_ServerRequestInterceptor_Adapter _tao_vfr ("
<< be_idt << be_idt_nl
@@ -290,7 +288,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// ServerRequestInterceptor::receive_request().
*os << be_nl
<< "if (!_tao_vfr.location_forwarded ())" << be_idt_nl
- << "{" << be_idt_nl;
+ << "{" << be_idt;
*os << "\n#endif /* TAO_HAS_INTERCEPTORS */\n";
@@ -308,8 +306,9 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
// Make the upcall.
- *os << be_nl
- << "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt_nl;
+ *os << be_idt_nl
+ << "_tao_impl->" << node->local_name () << " (" << be_idt << be_idt;
+
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS);
be_visitor_operation_argument oau_visitor (&ctx);
@@ -324,7 +323,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
}
// End the upcall.
- *os << be_uidt_nl << ");" << be_uidt_nl;
+ *os << be_uidt_nl << ");"
+ << be_uidt << be_uidt_nl;
if (!be_global->exception_support ())
{
@@ -336,16 +336,16 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
if (!bt)
{
- ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_interceptors_ch::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
}
// Invoke the send_reply() or send_other() interception point, and
// check for exception.
- *os << "\n\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl;
+ *os << "\n#if (TAO_HAS_INTERCEPTORS == 1)";
// Close scope for "if (!_tao_vfr.location_forwarded ()"
*os << be_uidt_nl
@@ -450,7 +450,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
// Convert non-CORBA C++ exceptions to CORBA::UNKNOWN.
*os << "\n# if defined (ACE_HAS_EXCEPTIONS) \\\n"
- << " && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)" << be_nl
+ << " && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)" << be_nl
<< "ACE_CATCHALL" << be_idt_nl
<< "{" << be_idt_nl
<< "CORBA::UNKNOWN ex;" << be_nl
@@ -487,11 +487,11 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
*os << "(ex);" << be_uidt << be_uidt_nl
<< "}" << be_uidt
<< "\n# endif /* ACE_HAS_EXCEPTIONS"
- << " && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */" << be_nl << be_nl;
+ << " && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */" << be_nl;
*os << "ACE_ENDTRY;" << be_nl;
- *os << "ACE_CHECK;\n"
- << "#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl;
+ *os << "ACE_CHECK;"
+ << "\n#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl;
// Check if we are oneway in which case, we are done.
if (node->flags () == AST_Operation::OP_oneway)
@@ -515,7 +515,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node)
-1);
}
- *os << be_nl << be_nl << "// In case _tao_servant_upcall is not used in this function"
+ *os << be_nl << be_nl
+ << "// In case _tao_servant_upcall is not used in this function"
<< be_nl
<< "ACE_UNUSED_ARG (_tao_servant_upcall);" << be_uidt_nl
<< "}";;
@@ -609,15 +610,15 @@ be_visitor_operation_ss::gen_demarshal_params (be_operation *node,
-1);
}
- *os << be_nl << "))" << be_nl;
+ *os << be_nl << "))" << be_uidt_nl;
// If marshaling fails, raise exception (codesetting has minor codes)
- *os << "{" << be_idt_nl << be_nl
- << "TAO_InputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER);" << be_nl
+ *os << "{" << be_idt_nl
+ << "TAO_InputCDR::throw_skel_exception "
+ << "(errno ACE_ENV_ARG_PARAMETER);"
+ << be_nl
<< "ACE_CHECK;" << be_uidt_nl
- << "}" << be_nl;
-
- *os << be_uidt << be_uidt;
+ << "}" << be_uidt;
};
return 0;
@@ -680,6 +681,7 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
*os << be_nl << be_nl
<< "TAO_OutputCDR &_tao_out = _tao_server_request.outgoing ();"
<< be_nl << be_nl;
+
*os << "if (!(" << be_idt << be_idt;
if (!this->void_return_type (bt))
@@ -725,55 +727,15 @@ be_visitor_operation_ss::gen_marshal_params (be_operation *node,
}
}
- *os << be_nl << "))" << be_nl;
+ *os << be_nl << "))" << be_uidt_nl;
// If marshaling fails, raise exception (codesetting has minor codes)
- *os << "{" << be_idt_nl << be_nl
- << "TAO_OutputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER);" << be_nl
+ *os << "{" << be_idt_nl
+ << "TAO_OutputCDR::throw_skel_exception (errno ACE_ENV_ARG_PARAMETER);"
+ << be_nl
<< "ACE_CHECK;" << be_uidt_nl
- << "}" << be_nl;
-
- *os << be_uidt << be_uidt;
+ << "}" << be_uidt;
return 0;
}
-const char *
-be_visitor_operation_ss::compute_operation_name (be_operation *node)
-{
- if (this->operation_name_ == 0)
- {
- size_t len = 3; // The null termination char.
-
- if (this->ctx_->attribute ())
- {
- len += 5; // "Added length for "_set_" or "_get_".
- }
-
- len += ACE_OS::strlen (node->local_name ()->get_string ());
-
- ACE_NEW_RETURN (this->operation_name_,
- char [len],
- 0);
-
- ACE_OS::strcpy (this->operation_name_, "\"");
-
- if (this->ctx_->attribute ())
- {
- if (node->nmembers () == 1)
- {
- ACE_OS::strcat (this->operation_name_, "_set_");
- }
- else
- {
- ACE_OS::strcat (this->operation_name_, "_get_");
- }
- }
-
- ACE_OS::strcat (this->operation_name_,
- node->local_name ()->get_string ());
- ACE_OS::strcat (this->operation_name_, "\"");
- }
-
- return this->operation_name_;
-}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
index eeaf83dfeb1..7287ac5668d 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp
@@ -1,13 +1,13 @@
// $Id$
-ACE_RCSID (be_visitor_operation,
- proxy_impl_xh,
+ACE_RCSID (be_visitor_operation,
+ proxy_impl_xh,
"$Id$")
be_visitor_operation_proxy_impl_xh::be_visitor_operation_proxy_impl_xh (
be_visitor_context *ctx
)
- : be_visitor_scope (ctx)
+ : be_visitor_operation (ctx)
{
}
@@ -23,49 +23,42 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node)
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- *os << "virtual ";
+ *os << "static void" << be_nl;
- // STEP I: generate the return type.
- be_type *bt = be_type::narrow_from_decl (node->return_type ());
-
- if (!bt)
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "Bad return type\n"),
- -1);
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
}
- be_visitor_context ctx (*this->ctx_);
- be_visitor_operation_rettype oro_visitor (&ctx);
+ *os << node->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument ** args," << be_nl
+ << "int num_args" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")";
- if (bt->accept (&oro_visitor) == -1)
+ if (this->gen_throw_spec (node) != 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "codegen for return type failed\n"),
- -1);
+ ACE_ERROR_RETURN ((
+ LM_ERROR,
+ "(%N:%l) be_visitor_operation_proxy_impl_xh::"
+ "visit_operation - "
+ "throw spec generation failed\n"
+ ),
+ -1
+ );
}
- // STEP 2: generate the operation name
- *os << " " << node->local_name ();
-
- // STEP 3: generate the argument list with the appropriate mapping. For these
- // we grab a visitor that generates the parameter listing
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH);
- be_visitor_operation_arglist oapi_visitor (&ctx);
-
- if (node->accept (&oapi_visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_sh::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
- }
+ *os << ";";
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
index 8b30a1ce8c8..2f3f0060503 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp
@@ -48,94 +48,57 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
);
}
- // retrieve the operation return type
- be_type *bt = be_type::narrow_from_decl (node->return_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "Bad return type\n"
- ),
- -1
- );
- }
-
*os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- // STEP 2: generate the return type mapping (same as in the header file)
- be_visitor_context ctx (*this->ctx_);
- be_visitor_operation_rettype oro_visitor (&ctx);
+ *os << "void" << be_nl
+ << intf->full_thru_poa_proxy_impl_name () << "::";
- if (bt->accept (&oro_visitor) == -1)
+ // Check if we are an attribute node in disguise.
+ if (this->ctx_->attribute ())
{
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for return type failed\n"
- ),
- -1
- );
+ // Now check if we are a "get" or "set" operation.
+ if (node->nmembers () == 1)
+ {
+ *os << "_set_";
+ }
+ else
+ {
+ *os << "_get_";
+ }
}
- *os << " " << intf->full_thru_poa_proxy_impl_name () << "::";
- *os << node->local_name ();
+ *os << node->local_name () << " (" << be_idt << be_idt_nl
+ << "TAO_Abstract_ServantBase *servant," << be_nl
+ << "TAO::Argument **";
- // STEP 4: generate the argument list with the appropriate mapping (same as
- // in the header file)
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS);
- be_visitor_operation_arglist oapi_visitor (&ctx);
-
- if (node->accept (&oapi_visitor) == -1)
+ if (!node->void_return_type () || node->nmembers () > 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ss::"
- "visit_operation - "
- "codegen for argument list failed\n"),
- -1);
+ *os << " args";
}
- *os << be_nl << "{" << be_idt << be_nl;
+ *os << "," << be_nl
+ << "int " << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")";
- if (!be_global->exception_support ())
+ if (this->gen_throw_spec (node) != 0)
{
- // Declare a return type
- ctx = *this->ctx_;
- be_visitor_operation_rettype_vardecl_ss ord_visitor (&ctx);
-
- if (bt->accept (&ord_visitor) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for return var decl failed\n"
- ),
- -1
- );
- }
-
- if (!this->void_return_type (bt))
- {
- *os << be_nl << "ACE_UNUSED_ARG (_tao_retval);";
- }
+ return -1;
}
- *os << be_nl
+ *os << be_uidt_nl
+ << "{" << be_idt_nl;
+
+#if 0
<< "TAO_Object_Adapter::Servant_Upcall servant_upcall ("
<< be_idt << be_idt_nl
- << "_collocated_tao_target_->_stubobj ()"
+ << "obj->_stubobj ()"
<< "->servant_orb_var ()->orb_core ()"
<< be_uidt_nl
- << ");" << be_uidt_nl
- << "CORBA::Object_var forward_to;" << be_nl
+ << ");" << be_uidt_nl << be_nl
<< "servant_upcall.prepare_for_upcall (" << be_idt << be_idt_nl
- << "_collocated_tao_target_->_stubobj ()->object_key ()," << be_nl
+ << "obj->_stubobj ()->object_key ()," << be_nl
<< "\"";
// Check if we are an attribute node in disguise.
@@ -153,7 +116,7 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
}
*os << node->original_local_name () << "\"," << be_nl
- << "forward_to.out ()";
+ << "forward";
if (!be_global->exception_support ())
{
@@ -169,20 +132,10 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
// Check if there is an exception.
if (!be_global->exception_support ())
{
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "visit_operation - "
- "codegen for checking exception failed\n"
- ),
- -1
- );
- }
+ *os << "ACE_CHECK;";
}
- *os << be_nl
+ *os << be_nl << be_nl
<< "servant_upcall.pre_invoke_collocated_request (";
if (!be_global->exception_support ())
@@ -196,40 +149,46 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
*os << ");" << be_nl;
}
- // check if there is an exception
+ // Check if there is an exception.
if (!be_global->exception_support ())
{
- if (this->gen_check_exception (bt) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_"
- " poa_collocated_ss::"
- "visit_operation - "
- "codegen for checking exception failed\n"),
- -1);
- }
+ *os << "ACE_CHECK;";
}
- *os << be_nl;
+#endif /*if 0*/
- if (!this->void_return_type (bt))
+ if (!node->void_return_type ())
{
- *os << "return ";
+ *os << "((TAO::Arg_Traits<";
+
+ this->gen_arg_template_param_name (node->return_type (),
+ os);
+
+ *os << ">::ret_val *) args[0])->arg () =" << be_idt_nl;
}
*os << "ACE_reinterpret_cast (" << be_idt << be_idt_nl
<< intf->full_skel_name () << "_ptr," << be_nl
- << "servant_upcall.servant ()->_downcast (" << be_idt << be_idt_nl
+ << "servant->_downcast (" << be_idt << be_idt_nl
<< "\"" << intf->repoID () << "\"" << be_uidt_nl
<< ")" << be_uidt << be_uidt_nl
<< ")" << be_uidt;
+ be_visitor_context ctx;
+
if (this->gen_invoke (ctx, node) == -1)
{
return -1;
}
- *os << "}";
+ if (!node->void_return_type ())
+ {
+ *os << be_uidt;
+ }
+
+ *os << be_uidt << be_uidt_nl
+ << "ACE_CHECK;" << be_uidt_nl
+ << "}";
return 0;
}
@@ -237,36 +196,63 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation (
int
be_visitor_operation_thru_poa_proxy_impl_ss::gen_invoke (
- be_visitor_context &ctx,
+ be_visitor_context &,
be_operation *node
)
{
TAO_OutStream *os = this->ctx_->stream ();
*os << "->" << node->local_name () << " ("
- << be_idt << be_idt << be_idt_nl;
+ << be_idt << be_idt << be_idt;
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS);
- be_visitor_operation_argument visitor (&ctx);
+ UTL_ScopeActiveIterator si (node,
+ UTL_Scope::IK_decls);
- if (node->accept (&visitor) == -1)
+ if (si.is_done ())
{
- ACE_ERROR_RETURN ((
- LM_ERROR,
- "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::"
- "gen_invoke - "
- "codegen for making upcall failed\n"
- ),
- -1
- );
+ *os << be_nl
+ << "ACE_ENV_SINGLE_ARG_PARAMETER" << be_uidt_nl
+ << ");";
+
+ return 0;
+ }
+
+ AST_Argument *arg = 0;
+ int index = 1;
+
+ for (; !si.is_done (); si.next (), ++index)
+ {
+ arg = AST_Argument::narrow_from_decl (si.item ());
+
+ *os << (index == 1 ? "" : ",") << be_nl
+ << "((TAO::Arg_Traits<";
+
+ this->gen_arg_template_param_name (arg->field_type (),
+ os);
+
+ *os << ">::";
+
+ switch (arg->direction ())
+ {
+ case AST_Argument::dir_IN:
+ *os << "in";
+ break;
+ case AST_Argument::dir_INOUT:
+ *os << "inout";
+ break;
+ case AST_Argument::dir_OUT:
+ *os << "out";
+ default:
+ break;
+ }
+
+ *os << "_arg_val *) args[" << index << "])->arg ()";
}
// End the upcall
- *os << be_uidt_nl
+ *os << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
<< ");";
- *os << be_uidt << be_uidt << be_uidt_nl;
-
return 0;
}