summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgmaxey <gmaxey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-06-22 18:42:11 +0000
committergmaxey <gmaxey@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-06-22 18:42:11 +0000
commit127be26c78b9c8580202894211d75936cd623b0f (patch)
tree6ede6b358ba752ce427deec4accab50e8ce0e4ff
parent6cb03f568d389666bffd924c617176053ebe164e (diff)
downloadATCD-127be26c78b9c8580202894211d75936cd623b0f.tar.gz
ChangeLogTag: Wed Jun 22 11:34:12 2005 Gary Maxey <gary.maxey@hp.com>
-rw-r--r--TAO/ChangeLog7
-rw-r--r--TAO/TAO_IDL/fe/idl.yy52
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp54
3 files changed, 98 insertions, 15 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 2f2a59c0c4c..5bd365b0ea7 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jun 22 11:34:12 2005 Gary Maxey <gary.maxey@hp.com>
+
+ * TAO_IDL/fe/y.tab.cpp
+ * TAO_IDL/fe/idl.yy
+
+ Added valuebox support
+
Wed Jun 22 08:23:16 2005 J.T. Conklin <jtc@acorntoolworks.com>
* orbsvcs/orbsvcs/Log/Iterator_i.cpp (handle_timeout):
diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy
index b195ccbca1c..e785b5e6dd5 100644
--- a/TAO/TAO_IDL/fe/idl.yy
+++ b/TAO/TAO_IDL/fe/idl.yy
@@ -79,6 +79,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_operation.h"
#include "ast_generator.h"
#include "ast_module.h"
+#include "ast_valuebox.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
@@ -956,13 +957,50 @@ value_box_decl
: value_decl type_spec /* in this order %!?*/
{
// value_box_decl : value_decl type_spec
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
- ACE_TEXT (" boxes yet\n")));
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
+
+ if (s != 0 && $2 != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl ($2);
+
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl ($2);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
+
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type ($2);
+ }
+
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (UTL_Error::EIDL_ILLEGAL_VALUETYPE);
+ }
+
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
}
;
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp
index e27d68e7020..6fd84fb8f03 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/TAO/TAO_IDL/fe/y.tab.cpp
@@ -223,6 +223,7 @@
#include "ast_operation.h"
#include "ast_generator.h"
#include "ast_module.h"
+#include "ast_valuebox.h"
#include "ast_valuetype.h"
#include "ast_valuetype_fwd.h"
#include "ast_eventtype.h"
@@ -2828,14 +2829,51 @@ tao_yyreduce:
{
// value_box_decl : value_decl type_spec
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("error in %s line %d\n"),
- idl_global->filename ()->get_string (),
- idl_global->lineno ()));
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("Sorry, I (TAO_IDL) can't handle")
- ACE_TEXT (" boxes yet\n")));
- }
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
+
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
+
+ if (s != 0 && tao_yyvsp[0].dcval != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl (tao_yyvsp[0].dcval);
+
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl (tao_yyvsp[0].dcval);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
+
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type (tao_yyvsp[0].dcval);
+ }
+
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (UTL_Error::EIDL_ILLEGAL_VALUETYPE);
+ }
+
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
+ }
break;
case 78: