summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-02-07 19:17:29 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-02-07 19:17:29 +0000
commite8e94ebc4af41d193d45bacdc90abd248047c7b3 (patch)
tree3a5af2ccd52ff1198cefa4d0f8640e5bbdd7f7fb
parentbc470e78de84e14404f1c0ddb7dd8045916238f9 (diff)
downloadATCD-e8e94ebc4af41d193d45bacdc90abd248047c7b3.tar.gz
ChangeLogTag: Thu Feb 7 13:13:59 2002 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp73
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation.cpp20
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h3
4 files changed, 65 insertions, 42 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 523bf487ced..6cd31367597 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
@@ -90,6 +90,11 @@ be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
// Step 2 : Generate the params of the method
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS);
+
+ // Set the substate because response handler operations without
+ // parameters don't use the environment parameter in the body.
+ ctx.sub_state (TAO_CodeGen::TAO_AMH_RESPONSE_HANDLER_OPERATION);
+
be_visitor_operation_arglist visitor (&ctx);
if (node->accept (&visitor) == -1)
@@ -110,8 +115,8 @@ be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
// 3) The argument takes an implied valuetype generated from the
// original interface
// 4) The implied valuetype ends in ExceptionHolder
- const char *last_underbar =
- ACE_OS::strrchr (node->full_name (), '_');
+ const char *last_underbar = ACE_OS::strrchr (node->full_name (), '_');
+
if (last_underbar != 0
&& ACE_OS::strcmp (last_underbar, "_excep") == 0)
{
@@ -132,6 +137,7 @@ be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
{
const char *last_E =
ACE_OS::strrchr (vt->full_name (), 'E');
+
if (last_E != 0
&& ACE_OS::strcmp (last_E, "ExceptionHolder") == 0)
{
@@ -228,6 +234,7 @@ be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node)
"(%N:%l) gen_raise_exception failed\n"),
-1);
}
+
*os << be_uidt << be_uidt;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
index 35a5017deac..f112884f12e 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp
@@ -18,11 +18,11 @@
//
// ============================================================================
-#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"
+#include "be_visitor_argument.h"
ACE_RCSID(be_visitor_operation, arglist, "$Id$")
@@ -33,8 +33,9 @@ ACE_RCSID(be_visitor_operation, arglist, "$Id$")
// visitors to avoid code duplication and tight coupling
// ************************************************************
-be_visitor_operation_arglist::
-be_visitor_operation_arglist (be_visitor_context *ctx)
+be_visitor_operation_arglist::be_visitor_operation_arglist (
+ be_visitor_context *ctx
+ )
: be_visitor_operation (ctx)
{
}
@@ -47,10 +48,11 @@ int
be_visitor_operation_arglist::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
- *os << " (" << be_idt // idt = 1
- << be_idt_nl; // idt = 2
- bool arg_emitted = false;
+ *os << " (" << be_idt
+ << be_idt_nl;
+
+ int arg_emitted = 0;
switch (this->ctx_->state ())
{
@@ -58,16 +60,19 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
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_";
+
if (node->argument_count () > 0)
- *os << "," << be_nl;
- arg_emitted = true;
- break;
+ {
+ *os << "," << be_nl;
+ }
+ arg_emitted = 1;
+ break;
default:
break;
}
- // all we do is hand over code generation to our scope
+ // All we do is hand over code generation to our scope.
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -89,7 +94,7 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
*os << be_uidt_nl // idt = 1
<< ")" << be_uidt; // idt = 0
- // now generate the throw specs
+ // Now generate the throw specs.
if (this->gen_throw_spec (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -105,17 +110,21 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH:
case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH:
if (node->is_local ())
- *os << " = 0;" << be_nl << be_nl;
+ {
+ *os << " = 0;" << be_nl << be_nl;
+ }
else
- *os << ";" << be_nl << be_nl;
- break;
+ {
+ *os << ";" << be_nl << be_nl;
+ }
+ break;
case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH:
*os << ";" << be_nl << be_nl;
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
+ // Each method is pure virtual in the server header.
*os << " = 0;" << be_nl << be_nl;
break;
case TAO_CodeGen::TAO_OPERATION_ARGLIST_IS:
@@ -130,15 +139,16 @@ be_visitor_operation_arglist::visit_operation (be_operation *node)
int
be_visitor_operation_arglist::visit_argument (be_argument *node)
{
- // get the visitor that will dump the argument's mapping in the operation
+ // Get the visitor that will dump the argument's mapping in the operation
// signature.
be_visitor_context ctx (*this->ctx_);
- // first grab the interface definition inside which this operation is
+ // First grab the interface definition inside which this operation is
// defined. We need this since argument types may very well be declared
// inside the scope of the interface node. In such cases, we would like to
// generate the appropriate relative scoped names.
be_operation *op = this->ctx_->be_scope_as_operation ();
+
if (!op)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -164,7 +174,9 @@ be_visitor_operation_arglist::visit_argument (be_argument *node)
"Bad interface\n"),
-1);
}
- ctx.scope (intf); // set new scope
+
+ // Set new scope.
+ ctx.scope (intf);
switch (this->ctx_->state ())
{
@@ -191,26 +203,18 @@ be_visitor_operation_arglist::visit_argument (be_argument *node)
}
}
- // grab a visitor
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_arglist::"
- "visit_argument - "
- "Bad visitor\n"),
- -1);
- }
- if (node->accept (visitor) == -1)
+ // Create a visitor.
+ be_visitor_args_arglist visitor (&ctx);
+
+ if (visitor.visit_argument (node) == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_arglist::"
"visit_argument - "
"codegen for arglist failed\n"),
-1);
}
- delete visitor;
+
return 0;
}
@@ -226,5 +230,6 @@ be_visitor_operation_arglist::post_process (be_decl *bd)
{
*os << "," << be_nl;
}
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
index 89a76431275..adb5ebac7dd 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp
@@ -18,10 +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"
ACE_RCSID(be_visitor_operation, operation, "$Id$")
@@ -163,8 +162,17 @@ be_visitor_operation::gen_environment_decl (int argument_emitted,
// Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on
// whether the operation node has parameters.
const char *env_decl = "ACE_ENV_SINGLE_ARG_DECL";
-
- if (argument_emitted || node->argument_count () > 0)
+
+ if (this->ctx_->sub_state ()
+ == TAO_CodeGen::TAO_AMH_RESPONSE_HANDLER_OPERATION
+ && node->argument_count () == 0)
+ {
+ // Response handler operations don't use the environment arg
+ // unless there are other args in the operation.
+ env_decl = "ACE_ENV_SINGLE_ARG_DECL_NOT_USED";
+ this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN);
+ }
+ else if (argument_emitted || node->argument_count () > 0)
{
env_decl = "ACE_ENV_ARG_DECL";
}
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index b78249ba663..45ace5551cc 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -549,6 +549,9 @@ public:
// Generating the _var template parameter in sequence of arrays.
TAO_ARRAY_SEQ_CH_TEMPLATE_VAR,
+ // Generating an AMH response handler operation.
+ TAO_AMH_RESPONSE_HANDLER_OPERATION,
+
// Used to denote either error or don't care.
TAO_SUB_STATE_UNKNOWN
};