summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 19:45:46 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 19:45:46 +0000
commitee49a15ead5eccccff4e4d5e5210679d67bd471a (patch)
tree23c02656dceb2c1e6f3df7dcea3d51c86ca562ea
parent8b25633b3fe542a54c4989fbf2ee8e26c385b71d (diff)
downloadATCD-ee49a15ead5eccccff4e4d5e5210679d67bd471a.tar.gz
*** empty log message ***
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp136
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp124
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp177
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp227
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp228
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp59
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root_is.cpp65
7 files changed, 1016 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
new file mode 100644
index 00000000000..c952c2fab35
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
@@ -0,0 +1,136 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_interface.h"
+
+ACE_RCSID(be_visitor_interface, interface_ih, "$Id$")
+
+// ************************************************************
+// Interface visitor for implementation header
+// ************************************************************
+
+be_visitor_interface_ih::be_visitor_interface_ih (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_ih::~be_visitor_interface_ih (void)
+{
+}
+
+int
+be_visitor_interface_ih::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os; // output stream
+ long i; // loop index
+ static char namebuf [NAMEBUFSIZE]; // holds the class name
+
+
+ if (node->impl_hdr_gen () || node->imported ())
+ return 0;
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
+
+ os = this->ctx_->stream ();
+
+ // generate the skeleton class name
+
+ os->indent (); // start with whatever indentation level we are at
+
+
+ ACE_OS::sprintf (namebuf, "%s", node->flatname ());
+
+ *os << "//Class " << idl_global->impl_class_prefix ()<<namebuf << idl_global->impl_class_suffix ()<< be_nl;
+ // now generate the class definition
+ *os << "class " << idl_global->export_macro ()
+ << " " <<idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " : ";
+
+ if (node->n_inherits () > 0)
+ {
+ // this interface inherits from other interfaces
+ be_interface *intf; // inherited interface
+
+
+ *os << "public virtual ";
+
+ intf = be_interface::narrow_from_decl (node->inherits ()[0]);
+ *os << idl_global->impl_class_prefix () << intf->flatname () << idl_global->impl_class_suffix ();//intf->relative_skel_name (node->full_skel_name ());
+ for (i = 1; i < node->n_inherits (); i++)
+ {
+ *os << ", public virtual ";
+ intf = be_interface::narrow_from_decl (node->inherits ()[i]);
+ *os << idl_global->impl_class_prefix () <<intf->flatname () << idl_global->impl_class_suffix ();//intf->relative_skel_name (node->full_skel_name ());
+ } // end of for loop
+
+ //inherit from the base skeleton file
+ *os<<", public virtual "<<node->full_skel_name ();
+ }
+
+ else
+ {
+ //inherit from the base skeleton file
+ *os<<"public virtual "<<node->full_skel_name ();
+ }
+
+
+ *os << be_nl
+ << "{" << be_nl
+ << "public:" << be_idt_nl
+ << "//Constructor " << be_nl
+ << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (void);" << be_nl << be_nl;
+
+ if (idl_global->gen_copy_ctor ())
+ {
+ *os << "//Copy Constructor"<<be_nl
+ << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (const "
+ << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
+ }
+
+ if (idl_global->gen_assign_op ())
+ {
+ *os << "//Copy Assignment" << be_nl
+ << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "& "
+ << "operator=(const " << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << "&);"<<be_nl << be_nl;
+
+ }
+
+ *os << "//Destructor " << be_nl
+ << "virtual " << "~" << idl_global->impl_class_prefix () << namebuf << idl_global->impl_class_suffix () << " (void);" << be_nl << be_uidt_nl;
+
+
+ // generate code for elements in the scope (e.g., operations)
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ih::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+
+ *os << "};" << be_nl <<be_nl;
+ return 0;
+}
+
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
new file mode 100644
index 00000000000..21c3ebb6245
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
@@ -0,0 +1,124 @@
+// Id:$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// interface_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Interfaces in the implementation skeletons file.
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_interface.h"
+
+
+// ************************************************************
+// Interface visitor for implementation skeletons
+// ************************************************************
+
+ACE_RCSID(be_visitor_interface, interface_is, "$Id$")
+
+be_visitor_interface_is::be_visitor_interface_is (be_visitor_context *ctx)
+ : be_visitor_interface (ctx)
+{
+}
+
+be_visitor_interface_is::~be_visitor_interface_is (void)
+{
+}
+
+int
+be_visitor_interface_is::visit_interface (be_interface *node)
+{
+ TAO_OutStream *os; // output stream
+
+ if (node->impl_skel_gen () || node->imported ())
+ return 0;
+
+ os = this->ctx_->stream ();
+
+ // generate the skeleton class name
+
+ os->indent (); // start with whatever indentation level we are at
+
+
+ // constructor
+ *os << "// Implementation skeleton constructor" << be_nl;
+ // find if we are at the top scope or inside some module
+ *os << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () <<"::" << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () <<
+ " (void)" << be_idt_nl;
+
+
+ if(node->n_inherits () >0)
+ {
+ //generate the default constructors of all the base classes
+ node->gen_def_ctors(os);
+ }
+ *os << "{" << be_nl
+ << "}" << be_nl << be_uidt_nl;
+
+ // destructor
+ os->indent ();
+ *os << "// Implementation skeleton destructor" << be_nl;
+
+ *os << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () <<"::~" << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () <<
+ " (void)" << be_idt_nl;
+
+ *os << "{" <<be_nl;
+ *os << "}" << be_nl <<be_uidt_nl;
+
+ if (idl_global->gen_copy_ctor () )
+ {
+ *os << "//Implementation Skeleton Copy Constructor" << be_nl;
+
+ *os <<idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () <<"::"
+ << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () << " (const "
+ << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () << "& t)"<< be_idt_nl;
+ if(node->n_inherits () >0)
+ {
+ node->gen_copy_ctors(os);
+ *os << ", TAO_ServantBase (t)" << be_nl;
+ }
+ *os << "{" << be_nl
+ << "}" << be_nl << be_uidt_nl;
+ }
+
+ if (idl_global->gen_assign_op ())
+ {
+ *os << "//Implementation Skeleton Copy Assignment" << be_nl;
+
+ *os << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () << "& "
+ << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () << "::operator=(const "
+ << idl_global->impl_class_prefix () << node->flatname () << idl_global->impl_class_suffix () << "& t)" <<be_idt_nl
+ << "{" << be_idt_nl
+ << "return *this;" << be_uidt_nl
+ << "}" << be_nl << be_uidt_nl;
+ }
+
+ // generate code for elements in the scope (e.g., operations)
+
+ if (this->visit_scope (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_interface_ss::"
+ "visit_interface - "
+ "codegen for scope failed\n"),
+ -1);
+ }
+
+
+ return 0;
+}
+
+
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
new file mode 100644
index 00000000000..ed375de2dfe
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ih.cpp
@@ -0,0 +1,177 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, operation_ih, "$Id$")
+
+// ************************************************************
+// Operation visitor for implementation header
+// ************************************************************
+
+be_visitor_operation_ih::be_visitor_operation_ih (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_ih::~be_visitor_operation_ih (void)
+{
+}
+
+int
+be_visitor_operation_ih::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os; // output stream
+ be_type *bt; // type node representing the return type
+
+ os = this->ctx_->stream ();
+ this->ctx_->node (node); // save the node
+
+ os->indent (); // start with the current indentation level
+
+ // every operation is declared virtual in the client code
+ *os << "virtual ";
+
+ // STEP I: generate the return type
+ bt = be_type::narrow_from_decl (node->return_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_sh::"
+ "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_OTHERS);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_ih::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (bt->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ih::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ // 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_IH);
+ visitor = tao_cg->make_visitor (&ctx);
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_ih::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_ih::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ //generate the exceptions that are thrown by the operation
+ gen_raise_exception (node);
+
+ *os << ";\n\n";
+
+ return 0;
+}
+
+
+//Method to generate the exceptions that are thrown by the operation
+int
+be_visitor_operation_ih::gen_raise_exception (be_operation *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+
+ if (node->exceptions ())
+ {
+ os->indent ();
+
+ // initialize an iterator to iterate thru the exception list
+ UTL_ExceptlistActiveIterator *ei;
+ ACE_NEW_RETURN (ei,
+ UTL_ExceptlistActiveIterator (node->exceptions ()),
+ -1);
+ *os << be_idt_nl << "TAO_THROW_SPEC ((";
+ // continue until each element is visited
+ while (!ei->is_done ())
+ {
+ be_exception *excp = be_exception::narrow_from_decl (ei->item ());
+
+ if (excp == 0)
+ {
+ delete ei;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_exceptlist_cs"
+ "visit_operation - "
+ "codegen for scope failed\n"), -1);
+
+ }
+
+
+ // allocator method
+ *os << excp->name ();
+ ei->next ();
+ if (!ei->is_done ())
+ {
+ *os << "," <<be_nl<<"\t\t";
+ //os->indent ();
+ }
+ // except the last one is processed?
+
+ } // end of while loop
+ delete ei;
+ *os << "))"<<be_uidt;
+ } // end of if
+
+ return 0;
+
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
new file mode 100644
index 00000000000..2bb11720418
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_is.cpp
@@ -0,0 +1,227 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// operation_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Operation in the implementation skeleton
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+#include "ace/SString.h"
+
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, operation_is, "$Id$")
+
+// ************************************************************
+// Operation visitor for implementation skeleton
+// ************************************************************
+
+be_visitor_operation_is::be_visitor_operation_is (be_visitor_context *ctx)
+ : be_visitor_operation (ctx)
+{
+}
+
+be_visitor_operation_is::~be_visitor_operation_is (void)
+{
+}
+
+int
+be_visitor_operation_is::visit_operation (be_operation *node)
+{
+ TAO_OutStream *os; // output stream
+ be_type *bt; // type node representing the return type
+
+ //cout<<"Within visit_operation "<<endl;
+ os = this->ctx_->stream ();
+ this->ctx_->node (node); // save the node
+
+ os->indent (); // start with the current indentation level
+
+
+
+
+ // STEP I: generate the return type
+ bt = be_type::narrow_from_decl (node->return_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "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_OTHERS);
+ be_visitor *visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_is::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+ if (bt->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+ delete visitor;
+
+
+ ACE_CString str(node->flatname ());
+
+
+ int lnmlength = ACE_OS::strlen (node->local_name ()->get_string ());
+
+ int fnmlength = ACE_OS::strlen (node->flatname ());
+ fnmlength--;
+
+ char * classname = str.substr (0,(fnmlength-lnmlength) ).rep ();
+
+ // STEP 2: generate the operation name
+ *os << " " << idl_global->impl_class_prefix () << classname << idl_global->impl_class_suffix () << "::" << 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_IS);
+ visitor = tao_cg->make_visitor (&ctx);
+
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_is::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+
+ if (node->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "visit_operation - "
+ "codegen for argument list failed\n"),
+ -1);
+ }
+ delete visitor;
+
+ //generate the excetions thrown by the operation
+ this->gen_raise_exception (node);
+
+ *os <<be_idt_nl << "{"<<be_idt_nl;
+ *os << "//Add your implementation here"<<be_uidt_nl;
+
+ //Code to generate teh return statement in the operations.....
+ //Can be uncommented when required
+
+ /*
+ ctx = *this->ctx_;
+ ctx.state (TAO_CodeGen::TAO_OPERATION_RETTYPE_IS);
+ visitor = tao_cg->make_visitor (&ctx);
+
+ if (!visitor)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_is::"
+ "visit_operation - "
+ "Bad visitor to return type\n"),
+ -1);
+ }
+
+
+ if (bt->accept (visitor) == -1)
+ {
+ delete visitor;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_is::"
+ "visit_operation - "
+ "codegen for return type failed\n"),
+ -1);
+ }
+ delete visitor;
+ */
+
+ *os << "}" << be_nl << be_uidt_nl;
+
+
+ return 0;
+}
+
+
+//method to generate the exceptions throw by the operation
+int
+be_visitor_operation_is::gen_raise_exception (be_operation *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+
+ if (node->exceptions ())
+ {
+ os->indent ();
+
+ // initialize an iterator to iterate thru the exception list
+ UTL_ExceptlistActiveIterator *ei;
+ ACE_NEW_RETURN (ei,
+ UTL_ExceptlistActiveIterator (node->exceptions ()),
+ -1);
+ *os << be_idt_nl << "TAO_THROW_SPEC ((";
+ // continue until each element is visited
+ while (!ei->is_done ())
+ {
+ be_exception *excp = be_exception::narrow_from_decl (ei->item ());
+
+ if (excp == 0)
+ {
+ delete ei;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_operation_exceptlist_cs"
+ "visit_operation - "
+ "codegen for scope failed\n"), -1);
+
+ }
+
+
+ // allocator method
+ *os << excp->name ();
+ ei->next ();
+ if (!ei->is_done ())
+ {
+ *os << "," <<be_nl<<"\t\t";
+ //os->indent ();
+ }
+ // except the last one is processed?
+
+ } // end of while loop
+ delete ei;
+ *os << "))"<<be_uidt;
+ } // end of if
+
+ return 0;
+
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp
new file mode 100644
index 00000000000..e8abea1e599
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp
@@ -0,0 +1,228 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// rettype.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for return type of the Operation node
+//
+// = AUTHOR
+// Aniruddha Gokhale
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_operation.h"
+
+ACE_RCSID(be_visitor_operation, rettype_is, "$Id$")
+
+
+// ****************************************************************************
+// Operation visitor for return types. This generates the mapping for a return
+// type in an operation signature
+// ****************************************************************************
+
+be_visitor_operation_rettype_is::be_visitor_operation_rettype_is (be_visitor_context
+ *ctx)
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_operation_rettype_is::~be_visitor_operation_rettype_is (void)
+{
+}
+
+int
+be_visitor_operation_rettype_is::visit_array (be_array *node)
+{
+
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_enum (be_enum *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_interface (be_interface *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_interface_fwd (be_interface_fwd *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_native (be_native *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_predefined_type (be_predefined_type *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ switch (node->pt ())
+ {
+ case AST_PredefinedType::PT_void:
+ *os << "return;" <<be_nl;
+ break;
+ default:
+ *os << "return 0;" <<be_nl;
+ break;
+ }
+
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_sequence (be_sequence *node)
+{
+
+
+ // we should never directly be here because anonymous sequence return types
+ // are not allowed
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_string (be_string * /* node*/)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+
+
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_structure (be_structure *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+
+ *os << bt->name () << "_var _tao_retval;";
+
+ *os << "return _tao_retval._retn ();";
+
+ *os << "return 0;" <<be_nl;
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_typedef (be_typedef *node)
+{
+
+ this->ctx_->alias (node); // set the alias node
+ if (node->primitive_base_type ()->accept (this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_visitor_operation_rettype::"
+ "visit_typedef - "
+ "accept on primitive type failed\n"),
+ -1);
+ }
+ this->ctx_->alias (0);
+ return 0;
+}
+
+int
+be_visitor_operation_rettype_is::visit_union (be_union *node)
+{
+
+ TAO_OutStream *os = this->ctx_->stream (); // grab the out stream
+ be_type *bt; // return type
+
+ if (this->ctx_->alias ()) // a typedefed return type
+ bt = this->ctx_->alias ();
+ else
+ bt = node;
+
+ *os << "return 0;" <<be_nl;
+
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
new file mode 100644
index 00000000000..98370a45a42
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp
@@ -0,0 +1,59 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_ih.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Root in the server implementation header
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_root.h"
+
+ACE_RCSID(be_visitor_root, root_ih, "$Id$")
+
+
+// ***********************************
+// Root visitor for implementation header
+// ***********************************
+
+be_visitor_root_ih::be_visitor_root_ih (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_ih::~be_visitor_root_ih (void)
+{
+}
+
+int
+be_visitor_root_ih::init (void)
+{
+ // open the file
+ if (tao_cg->start_implementation_header (idl_global->be_get_implementation_hdr_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ih::init - "
+ "Error :%p: Unable to open implementation header file : %s\n",
+ idl_global->be_get_implementation_hdr_fname ()),
+ -1);
+ }
+
+
+ // set the stream and the next state
+ this->ctx_->stream (tao_cg->implementation_header ());
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
new file mode 100644
index 00000000000..5cf2a47ffce
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp
@@ -0,0 +1,65 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// root_is.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for the Root in the implementation skeletons file
+//
+// = AUTHOR
+// Yamuna Krishnamurthy (yamuna@cs.wustl.edu)
+//
+// ============================================================================
+
+#include "idl.h"
+#include "idl_extern.h"
+#include "be.h"
+
+#include "be_visitor_root.h"
+
+//ACE_RCSID(be_visitor_root, root_ss, "$Id$")
+
+
+// ******************************************************
+// Root visitor for implementation skeletons
+// ******************************************************
+
+be_visitor_root_is::be_visitor_root_is (be_visitor_context *ctx)
+ : be_visitor_root (ctx)
+{
+}
+
+be_visitor_root_is::~be_visitor_root_is (void)
+{
+}
+
+int
+be_visitor_root_is::init (void)
+{
+ // first open the file for writing
+ if (tao_cg->start_implementation_skeleton (idl_global
+ ->be_get_implementation_skel_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_is::init - "
+ "Error opening implementation skeletons file\n"), -1);
+ }
+ /*
+ if (tao_cg->start_server_template_skeletons
+ (idl_global->be_get_server_template_skeleton_fname ())
+ == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root_ss::init - "
+ "Error opening server template skeleton file\n"),
+ -1);
+ }
+ */
+ // set stream
+ this->ctx_->stream (tao_cg->implementation_skeleton ());
+ return 0;
+}