summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
diff options
context:
space:
mode:
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.cpp137
1 files changed, 54 insertions, 83 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 a2eed0f22a0..9df843f51c1 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp
@@ -18,9 +18,9 @@
//
// ============================================================================
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
#include "be_visitor_operation.h"
@@ -222,6 +222,20 @@ be_visitor_operation_cs::visit_operation (be_operation *node)
}
+ // do any post processing for the retval
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor || (bt->accept (visitor) == -1))
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_cs::"
+ "visit_operation - "
+ "codegen for return type post do_static_call failed\n"),
+ -1);
+ }
+
if (!this->void_return_type (bt))
{
// now generate the normal successful return statement
@@ -578,36 +592,8 @@ be_interpretive_visitor_operation_cs::gen_marshal_and_invoke (be_operation
"(%N:%l) be_interpretive_visitor_operation_cs::"
"gen_marshal_and_invoke - "
"codegen for checking exception failed\n"),
- -1);
-
- }
-
- // do any post processing for the arguments
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "visit_operation - "
- "codegen for args post do_static_call failed\n"),
- -1);
- }
+ -1);
- // do any post processing for the retval
- ctx = *this->ctx_;
- ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (bt->accept (visitor) == -1))
- {
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_cs::"
- "visit_operation - "
- "codegen for return type post do_static_call failed\n"),
- -1);
}
return 0;
@@ -653,6 +639,8 @@ be_compiled_visitor_operation_cs::gen_pre_stub_info (be_operation *node,
}
}
+ TAO_OutStream *os = this->ctx_->stream ();
+
return 0;
}
@@ -808,67 +796,47 @@ be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation
// the code below this is for 2way 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))
- {
- return 0;
- }
-
- // 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);
- visitor = tao_cg->make_visitor (&ctx);
- if (!visitor || (node->accept (visitor) == -1))
+ if (!this->void_return_type (bt) ||
+ this->has_param_type (node, AST_Argument::dir_INOUT) ||
+ this->has_param_type (node, AST_Argument::dir_OUT))
{
- delete visitor;
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_visitor_operation_cs::"
- "gen_marshal_and_invoke - "
- "codegen for args in post do_static_call\n"),
- -1);
- }
-
+ // 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);
+ 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_cs::"
+ "gen_marshal_and_invoke - "
+ "codegen for args in post do_static_call\n"),
+ -1);
+ }
- // Generate any temporary variables to demarshal the arguments
- ctx = *this->ctx_;
- be_visitor_compiled_args_decl vis1 (new be_visitor_context (ctx));
- if (node->accept (&vis1) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_compiled_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
- ctx = *this->ctx_;
- be_visitor_context *new_ctx =
- new be_visitor_context (ctx);
- be_visitor_operation_compiled_rettype_post_docall vis2 (new_ctx);
- if (bt->accept (&vis2) == -1)
+ // Generate any temporary variables to demarshal the arguments
+ be_visitor_context ctx = *this->ctx_;
+ be_visitor_compiled_args_decl visitor (&ctx);
+ if (node->accept (&visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_compiled_visitor_operation_cs::"
"gen_pre_stub_info - "
- "codegen rettype [post docall] failed\n"),
+ "codegen for pre args 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 << "TAO_InputCDR &_tao_in = _tao_call.inp_stream ();" << be_nl
+ << "if (!(\n" << be_idt << be_idt << be_idt;
}
- // 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 << "TAO_InputCDR &_tao_in = _tao_call.inp_stream ();" << be_nl
- << "if (!(\n" << be_idt << be_idt << be_idt;
-
if (!this->void_return_type (bt))
{
- // demarshal the return val
+ // demarshal the return val and each inout and out argument
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
@@ -882,14 +850,17 @@ be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation
"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))
+ {
+ // there are more to follow
+ *os << " &&\n";
+ }
}
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 << " &&\n";
-
// demarshal each out and inout argument
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS);