summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-04-12 22:58:36 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-04-12 22:58:36 +0000
commitf13cca40aaf0228bc434e562829af0eb2bb3e990 (patch)
tree56dfbd4e24949ea11df368aa9e04b41cf987b5f7
parent51fe336a08f2f3d4141d4f00660418ea56eed72f (diff)
downloadATCD-f13cca40aaf0228bc434e562829af0eb2bb3e990.tar.gz
ChangeLogTag: Tue Apr 12 17:51:58 2005 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog26
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp16
-rw-r--r--TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp23
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp50
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h46
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h3
-rw-r--r--TAO/TAO_IDL/include/ast_interface.h7
15 files changed, 274 insertions, 6 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index f026e4a8bac..aad006c83bd 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,29 @@
+Tue Apr 12 17:51:58 2005 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_home/home_cs.cpp:
+ * TAO_IDL/be_include/be_visitor_home/home_cs.h:
+
+ New files to generate the home typecode.
+
+ * TAO_IDL/ast/ast_interface.cpp:
+ * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp:
+ * TAO_IDL/be/be_visitor_home.cpp:
+ * TAO_IDL/be/be_visitor_home/home_ch.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_ch.cpp:
+ * TAO_IDL/be/be_visitor_interface/interface_cs.cpp:
+ * TAO_IDL/be/be_visitor_module/module.cpp:
+ * TAO_IDL/be/be_visitor_root/root.cpp:
+ * TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp:
+ * TAO_IDL/be_include/be_visitor_home.h:
+ * TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h:
+ * TAO_IDL/include/ast_interface.h:
+
+ Changes to exisiting files to support the new files above
+ and to suppress typecode generation for the home equivalent
+ interface, which was previously done but led to typecode
+ with an incorrect TCKind. Thanks to Ossama Othman
+ <ossama@dre.vanderbilt.edu> for pointing out the oversight.
+
Tue Apr 12 21:13:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/Portable_Interceptors/ForwardRequest/Server_Request_Interceptor.cpp:
diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp
index 8c41d3f43d5..463b4af6f7c 100644
--- a/TAO/TAO_IDL/ast/ast_interface.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -109,7 +109,8 @@ AST_Interface::AST_Interface (void)
pd_inherits (0),
pd_n_inherits (0),
pd_inherits_flat (0),
- pd_n_inherits_flat (0)
+ pd_n_inherits_flat (0),
+ home_equiv_ (I_FALSE)
{
this->size_type (AST_Type::VARIABLE); // Always the case.
this->has_constructor (I_TRUE); // Always the case.
@@ -132,7 +133,8 @@ AST_Interface::AST_Interface (UTL_ScopedName *n,
pd_inherits (ih),
pd_n_inherits (nih),
pd_inherits_flat (ih_flat),
- pd_n_inherits_flat (nih_flat)
+ pd_n_inherits_flat (nih_flat),
+ home_equiv_ (I_FALSE)
{
this->size_type (AST_Type::VARIABLE); // always the case
this->has_constructor (I_TRUE); // always the case
@@ -1217,6 +1219,18 @@ AST_Interface::redef_clash_populate_r (AST_Interface *t)
}
}
+idl_bool
+AST_Interface::home_equiv (void) const
+{
+ return this->home_equiv_;
+}
+
+void
+AST_Interface::home_equiv (idl_bool val)
+{
+ this->home_equiv_ = val;
+}
+
int
AST_Interface::insert_non_dup (AST_Interface *t,
idl_bool abstract_paths_only)
diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index a9cb5a44a15..5dabb0e35d5 100644
--- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -1704,6 +1704,9 @@ be_visitor_ccm_pre_proc::create_equivalent (be_home *node,
// Back to reality.
idl_global->scopes ().pop ();
+
+ // So we can skip typecode generation.
+ retval->home_equiv (I_TRUE);
retval->set_name (equiv_name);
retval->set_defined_in (s);
diff --git a/TAO/TAO_IDL/be/be_visitor_home.cpp b/TAO/TAO_IDL/be/be_visitor_home.cpp
index 216b5b01892..3ef51b8fe8e 100644
--- a/TAO/TAO_IDL/be/be_visitor_home.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_home.cpp
@@ -21,10 +21,14 @@
#include "be_home.h"
#include "be_visitor_home.h"
+#include "be_visitor_typecode/typecode_defn.h"
+#include "be_visitor_typecode/objref_typecode.h"
#include "be_visitor_context.h"
#include "be_helper.h"
+#include "be_extern.h"
#include "be_visitor_home/home_ch.cpp"
+#include "be_visitor_home/home_cs.cpp"
ACE_RCSID (be,
be_visitor_home,
diff --git a/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp b/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
index b9a3b18a2e8..4b5a5d8d1ac 100644
--- a/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_home/home_ch.cpp
@@ -59,6 +59,22 @@ be_visitor_home_ch::visit_home (be_home *node)
os->gen_endif ();
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ be_visitor_typecode_decl tc_visitor (&ctx);
+
+ if (node->accept (&tc_visitor) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_home_ch::"
+ "visit_home - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
node->cli_hdr_gen (I_TRUE);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp b/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp
new file mode 100644
index 00000000000..61552720cba
--- /dev/null
+++ b/TAO/TAO_IDL/be/be_visitor_home/home_cs.cpp
@@ -0,0 +1,64 @@
+//
+// $Id$
+//
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_cs.cpp
+//
+// = DESCRIPTION
+// Visitor generating code for Component Home node in the client source.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+ACE_RCSID (be_visitor_home,
+ home_cs,
+ "$Id$")
+
+be_visitor_home_cs::be_visitor_home_cs (
+ be_visitor_context *ctx
+ )
+ : be_visitor_decl (ctx)
+{
+}
+
+be_visitor_home_cs::~be_visitor_home_cs (void)
+{
+}
+
+int
+be_visitor_home_cs::visit_home (be_home *node)
+{
+ if (node->cli_stub_gen () || node->imported ())
+ {
+ return 0;
+ }
+
+ if (be_global->tc_support ())
+ {
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ TAO::be_visitor_objref_typecode tc_visitor (&ctx);
+
+ // No double dispatch here so the objref_typecode visitor
+ // can dynamic_cast the node to tell it's a home.
+ if (tc_visitor.visit_interface (node) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_home_cs::"
+ "visit_home - "
+ "TypeCode definition failed\n"),
+ -1);
+ }
+ }
+
+ node->cli_stub_gen (I_TRUE);
+ return 0;
+}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
index 530d25e9c3b..1a410049325 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -228,7 +228,26 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
<< "::Components::CCMException" << be_uidt_nl
<< "));" << be_uidt_nl << be_nl;
}
-
+/*
+ if (node->n_inherits () > 0)
+ {
+ const char *id = node->inherits ()[0]->repoID ();
+ const char *ecb_id = "IDL:omg.org/Components/EventConsumerBase:1.0";
+
+ if (ACE_OS::strcmp (id, ecb_id) == 0)
+ {
+ *os << "// Check that enables substitution of base class events."
+ << be_nl
+ << "virtual CORBA::Boolean tao_is_substitutable ("
+ << be_idt << be_idt_nl
+ << "const char *repo_id" << be_nl
+ << "ACE_ENV_ARG_DECL_WITH_DEFAULTS" << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException));"
+ << be_uidt_nl << be_nl;
+ }
+ }
+*/
if (! node->is_abstract ())
{
node->analyze_parentage ();
@@ -377,7 +396,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
os->gen_endif ();
- if (be_global->tc_support ())
+ if (be_global->tc_support () && !node->home_equiv ())
{
be_visitor_typecode_decl td_visitor (&ctx);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index 4a3c95b8eff..8ff4fd6fb14 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -360,7 +360,53 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< "{" << be_nl
<< "}" << be_nl << be_nl;
}
-
+/*
+ if (node->n_inherits () > 0)
+ {
+ const char *id = node->inherits ()[0]->repoID ();
+ const char *ecb_id = "IDL:omg.org/Components/EventConsumerBase:1.0";
+
+ if (ACE_OS::strcmp (id, ecb_id) == 0)
+ {
+ *os << "// Check that enables substitution of base class events."
+ << be_nl
+ << "CORBA::Boolean" << be_nl
+ << node->full_name () << "::tao_is_substitutable ("
+ << be_idt << be_idt_nl
+ << "const char *repo_id" << be_nl
+ << "ACE_ENV_ARG_DECL" << be_uidt_nl
+ << ")" << be_nl
+ << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl
+ << "{" << be_idt_nl
+ << "if (repo_id == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "ACE_THROW_RETURN (CORBA::BAD_PARAM (), FALSE);"
+ << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::ValueFactory_var f =" << be_idt_nl
+ << "this->_stubobj ()->servant_orb_var ()->lookup_value_factory ("
+ << be_idt << be_idt_nl
+ << "repo_id" << be_nl
+ << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl
+ << ");" << be_uidt << be_uidt_nl
+ << "ACE_CHECK_RETURN (FALSE);" << be_nl << be_nl
+ << "if (f.ptr () == 0)" << be_idt_nl
+ << "{" << be_idt_nl
+ << "return FALSE;" << be_uidt_nl
+ << "}" << be_uidt_nl << be_nl
+ << "CORBA::ValueBase_var v = f->create_for_unmarshal ();"
+ << be_nl;
+
+ // To get the event name, chop "Consumer" from node name.
+ size_t len = ACE_OS::strlen (node->full_name ());
+ ACE_CString event_name (node->full_name (), len - 8);
+
+ *os << "return dynamic_cast<" << event_name.c_str ()
+ << " const*> (v.in ()) != 0;" << be_uidt_nl
+ << "}" << be_nl << be_nl;
+ }
+ }
+*/
*os << "CORBA::Boolean" << be_nl
<< node->full_name () << "::_is_a (" << be_idt << be_idt_nl
<< "const char *value" << be_nl;
@@ -489,7 +535,7 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
}
}
- if (be_global->tc_support ())
+ if (be_global->tc_support () && !node->home_equiv ())
{
be_visitor_context ctx = *this->ctx_;
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
index 063a22f5bf4..d830c0973f9 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -745,6 +745,12 @@ be_visitor_module::visit_home (be_home *node)
status = node->accept (&visitor);
break;
}
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_home_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
return 0; // nothing to be done
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index 5e203e25b77..2e290086017 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -1140,6 +1140,12 @@ be_visitor_root::visit_home (be_home *node)
status = node->accept (&visitor);
break;
}
+ case TAO_CodeGen::TAO_ROOT_CS:
+ {
+ be_visitor_home_cs visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
default:
return 0; // nothing to be done
}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
index 0f3dce7dbe6..d900dfbbfad 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_decl.cpp
@@ -105,6 +105,12 @@ be_visitor_typecode_decl::visit_component (be_component *node)
}
int
+be_visitor_typecode_decl::visit_home (be_home *node)
+{
+ return this->visit_type (node);
+}
+
+int
be_visitor_typecode_decl::visit_sequence (be_sequence *node)
{
return this->visit_type (node);
diff --git a/TAO/TAO_IDL/be_include/be_visitor_home.h b/TAO/TAO_IDL/be_include/be_visitor_home.h
index b511f6cd2a9..f8fa355bcdd 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_home.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_home.h
@@ -23,7 +23,9 @@
#define TAO_BE_VISITOR_HOME_H
#include "be_visitor_decl.h"
+#include "be_visitor_typecode/typecode_decl.h"
#include "be_visitor_home/home_ch.h"
+#include "be_visitor_home/home_cs.h"
#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h b/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h
new file mode 100644
index 00000000000..77c1a60f7e6
--- /dev/null
+++ b/TAO/TAO_IDL/be_include/be_visitor_home/home_cs.h
@@ -0,0 +1,46 @@
+//
+// $Id$
+//
+/* -*- c++ -*- */
+// ============================================================================
+//
+// = LIBRARY
+// TAO IDL
+//
+// = FILENAME
+// home_cs.h
+//
+// = DESCRIPTION
+// Concrete visitor for the Component Home node.
+// This one provides code generation for component home node.
+//
+// = AUTHOR
+// Jeff Parsons
+//
+// ============================================================================
+
+#ifndef _BE_VISITOR_HOME_CS_H_
+#define _BE_VISITOR_HOME_CS_H_
+
+class be_visitor_home_cs : public be_visitor_decl
+{
+ //
+ // = TITLE
+ // be_visitor_home_cs
+ //
+ // = DESCRIPTION
+ // This is the visitor for component home for the source file
+ //
+ //
+public:
+ be_visitor_home_cs (be_visitor_context *ctx);
+ // constructor
+
+ ~be_visitor_home_cs (void);
+ // destructor
+
+ virtual int visit_home (be_home *node);
+ // visit home.
+};
+
+#endif /* _BE_VISITOR_HOME_CS_H_ */
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h
index 0685cf845f9..122d59eea0d 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_decl.h
@@ -60,6 +60,9 @@ public:
virtual int visit_component (be_component *node);
// visit component
+ virtual int visit_home (be_home *node);
+ // visit home
+
virtual int visit_sequence (be_sequence *node);
// visit a sequence
diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h
index 8aeb582807e..f9d0c7d0f0f 100644
--- a/TAO/TAO_IDL/include/ast_interface.h
+++ b/TAO/TAO_IDL/include/ast_interface.h
@@ -125,6 +125,10 @@ public:
// Check if we have redefined any of our parents' operations or attributes,
// and check if there is such a clash among the parents
virtual idl_bool redef_clash (void);
+
+ // Accessors for the member.
+ idl_bool home_equiv (void) const;
+ void home_equiv (idl_bool val);
// Look through inherited interfaces.
virtual AST_Decl *look_in_inherited (UTL_ScopedName *e,
@@ -168,6 +172,9 @@ protected:
// Queue of dequeued nodes to be searched for the above case.
ACE_Unbounded_Queue<AST_Interface *> del_queue;
+
+ // Are we the equivalent interface of a home?
+ idl_bool home_equiv_;
protected:
// Scope Management Protocol.