summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-08-20 17:11:34 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-08-20 17:11:34 +0000
commit4d06665bfcfc8351507e0c22c719f22360ee3c48 (patch)
treea1fe2fd5b5f1fdaa2ee70aeb8d08b81bf7a14b70
parent87cdc5e1046624b52ddbf30727fce5352aaa3dcc (diff)
downloadATCD-4d06665bfcfc8351507e0c22c719f22360ee3c48.tar.gz
ChangeLogTag: Thu Aug 20 17:09:01 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--modules/TAO/ChangeLog17
-rw-r--r--modules/TAO/TAO_IDL/ast/ast_connector.cpp77
-rw-r--r--modules/TAO/TAO_IDL/fe/fe_utils.cpp7
-rw-r--r--modules/TAO/TAO_IDL/fe/idl.yy79
-rw-r--r--modules/TAO/TAO_IDL/include/ast_connector.h8
-rw-r--r--modules/TAO/TAO_IDL/include/fe_utils.h9
-rw-r--r--modules/TAO/TAO_IDL/include/utl_scope.h7
-rw-r--r--modules/TAO/TAO_IDL/util/utl_scope.cpp12
8 files changed, 215 insertions, 1 deletions
diff --git a/modules/TAO/ChangeLog b/modules/TAO/ChangeLog
index f7fd087b588..162e6473b0c 100644
--- a/modules/TAO/ChangeLog
+++ b/modules/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Thu Aug 20 17:09:01 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/ast/ast_connector.cpp:
+ * TAO_IDL/fe/fe_utils.cpp:
+ * TAO_IDL/fe/idl.yy:
+ * TAO_IDL/include/ast_connector.h:
+ * TAO_IDL/include/fe_utils.h:
+ * TAO_IDL/include/utl_scope.h:
+ * TAO_IDL/util/utl_scope.cpp:
+
+ Added methods to add AST_Tmpl_Port and AST_Tmpl_Mirror_Port
+ nodes to a connector's scope. Also added semantic actions
+ to create these nodes, check their validity, and call the
+ scope adding methods.
+
Wed Aug 19 20:54:41 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/ast/ast_tmpl_mirror_port.cpp:
@@ -27,7 +42,7 @@ Wed Aug 19 20:54:41 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
Intergration of the new node types above into
the IDL compiler.
-
+
Wed Aug 19 16:38:17 UTC 2009 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/fe/idl.yy:
diff --git a/modules/TAO/TAO_IDL/ast/ast_connector.cpp b/modules/TAO/TAO_IDL/ast/ast_connector.cpp
index 2f09e56b86d..8d297fa5e87 100644
--- a/modules/TAO/TAO_IDL/ast/ast_connector.cpp
+++ b/modules/TAO/TAO_IDL/ast/ast_connector.cpp
@@ -1,6 +1,7 @@
// $Id$
#include "ast_connector.h"
+#include "ast_tmpl_mirror_port.h"
#include "ast_visitor.h"
#include "utl_identifier.h"
#include "utl_indenter.h"
@@ -86,5 +87,81 @@ AST_Connector::ast_accept (ast_visitor *visitor)
return visitor->visit_connector (this);
}
+AST_Tmpl_Port *
+AST_Connector::fe_add_tmpl_port (AST_Tmpl_Port *p)
+{
+ AST_Decl *d = 0;
+
+ // Already defined? Or already used?
+ if ((d = this->lookup_for_add (p, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ p,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, p->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ p,
+ this,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (p);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (p,
+ false,
+ p->local_name ());
+
+ return p;
+}
+
+AST_Tmpl_Mirror_Port *
+AST_Connector::fe_add_tmpl_mirror_port (AST_Tmpl_Mirror_Port *p)
+{
+ AST_Decl *d = 0;
+
+ // Already defined? Or already used?
+ if ((d = this->lookup_for_add (p, false)) != 0)
+ {
+ if (!can_be_redefined (d))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ p,
+ this,
+ d);
+ return 0;
+ }
+
+ if (this->referenced (d, p->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ p,
+ this,
+ d);
+ return 0;
+ }
+ }
+
+ // Add it to scope.
+ this->add_to_scope (p);
+
+ // Add it to set of locally referenced symbols.
+ this->add_to_referenced (p,
+ false,
+ p->local_name ());
+
+ return p;
+}
+
IMPL_NARROW_FROM_DECL (AST_Connector)
IMPL_NARROW_FROM_SCOPE (AST_Connector)
diff --git a/modules/TAO/TAO_IDL/fe/fe_utils.cpp b/modules/TAO/TAO_IDL/fe/fe_utils.cpp
index b0fc445a335..2f4c371ddfe 100644
--- a/modules/TAO/TAO_IDL/fe/fe_utils.cpp
+++ b/modules/TAO/TAO_IDL/fe/fe_utils.cpp
@@ -38,6 +38,13 @@ FE_Utils::T_Ref_Info::destroy (void)
}
}
+FE_Utils::T_Port_Info::T_Port_Info (const char *name,
+ AST_PortType *type)
+ : name_ (name),
+ type_ (type)
+{
+}
+
FE_Utils::T_Inst_Info::T_Inst_Info (UTL_ScopedName *n,
UTL_NameList *args)
: name_ (n),
diff --git a/modules/TAO/TAO_IDL/fe/idl.yy b/modules/TAO/TAO_IDL/fe/idl.yy
index 96d48206089..48bfaeb3e09 100644
--- a/modules/TAO/TAO_IDL/fe/idl.yy
+++ b/modules/TAO/TAO_IDL/fe/idl.yy
@@ -181,6 +181,7 @@ AST_Decl *tao_enum_constant_decl = 0;
FE_Utils::T_Ref_Info *trval; /* Template interface info */
FE_Utils::T_REFLIST_INFO *rlval; /* List of above structs */
FE_Utils::T_Inst_Info *tival; /* Template instantiation */
+ FE_Utils::T_Port_Info *ptval /* Porttype reference */
}
/*
@@ -357,6 +358,8 @@ AST_Decl *tao_enum_constant_decl = 0;
%type <thval> template_interface_header
%type <tival> template_inst
+
+%type <ptval> template_ref_decl
%%
/*
@@ -6751,11 +6754,87 @@ If this is also legal, there will be conflicts to be resolved
template_extended_port_decl
: IDL_PORT template_ref_decl
+ {
+// template_extended_port_decl : IDL_PORT template_ref_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
+ if ($2 != 0)
+ {
+ Identifier id ($2->name_.c_str ());
+ UTL_ScopedName sn (&id, 0);
+
+ AST_Tmpl_Port *pt =
+ idl_global->gen ()->create_tmpl_port (
+ &sn,
+ $2->type_);
+
+ (void) s->fe_add_tmpl_port (pt);
+
+ delete $2;
+ $2 = 0;
+ }
+ }
| IDL_MIRRORPORT template_ref_decl
+ {
+// | IDL_MIRRORPORT template_ref_decl
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+
+ if ($2 != 0)
+ {
+ Identifier id ($2->name_.c_str ());
+ UTL_ScopedName sn (&id, 0);
+
+ AST_Tmpl_Mirror_Port *pt =
+ idl_global->gen ()->create_tmpl_mirror_port (
+ &sn,
+ $2->type_);
+
+ (void) s->fe_add_tmpl__mirror_port (pt);
+
+ delete $2;
+ $2 = 0;
+ }
+ }
;
template_ref_decl
: template_ref IDENTIFIER
+ {
+// template_ref_decl : template_ref IDENTIFIER
+ $$ = 0;
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ AST_Decl *d = s->lookup_by_name ($1->name_,
+ true);
+
+ if (d == 0)
+ {
+ idl_global->err ()->lookup_error ($1->name_);
+ }
+ else
+ {
+ AST_PortType *pt = AST_PortType::narrow_from_decl (d);
+
+ if (pt == 0)
+ {
+ idl_global->err ()->error1 (UTL_Error::EIDL_PORTTYPE_EXPECTED,
+ d);
+ }
+ else
+ {
+ ACE_NEW_RETURN ($$,
+ FE_Utils::T_Port_Info ($2,
+ pt),
+ 1);
+ }
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+
+ ACE::strdelete ($2);
+ $2 = 0;
+ }
;
%%
diff --git a/modules/TAO/TAO_IDL/include/ast_connector.h b/modules/TAO/TAO_IDL/include/ast_connector.h
index e16636de46f..29cb5de7afb 100644
--- a/modules/TAO/TAO_IDL/include/ast_connector.h
+++ b/modules/TAO/TAO_IDL/include/ast_connector.h
@@ -7,6 +7,9 @@
#include "ast_component.h"
#include "fe_utils.h"
+class AST_Tmpl_Port;
+class AST_Tmpl_Mirror_Port;
+
class TAO_IDL_FE_Export AST_Connector
: public virtual AST_Component
{
@@ -35,6 +38,11 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+protected:
+ virtual AST_Tmpl_Port *fe_add_tmpl_port (AST_Tmpl_Port *p);
+ virtual AST_Tmpl_Mirror_Port *fe_add_tmpl_mirror_port (
+ AST_Tmpl_Mirror_Port *p);
+
private:
FE_Utils::T_PARAMLIST_INFO *template_params_;
};
diff --git a/modules/TAO/TAO_IDL/include/fe_utils.h b/modules/TAO/TAO_IDL/include/fe_utils.h
index 3de5df8cdc7..7ac488e4203 100644
--- a/modules/TAO/TAO_IDL/include/fe_utils.h
+++ b/modules/TAO/TAO_IDL/include/fe_utils.h
@@ -11,6 +11,7 @@ class UTL_StrList;
class UTL_IdList;
typedef UTL_IdList UTL_ScopedName;
class UTL_NameList;
+class AST_PortType;
struct TAO_IDL_FE_Export FE_Utils
{
@@ -34,6 +35,14 @@ struct TAO_IDL_FE_Export FE_Utils
};
typedef ACE_Unbounded_Queue<T_Ref_Info> T_REFLIST_INFO;
+
+ struct T_Port_Info
+ {
+ ACE_CString name_;
+ AST_PortType *type_;
+
+ T_Port_Info (const char *name, AST_PortType *type);
+ };
struct T_Inst_Info
{
diff --git a/modules/TAO/TAO_IDL/include/utl_scope.h b/modules/TAO/TAO_IDL/include/utl_scope.h
index 13e53081649..f86ebc01de4 100644
--- a/modules/TAO/TAO_IDL/include/utl_scope.h
+++ b/modules/TAO/TAO_IDL/include/utl_scope.h
@@ -128,6 +128,8 @@ class AST_Consumes;
class AST_Extended_Port;
class AST_Mirror_Port;
class AST_Connector;
+class AST_Tmpl_Port;
+class AST_Tmpl_Mirror_Port;
class UTL_StrList;
class UTL_NameList;
@@ -462,6 +464,11 @@ private:
virtual AST_Extended_Port *fe_add_extended_port (AST_Extended_Port *ep);
virtual AST_Mirror_Port *fe_add_mirror_port (AST_Mirror_Port *mp);
+
+ virtual AST_Tmpl_Port *fe_add_tmpl_port (AST_Tmpl_Port *p);
+
+ virtual AST_Tmpl_Mirror_Port *fe_add_tmpl_mirror_port (
+ AST_Tmpl_Mirror_Port *p);
};
// Active iterator for a UTL_Scope node
diff --git a/modules/TAO/TAO_IDL/util/utl_scope.cpp b/modules/TAO/TAO_IDL/util/utl_scope.cpp
index dc3f57b4125..35c722c3b86 100644
--- a/modules/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/modules/TAO/TAO_IDL/util/utl_scope.cpp
@@ -1287,6 +1287,18 @@ UTL_Scope::fe_add_connector (AST_Connector *)
return 0;
}
+AST_Tmpl_Port *
+UTL_Scope::fe_add_tmpl_port (AST_Tmpl_Port *)
+{
+ return 0;
+}
+
+AST_Tmpl_Mirror_Port *
+UTL_Scope::fe_add_tmpl_mirror_port (AST_Tmpl_Mirror_Port *)
+{
+ return 0;
+}
+
// This is the second pass of the front end
// It calls the public add protocol on everything in scope.
// It calls the add_xx functions of the most derived AST_Node.