summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-03 00:19:52 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-01-03 00:19:52 +0000
commit9f09a39fb2627c9bcff8b1cfc9caf9052b7c1823 (patch)
treeeb016a9ca2a4ab5e4bde44b7e92f0ddbebbc5cce
parent2373dabeb0a0bef66650b96cd28d4c5199904a7b (diff)
downloadATCD-9f09a39fb2627c9bcff8b1cfc9caf9052b7c1823.tar.gz
ChangeLogTag: Thu Jan 2 17:51:49 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog14
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp36
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp91
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h7
7 files changed, 127 insertions, 36 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index f2aedad5a4d..9a7e521ee6d 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,17 @@
+Thu Jan 2 17:51:49 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_valuetype/arglist.cpp:
+ * TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp:
+ * TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp:
+ * TAO_IDL/be/be_codegen.cpp:
+ * TAO_IDL/be_include/be_codegen.h:
+ * TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h:
+
+ Moved generation of AMH exception holder raise_* method
+ body from the stub header file to the stub source file. Also
+ added explicit include of ace/Auto_Ptr when generating AMH
+ classes (needed to correct AIX build errors).
+
Thu Jan 2 13:33:01 2003 Chad Elliott <elliott_c@ociweb.com>
* orbsvcs/orbsvcs/AV/AV_Core.h:
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 08f75f48cdf..33154c77d9b 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -346,7 +346,7 @@ TAO_CodeGen::start_client_stubs (const char *fname)
"tao/ClientRequestInfo_i.h");
this->gen_standard_include (this->client_stubs_,
"tao/ClientInterceptorAdapter.h");
- *this->client_stubs_ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */\n\n";
+ *this->client_stubs_ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */\n";
if (be_global->ami_call_back () == I_TRUE)
{
@@ -356,7 +356,14 @@ TAO_CodeGen::start_client_stubs (const char *fname)
*this->client_stubs_ << "\n#if TAO_HAS_INTERCEPTORS == 1\n";
this->gen_standard_include (this->client_stubs_,
"tao/Messaging/AMI_ClientRequestInfo_i.h");
- *this->client_stubs_ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */\n\n";
+ *this->client_stubs_ << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */\n";
+ }
+
+ if (be_global->gen_amh_classes () == I_TRUE)
+ {
+ // Necessary for the AIX compiler.
+ this->gen_standard_include (this->client_stubs_,
+ "ace/Auto_Ptr.h");
}
*this->client_stubs_ << "\n\n#if defined (__BORLANDC__)\n"
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
index dadbaa62c0a..f589b0cd00c 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp
@@ -90,7 +90,7 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
-1);
}
- int amh_valuetype = is_amh_exception_holder (node);
+ int amh_valuetype = this->is_amh_exception_holder (node);
// Generate the ACE_ENV_ARG_DECL parameter for the alternative mapping.
if (!be_global->exception_support ())
@@ -103,7 +103,7 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
// ACE_ENV_SINGLE_ARG_DECL_NOT_USED when generating argument
// list for AMHExceptioHolders
/***********************************************************/
- if (is_amh_exception_holder (node))
+ if (amh_valuetype)
{
*os << "ACE_ENV_SINGLE_ARG_DECL";
}
@@ -161,43 +161,21 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node)
switch (this->ctx_->state ())
{
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH:
- /***********************************************************/
- // 2.1
// Each method is pure virtual in the Valuetype class.
// BUT, not if it is an AMH ExceptionHolder!
- /***********************************************************/
- if (is_amh_exception_holder (node))
+ if (amh_valuetype)
{
- // We need to throw an exceptions that was assigned in a
- // different place (by the app-developer). ACE_THROW does
- // not fit the bill since the ACE_THROW macro contructs the
- // exception passed to it. Also exception->raise_() is
- // ruled out since in platforms without native exception
- // support, the raise() function does not do anything. What
- // is left as an alternative is tthe hack below where we
- // explicitly take care of both the cases (platforms with
- // and without native exception support).
- *os << be_nl
- << "{" << be_nl
- << "#if defined (TAO_HAS_EXCEPTIONS)" << be_idt_nl
- << "auto_ptr<CORBA::Exception> safety (exception);" << be_nl
- << "// Direct throw because we don't have the ACE_TRY_ENV." << be_nl
- << "exception->_raise ();" << be_uidt_nl
- << "#else" << be_idt_nl
- << "// We can not use ACE_THROW here." << be_nl
- << "ACE_TRY_ENV.exception (this->exception);" << be_uidt_nl
- << "#endif" << be_nl
- << "}"
- << be_uidt_nl;
+ *os << ";" << be_uidt;
}
- /***********************************************************/
else
{
*os << " = 0;" << be_uidt;
}
break;
- case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CS:
+ *os << be_uidt;
break;
+ case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH:
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS:
break;
case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CH:
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
index f51bc12cd4f..34912629afb 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -466,7 +466,6 @@ int
be_visitor_valuetype_ch::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
-
this->ctx_->node (node); // save the node
*os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
@@ -513,7 +512,7 @@ be_visitor_valuetype_ch::visit_operation (be_operation *node)
if (node->accept (&ooa_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_operation_ch::"
+ "(%N:%l) be_visitor_valuetype_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
index 2dca378e520..e862df548cd 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp
@@ -384,3 +384,94 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node)
return 0;
}
+
+int
+be_visitor_valuetype_cs::visit_operation (be_operation *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ be_valuetype *parent =
+ be_valuetype::narrow_from_scope (node->defined_in ());
+
+ if (parent == 0 || ! this->is_amh_exception_holder (parent))
+ {
+ return 0;
+ }
+
+ TAO_OutStream *os = this->ctx_->stream ();
+ this->ctx_->node (node);
+
+ *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl
+ << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
+
+ // STEP I: Generate the return type.
+ be_type *bt = be_type::narrow_from_decl (node->return_type ());
+
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "Bad return type\n"),
+ -1);
+ }
+
+ // Grab the right visitor to generate the return type.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_CH);
+ be_visitor_operation_rettype or_visitor (&ctx);
+
+ if (bt->accept (&or_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+
+ // STEP 2: Generate the operation name.
+ *os << be_nl << parent->name () << "::" << 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_OBV_OPERATION_ARGLIST_CS);
+ be_visitor_obv_operation_arglist ooa_visitor (&ctx);
+
+ if (node->accept (&ooa_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_valuetype_cs::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+
+ // We need to throw an exceptions that was assigned in a
+ // different place (by the app-developer). ACE_THROW does
+ // not fit the bill since the ACE_THROW macro contructs the
+ // exception passed to it. Also exception->_raise() is
+ // ruled out since in platforms without native exception
+ // support, the _raise() function does not do anything. Below we
+ // explicitly take care of both cases (platforms with
+ // and without native exception support).
+ *os << be_nl
+ << "{" << be_nl
+ << "#if defined (TAO_HAS_EXCEPTIONS)" << be_idt_nl
+ << "auto_ptr<CORBA::Exception> safety (this->exception);" << be_nl
+ << "// Direct throw because we don't have the ACE_TRY_ENV." << be_nl
+ << "this->exception->_raise ();" << be_uidt_nl
+ << "#else" << be_idt_nl
+ << "// We can not use ACE_THROW here." << be_nl
+ << "ACE_TRY_ENV.exception (this->exception);" << be_uidt_nl
+ << "#endif" << be_nl
+ << "}"
+ << be_uidt_nl;
+
+ return 0;
+}
+
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 95e43105898..7ba6ae7cbd2 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -413,6 +413,7 @@ public:
TAO_OPERATION_TIE_SI,
TAO_OBV_OPERATION_ARGLIST_CH, // parameter list in obv op signature
+ TAO_OBV_OPERATION_ARGLIST_CS, // used only for AMH exceptions
// ... for client header
TAO_OBV_OPERATION_ARGLIST_OBV_CH, // ... for OBV_ class
TAO_OBV_OPERATION_ARGLIST_SH, // ... for server header
diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h
index a0adef76ea7..cccb79ee115 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_cs.h
@@ -35,10 +35,8 @@ class be_visitor_valuetype_cs : public be_visitor_valuetype
//
public:
be_visitor_valuetype_cs (be_visitor_context *ctx);
- // constructor
~be_visitor_valuetype_cs (void);
- // destructor
virtual int is_amh_exception_holder (be_valuetype *node);
// Test if valuetype is an AMH ExceptionHolder. Special generation
@@ -46,7 +44,10 @@ public:
// ExceptionHolder
virtual int visit_valuetype (be_valuetype *node);
- // set the right context and make a visitor
+ // Set the right context and make a visitor.l
+
+ virtual int visit_operation (be_operation *node);
+ // Called only by AMH exceptions.
};
#endif /* _BE_VALUETYPE_VALUETYPE_CS_H_ */