summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-25 17:19:27 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-10-25 17:19:27 +0000
commit5428ca2afc9c5afc5c3fb61c272e39eff53ad6c2 (patch)
tree3938fbef262435ab241d0224331627542799546b
parenta712cb080cf8d8b9c2f54adb502dfaaed43cd96b (diff)
downloadATCD-5428ca2afc9c5afc5c3fb61c272e39eff53ad6c2.tar.gz
ChangeLogTag: Sun Oct 25 17:10:27 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog25
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp9
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component.cpp1
-rw-r--r--modules/TAO/TAO_IDL/be/be_visitor_component_scope.cpp (renamed from modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp)80
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h4
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component.h2
-rw-r--r--modules/TAO/TAO_IDL/be_include/be_visitor_component_scope.h (renamed from modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h)28
7 files changed, 123 insertions, 26 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index b675918f665..2e54ee60157 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,28 @@
+Sun Oct 25 17:10:27 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be_include/be_visitor_component_scope.h:
+ * TAO_IDL/be/be_visitor_component_scope.cpp:
+
+ Moved these files from the be_visitor_component
+ subdirectory, so the visitor would be accessible
+ as a base class to be_visitor_ccm_pre_proc. Also
+ add override of base class (be_visitor_scope)
+ method pre_proces(), to extend the generated
+ names of provides and uses methods with a
+ prefix of the port or mirrorport name, if any.
+
+ * TAO_IDL/be/be_visitor_ccm_pre_proc.cpp:
+ * TAO_IDL/be_include/be_visitor_ccm_pre_proc.h:
+
+ Made class be_visitor_component_scope the base class
+ of this visitor, thereby adding support for simple
+ ports, mirrorports and porttypes.
+
+ * TAO_IDL/be_include/be_visitor_component.h:
+ * TAO_IDL/be/be_visitor_component.cpp:
+
+ Removed relocated files from these file lists.
+
Thu Oct 22 20:39:02 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_visitor_component/component_scope.cpp:
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index 24d10dce4d2..c949e244fea 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -41,10 +41,6 @@
#include "global_extern.h"
#include "nr_extern.h"
-ACE_RCSID (be,
- be_visitor_ccm_pre_proc,
- "$Id$")
-
const char *EXCEP_NAMES[] =
{
"AlreadyConnected",
@@ -64,8 +60,9 @@ const char *EXCEP_NAMES[] =
const int N_EXCEPS = sizeof (EXCEP_NAMES) / sizeof (char *);
be_exception *EXCEPS[N_EXCEPS];
-be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (be_visitor_context *ctx)
- : be_visitor_scope (ctx),
+be_visitor_ccm_pre_proc::be_visitor_ccm_pre_proc (
+ be_visitor_context *ctx)
+ : be_visitor_component_scope (ctx),
module_id_ ("Components"),
cookie_ (0),
already_connected_ (0),
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
index 86390b42de3..16802a84032 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component.cpp
@@ -60,7 +60,6 @@
#include "be_extern.h"
#include "be_visitor_component/component.cpp"
-#include "be_visitor_component/component_scope.cpp"
#include "be_visitor_component/component_ch.cpp"
#include "be_visitor_component/component_ci.cpp"
#include "be_visitor_component/component_cs.cpp"
diff --git a/modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp b/modules/TAO/TAO_IDL/be/be_visitor_component_scope.cpp
index 5666eb6db84..4e4502653e3 100644
--- a/modules/TAO/TAO_IDL/be/be_visitor_component/component_scope.cpp
+++ b/modules/TAO/TAO_IDL/be/be_visitor_component_scope.cpp
@@ -8,7 +8,7 @@
// TAO IDL
//
// = FILENAME
-// component_scope.cpp
+// be_visitor_component_scope.cpp
//
// = DESCRIPTION
// Abstract visitor providing ancestor scope visitation.
@@ -18,6 +18,19 @@
//
// ============================================================================
+#include "be_visitor_component_scope.h"
+#include "be_visitor_context.h"
+
+#include "be_mirror_port.h"
+#include "be_component.h"
+#include "be_provides.h"
+#include "be_uses.h"
+
+#include "be_extern.h"
+
+#include "utl_identifier.h"
+#include "nr_extern.h"
+
be_visitor_component_scope::be_visitor_component_scope (
be_visitor_context *ctx)
: be_visitor_scope (ctx),
@@ -46,21 +59,33 @@ int
be_visitor_component_scope::visit_extended_port (
be_extended_port *node)
{
- return this->visit_porttype (node->port_type ());
+
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Store this to prefix to contained provides or uses node name.
+ if (nt == AST_Decl::NT_component || nt == AST_Decl::NT_connector)
+ {
+ this->current_port_name_ = node->local_name ()->get_string ();
+ }
+
+ return this->visit_porttype_scope (node->port_type ());
}
int
be_visitor_component_scope::visit_mirror_port (
be_mirror_port *node)
{
- return this->visit_porttype_mirror (node->port_type ());
-}
-
-int
-be_visitor_component_scope::visit_porttype (
- be_porttype *node)
-{
- return this->visit_scope (node);
+ AST_Decl::NodeType nt =
+ ScopeAsDecl (node->defined_in ())->node_type ();
+
+ // Store this to prefix to contained provides or uses node name.
+ if (nt == AST_Decl::NT_component || nt == AST_Decl::NT_connector)
+ {
+ this->current_port_name_ = node->local_name ()->get_string ();
+ }
+
+ return this->visit_porttype_scope_mirror (node->port_type ());
}
int
@@ -86,13 +111,22 @@ be_visitor_component_scope::visit_component_scope (
}
int
-be_visitor_component_scope::visit_porttype_mirror (be_porttype *node)
+be_visitor_component_scope::visit_porttype_scope (
+ be_porttype *node)
+{
+ return this->visit_scope (node);
+}
+
+int
+be_visitor_component_scope::visit_porttype_scope_mirror (be_porttype *node)
{
for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
!si.is_done ();
si.next ())
{
be_decl *d = be_decl::narrow_from_decl (si.item ());
+
+ (void) this->pre_process (d);
switch (d->node_type ())
{
@@ -143,4 +177,28 @@ be_visitor_component_scope::visit_porttype_mirror (be_porttype *node)
}
return 0;
+}
+
+int
+be_visitor_component_scope::pre_process (be_decl *node)
+{
+ AST_Decl::NodeType nt = node->node_type ();
+
+ if (nt == AST_Decl::NT_provides || nt == AST_Decl::NT_uses)
+ {
+ AST_Decl *s = ScopeAsDecl (node->defined_in ());
+ AST_Decl::NodeType snt = s->node_type ();
+
+ if (snt == AST_Decl::NT_porttype)
+ {
+ ACE_CString new_name = current_port_name_;
+ new_name += '_';
+ new_name += node->local_name ()->get_string ();
+
+ Identifier *i = node->name ()->last_component ();
+ i->replace_string (new_name.c_str ());
+ }
+ }
+
+ return 0;
} \ No newline at end of file
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
index b2502f0bb26..77d2a6bcafa 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
@@ -25,7 +25,7 @@
#ifndef TAO_BE_VISITOR_CCM_PRE_PROC_H
#define TAO_BE_VISITOR_CCM_PRE_PROC_H
-#include "be_visitor_scope.h"
+#include "be_visitor_component_scope.h"
#include "ast_component.h"
#include "ast_template_common.h"
#include "utl_identifier.h"
@@ -35,7 +35,7 @@ class be_exception;
class UTL_ExceptList;
class AST_Template_Interface;
-class be_visitor_ccm_pre_proc : public be_visitor_scope
+class be_visitor_ccm_pre_proc : public be_visitor_component_scope
{
//
// = TITLE
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
index bd65fdcacee..92a14b88dfe 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component.h
@@ -23,9 +23,9 @@
#define TAO_BE_VISITOR_COMPONENT_H
#include "be_visitor_interface.h"
+#include "be_visitor_component_scope.h"
#include "be_visitor_component/component.h"
-#include "be_visitor_component/component_scope.h"
#include "be_visitor_component/component_ch.h"
#include "be_visitor_component/component_ci.h"
#include "be_visitor_component/component_cs.h"
diff --git a/modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h b/modules/TAO/TAO_IDL/be_include/be_visitor_component_scope.h
index d8d3166f239..6bf54abf1d1 100644
--- a/modules/TAO/TAO_IDL/be_include/be_visitor_component/component_scope.h
+++ b/modules/TAO/TAO_IDL/be_include/be_visitor_component_scope.h
@@ -8,7 +8,7 @@
// TAO IDL
//
// = FILENAME
-// component_scope.h
+// be_visitor_component_scope.h
//
// = DESCRIPTION
// Base class for visitors that need to visit the scope of a
@@ -22,6 +22,10 @@
#ifndef _BE_COMPONENT_COMPONENT_SCOPE_H_
#define _BE_COMPONENT_COMPONENT_SCOPE_H_
+#include "ace/SString.h"
+
+#include "be_visitor_scope.h"
+
class be_visitor_component_scope : public be_visitor_scope
{
//
@@ -40,14 +44,25 @@ protected:
public:
virtual int visit_extended_port (be_extended_port *node);
virtual int visit_mirror_port (be_mirror_port *node);
- virtual int visit_porttype (be_porttype *node);
// Automatically recurses to the ancestor scopes, if any.
int visit_component_scope (be_component *node);
- // Swaps uses for provides members and vice versa.S
-
- int visit_porttype_mirror (be_porttype *node);
+ // These two methods are used instead of overriding
+ // visit_porttype so we can traverse a porttype only
+ // when it is referenced.
+
+ int visit_porttype_scope (be_porttype *node);
+
+ // Swaps uses for provides members and vice versa.S
+ int visit_porttype_scope_mirror (be_porttype *node);
+
+ // This override is used to prefix a provides or uses
+ // node's local name with the name of the port or
+ // mirrorport node that may contain reference the
+ // containing porttype.
+ // TODO - support nested ports, if they are allowed.
+ virtual int pre_process (be_decl *);
protected:
be_component *node_;
@@ -55,6 +70,9 @@ protected:
ACE_CString export_macro_;
bool swapping_;
bool static_config_;
+
+private:
+ ACE_CString current_port_name_;
};
#endif /* _BE_COMPONENT_COMPONENT_SCOPE_H_ */