summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgmaxey <gmaxey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-06-17 23:53:56 +0000
committergmaxey <gmaxey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-06-17 23:53:56 +0000
commit5449abbf3184d96d39414764514b4b0a18544aa9 (patch)
treeb09980202be7b5ba8052964fc757c1e00fb1d4be
parent578d97fb32ffa3bff3f9a41474944cb01936c646 (diff)
downloadATCD-5449abbf3184d96d39414764514b4b0a18544aa9.tar.gz
ChangeLogTag: Fri Jun 17 23:45:00 UTC 2005 Gary Maxey <gary.maxey@hp.com>
-rw-r--r--TAO/ChangeLog19
-rw-r--r--TAO/TAO_IDL/ast/ast_generator.cpp13
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp49
-rw-r--r--TAO/TAO_IDL/ast/ast_redef.cpp1
-rw-r--r--TAO/TAO_IDL/ast/ast_valuebox.cpp62
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h1
-rw-r--r--TAO/TAO_IDL/include/ast_generator.h4
-rw-r--r--TAO/TAO_IDL/include/ast_module.h2
-rw-r--r--TAO/TAO_IDL/include/ast_valuebox.h39
-rw-r--r--TAO/TAO_IDL/include/ast_visitor.h4
-rw-r--r--TAO/TAO_IDL/include/idl_global.h1
-rw-r--r--TAO/TAO_IDL/include/utl_err.h1
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h3
-rw-r--r--TAO/TAO_IDL/util/utl_err.cpp4
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp7
15 files changed, 210 insertions, 0 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 29e0afde745..41bf8fb5231 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,22 @@
+Fri Jun 17 23:45:00 UTC 2005 Gary Maxey <gary.maxey@hp.com>
+
+ * TAO_IDL/include/ast_decl.h
+ * TAO_IDL/include/ast_generator.h
+ * TAO_IDL/include/ast_module.h
+ * TAO_IDL/include/ast_valuebox.h
+ * TAO_IDL/include/ast_visitor.h
+ * TAO_IDL/include/idl_global.h
+ * TAO_IDL/include/utl_err.h
+ * TAO_IDL/include/utl_scope.h
+ * TAO_IDL/util/utl_err.cpp
+ * TAO_IDL/util/utl_scope.cpp
+ * TAO_IDL/ast/ast_generator.cpp
+ * TAO_IDL/ast/ast_module.cpp
+ * TAO_IDL/ast/ast_redef.cpp
+ * TAO_IDL/ast/ast_valuebox.cpp
+ Changes and additions to IDL compiler front-end for
+ valuebox support.
+
Fri Jun 17 15:40:51 2005 J.T. Conklin <jtc@acorntoolworks.com>
* orbsvcs/orbsvcs/orbsvcs.rc:
diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp
index 81765b7807f..474c6f6d9f8 100644
--- a/TAO/TAO_IDL/ast/ast_generator.cpp
+++ b/TAO/TAO_IDL/ast/ast_generator.cpp
@@ -71,6 +71,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// of every AST class.
#include "ast_root.h"
+#include "ast_valuebox.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
@@ -901,3 +902,15 @@ AST_Generator::create_factory (UTL_ScopedName *n)
return retval;
}
+
+AST_ValueBox *
+AST_Generator::create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type)
+{
+ AST_ValueBox *retval = 0;
+ ACE_NEW_RETURN (retval,
+ AST_ValueBox (n, boxed_type),
+ 0);
+
+ return retval;
+}
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index 55fc86f68ee..eb7aff2a1bc 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -70,6 +70,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_module.h"
#include "ast_predefined_type.h"
+#include "ast_valuebox.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
@@ -346,6 +347,54 @@ AST_Module::fe_add_interface (AST_Interface *t)
return t;
}
+
+// Add this AST_ValueBox node (a value type declaration) to this scope.
+AST_ValueBox *
+AST_Module::fe_add_valuebox (AST_ValueBox *t)
+{
+ AST_Decl *predef = 0;
+
+ // Already defined and cannot be redefined? Or already used?
+ if ((predef = this->lookup_for_add (t, I_FALSE)) != 0)
+ {
+ if (!can_be_redefined (predef))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (referenced (predef, t->local_name ()))
+ {
+ idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE,
+ t,
+ this,
+ predef);
+
+ return 0;
+ }
+ else if (t->has_ancestor (predef))
+ {
+ idl_global->err ()->redefinition_in_scope (t,
+ predef);
+
+ return 0;
+ }
+ }
+
+ // Add it to scope
+ this->add_to_scope (t);
+
+ // Add it to set of locally referenced symbols
+ this->add_to_referenced (t,
+ I_FALSE,
+ t->local_name ());
+ return t;
+}
+
+
// Add this AST_ValueType node (a value type declaration) to this scope.
AST_ValueType *
AST_Module::fe_add_valuetype (AST_ValueType *t)
diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp
index 42668eb1174..d729fe93466 100644
--- a/TAO/TAO_IDL/ast/ast_redef.cpp
+++ b/TAO/TAO_IDL/ast/ast_redef.cpp
@@ -101,6 +101,7 @@ can_be_redefined (AST_Decl *d)
case AST_Decl::NT_struct_fwd:
case AST_Decl::NT_enum:
case AST_Decl::NT_typedef:
+ case AST_Decl::NT_valuebox:
return I_TRUE;
case AST_Decl::NT_union_branch:
diff --git a/TAO/TAO_IDL/ast/ast_valuebox.cpp b/TAO/TAO_IDL/ast/ast_valuebox.cpp
new file mode 100644
index 00000000000..7ffda49ed57
--- /dev/null
+++ b/TAO/TAO_IDL/ast/ast_valuebox.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+#include "ast_valuebox.h"
+#include "ast_visitor.h"
+#include "utl_identifier.h"
+
+ACE_RCSID (ast,
+ ast_valuebox,
+ "ast_valuebox.cpp,v 1.0 Exp")
+
+AST_ValueBox::AST_ValueBox (void)
+ : COMMON_Base (),
+ AST_Decl (),
+ AST_Type (),
+ AST_ConcreteType ()
+{
+}
+
+AST_ValueBox::AST_ValueBox (UTL_ScopedName *n,
+ AST_Type *boxed_type)
+ : COMMON_Base (),
+ AST_Decl (AST_Decl::NT_valuebox,
+ n, I_TRUE),
+ AST_Type (AST_Decl::NT_valuebox,
+ n),
+ AST_ConcreteType (AST_Decl::NT_valuebox, n),
+ pd_boxed_type (boxed_type)
+{
+}
+
+AST_ValueBox::~AST_ValueBox (void)
+{
+}
+
+AST_Type *
+AST_ValueBox::boxed_type (void) const
+{
+ return this->pd_boxed_type;
+}
+
+void
+AST_ValueBox::dump (ACE_OSTREAM_TYPE &o)
+{
+
+ this->dump_i (o, "valuetype ");
+
+ this->local_name ()->dump (o);
+ this->dump_i (o, " ");
+ this->pd_boxed_type->dump (o);
+}
+
+int
+AST_ValueBox::ast_accept (ast_visitor *visitor)
+{
+ return visitor->visit_valuebox (this);
+}
+
+// Narrowing.
+IMPL_NARROW_METHODS1(AST_ValueBox, AST_ConcreteType)
+IMPL_NARROW_FROM_DECL(AST_ValueBox)
+
+
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
index 5d22107687d..ce6cedc495b 100644
--- a/TAO/TAO_IDL/include/ast_decl.h
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -153,6 +153,7 @@ public:
, NT_home // Denotes a CORBA component home
, NT_eventtype // Denotes a CCM event source or sink
, NT_eventtype_fwd // Denotes a forward declared CCM event
+ , NT_valuebox // Denotes an value box
};
// Operations.
diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h
index 104758630ff..b3604e4a00f 100644
--- a/TAO/TAO_IDL/include/ast_generator.h
+++ b/TAO/TAO_IDL/include/ast_generator.h
@@ -335,6 +335,10 @@ public:
// Create a node representing an OBV factory construct.
virtual AST_Factory *create_factory (UTL_ScopedName *n);
+
+ // Create a node representing a valuebox.
+ virtual AST_ValueBox *create_valuebox (UTL_ScopedName *n,
+ AST_Type *boxed_type);
};
#endif // _AST_GENERATOR_AST_GENERATOR_HH
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index a4c326d00db..e220bb8579f 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -179,6 +179,8 @@ private:
virtual AST_Native *fe_add_native (AST_Native *n);
+ virtual AST_ValueBox *fe_add_valuebox (AST_ValueBox *vb);
+
idl_bool pd_has_nested_valuetype;
ACE_Unbounded_Set<AST_Decl *> previous_;
diff --git a/TAO/TAO_IDL/include/ast_valuebox.h b/TAO/TAO_IDL/include/ast_valuebox.h
new file mode 100644
index 00000000000..5222dbe97be
--- /dev/null
+++ b/TAO/TAO_IDL/include/ast_valuebox.h
@@ -0,0 +1,39 @@
+// This may look like C, but it's really -*- C++ -*-
+// $Id$
+
+#ifndef _AST_VALUEBOX_AST_VALUEBOX_HH
+#define _AST_VALUEBOX_AST_VALUEBOX_HH
+
+#include "ast_concrete_type.h"
+
+class TAO_IDL_FE_Export AST_ValueBox : public virtual AST_ConcreteType
+{
+public:
+
+ // Constructor(s) and destructor.
+ AST_ValueBox (void);
+
+ AST_ValueBox (UTL_ScopedName *n,
+ AST_Type *boxed_type);
+
+ virtual ~AST_ValueBox (void);
+
+ // Data Accessors.
+ AST_Type *boxed_type (void) const;
+
+ // Narrowing.
+ DEF_NARROW_METHODS1(AST_ValueBox, AST_ConcreteType);
+ DEF_NARROW_FROM_DECL(AST_ValueBox);
+
+ // AST Dumping.
+ virtual void dump (ACE_OSTREAM_TYPE &o);
+
+ // Visiting.
+ virtual int ast_accept (ast_visitor *visitor);
+
+protected:
+ AST_Type *pd_boxed_type;
+
+};
+
+#endif // _AST_VALUEBOX_AST_VALUEBOX_HH
diff --git a/TAO/TAO_IDL/include/ast_visitor.h b/TAO/TAO_IDL/include/ast_visitor.h
index b41d64a9420..1fbb566a744 100644
--- a/TAO/TAO_IDL/include/ast_visitor.h
+++ b/TAO/TAO_IDL/include/ast_visitor.h
@@ -29,6 +29,7 @@ class AST_PredefinedType;
class AST_Module;
class AST_Interface;
class AST_InterfaceFwd;
+class AST_ValueBox;
class AST_ValueType;
class AST_ValueTypeFwd;
class AST_Component;
@@ -187,6 +188,9 @@ public:
virtual int visit_native (AST_Native *node) = 0;
// Visit a native.
+
+ virtual int visit_valuebox (AST_ValueBox *node) = 0;
+ // Visit a valuebox.
};
#endif /* TAO_IDL_FE_DLL_AST_VISITOR_H */
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index 4672cb826fb..24ee70d1114 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -263,6 +263,7 @@ public:
, PS_DeclsDeclSeen // Seen complete decl in decls list
, PS_NativeSeen // Seen a native declaration
, PS_PragmaPrefixSyntax // Could not parse the #pragma prefix
+ , PS_ValueBoxDeclSeen // Seen complete valuebox declaration
};
// flags for types of declarations seen while parsing.
diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h
index a5c90ce1595..ea9792768a0 100644
--- a/TAO/TAO_IDL/include/utl_err.h
+++ b/TAO/TAO_IDL/include/utl_err.h
@@ -138,6 +138,7 @@ public:
EIDL_LOCAL_REMOTE_MISMATCH, // Local type used in remote operation
EIDL_IGNORE_IDL3_ERROR, // -Sm option used with component or home decl
EIDL_TC_SUPPRESSION_WARNING,// -St option used with exception decl
+ EIDL_ILLEGAL_VALUETYPE, // Valuetype not allowed for box value type
EIDL_OK // No error
};
diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h
index f1b6dd6ad54..81e53e1265e 100644
--- a/TAO/TAO_IDL/include/utl_scope.h
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -93,6 +93,7 @@ class AST_PredefinedType;
class AST_Module;
class AST_Interface;
class AST_InterfaceFwd;
+class AST_ValueBox;
class AST_ValueType;
class AST_ValueTypeFwd;
class AST_EventType;
@@ -428,6 +429,8 @@ private:
virtual AST_Native *fe_add_native (AST_Native *n);
virtual AST_Factory *fe_add_factory (AST_Factory *f);
+
+ virtual AST_ValueBox *fe_add_valuebox (AST_ValueBox *vb);
};
// Active iterator for a UTL_Scope node
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp
index df18556b3e2..93bc2d29c61 100644
--- a/TAO/TAO_IDL/util/utl_err.cpp
+++ b/TAO/TAO_IDL/util/utl_err.cpp
@@ -208,6 +208,8 @@ error_string (UTL_Error::ErrorCode c)
case UTL_Error::EIDL_TC_SUPPRESSION_WARNING:
/* More intelligible message printed by warning routine */
return "";
+ case UTL_Error::EIDL_ILLEGAL_VALUETYPE:
+ return "valuetype not allowed as type of boxed value type";
}
return 0;
@@ -604,6 +606,8 @@ parse_state_to_error_message (IDL_GlobalData::ParseState ps)
return "Illegal syntax after declarator in declarators list";
case IDL_GlobalData::PS_PragmaPrefixSyntax:
return "Illegal syntax for #pragma prefix";
+ case IDL_GlobalData::PS_ValueBoxDeclSeen:
+ return "Missing boxed valuetype identifier following VALUETYPE keyword";
default:
return "Some syntax error";
}
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 111c812068b..10d65e8bf0d 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -69,6 +69,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_err.h"
#include "utl_indenter.h"
#include "utl_string.h"
+#include "ast_valuebox.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
@@ -1040,6 +1041,12 @@ UTL_Scope::fe_add_interface_fwd (AST_InterfaceFwd *)
return 0;
}
+AST_ValueBox *
+UTL_Scope::fe_add_valuebox (AST_ValueBox *)
+{
+ return 0;
+}
+
AST_ValueType *
UTL_Scope::fe_add_valuetype (AST_ValueType *)
{