diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-24 22:31:21 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-03-24 22:31:21 +0000 |
commit | f5ded2a97a43906b94f9759a9bd469a335f9207b (patch) | |
tree | 205dd5b0dfa1e9fd590e9facc5621aed736f0fc2 | |
parent | d233756bcd64b2d2a820847b4ea276f5e202a98a (diff) | |
download | ATCD-f5ded2a97a43906b94f9759a9bd469a335f9207b.tar.gz |
ChangeLogTag: Sun Mar 24 16:30:01 2002 Jeff Parsons <parsons@cs.wustl.edu>
136 files changed, 3534 insertions, 1435 deletions
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE index 37c1431e09a..85324c19c06 100644 --- a/TAO/TAO_IDL/Makefile.BE +++ b/TAO/TAO_IDL/Makefile.BE @@ -48,9 +48,11 @@ FILES = be/be_array \ be/be_sequence \ be/be_string \ be/be_structure \ + be/be_structure_fwd \ be/be_type \ be/be_typedef \ be/be_union \ + be/be_union_fwd \ be/be_union_branch \ be/be_union_label \ be/be_generator \ @@ -84,9 +86,11 @@ FILES = be/be_array \ be/be_visitor_scope \ be/be_visitor_sequence \ be/be_visitor_structure \ + be/be_visitor_structure_fwd \ be/be_visitor_typecode \ be/be_visitor_typedef \ be/be_visitor_union \ + be/be_visitor_union_fwd \ be/be_visitor_union_branch \ be/be_tmplinst diff --git a/TAO/TAO_IDL/Makefile.FE b/TAO/TAO_IDL/Makefile.FE index 2eb7bd204ac..2f27990c38e 100644 --- a/TAO/TAO_IDL/Makefile.FE +++ b/TAO/TAO_IDL/Makefile.FE @@ -53,9 +53,11 @@ FILES = fe/fe_declarator \ ast/ast_sequence \ ast/ast_string \ ast/ast_structure \ + ast/ast_structure_fwd \ ast/ast_type \ ast/ast_typedef \ ast/ast_union \ + ast/ast_union_fwd \ ast/ast_union_branch \ ast/ast_union_label \ ast/ast_generator \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE.bor b/TAO/TAO_IDL/TAO_IDL_BE.bor index 84cedba6b5c..715fb7e87cd 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE.bor +++ b/TAO/TAO_IDL/TAO_IDL_BE.bor @@ -35,10 +35,12 @@ OBJFILES = \ $(OBJDIR)\be_stream_factory.obj \ $(OBJDIR)\be_string.obj \ $(OBJDIR)\be_structure.obj \ + $(OBJDIR)\be_structure_fwd.obj \ $(OBJDIR)\be_sunsoft.obj \ $(OBJDIR)\be_type.obj \ $(OBJDIR)\be_typedef.obj \ $(OBJDIR)\be_union.obj \ + $(OBJDIR)\be_union_fwd.obj \ $(OBJDIR)\be_union_branch.obj \ $(OBJDIR)\be_union_label.obj \ $(OBJDIR)\be_valuetype.obj \ @@ -64,9 +66,11 @@ OBJFILES = \ $(OBJDIR)\be_visitor_scope.obj \ $(OBJDIR)\be_visitor_sequence.obj \ $(OBJDIR)\be_visitor_structure.obj \ + $(OBJDIR)\be_visitor_structure_fwd.obj \ $(OBJDIR)\be_visitor_typecode.obj \ $(OBJDIR)\be_visitor_typedef.obj \ $(OBJDIR)\be_visitor_union.obj \ + $(OBJDIR)\be_visitor_union_fwd.obj \ $(OBJDIR)\be_visitor_union_branch.obj \ $(OBJDIR)\be_visitor_valuetype.obj \ $(OBJDIR)\be_visitor_valuetype_fwd.obj diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp index 13d3dd60c0d..136cbffa81b 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp @@ -222,6 +222,10 @@ SOURCE=.\be\be_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_sunsoft.cpp
# End Source File
# Begin Source File
@@ -246,6 +250,10 @@ SOURCE=.\be\be_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_union_label.cpp
# End Source File
# Begin Source File
@@ -342,6 +350,10 @@ SOURCE=.\be\be_visitor_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_typecode.cpp
# End Source File
# Begin Source File
@@ -358,6 +370,10 @@ SOURCE=.\be\be_visitor_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_valuetype.cpp
# End Source File
# Begin Source File
@@ -490,6 +506,10 @@ SOURCE=.\be_include\be_structure.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_sunsoft.h
# End Source File
# Begin Source File
@@ -510,6 +530,10 @@ SOURCE=.\be_include\be_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_union_label.h
# End Source File
# Begin Source File
@@ -606,6 +630,10 @@ SOURCE=.\be_include\be_visitor_structure.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_typecode.h
# End Source File
# Begin Source File
@@ -622,6 +650,10 @@ SOURCE=.\be_include\be_visitor_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_valuetype.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp index 0be11d06abe..1f041117a56 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp @@ -215,6 +215,10 @@ SOURCE=.\be\be_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_sunsoft.cpp
# End Source File
# Begin Source File
@@ -239,6 +243,10 @@ SOURCE=.\be\be_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_union_label.cpp
# End Source File
# Begin Source File
@@ -335,6 +343,10 @@ SOURCE=.\be\be_visitor_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_typecode.cpp
# End Source File
# Begin Source File
@@ -351,6 +363,10 @@ SOURCE=.\be\be_visitor_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_visitor_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_visitor_valuetype.cpp
# End Source File
# Begin Source File
@@ -363,10 +379,6 @@ SOURCE=.\be\be_visitor_valuetype_fwd.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\be_include\be.h
-# End Source File
-# Begin Source File
-
SOURCE=.\be_include\be_argument.h
# End Source File
# Begin Source File
@@ -407,6 +419,10 @@ SOURCE=.\be_include\be_expression.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_extern.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_factory.h
# End Source File
# Begin Source File
@@ -483,6 +499,10 @@ SOURCE=.\be_include\be_structure.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_sunsoft.h
# End Source File
# Begin Source File
@@ -503,6 +523,10 @@ SOURCE=.\be_include\be_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_union_label.h
# End Source File
# Begin Source File
@@ -595,6 +619,10 @@ SOURCE=.\be_include\be_visitor_structure.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_typecode.h
# End Source File
# Begin Source File
@@ -611,6 +639,10 @@ SOURCE=.\be_include\be_visitor_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_visitor_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_visitor_valuetype.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE.bor b/TAO/TAO_IDL/TAO_IDL_FE.bor index 485e05d5cce..b761bfe6c2c 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE.bor +++ b/TAO/TAO_IDL/TAO_IDL_FE.bor @@ -31,9 +31,11 @@ OBJFILES = \ $(OBJDIR)\ast_sequence.obj \ $(OBJDIR)\ast_string.obj \ $(OBJDIR)\ast_structure.obj \ + $(OBJDIR)\ast_structure_fwd.obj \ $(OBJDIR)\ast_type.obj \ $(OBJDIR)\ast_typedef.obj \ $(OBJDIR)\ast_union.obj \ + $(OBJDIR)\ast_union_fwd.obj \ $(OBJDIR)\ast_union_branch.obj \ $(OBJDIR)\ast_union_label.obj \ $(OBJDIR)\ast_visitor.obj \ diff --git a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp index 5244d62ff79..f6d2bbcd759 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp @@ -210,6 +210,10 @@ SOURCE=.\ast\ast_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_type.cpp
# End Source File
# Begin Source File
@@ -226,6 +230,10 @@ SOURCE=.\ast\ast_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_union_label.cpp
# End Source File
# Begin Source File
@@ -442,6 +450,10 @@ SOURCE=.\include\ast_structure.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_type.h
# End Source File
# Begin Source File
@@ -458,6 +470,10 @@ SOURCE=.\include\ast_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_union_label.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp index 7af58f7dd53..17218ba107c 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp @@ -199,6 +199,10 @@ SOURCE=.\ast\ast_structure.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_structure_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_type.cpp
# End Source File
# Begin Source File
@@ -215,6 +219,10 @@ SOURCE=.\ast\ast_union_branch.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_union_fwd.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_union_label.cpp
# End Source File
# Begin Source File
@@ -331,10 +339,6 @@ SOURCE=.\fe\y.tab.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
-SOURCE=.\include\ast.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\ast_argument.h
# End Source File
# Begin Source File
@@ -431,6 +435,10 @@ SOURCE=.\include\ast_structure.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_structure_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_type.h
# End Source File
# Begin Source File
@@ -447,6 +455,10 @@ SOURCE=.\include\ast_union_branch.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_union_fwd.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_union_label.h
# End Source File
# Begin Source File
@@ -475,10 +487,6 @@ SOURCE=.\include\global_extern.h # End Source File
# Begin Source File
-SOURCE=.\include\idl.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\idl_bool.h
# End Source File
# Begin Source File
@@ -487,14 +495,6 @@ SOURCE=.\include\idl_defines.h # End Source File
# Begin Source File
-SOURCE=.\include\idl_extern.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\include\idl_fwd.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\idl_global.h
# End Source File
# Begin Source File
@@ -511,10 +511,6 @@ SOURCE=.\TAO_IDL_FE_Export.h # End Source File
# Begin Source File
-SOURCE=.\include\util.h
-# End Source File
-# Begin Source File
-
SOURCE=.\include\utl_decllist.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/ast/ast_check.cpp b/TAO/TAO_IDL/ast/ast_check.cpp index 112f8159ca2..3f931e86174 100644 --- a/TAO/TAO_IDL/ast/ast_check.cpp +++ b/TAO/TAO_IDL/ast/ast_check.cpp @@ -64,33 +64,29 @@ trademarks or registered trademarks of Sun Microsystems, Inc. */ -// The check ensures that for every forward declared interface we also -// saw a full definition of that interface. +// The check ensures that for every forward declared struct or union we also +// saw a full definition. -#include "ast_extern.h" -#include "ast_interface.h" -#include "ast_interface_fwd.h" #include "global_extern.h" #include "utl_err.h" -#include "ace/config-all.h" ACE_RCSID (ast, ast_check, "$Id$") // Static storage for remembering nodes. -static AST_InterfaceFwd **ast_fwds = 0; +static AST_Type **ast_fwds = 0; static long ast_n_fwds_used = 0; static long ast_n_fwds_alloc = 0; #undef INCREMENT #define INCREMENT 64 -// Store a node representing a forward declared interface. +// Store a node representing a forward declared struct or union. void -AST_record_fwd_interface (AST_InterfaceFwd *n) +AST_record_fwd_decl (AST_Type *n) { - AST_InterfaceFwd **o_ast_fwds = 0; + AST_Type **o_ast_fwds = 0; long o_ast_n_fwds_alloc = 0; // Make sure there's space to store one more. @@ -100,7 +96,7 @@ AST_record_fwd_interface (AST_InterfaceFwd *n) { ast_n_fwds_alloc = INCREMENT; ACE_NEW (ast_fwds, - AST_InterfaceFwd *[ast_n_fwds_alloc]); + AST_Type *[ast_n_fwds_alloc]); } else { @@ -109,7 +105,7 @@ AST_record_fwd_interface (AST_InterfaceFwd *n) ast_n_fwds_alloc += INCREMENT; ACE_NEW (ast_fwds, - AST_InterfaceFwd *[ast_n_fwds_alloc]); + AST_Type *[ast_n_fwds_alloc]); for (long i = 0; i < o_ast_n_fwds_alloc; i++) { @@ -124,24 +120,19 @@ AST_record_fwd_interface (AST_InterfaceFwd *n) ast_fwds[ast_n_fwds_used++] = n; } -// Check that all forward declared interfaces were also defined. -void -AST_check_fwd_interface (void) +// Check that all forward declared structs and unions were also defined. +TAO_IDL_FE_Export void +AST_check_fwd_decls (void) { - AST_InterfaceFwd *d = 0; - AST_Interface *itf = 0; + AST_Type *d = 0; - for (long i = 0; i < ast_n_fwds_used; i++) + for (long i = 0; i < ast_n_fwds_used; ++i) { d = ast_fwds[i]; - itf = d->full_definition (); - if (!itf->is_defined ()) + if (!d->is_defined ()) { - // The old pointer may now be garbage. - itf->set_file_name (idl_global->filename ()); - - idl_global->err ()->fwd_decl_not_defined (itf); + idl_global->err ()->fwd_decl_not_defined (d); } } } diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp index f80e7f4f075..1dbf2f2d2d4 100644 --- a/TAO/TAO_IDL/ast/ast_generator.cpp +++ b/TAO/TAO_IDL/ast/ast_generator.cpp @@ -70,7 +70,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // of the AST nodes. It contains an operation for every constructor // of every AST class. -#include "ast_generator.h" #include "ast_root.h" #include "ast_interface.h" #include "ast_interface_fwd.h" @@ -78,16 +77,20 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_enum.h" #include "ast_attribute.h" #include "ast_union.h" +#include "ast_union_fwd.h" #include "ast_union_branch.h" #include "ast_enum_val.h" #include "ast_array.h" #include "ast_sequence.h" #include "ast_string.h" +#include "ast_structure_fwd.h" #include "ast_native.h" #include "ast_factory.h" #include "utl_identifier.h" #include "nr_extern.h" +#include "ast_generator.h" + ACE_RCSID (ast, ast_generator, "$Id$") @@ -320,6 +323,17 @@ AST_Generator::create_structure (UTL_ScopedName *n, return retval; } +AST_StructureFwd * +AST_Generator::create_structure_fwd (UTL_ScopedName *n) +{ + AST_StructureFwd *retval = 0; + ACE_NEW_RETURN (retval, + AST_StructureFwd (n), + 0); + + return retval; +} + AST_Enum * AST_Generator::create_enum (UTL_ScopedName *n, idl_bool local, @@ -420,6 +434,17 @@ AST_Generator::create_union (AST_ConcreteType *dt, return retval; } +AST_UnionFwd * +AST_Generator::create_union_fwd (UTL_ScopedName *n) +{ + AST_UnionFwd *retval = 0; + ACE_NEW_RETURN (retval, + AST_UnionFwd (n), + 0); + + return retval; +} + AST_UnionBranch * AST_Generator::create_union_branch (UTL_LabelList *ll, AST_Type *ft, diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp index e39b58ecbc1..6670d175ca5 100644 --- a/TAO/TAO_IDL/ast/ast_interface.cpp +++ b/TAO/TAO_IDL/ast/ast_interface.cpp @@ -81,9 +81,12 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_enum.h" #include "ast_enum_val.h" #include "ast_union.h" +#include "ast_union_fwd.h" +#include "ast_structure_fwd.h" #include "ast_native.h" #include "ast_factory.h" #include "ast_visitor.h" +#include "ast_extern.h" #include "utl_err.h" #include "utl_identifier.h" #include "utl_indenter.h" @@ -170,7 +173,7 @@ AST_Interface::be_replace_operation (AST_Decl *old_op, void AST_Interface::be_add_operation (AST_Operation *op) { - fe_add_operation (op); + this->fe_add_operation (op); } // Add an AST_Constant node (a constant declaration) to this scope. @@ -445,42 +448,66 @@ AST_Interface::fe_add_operation (AST_Operation *t) AST_Structure * AST_Interface::fe_add_structure (AST_Structure *t) { - AST_Decl *d = 0; + AST_Decl *predef = 0; + AST_StructureFwd *fwd = 0; - // Can't add to interface which was not yet defined. - if (!this->is_defined ()) + if ((predef = this->lookup_for_add (t, I_FALSE)) != 0) { - idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED, - this, - t); - return 0; - } + // Treat fwd declared interfaces specially + if (predef->node_type () == AST_Decl::NT_struct_fwd) + { + fwd = AST_StructureFwd::narrow_from_decl (predef); - // Already defined and cannot be redefined? Or already used? - if ((d = this->lookup_for_add (t, I_FALSE)) != 0) - { - if (!can_be_redefined (d)) + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + if (fwd->defined_in () == this) + { + fwd->set_full_definition (t); + } + else + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + this); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + } + else if (!can_be_redefined (predef)) { idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, t, this, - d); + predef); + return 0; } - - if (this->referenced (d, t->local_name ())) + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) { idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, t, this, - d); - return 0; - } + predef); - if (t->has_ancestor (d)) - { - idl_global->err ()->redefinition_in_scope (t, - d); return 0; } } @@ -496,6 +523,84 @@ AST_Interface::fe_add_structure (AST_Structure *t) return t; } +// Add this AST_StructureFwd node (a forward declaration of an IDL +// struct) to this scope. +AST_StructureFwd * +AST_Interface::fe_add_structure_fwd (AST_StructureFwd *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (t, I_FALSE)) != 0) + { + AST_Decl::NodeType nt = d->node_type (); + + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add() calls only + // lookup_by_name_local(), which does not bump up the scope. + if (nt == AST_Decl::NT_struct_fwd) + { + // It's legal to forward declare something more than once, + // but we need only one entry in the scope for lookup. + AST_StructureFwd *fd = AST_StructureFwd::narrow_from_decl (d); + t->destroy (); + delete t; + t = 0; + return fd; + } + else if (nt == AST_Decl::NT_struct) + { + AST_Structure *s = AST_Structure::narrow_from_decl (d); + t->set_full_definition (s); + + if (t->added () == 0) + { + t->set_added (1); + this->add_to_scope (t); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + } + + return t; + } + else + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + d); + return 0; + } + + if (this->referenced (d, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + d); + 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 ()); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + return t; +} + // Add an AST_Enum node (an enum declaration) to this scope. AST_Enum * AST_Interface::fe_add_enum (AST_Enum *t) @@ -555,42 +660,66 @@ AST_Interface::fe_add_enum (AST_Enum *t) AST_Union * AST_Interface::fe_add_union (AST_Union *t) { - AST_Decl *d = 0; + AST_Decl *predef = 0; + AST_UnionFwd *fwd = 0; - // Can't add to interface which was not yet defined. - if (!this->is_defined ()) + if ((predef = this->lookup_for_add (t, I_FALSE)) != 0) { - idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED, - this, - t); - return 0; - } + // Treat fwd declared interfaces specially + if (predef->node_type () == AST_Decl::NT_union_fwd) + { + fwd = AST_UnionFwd::narrow_from_decl (predef); - // Already defined and cannot be redefined? Or already used? - if ((d = this->lookup_for_add (t, I_FALSE)) != 0) - { - if (!can_be_redefined (d)) + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + if (fwd->defined_in () == this) + { + fwd->set_full_definition (t); + } + else + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + this); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + } + else if (!can_be_redefined (predef)) { idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, t, this, - d); + predef); + return 0; } - - if (this->referenced (d, t->local_name ())) + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) { idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, t, this, - d); - return 0; - } + predef); - if (t->has_ancestor (d)) - { - idl_global->err ()->redefinition_in_scope (t, - d); return 0; } } @@ -606,6 +735,84 @@ AST_Interface::fe_add_union (AST_Union *t) return t; } +// Add this AST_UnionFwd node (a forward declaration of an IDL +// union) to this scope. +AST_UnionFwd * +AST_Interface::fe_add_union_fwd (AST_UnionFwd *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (t, I_FALSE)) != 0) + { + AST_Decl::NodeType nt = d->node_type (); + + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add() calls only + // lookup_by_name_local(), which does not bump up the scope. + if (nt == AST_Decl::NT_union_fwd) + { + // It's legal to forward declare something more than once, + // but we need only one entry in the scope for lookup. + AST_UnionFwd *fd = AST_UnionFwd::narrow_from_decl (d); + t->destroy (); + delete t; + t = 0; + return fd; + } + else if (nt == AST_Decl::NT_union) + { + AST_Union *s = AST_Union::narrow_from_decl (d); + t->set_full_definition (s); + + if (t->added () == 0) + { + t->set_added (1); + this->add_to_scope (t); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + } + + return t; + } + else + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + d); + return 0; + } + + if (this->referenced (d, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + d); + 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 ()); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + return t; +} + // Add an AST_EnumVal node (an enumerator) to this scope. // This is done to conform to the C++ scoping rules which declare // enumerators in the enclosing scope (in addition to declaring them @@ -935,8 +1142,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, // a new pointer in created, and the first term below will be // true. In that case, the scoped names must be compared. if (fd->defined_in () != s - && !AST_Interface::compare_names (fd, - i)) + && i->name ()->compare (fd->name ()) != 0) { idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT, i, @@ -1044,42 +1250,6 @@ AST_Interface::set_n_inherits_flat (long i) this->pd_n_inherits_flat = i; } -// Get the scoped names and, if they are the same -// length, iterate over them, comparing each term. -idl_bool -AST_Interface::compare_names (AST_Interface *that, - AST_Interface *other) -{ - UTL_ScopedName *that_name = that->name (); - UTL_ScopedName *other_name = other->name (); - - long that_length = that_name->length (); - - if (that_length != other_name->length ()) - { - return I_FALSE; - } - - Identifier *that_id = 0; - Identifier *other_id = 0; - - for (UTL_IdListActiveIterator that_iter (that_name), other_iter (other_name); - !that_iter.is_done (); - that_iter.next (), other_iter.next ()) - { - that_id = that_iter.item (); - other_id = other_iter.item (); - - if (ACE_OS::strcmp (that_id->get_string (), - other_id->get_string ())) - { - return I_FALSE; - } - } - - return I_TRUE; -} - void AST_Interface::inherited_name_clash (void) { diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp index 57815339897..48b302b418b 100644 --- a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp +++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp @@ -64,7 +64,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. */ -// AST_InterfaceFwd nodes denote forward declarations of IDL interfaces +// AST_InterfaceFwd nodes denote forward declarations of IDL interfaces. // AST_InterfaceFwd nodes have a field containing the full declaration // of the interface, which is initialized when that declaration is // encountered. @@ -91,7 +91,7 @@ AST_InterfaceFwd::AST_InterfaceFwd (AST_Interface *dummy, // Create a dummy placeholder for the forward declared interface. This // interface node is not yet defined (n_inherits < 0), so some operations // will fail. - pd_full_definition = dummy; + this->pd_full_definition = dummy; } AST_InterfaceFwd::~AST_InterfaceFwd (void) @@ -188,6 +188,14 @@ AST_InterfaceFwd::is_defined (void) return this->pd_full_definition->is_defined (); } +void +AST_InterfaceFwd::destroy (void) +{ + this->pd_full_definition->destroy (); + delete this->pd_full_definition; + this->pd_full_definition = 0; +} + // Narrowing methods. IMPL_NARROW_METHODS1 (AST_InterfaceFwd, AST_Type) IMPL_NARROW_FROM_DECL (AST_InterfaceFwd) diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp index 016d927e484..d063e6501d5 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -75,11 +75,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_constant.h" #include "ast_exception.h" #include "ast_union.h" +#include "ast_union_fwd.h" +#include "ast_structure_fwd.h" #include "ast_enum.h" #include "ast_enum_val.h" #include "ast_native.h" #include "ast_generator.h" #include "ast_visitor.h" +#include "ast_extern.h" #include "utl_err.h" #include "utl_identifier.h" #include "utl_indenter.h" @@ -329,7 +332,7 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i) // and look_in_previous() for modules. If look_in_previous() // finds something, the scopes will NOT be the same pointer // value, but the result is what we want. - if (d->node_type () == AST_Decl::NT_interface) + if (d->node_type () == AST_Decl::NT_interface) { itf = AST_Interface::narrow_from_decl (d); @@ -482,33 +485,70 @@ AST_Module::fe_add_exception (AST_Exception *t) AST_Union * AST_Module::fe_add_union (AST_Union *t) { - AST_Decl *d = 0; + AST_Decl *predef = 0; + AST_UnionFwd *fwd = 0; - // Already defined and cannot be redefined? Or already used? - if ((d = this->lookup_for_add (t, I_FALSE)) != 0) + if ((predef = this->lookup_for_add (t, I_FALSE)) != 0) { - if (!can_be_redefined (d)) + // Treat fwd declared interfaces specially + if (predef->node_type () == AST_Decl::NT_union_fwd) + { + fwd = AST_UnionFwd::narrow_from_decl (predef); + + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + UTL_Scope *s = fwd->defined_in (); + UTL_ScopedName *sn = ScopeAsDecl (s)->name (); + + if (fwd->defined_in () == this + || sn->compare (this->name ()) == 0) + { + fwd->set_full_definition (t); + } + else + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + this); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + } + else if (!can_be_redefined (predef)) { idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, t, this, - d); + predef); + return 0; } - - if (this->referenced (d, t->local_name ())) + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) { idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, t, this, - d); - return 0; - } + predef); - if (t->has_ancestor (d)) - { - idl_global->err ()->redefinition_in_scope (t, - d); return 0; } } @@ -524,37 +564,155 @@ AST_Module::fe_add_union (AST_Union *t) return t; } -// Add this AST_Structure node (a struct declaration) to this scope. -AST_Structure * -AST_Module::fe_add_structure (AST_Structure *t) +// Add this AST_UnionFwd node (a forward declaration of an IDL +// union) to this scope. +AST_UnionFwd * +AST_Module::fe_add_union_fwd (AST_UnionFwd *t) { AST_Decl *d = 0; // Already defined and cannot be redefined? Or already used? if ((d = this->lookup_for_add (t, I_FALSE)) != 0) { - if (!can_be_redefined (d)) + AST_Decl::NodeType nt = d->node_type (); + + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add() calls only + // lookup_by_name_local(), which does not bump up the scope, + // and look_in_previous() for modules. If look_in_previous() + // finds something, the scopes will NOT be the same pointer + // value, but the result is what we want. + if (nt == AST_Decl::NT_union_fwd) + { + // It's legal to forward declare something more than once, + // but we need only one entry in the scope for lookup. + AST_UnionFwd *fd = AST_UnionFwd::narrow_from_decl (d); + t->destroy (); + delete t; + t = 0; + return fd; + } + else if (nt == AST_Decl::NT_union) + { + AST_Union *s = AST_Union::narrow_from_decl (d); + t->set_full_definition (s); + + if (t->added () == 0) + { + t->set_added (1); + this->add_to_scope (t); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + } + + return t; + } + else + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + d); + return 0; + } + + if (this->referenced (d, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + d); + 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 ()); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + return t; +} + +// Add this AST_Structure node (a struct declaration) to this scope. +AST_Structure * +AST_Module::fe_add_structure (AST_Structure *t) +{ + AST_Decl *predef = 0; + AST_StructureFwd *fwd = 0; + + if ((predef = this->lookup_for_add (t, I_FALSE)) != 0) + { + // Treat fwd declared interfaces specially + if (predef->node_type () == AST_Decl::NT_struct_fwd) + { + fwd = AST_StructureFwd::narrow_from_decl (predef); + + if (fwd == 0) + { + return 0; + } + + // Forward declared and not defined yet. + if (!fwd->is_defined ()) + { + UTL_Scope *s = fwd->defined_in (); + UTL_ScopedName *sn = ScopeAsDecl (s)->name (); + + if (fwd->defined_in () == this + || sn->compare (this->name ()) == 0) + { + fwd->set_full_definition (t); + } + else + { + idl_global->err ()->error3 (UTL_Error::EIDL_SCOPE_CONFLICT, + fwd, + t, + this); + + return 0; + } + } + // OK, not illegal redef of forward declaration. Now check whether. + // it has been referenced already. + else if (this->referenced (predef, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + predef); + + return 0; + } + } + else if (!can_be_redefined (predef)) { idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, t, this, - d); + predef); + return 0; } - - if (this->referenced(d, t->local_name ())) + else if (referenced (predef, t->local_name ()) && !t->is_defined ()) { idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, t, this, - d); - return 0; - } + predef); - if (t->has_ancestor(d)) - { - idl_global->err ()->redefinition_in_scope (t, - d); return 0; } } @@ -570,6 +728,87 @@ AST_Module::fe_add_structure (AST_Structure *t) return t; } +// Add this AST_StructureFwd node (a forward declaration of an IDL +// struct) to this scope. +AST_StructureFwd * +AST_Module::fe_add_structure_fwd (AST_StructureFwd *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (t, I_FALSE)) != 0) + { + AST_Decl::NodeType nt = d->node_type (); + + // There used to be another check here ANDed with the one below: + // d->defined_in () == this. But lookup_for_add() calls only + // lookup_by_name_local(), which does not bump up the scope, + // and look_in_previous() for modules. If look_in_previous() + // finds something, the scopes will NOT be the same pointer + // value, but the result is what we want. + if (nt == AST_Decl::NT_struct_fwd) + { + // It's legal to forward declare something more than once, + // but we need only one entry in the scope for lookup. + AST_StructureFwd *fd = AST_StructureFwd::narrow_from_decl (d); + t->destroy (); + delete t; + t = 0; + return fd; + } + else if (nt == AST_Decl::NT_struct) + { + AST_Structure *s = AST_Structure::narrow_from_decl (d); + t->set_full_definition (s); + + if (t->added () == 0) + { + t->set_added (1); + this->add_to_scope (t); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + } + + return t; + } + else + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + t, + this, + d); + return 0; + } + + if (this->referenced (d, t->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + t, + this, + d); + 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 ()); + + // Must check later that all struct and union forward declarations + // are defined in the same IDL file. + AST_record_fwd_decl (t); + return t; +} + // Add this AST_Enum node (an enum declaration) to this scope. AST_Enum * AST_Module::fe_add_enum (AST_Enum *t) diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp index b8e8f49100a..73a49b00a6b 100644 --- a/TAO/TAO_IDL/ast/ast_redef.cpp +++ b/TAO/TAO_IDL/ast/ast_redef.cpp @@ -89,7 +89,9 @@ can_be_redefined (AST_Decl *d) case AST_Decl::NT_array: case AST_Decl::NT_sequence: case AST_Decl::NT_union: + case AST_Decl::NT_union_fwd: case AST_Decl::NT_struct: + case AST_Decl::NT_struct_fwd: case AST_Decl::NT_enum: case AST_Decl::NT_typedef: return I_TRUE; diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp index 541031b52b7..dbba255a6a4 100644 --- a/TAO/TAO_IDL/ast/ast_structure.cpp +++ b/TAO/TAO_IDL/ast/ast_structure.cpp @@ -492,10 +492,6 @@ AST_Structure::dump (ACE_OSTREAM_TYPE &o) { o << "(local) "; } - else - { - o << "(abstract) "; - } o << "struct "; AST_Decl::dump (o); diff --git a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp new file mode 100644 index 00000000000..4f64a401516 --- /dev/null +++ b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp @@ -0,0 +1,76 @@ +// $Id$ + +// AST_StructureFwd nodes denote forward declarations of IDL structs. +// AST_StructureFwd nodes have a field containing the full declaration +// of the struct, which is initialized when that declaration is +// encountered. + +#include "ast_structure_fwd.h" +#include "ast_structure.h" +#include "ast_visitor.h" +#include "utl_identifier.h" + +ACE_RCSID( ast, + ast_structure_fwd, + "$Id$") + +AST_StructureFwd::AST_StructureFwd (void) + : pd_full_definition (0) +{ +} + +AST_StructureFwd::AST_StructureFwd (UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_struct_fwd, + n), + pd_full_definition (0) +{ +} + +AST_StructureFwd::~AST_StructureFwd (void) +{ +} + +// Redefinition of inherited virtual operations. + +// Dump this AST_StructureFwd node to the ostream o. +void +AST_StructureFwd::dump (ACE_OSTREAM_TYPE &o) +{ + o << "struct "; + this->local_name ()->dump (o); +} + +int +AST_StructureFwd::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_structure_fwd (this); +} + +// Data accessors. + +AST_Structure * +AST_StructureFwd::full_definition (void) +{ + return this->pd_full_definition; +} + +void +AST_StructureFwd::set_full_definition (AST_Structure *nfd) +{ + this->pd_full_definition = nfd; +} + +idl_bool +AST_StructureFwd::is_defined (void) +{ + return (this->pd_full_definition != 0); +} + +void +AST_StructureFwd::destroy (void) +{ +} + +// Narrowing methods. +IMPL_NARROW_METHODS1 (AST_StructureFwd, AST_Type) +IMPL_NARROW_FROM_DECL (AST_StructureFwd) diff --git a/TAO/TAO_IDL/ast/ast_type.cpp b/TAO/TAO_IDL/ast/ast_type.cpp index b5c974a4ddf..a7a1d7eee77 100644 --- a/TAO/TAO_IDL/ast/ast_type.cpp +++ b/TAO/TAO_IDL/ast/ast_type.cpp @@ -69,6 +69,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_type.h" #include "ast_visitor.h" +#include "ace/Log_Msg.h" ACE_RCSID (ast, ast_type, @@ -76,7 +77,9 @@ ACE_RCSID (ast, AST_Type::AST_Type (void) : ifr_added_ (0), - ifr_fwd_added_ (0) + ifr_fwd_added_ (0), + size_type_ (AST_Type::SIZE_UNKNOWN), + has_constructor_ (0) { } @@ -85,7 +88,9 @@ AST_Type::AST_Type (AST_Decl::NodeType nt, : AST_Decl (nt, n), ifr_added_ (0), - ifr_fwd_added_ (0) + ifr_fwd_added_ (0), + size_type_ (AST_Type::SIZE_UNKNOWN), + has_constructor_ (0) { } @@ -95,6 +100,47 @@ AST_Type::~AST_Type (void) // Public operations. +// Return our size type. +AST_Type::SIZE_TYPE +AST_Type::size_type (void) +{ + if (this->size_type_ == AST_Type::SIZE_UNKNOWN) + { + (void) this->compute_size_type (); + } + + return this->size_type_; +} + +// Set our size type and that of all our ancestors. +void +AST_Type::size_type (AST_Type::SIZE_TYPE st) +{ + // Precondition - you cannot set somebody's sizetype to unknown. + ACE_ASSERT (st != AST_Type::SIZE_UNKNOWN); + + // Size type can be VARIABLE or FIXED. + if (this->size_type_ == AST_Type::SIZE_UNKNOWN) // not set yet + { + this->size_type_ = st; // set it + } + else if ((this->size_type_ == AST_Type::FIXED) + && (st == AST_Type::VARIABLE)) + { + // Once we are VARIABLE, we cannot be FIXED. But if we were FIXED and then + // get overwritten to VARIABLE, it is fine. Such a situation occurs only + // when setting the sizes of structures and unions. + this->size_type_ = st; + } +} + +// Compute the size type of the node in question +int +AST_Type::compute_size_type (void) +{ + return 0; +} + idl_bool AST_Type::in_recursion (AST_Type *) { @@ -134,6 +180,24 @@ AST_Type::ifr_fwd_added (idl_bool val) this->ifr_fwd_added_ = val; } +idl_bool +AST_Type::has_constructor (void) +{ + return this->has_constructor_; +} + +void +AST_Type::has_constructor (idl_bool value) +{ + // Similarly to be_decl::size_type_, once this + // gets set to I_TRUE, we don't want it to + // change back. + if (this->has_constructor_ == 0) + { + this->has_constructor_ = value; + } +} + int AST_Type::ast_accept (ast_visitor *visitor) { diff --git a/TAO/TAO_IDL/ast/ast_union_fwd.cpp b/TAO/TAO_IDL/ast/ast_union_fwd.cpp new file mode 100644 index 00000000000..b24676a653d --- /dev/null +++ b/TAO/TAO_IDL/ast/ast_union_fwd.cpp @@ -0,0 +1,76 @@ +// $Id$ + +// AST_UnionFwd nodes denote forward declarations of IDL union. +// AST_UnionFwd nodes have a field containing the full declaration +// of the union, which is initialized when that declaration is +// encountered. + +#include "ast_union_fwd.h" +#include "ast_union.h" +#include "ast_visitor.h" +#include "utl_identifier.h" + +ACE_RCSID( ast, + ast_union_fwd, + "$Id$") + +AST_UnionFwd::AST_UnionFwd (void) + : pd_full_definition (0) +{ +} + +AST_UnionFwd::AST_UnionFwd (UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_union_fwd, + n), + pd_full_definition (0) +{ +} + +AST_UnionFwd::~AST_UnionFwd (void) +{ +} + +// Redefinition of inherited virtual operations. + +// Dump this AST_StructureFwd node to the ostream o. +void +AST_UnionFwd::dump (ACE_OSTREAM_TYPE &o) +{ + o << "union "; + this->local_name ()->dump (o); +} + +int +AST_UnionFwd::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_union_fwd (this); +} + +// Data accessors. + +AST_Union * +AST_UnionFwd::full_definition (void) +{ + return this->pd_full_definition; +} + +void +AST_UnionFwd::set_full_definition (AST_Union *nfd) +{ + this->pd_full_definition = nfd; +} + +idl_bool +AST_UnionFwd::is_defined (void) +{ + return (this->pd_full_definition != 0); +} + +void +AST_UnionFwd::destroy (void) +{ +} + +// Narrowing methods. +IMPL_NARROW_METHODS1 (AST_UnionFwd, AST_Type) +IMPL_NARROW_FROM_DECL (AST_UnionFwd) diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp index f934c36dec5..fc9a775f943 100644 --- a/TAO/TAO_IDL/be/be_constant.cpp +++ b/TAO/TAO_IDL/be/be_constant.cpp @@ -28,7 +28,6 @@ ACE_RCSID (be, be_constant::be_constant (void) { - this->size_type (be_decl::FIXED); } be_constant::be_constant (AST_Expression::ExprType et, @@ -40,7 +39,6 @@ be_constant::be_constant (AST_Expression::ExprType et, AST_Decl (AST_Decl::NT_const, n) { - this->size_type (be_decl::FIXED); } const char * diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index 25c9af4b2bd..11424e5f491 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -55,9 +55,7 @@ be_decl::be_decl (void) cli_stub_cdr_op_gen_ (I_FALSE), cli_inline_cdr_op_gen_ (I_FALSE), cli_inline_cdr_decl_gen_ (I_FALSE), - flat_name_ (0), - size_type_ (be_decl::SIZE_UNKNOWN), - has_constructor_ (I_FALSE) + flat_name_ (0) { } @@ -79,9 +77,7 @@ be_decl::be_decl (AST_Decl::NodeType type, cli_hdr_cdr_op_gen_ (I_FALSE), cli_stub_cdr_op_gen_ (I_FALSE), cli_inline_cdr_op_gen_ (I_FALSE), - flat_name_ (0), - size_type_ (be_decl::SIZE_UNKNOWN), - has_constructor_ (I_FALSE) + flat_name_ (0) { } @@ -90,40 +86,6 @@ be_decl::~be_decl (void) { } -// Return our size type. -be_decl::SIZE_TYPE -be_decl::size_type (void) -{ - if (this->size_type_ == be_decl::SIZE_UNKNOWN) - { - (void) this->compute_size_type (); - } - - return this->size_type_; -} - -// Set our size type and that of all our ancestors. -void -be_decl::size_type (be_decl::SIZE_TYPE st) -{ - // Precondition - you cannot set somebody's sizetype to unknown. - ACE_ASSERT (st != be_decl::SIZE_UNKNOWN); - - // Size type can be VARIABLE or FIXED. - if (this->size_type_ == be_decl::SIZE_UNKNOWN) // not set yet - { - this->size_type_ = st; // set it - } - else if ((this->size_type_ == be_decl::FIXED) - && (st == be_decl::VARIABLE)) - { - // Once we are VARIABLE, we cannot be FIXED. But if we were FIXED and then - // get overwritten to VARIABLE, it is fine. Such a situation occurs only - // when setting the sizes of structures and unions. - this->size_type_ = st; - } -} - void be_decl::compute_full_name (const char *prefix, const char *suffix, @@ -374,13 +336,6 @@ be_decl::is_nested (void) return I_FALSE; } -// Compute the size type of the node in question -int -be_decl::compute_size_type (void) -{ - return 0; -} - // Return the scope created by this node (if one exists, else NULL). be_scope * be_decl::scope (void) @@ -593,24 +548,6 @@ be_decl::accept (be_visitor *visitor) return visitor->visit_decl (this); } -idl_bool -be_decl::has_constructor (void) -{ - return this->has_constructor_; -} - -void -be_decl::has_constructor (idl_bool value) -{ - // Similarly to be_decl::size_type_, once this - // gets set to I_TRUE, we don't want it to - // change back. - if (this->has_constructor_ == 0) - { - this->has_constructor_ = value; - } -} - // Narrowing methods. IMPL_NARROW_METHODS1 (be_decl, AST_Decl) IMPL_NARROW_FROM_DECL (be_decl) diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp index 791c0a41008..93adad15665 100644 --- a/TAO/TAO_IDL/be/be_enum.cpp +++ b/TAO/TAO_IDL/be/be_enum.cpp @@ -28,7 +28,7 @@ ACE_RCSID (be, be_enum::be_enum (void) { - this->size_type (be_decl::FIXED); + this->size_type (AST_Type::FIXED); } be_enum::be_enum (UTL_ScopedName *n, @@ -43,7 +43,7 @@ be_enum::be_enum (UTL_ScopedName *n, COMMON_Base (local, abstract) { - this->size_type (be_decl::FIXED); + this->size_type (AST_Type::FIXED); } void diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp index fb0612bb0cb..a0fe6574b54 100644 --- a/TAO/TAO_IDL/be/be_enum_val.cpp +++ b/TAO/TAO_IDL/be/be_enum_val.cpp @@ -54,13 +54,6 @@ be_enum_val::destroy (void) this->be_decl::destroy (); } -int -be_enum_val::compute_size_type (void) -{ - this->size_type_ = be_decl::FIXED; - return 0; -} - // Narrowing IMPL_NARROW_METHODS2 (be_enum_val, AST_EnumVal, be_decl) IMPL_NARROW_FROM_DECL (be_enum_val) diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp index 5216b6c8d34..ebd3592ea33 100644 --- a/TAO/TAO_IDL/be/be_exception.cpp +++ b/TAO/TAO_IDL/be/be_exception.cpp @@ -29,7 +29,7 @@ ACE_RCSID (be, be_exception::be_exception (void) { - this->size_type (be_decl::VARIABLE); // always the case + this->size_type (AST_Type::VARIABLE); // always the case } be_exception::be_exception (UTL_ScopedName *n, @@ -46,7 +46,7 @@ be_exception::be_exception (UTL_ScopedName *n, abstract) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } void diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp index 701b194aec7..76b8aece9f0 100644 --- a/TAO/TAO_IDL/be/be_field.cpp +++ b/TAO/TAO_IDL/be/be_field.cpp @@ -45,29 +45,6 @@ be_field::be_field (AST_Type *ft, { } -// Compute the size type of the node in question. -int -be_field::compute_size_type (void) -{ - be_type *type = be_type::narrow_from_decl (this->field_type ()); - - if (type == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_field::compute_size_type - " - "bad field type\n"), -1); - } - - // Our size type is the same as our type. - this->size_type (type->size_type ()); // As a side effect, will also update - // the size type of parent. - - // While we're here, take care of has_constructor. - this->has_constructor (type->has_constructor ()); - - return 0; -} - int be_field::accept (be_visitor *visitor) { diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp index 8094476b3cc..e6933d003ff 100644 --- a/TAO/TAO_IDL/be/be_generator.cpp +++ b/TAO/TAO_IDL/be/be_generator.cpp @@ -78,7 +78,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_valuetype.h" #include "be_valuetype_fwd.h" #include "be_union.h" +#include "be_union_fwd.h" #include "be_structure.h" +#include "be_structure_fwd.h" #include "be_exception.h" #include "be_operation.h" #include "be_enum.h" @@ -302,6 +304,17 @@ be_generator::create_structure (UTL_ScopedName *n, return retval; } +AST_StructureFwd * +be_generator::create_structure_fwd (UTL_ScopedName *n) +{ + be_structure_fwd *retval = 0; + ACE_NEW_RETURN (retval, + be_structure_fwd (n), + 0); + + return retval; +} + AST_Enum * be_generator::create_enum (UTL_ScopedName *n, idl_bool local, @@ -402,6 +415,17 @@ be_generator::create_union (AST_ConcreteType *dt, return retval; } +AST_UnionFwd * +be_generator::create_union_fwd (UTL_ScopedName *n) +{ + be_union_fwd *retval = 0; + ACE_NEW_RETURN (retval, + be_union_fwd (n), + 0); + + return retval; +} + AST_UnionBranch * be_generator::create_union_branch (UTL_LabelList *ll, AST_Type *ft, diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 31d132536f0..abc7bcb1d41 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -43,7 +43,7 @@ be_interface::be_interface (void) { ACE_NEW (this->strategy_, be_interface_default_strategy (this)); - this->size_type (be_decl::VARIABLE); // Always the case. + this->size_type (AST_Type::VARIABLE); // Always the case. this->has_constructor (I_TRUE); // Always the case. } @@ -73,7 +73,7 @@ be_interface::be_interface (UTL_ScopedName *n, { ACE_NEW (this->strategy_, be_interface_default_strategy (this)); - this->size_type (be_decl::VARIABLE); // always the case + this->size_type (AST_Type::VARIABLE); // always the case this->has_constructor (I_TRUE); // always the case } diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp index ce83586c051..522e549f129 100644 --- a/TAO/TAO_IDL/be/be_interface_fwd.cpp +++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp @@ -6,10 +6,10 @@ // TAO IDL // // = FILENAME -// be_interface.h +// be_interface_fwd.cpp // // = DESCRIPTION -// Extension of class AST_Interface_Fwd that provides additional means for C++ +// Extension of class AST_InterfaceFwd that provides additional means for C++ // mapping of an interface. // // = AUTHOR @@ -29,7 +29,7 @@ ACE_RCSID (be, be_interface_fwd::be_interface_fwd (void) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } be_interface_fwd::be_interface_fwd (AST_Interface *dummy, @@ -40,7 +40,7 @@ be_interface_fwd::be_interface_fwd (AST_Interface *dummy, n) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } be_interface_fwd::~be_interface_fwd (void) diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp index 017350716db..a7980972eaf 100644 --- a/TAO/TAO_IDL/be/be_module.cpp +++ b/TAO/TAO_IDL/be/be_module.cpp @@ -38,14 +38,6 @@ be_module::be_module (UTL_ScopedName *n) { } -// Compute the size type of the node in question. -int -be_module::compute_size_type (void) -{ - // Our size does not matter. - return 0; -} - void be_module::destroy (void) { diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index 0fadcd038d0..d05ae7b8964 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -87,38 +87,6 @@ be_operation::add_argument_to_scope (be_argument *arg) return arg; } -// Compute the size type of the node in question. -int -be_operation::compute_size_type (void) -{ - - for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) - { - // Get the next AST decl node - AST_Decl *d = si.item (); - be_decl *bd = be_decl::narrow_from_decl (d); - - if (bd != 0) - { - // Our sizetype depends on the sizetype of our members. Although - // previous value of sizetype may get overwritten, we are - // guaranteed by the "size_type" call that once the value reached - // be_decl::VARIABLE, nothing else can overwrite it. - this->size_type (bd->size_type ()); - } - else - { - ACE_DEBUG ((LM_DEBUG, - "WARNING (%N:%l) be_operation::compute_size_type - " - "narrow_from_decl returned 0\n")); - } - } - - return 0; -} - void be_operation::destroy (void) { diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index 6db4f96ce48..9a241da2699 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -159,11 +159,11 @@ be_predefined_type::compute_size_type (void) if (this->pt () == AST_PredefinedType::PT_any || this->pt () == AST_PredefinedType::PT_pseudo) { - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } else { - this->size_type (be_decl::FIXED); + this->size_type (AST_Type::FIXED); } return 0; diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index e1fd6b6131d..c5720f2af85 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -36,7 +36,7 @@ be_sequence::be_sequence (void) : mt_ (be_sequence::MNG_UNKNOWN) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); this->has_constructor (I_TRUE); } @@ -68,7 +68,7 @@ be_sequence::be_sequence (AST_Expression *v, mt_ (be_sequence::MNG_UNKNOWN) { // A sequence data type is always VARIABLE. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); // Always the case. this->has_constructor (I_TRUE); diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp index 214296dbcc7..f16196e015b 100644 --- a/TAO/TAO_IDL/be/be_string.cpp +++ b/TAO/TAO_IDL/be/be_string.cpp @@ -30,7 +30,7 @@ ACE_RCSID (be, be_string::be_string (void) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } be_string::be_string (AST_Decl::NodeType nt, @@ -46,7 +46,7 @@ be_string::be_string (AST_Decl::NodeType nt, I_TRUE) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); } // Overriden method. diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp index dd450a8a738..6390860c9be 100644 --- a/TAO/TAO_IDL/be/be_structure.cpp +++ b/TAO/TAO_IDL/be/be_structure.cpp @@ -24,6 +24,7 @@ #include "be_helper.h" #include "be_visitor.h" #include "be_extern.h" +#include "ast_field.h" #include "utl_identifier.h" ACE_RCSID (be, @@ -81,7 +82,7 @@ be_structure::gen_var_defn (char *) *ch << namebuf << " (const " << namebuf << " &);" << be_nl; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << "// Fixed-size types only." << be_nl; *ch << namebuf << " (const " << this->local_name () @@ -100,7 +101,7 @@ be_structure::gen_var_defn (char *) *ch << namebuf << " &operator= (const " << namebuf << " &);" << be_nl; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << "// Fixed-size types only." << be_nl; *ch << namebuf << " &operator= (const " << this->local_name () @@ -118,7 +119,7 @@ be_structure::gen_var_defn (char *) *ch << "operator " << this->local_name () << " &();" << be_nl; *ch << "operator " << this->local_name () << " &() const;" << be_nl; - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { *ch << "// Variable-size types only." << be_nl; *ch << "operator " << this->local_name () @@ -130,7 +131,7 @@ be_structure::gen_var_defn (char *) // The return types of in, out, inout, and _retn are based on the // parameter passing rules and the base type. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << "const " << this->local_name () << " &in (void) const;" << be_nl; *ch << this->local_name () << " &inout (void);" << be_nl; @@ -223,7 +224,7 @@ be_structure::gen_var_impl (char *, *ci << "}\n\n"; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ci << "// fixed-size types only" << be_nl; *ci << "ACE_INLINE" << be_nl; @@ -291,7 +292,7 @@ be_structure::gen_var_impl (char *, << "}\n\n"; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { ci->indent (); *ci << "// fixed-size types only" << be_nl; @@ -364,7 +365,7 @@ be_structure::gen_var_impl (char *, *ci << "}\n\n"; // Variable-size types only. - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { ci->indent (); *ci << "// variable-size types only" << be_nl; @@ -399,7 +400,7 @@ be_structure::gen_var_impl (char *, // The out is handled differently based on our size type. ci->indent (); - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { *ci << "// mapping for variable size " << be_nl; *ci << "ACE_INLINE " << "::" << this->name () << " *&" << be_nl; @@ -664,19 +665,20 @@ be_structure::compute_size_type (void) { // Get the next AST decl node. AST_Decl *d = si.item (); - be_decl *bd = be_decl::narrow_from_decl (d); + AST_Field *f = AST_Field::narrow_from_decl (d); - if (bd != 0) + if (f != 0) { + AST_Type *t = f->field_type (); // Our sizetype depends on the sizetype of our // members. Although previous value of sizetype may get // overwritten, we are guaranteed by the "size_type" call // that once the value reached be_decl::VARIABLE, nothing // else can overwrite it. - this->size_type (bd->size_type ()); + this->size_type (t->size_type ()); // While we're iterating, we might as well do this one too. - this->has_constructor (bd->has_constructor ()); + this->has_constructor (t->has_constructor ()); } else { diff --git a/TAO/TAO_IDL/be/be_structure_fwd.cpp b/TAO/TAO_IDL/be/be_structure_fwd.cpp new file mode 100644 index 00000000000..872eb2f094a --- /dev/null +++ b/TAO/TAO_IDL/be/be_structure_fwd.cpp @@ -0,0 +1,60 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_structure_fwd.cpp +// +// = DESCRIPTION +// Extension of class AST_StructureFwd that provides additional means for C++ +// mapping of a struct. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_structure_fwd.h" +#include "be_visitor.h" + +ACE_RCSID (be, + be_structure_fwd, + "$Id$") + +be_structure_fwd::be_structure_fwd (void) +{ +} + +be_structure_fwd::be_structure_fwd (UTL_ScopedName *n) + : be_type (AST_Decl::NT_struct_fwd, + n), + AST_StructureFwd (n), + AST_Type (AST_Decl::NT_struct_fwd, + n), + AST_Decl (AST_Decl::NT_struct_fwd, + n) +{ +} + +be_structure_fwd::~be_structure_fwd (void) +{ +} + +void +be_structure_fwd::destroy (void) +{ + // Do nothing. +} + +int +be_structure_fwd::accept (be_visitor *visitor) +{ + return visitor->visit_structure_fwd (this); +} + +// Narrowing +IMPL_NARROW_METHODS2 (be_structure_fwd, AST_StructureFwd, be_type) +IMPL_NARROW_FROM_DECL (be_structure_fwd) diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp index a9fcc4508b2..b5c0ffafaac 100644 --- a/TAO/TAO_IDL/be/be_typedef.cpp +++ b/TAO/TAO_IDL/be/be_typedef.cpp @@ -86,7 +86,7 @@ be_typedef::compute_size_type (void) // Our size type is the same as our type. this->size_type (type->size_type ()); - //While we're here, take care of has_constructor. + // While we're here, take care of has_constructor. this->has_constructor (type->has_constructor ()); return 0; diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index fed394ea717..077e99895b8 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -96,7 +96,7 @@ be_union::gen_var_defn (char *) << " &);" << be_nl; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << namebuf << " (const " << this->local_name () << " &); // fixed-size types only" << be_nl; @@ -114,7 +114,7 @@ be_union::gen_var_defn (char *) *ch << namebuf << " &operator= (const " << namebuf << " &);" << be_nl; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << namebuf << " &operator= (const " << this->local_name () << " &); // fixed-size types only" << be_nl; @@ -131,7 +131,7 @@ be_union::gen_var_defn (char *) *ch << "operator " << this->local_name () << " &();" << be_nl; *ch << "operator " << this->local_name () << " &() const;" << be_nl; - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { *ch << " // Variable size types only." << be_nl; *ch << "operator " << this->local_name () @@ -143,7 +143,7 @@ be_union::gen_var_defn (char *) // The return types of in, out, inout, and _retn are based on the parameter // passing rules and the base type. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ch << "const " << local_name () << " &in (void) const;" << be_nl; *ch << this->local_name () << " &inout (void);" << be_nl; @@ -241,7 +241,7 @@ be_union::gen_var_impl (char *, *ci << "}\n\n"; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { *ci << "// fixed-size types only" << be_nl; *ci << "ACE_INLINE" << be_nl; @@ -309,7 +309,7 @@ be_union::gen_var_impl (char *, << "}\n\n"; // Fixed-size types only. - if (this->size_type () == be_decl::FIXED) + if (this->size_type () == AST_Type::FIXED) { ci->indent (); *ci << "// fixed-size types only" << be_nl; @@ -382,7 +382,7 @@ be_union::gen_var_impl (char *, *ci << "}\n\n"; // Variable-size types only. - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { ci->indent (); *ci << "// variable-size types only" << be_nl; @@ -417,7 +417,7 @@ be_union::gen_var_impl (char *, // The out and _retn are handled differently based on our size type. ci->indent (); - if (this->size_type () == be_decl::VARIABLE) + if (this->size_type () == AST_Type::VARIABLE) { *ci << "// mapping for variable size " << be_nl; *ci << "ACE_INLINE ::" << this->name () << " *&" << be_nl; @@ -685,15 +685,16 @@ be_union::compute_size_type (void) { // Get the next AST decl node. AST_Decl *d = si.item (); - be_decl *bd = be_decl::narrow_from_decl (d); + AST_Field *f = AST_Field::narrow_from_decl (d); - if (bd != 0) + if (f != 0) { + AST_Type *t = f->field_type (); // Our sizetype depends on the sizetype of our members. Although // previous value of sizetype may get overwritten, we are // guaranteed by the "size_type" call that once the value reached // be_decl::VARIABLE, nothing else can overwrite it. - this->size_type (bd->size_type ()); + this->size_type (t->size_type ()); } else { diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp index 8bbcfbc32f9..c24f04b1b42 100644 --- a/TAO/TAO_IDL/be/be_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_union_branch.cpp @@ -51,27 +51,6 @@ be_union_branch::be_union_branch (UTL_LabelList *ll, { } -// Compute the size type of the node in question. -int -be_union_branch::compute_size_type (void) -{ - be_type *type = be_type::narrow_from_decl (this->field_type ()); - - if (type == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_field::compute_size_type - " - "bad field type\n"), - -1); - } - - // Our size type is the same as our type. - // As a side effect will also update the size type of parent. - this->size_type (type->size_type ()); - - return 0; -} - int be_union_branch::gen_label_value (TAO_OutStream *os, unsigned long index) { diff --git a/TAO/TAO_IDL/be/be_union_fwd.cpp b/TAO/TAO_IDL/be/be_union_fwd.cpp new file mode 100644 index 00000000000..0bdcf6ac257 --- /dev/null +++ b/TAO/TAO_IDL/be/be_union_fwd.cpp @@ -0,0 +1,60 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_union_fwd.cpp +// +// = DESCRIPTION +// Extension of class AST_UnionFwd that provides additional means for C++ +// mapping of a union. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_union_fwd.h" +#include "be_visitor.h" + +ACE_RCSID (be, + be_union_fwd, + "$Id$") + +be_union_fwd::be_union_fwd (void) +{ +} + +be_union_fwd::be_union_fwd (UTL_ScopedName *n) + : be_type (AST_Decl::NT_union_fwd, + n), + AST_UnionFwd (n), + AST_Type (AST_Decl::NT_union_fwd, + n), + AST_Decl (AST_Decl::NT_union_fwd, + n) +{ +} + +be_union_fwd::~be_union_fwd (void) +{ +} + +void +be_union_fwd::destroy (void) +{ + // Do nothing. +} + +int +be_union_fwd::accept (be_visitor *visitor) +{ + return visitor->visit_union_fwd (this); +} + +// Narrowing +IMPL_NARROW_METHODS2 (be_union_fwd, AST_UnionFwd, be_type) +IMPL_NARROW_FROM_DECL (be_union_fwd) diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index 153d40a3e6c..a282735b5f4 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -34,7 +34,7 @@ be_valuetype::be_valuetype (void) : full_obv_skel_name_ (0) { // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ()); @@ -79,7 +79,7 @@ be_valuetype::be_valuetype (UTL_ScopedName *n, // Check that redefine() copies all members. // Always the case. - this->size_type (be_decl::VARIABLE); + this->size_type (AST_Type::VARIABLE); AST_Module *m = AST_Module::narrow_from_scope (this->defined_in ()); diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp index 780ae08cde8..2c609167b15 100644 --- a/TAO/TAO_IDL/be/be_visitor.cpp +++ b/TAO/TAO_IDL/be/be_visitor.cpp @@ -92,6 +92,11 @@ int be_visitor::visit_structure (be_structure *) return 0; } +int be_visitor::visit_structure_fwd (be_structure_fwd *) +{ + return 0; +} + int be_visitor::visit_exception (be_exception *) { return 0; @@ -132,6 +137,11 @@ int be_visitor::visit_union (be_union *) return 0; } +int be_visitor::visit_union_fwd (be_union_fwd *) +{ + return 0; +} + int be_visitor::visit_union_branch (be_union_branch *) { return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp index b1d886266d8..ae948fc61a1 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -204,7 +204,9 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node, 0); } - if (d->node_type () == AST_Decl::NT_attr) + AST_Decl::NodeType nt = d->node_type (); + + if (nt == AST_Decl::NT_attr) { be_attribute *attribute = be_attribute::narrow_from_decl (d); @@ -213,7 +215,7 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node, return 0; } } - else + else if (nt == AST_Decl::NT_op) { be_operation* operation = be_operation::narrow_from_decl (d); @@ -224,6 +226,10 @@ be_visitor_amh_pre_proc::add_rh_node_members ( be_interface *node, exception_holder); } } + else + { + continue; + } } return 1; @@ -648,8 +654,9 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) } be_decl *op = be_decl::narrow_from_decl (d); + AST_Decl::NodeType nt = d->node_type (); - if (d->node_type () == AST_Decl::NT_attr) + if (nt == AST_Decl::NT_attr) { AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d); @@ -669,12 +676,16 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) SET_OPERATION); } } - else + else if (nt == AST_Decl::NT_op) { this->create_raise_operation (op, excep_holder, NORMAL); } + else + { + continue; + } } return excep_holder; diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp index a4947efff7c..ccbe13d8ef7 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -397,9 +397,11 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) 0); } + be_decl *op = be_decl::narrow_from_decl (d); + AST_Decl::NodeType nt = d->node_type (); - if (d->node_type () == AST_Decl::NT_attr) + if (nt == AST_Decl::NT_attr) { AST_Attribute *attribute = AST_Attribute::narrow_from_decl (d); @@ -420,12 +422,16 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) } } - else + else if (nt == AST_Decl::NT_op) { this->create_raise_operation (op, excep_holder, NORMAL); } + else + { + continue; + } } // end of while loop } // end of if diff --git a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp index 5be455812b5..a9c924ea291 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp @@ -171,7 +171,7 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node) *os << "_tao_argument_" << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "_tao_argument_" << arg->local_name (); } @@ -707,7 +707,7 @@ int be_visitor_args_invoke_cs::visit_structure (be_structure *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "*" << arg->local_name () << ".ptr ()"; else *os << arg->local_name (); @@ -753,7 +753,7 @@ int be_visitor_args_invoke_cs::visit_union (be_union *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "*" << arg->local_name () << ".ptr ()"; else *os << arg->local_name (); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp index bc612c5c232..1651a3c48ad 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp @@ -700,7 +700,7 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << arg->local_name () << ".in ()"; else *os << arg->local_name (); @@ -746,7 +746,7 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << arg->local_name () << ".in ()"; else *os << arg->local_name (); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp index 5617fa0b5dd..e07bbc41fb7 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp @@ -27,8 +27,10 @@ ACE_RCSID (be_visitor_argument, // visitor for doing any post-processing after the upcall is made // ************************************************************************ -be_visitor_args_post_upcall_ss::be_visitor_args_post_upcall_ss (be_visitor_context *ctx) - : be_visitor_scope (ctx) +be_visitor_args_post_upcall_ss::be_visitor_args_post_upcall_ss ( + be_visitor_context *ctx + ) + : be_visitor_args (ctx) { } @@ -48,6 +50,7 @@ int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) // retrieve the type be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -79,8 +82,11 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) // if the current type is an alias, use that be_type *bt = node; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } switch (arg->direction ()) { @@ -103,6 +109,7 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) << arg->local_name () << be_uidt_nl << ");\n" << be_uidt; } + break; } return 0; @@ -111,6 +118,7 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) int be_visitor_args_post_upcall_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -119,6 +127,7 @@ int be_visitor_args_post_upcall_ss::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp index b8544336315..b7f4aedac4a 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp @@ -76,7 +76,7 @@ be_visitor_args_pre_invoke_cs::cannot_return_zero (void) return 1; } else if (bt->base_node_type () == AST_Decl::NT_struct - && bt->size_type () == be_decl::FIXED) + && bt->size_type () == AST_Type::FIXED) { return 1; } @@ -137,7 +137,7 @@ be_visitor_args_pre_invoke_cs::visit_array (be_array *node) switch (this->direction ()) { case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { os->indent (); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp index cbd9b2647ff..68c3c2c0582 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp @@ -88,7 +88,7 @@ int be_visitor_args_upcall_ss::visit_array (be_array *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) *os << arg->local_name (); @@ -377,7 +377,7 @@ int be_visitor_args_upcall_ss::visit_structure (be_structure *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) *os << arg->local_name (); @@ -402,7 +402,7 @@ int be_visitor_args_upcall_ss::visit_union (be_union *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) *os << arg->local_name (); diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp index f39e1886924..9609981b577 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp @@ -161,7 +161,7 @@ int be_visitor_array_ch::visit_array (be_array *node) } // An out defn is generated only for a variable length struct - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { if (this->gen_out_defn (node) == -1) { @@ -351,7 +351,7 @@ be_visitor_array_ch::gen_var_defn (be_array *node) *os << "operator " << namebuf << "_slice * const &() const;" << be_nl; - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "operator " << namebuf << "_slice *&();" << be_nl; } @@ -370,7 +370,7 @@ be_visitor_array_ch::gen_var_defn (be_array *node) *os << "// in, inout, out, _retn " << be_nl; *os << "const " << namebuf << "_slice *in (void) const;" << be_nl; - if (node->size_type () == be_decl::FIXED) + if (node->size_type () == AST_Type::FIXED) { *os << namebuf << "_slice *inout (void);" << be_nl; } diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp index ca346dadd7e..86e7c060e7a 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp @@ -84,7 +84,7 @@ int be_visitor_array_ci::visit_array (be_array *node) "var_defn failed\n"), -1); } - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { if (this->gen_out_impl (node) == -1) { @@ -249,7 +249,7 @@ be_visitor_array_ci::gen_var_impl (be_array *node) *os << "return this->ptr_;" << be_uidt_nl; *os << "}\n\n"; - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { os->indent (); *os << "ACE_INLINE " << be_nl; @@ -304,7 +304,7 @@ be_visitor_array_ci::gen_var_impl (be_array *node) *os << "}\n\n"; os->indent (); - if (node->size_type () == be_decl::FIXED) + if (node->size_type () == AST_Type::FIXED) { *os << "ACE_INLINE " << nodename << "_slice *" << be_nl; } diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index ebcf725f544..829f99f7961 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -30,6 +30,7 @@ #include "be_visitor_interface/interface_ch.h" #include "be_visitor_interface/ami_interface_ch.h" #include "be_visitor_valuetype/valuetype.h" +#include "be_visitor_valuetype/valuetype_ch.h" #include "be_visitor_valuetype/valuetype_obv_ch.h" #include "be_visitor_valuetype/valuetype_obv_cs.h" #include "be_visitor_valuetype/ami_exception_holder_ch.h" diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp index 114bd739a14..021fbb55cc4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp @@ -1,5 +1,7 @@ + // $Id$ // +/* -*- c++ -*- */ // ============================================================================ // // = LIBRARY @@ -16,6 +18,7 @@ // // ============================================================================ +#include "be_argument.h" #include "be_interface.h" #include "be_attribute.h" #include "be_constant.h" @@ -23,7 +26,9 @@ #include "be_exception.h" #include "be_operation.h" #include "be_structure.h" +#include "be_structure_fwd.h" #include "be_union.h" +#include "be_union_fwd.h" #include "be_typedef.h" #include "be_predefined_type.h" #include "be_helper.h" @@ -38,8 +43,10 @@ #include "be_visitor_enum.h" #include "be_visitor_exception.h" #include "be_visitor_structure.h" +#include "be_visitor_structure_fwd.h" #include "be_visitor_typedef.h" #include "be_visitor_union.h" +#include "be_visitor_union_fwd.h" #include "be_visitor_operation.h" #include "be_visitor_context.h" diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index 9995568c4f5..a3bf1523e1a 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -966,6 +966,97 @@ be_visitor_interface::visit_structure (be_structure *node) } int +be_visitor_interface::visit_structure_fwd (be_structure_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + { + ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH); + be_visitor_structure_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_CS: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS: + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_IH: + case TAO_CodeGen::TAO_INTERFACE_IS: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: + case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH: + case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SS: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CS: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS: + case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH: + case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SS: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CS: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS: + + case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH: + case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_structure_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_structure_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_interface::visit_union (be_union *node) { // Instantiate a visitor context with a copy of our context. This info @@ -1099,6 +1190,97 @@ be_visitor_interface::visit_union (be_union *node) } int +be_visitor_interface::visit_union_fwd (be_union_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_INTERFACE_CH: + { + ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH); + be_visitor_union_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_INTERFACE_CI: + case TAO_CodeGen::TAO_INTERFACE_CS: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CS: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CH: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CI: + case TAO_CodeGen::TAO_INTERFACE_CDR_OP_CS: + case TAO_CodeGen::TAO_INTERFACE_SH: + case TAO_CodeGen::TAO_INTERFACE_IH: + case TAO_CodeGen::TAO_INTERFACE_IS: + case TAO_CodeGen::TAO_INTERFACE_SI: + case TAO_CodeGen::TAO_INTERFACE_SS: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_COLLOCATED_SS: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SH: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_COLLOCATED_SS: + case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH: + case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CH: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_CS: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SH: + case TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS: + case TAO_CodeGen::TAO_INTERFACE_TIE_SH: + case TAO_CodeGen::TAO_INTERFACE_TIE_SI: + + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_CS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_BROKERS_SS: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CH: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_BROKER_CS: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CH: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_BROKER_CS: + case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH: + case TAO_CodeGen::TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_CS: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SH: + case TAO_CodeGen::TAO_INTERFACE_PROXY_IMPLS_SS: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CH: + case TAO_CodeGen::TAO_INTERFACE_BASE_PROXY_IMPL_CS: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CH: + case TAO_CodeGen::TAO_INTERFACE_REMOTE_PROXY_IMPL_CS: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH: + case TAO_CodeGen::TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH: + case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS: + + case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SH: + case TAO_CodeGen::TAO_INTERFACE_AMH_RH_SS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_union_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface::" + "visit_union_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_interface::visit_typedef (be_typedef *node) { // Instantiate a visitor context with a copy of our context. This info diff --git a/TAO/TAO_IDL/be/be_visitor_module.cpp b/TAO/TAO_IDL/be/be_visitor_module.cpp index 48a37c91fd6..6028e016bb0 100644 --- a/TAO/TAO_IDL/be/be_visitor_module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module.cpp @@ -25,8 +25,10 @@ #include "be_interface.h" #include "be_interface_fwd.h" #include "be_structure.h" +#include "be_structure_fwd.h" #include "be_typedef.h" #include "be_union.h" +#include "be_union_fwd.h" #include "be_valuetype.h" #include "be_valuetype_fwd.h" #include "be_extern.h" @@ -40,8 +42,11 @@ #include "be_visitor_interface.h" #include "be_visitor_interface_fwd.h" #include "be_visitor_structure.h" +#include "be_visitor_structure_fwd.h" #include "be_visitor_typedef.h" #include "be_visitor_union.h" +#include "be_visitor_union_fwd.h" +#include "be_visitor_valuetype.h" #include "be_visitor_valuetype_fwd.h" #include "be_visitor_context.h" diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index f81d93231e3..9341c966799 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -48,7 +48,8 @@ int be_visitor_module::visit_module (be_module *node) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_module::visit_module - " - "codegen for scope failed\n"), -1); + "codegen for scope failed\n"), + -1); } return 0; @@ -558,33 +559,66 @@ be_visitor_module::visit_valuetype (be_valuetype *node) // will be modified based on what type of node we are visiting be_visitor_context ctx (*this->ctx_); ctx.node (node); + int status = 0; switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_MODULE_CH: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CH); + be_visitor_valuetype_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_CI: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CI); + be_visitor_valuetype_ci visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CS); + be_visitor_valuetype_cs visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_CDR_OP_CH: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH); + be_visitor_valuetype_cdr_op_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_CDR_OP_CI: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI); + be_visitor_valuetype_cdr_op_ci visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_CDR_OP_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS); + be_visitor_valuetype_cdr_op_cs visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH); + be_visitor_valuetype_any_op_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS); - break; + { + ctx.state (TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS); + be_visitor_valuetype_any_op_cs visitor (&ctx); + status = node->accept (&visitor); + break; + } case TAO_CodeGen::TAO_MODULE_SH: case TAO_CodeGen::TAO_MODULE_IH: case TAO_CodeGen::TAO_MODULE_SI: @@ -601,21 +635,7 @@ be_visitor_module::visit_valuetype (be_valuetype *node) } } - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state ())); - be_visitor *visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - // Let the node accept this visitor. - if (node->accept (visitor) == -1) + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_module::" @@ -624,39 +644,6 @@ be_visitor_module::visit_valuetype (be_valuetype *node) -1); } - delete visitor; - visitor = 0; - - // Do addtional "extra" code generation if necessary. - if (node->has_extra_code_generation (ctx.state ())) - { - // Change the state depending on the kind of node strategy. - ctx.state (node->next_state (ctx.state (), 1)); - visitor = tao_cg->make_visitor (&ctx); - - if (!visitor) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_module::" - "visit_valuetype - " - "NUL visitor\n"), - -1); - } - - // Let the node accept this visitor. - if (node->accept (visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_module::" - "visit_valuetype - " - "failed to accept visitor\n"), - -1); - } - - delete visitor; - visitor = 0; - } - return 0; } @@ -827,6 +814,59 @@ be_visitor_module::visit_structure (be_structure *node) } int +be_visitor_module::visit_structure_fwd (be_structure_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + { + ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH); + be_visitor_structure_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_MODULE_CI: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CI: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CH: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CS: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + case TAO_CodeGen::TAO_MODULE_CS: + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + case TAO_CodeGen::TAO_MODULE_IH: + case TAO_CodeGen::TAO_MODULE_IS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_module::visit_union (be_union *node) { // Instantiate a visitor context with a copy of our context. This info @@ -922,6 +962,59 @@ be_visitor_module::visit_union (be_union *node) } int +be_visitor_module::visit_union_fwd (be_union_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_MODULE_CH: + { + ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH); + be_visitor_union_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_MODULE_CI: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CI: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CH: + case TAO_CodeGen::TAO_MODULE_CDR_OP_CS: + case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: + case TAO_CodeGen::TAO_MODULE_CS: + case TAO_CodeGen::TAO_MODULE_SH: + case TAO_CodeGen::TAO_MODULE_SI: + case TAO_CodeGen::TAO_MODULE_SS: + case TAO_CodeGen::TAO_MODULE_IH: + case TAO_CodeGen::TAO_MODULE_IS: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_module::" + "visit_interface_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_module::visit_typedef (be_typedef *node) { // Instantiate a visitor context with a copy of our context. This info diff --git a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp index 78c2937678b..c0bab945186 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/interceptors_info_rettype.cpp @@ -234,7 +234,7 @@ be_visitor_operation_interceptors_info_rettype::visit_structure (be_structure *n // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << " *"; } @@ -280,7 +280,7 @@ be_visitor_operation_interceptors_info_rettype::visit_union (be_union *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << " *"; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp index 4cb909735b3..37aa726e00b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -177,9 +177,7 @@ be_visitor_operation_cs::visit_operation (be_operation *node) } else if (bnt == AST_Decl::NT_struct || bnt == AST_Decl::NT_union) { - be_decl *bd = be_decl::narrow_from_decl (bt); - - if (bd->size_type () == be_decl::FIXED) + if (bt->size_type () == AST_Type::FIXED) { // For a fixed size struct or union the return value // is not a pointer, so we call the default constructor diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp index fe69d082c97..fd0245978f8 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -371,7 +371,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - if (bt->size_type () == be_decl::VARIABLE + if (bt->size_type () == AST_Type::VARIABLE || bt->base_node_type () == AST_Decl::NT_array) { *os << " _tao_retval_info = _tao_retval._retn ();" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp index 9771831fe2c..415510955c3 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/remote_proxy_impl_cs.cpp @@ -236,7 +236,7 @@ be_visitor_operation_remote_proxy_impl_cs::visit_operation ( if (!this->void_return_type (bt)) { // Now generate the normal successful return statement. - if (bt->size_type () == be_decl::VARIABLE + if (bt->size_type () == AST_Type::VARIABLE || bt->base_node_type () == AST_Decl::NT_array) { *os << "return _tao_retval._retn ();"; @@ -809,7 +809,7 @@ be_visitor_operation_remote_proxy_impl_cs::gen_marshal_and_invoke ( ); } - if (bt->size_type () == be_decl::VARIABLE + if (bt->size_type () == AST_Type::VARIABLE || bt->base_node_type () == AST_Decl::NT_array) { *os << " _tao_retval_info = _tao_retval._retn ();" << be_nl @@ -967,7 +967,7 @@ be_visitor_operation_remote_proxy_impl_cs::gen_raise_interceptor_exception ( } else { - if (bt->size_type () == be_decl::VARIABLE + if (bt->size_type () == AST_Type::VARIABLE || bt->base_node_type () == AST_Decl::NT_array) { *os << "TAO_INTERCEPTOR_THROW_RETURN (" << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp index 306f412d127..f513797124b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp @@ -248,7 +248,7 @@ be_visitor_operation_rettype::visit_structure (be_structure *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << " *"; } @@ -295,7 +295,7 @@ be_visitor_operation_rettype::visit_union (be_union *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << " *"; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp index 6199e6e1e45..dc949f8286d 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp @@ -434,14 +434,14 @@ int be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "_tao_retval.in ()"; else *os << "_tao_retval"; } else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "_tao_retval.inout ()"; else *os << "_tao_retval"; @@ -463,14 +463,14 @@ int be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node) if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "_tao_retval.in ()"; else *os << "_tao_retval"; } else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "_tao_retval.inout ()"; else *os << "_tao_retval"; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp index c5f18a17af3..d5133f22ea9 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp @@ -150,7 +150,7 @@ be_visitor_operation_rettype_return_cs::visit_structure (be_structure *node) { TAO_OutStream *os = this->ctx_->stream (); - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "_tao_retval._retn ()"; } @@ -185,7 +185,7 @@ be_visitor_operation_rettype_return_cs::visit_union (be_union *node) { TAO_OutStream *os = this->ctx_->stream (); - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "_tao_retval._retn ()"; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp index bb9e1a763bd..9cd41f14904 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp @@ -313,7 +313,7 @@ be_visitor_operation_rettype_vardecl_cs::visit_structure (be_structure *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << bt->name () << "_var _tao_retval;" << be_nl; } @@ -365,7 +365,7 @@ be_visitor_operation_rettype_vardecl_cs::visit_union (be_union *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << bt->name () << "_var _tao_retval;"; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp index 3b1bec6ed16..2fd79a86c57 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp @@ -217,7 +217,7 @@ be_visitor_operation_rettype_vardecl_ss::visit_structure (be_structure *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "::" << bt->name () << "_var _tao_retval;\n"; } @@ -265,7 +265,7 @@ be_visitor_operation_rettype_vardecl_ss::visit_union (be_union *node) // Based on whether we are variable or not, we return a pointer or the // aggregate type. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { *os << "::" << bt->name () << "_var _tao_retval;\n"; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence.cpp b/TAO/TAO_IDL/be/be_visitor_sequence.cpp index 863d6bd9b43..c13e473c54a 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence.cpp @@ -25,7 +25,9 @@ #include "be_sequence.h" #include "be_string.h" #include "be_structure.h" +#include "be_structure_fwd.h" #include "be_union.h" +#include "be_union_fwd.h" #include "be_type.h" #include "be_typedef.h" #include "be_valuetype.h" diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp index 434e5706ed8..e180e5f17b1 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp @@ -158,12 +158,24 @@ be_visitor_sequence_buffer_type::visit_structure (be_structure *node) } int +be_visitor_sequence_buffer_type::visit_structure_fwd (be_structure_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_buffer_type::visit_union (be_union *node) { return this->visit_node (node); } int +be_visitor_sequence_buffer_type::visit_union_fwd (be_union_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_buffer_type::visit_enum (be_enum *node) { return this->visit_node (node); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp index 5d0c6833595..150b3ea2209 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp @@ -278,12 +278,24 @@ be_visitor_sequence_elemtype::visit_structure (be_structure *node) } int +be_visitor_sequence_elemtype::visit_structure_fwd (be_structure_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_elemtype::visit_union (be_union *node) { return this->visit_node (node); } int +be_visitor_sequence_elemtype::visit_union_fwd (be_union_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_elemtype::visit_enum (be_enum *node) { return this->visit_node (node); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp index fde9d8dfe05..0e254c20ad9 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_sequence_ch.cpp @@ -61,8 +61,8 @@ be_visitor_sequence_ch::gen_unbounded_sequence (be_sequence *node) ctx.state (TAO_CodeGen::TAO_SEQUENCE_BASE_CH); be_visitor_sequence_base visitor (&ctx); - *os << be_nl << "// TAO_IDL - Generated from " - << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + *os << be_nl << "// TAO_IDL - Generated from " << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; os->gen_ifdef_AHETI (); os->gen_ifdef_macro (class_name); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp index 17a189bd353..1277fd82ccf 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp @@ -129,12 +129,24 @@ be_visitor_sequence_base::visit_structure (be_structure *node) } int +be_visitor_sequence_base::visit_structure_fwd (be_structure_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_base::visit_union (be_union *node) { return this->visit_node (node); } int +be_visitor_sequence_base::visit_union_fwd (be_union_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_base::visit_enum (be_enum *node) { return this->visit_node (node); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp index 3f1a1da8d8b..81acaff310c 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp @@ -47,9 +47,6 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node) -1); } - *os << be_nl << "// TAO_IDL - Generated from " - << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - os->gen_ifdef_AHETI (); // This is the instantiation branch. @@ -369,6 +366,9 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node) << "// *************************************************************" << be_nl << be_nl; + *os << be_nl << "// TAO_IDL - Generated from " << be_nl + << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; + // Generate a typedef to a parametrized sequence. *os << "class " << be_global->stub_export_macro () << " " << node->local_name () << " : public "; @@ -565,7 +565,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node) *os << namebuf << " (const " << namebuf << " &);" << be_nl; // Fixed-size base types only. - if (bt->size_type () == be_decl::FIXED) + if (bt->size_type () == AST_Type::FIXED) { *os << "// Fixed-size base types only." << be_nl; *os << namebuf << " (const " << node->local_name () @@ -584,7 +584,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node) *os << namebuf << " &operator= (const " << namebuf << " &);" << be_nl; // Fixed-size base types only. - if (bt->size_type () == be_decl::FIXED) + if (bt->size_type () == AST_Type::FIXED) { *os << "// Fixed-size base types only." << be_nl; *os << namebuf << " &operator= (const " << node->local_name () @@ -604,7 +604,7 @@ be_visitor_sequence_ch::gen_var_defn (be_sequence *node) *os << "operator " << node->local_name () << " &();" << be_nl; *os << "operator " << node->local_name () << " &() const;" << be_nl; - if (bt->size_type () == be_decl::VARIABLE) + if (bt->size_type () == AST_Type::VARIABLE) { *os << "operator " << node->local_name () << " *&(); // variable-size base types only" << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp index 682cdf9f5f3..398680b7b7b 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp @@ -260,7 +260,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node) *os << "}" << be_nl << be_nl; // Fixed-size base types only. - if (bt->size_type () == be_decl::FIXED) + if (bt->size_type () == AST_Type::FIXED) { *os << "// fixed-size base types only" << be_nl; *os << "ACE_INLINE" << be_nl; @@ -319,7 +319,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node) << "}\n\n"; // Fixed-size base types only. - if (bt->size_type () == be_decl::FIXED) + if (bt->size_type () == AST_Type::FIXED) { *os << "// fixed-size types only" << be_nl; *os << "ACE_INLINE ::" << fname << " &" << be_nl; @@ -372,7 +372,7 @@ be_visitor_sequence_ci::gen_var_impl (be_sequence *node) *os << "}" << be_nl << be_nl; // Variable-size base types only. - if (bt->size_type () == be_decl::VARIABLE) + if (bt->size_type () == AST_Type::VARIABLE) { *os << "// variable-size types only" << be_nl; *os << "ACE_INLINE" << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp index ff1448ce383..b51c799747a 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ch.cpp @@ -44,7 +44,6 @@ int be_visitor_structure_ch::visit_structure (be_structure *node) { os = this->ctx_->stream (); - *os << "struct " << node->local_name () << ";" << be_nl; *os << "class " << node->local_name () << "_var;" << be_nl << be_nl; *os << "struct " << be_global->stub_export_macro () << " " @@ -89,7 +88,7 @@ int be_visitor_structure_ch::visit_structure (be_structure *node) // A class is generated for an out defn only for a variable // length struct. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { if (node->gen_out_defn () == -1) { diff --git a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp index 83d98176692..a064c72541d 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/structure_ci.cpp @@ -47,7 +47,7 @@ int be_visitor_structure_ci::visit_structure (be_structure *node) "visit_structure - " "codegen for _var failed\n"), -1); } - if (node->size_type () == be_decl::VARIABLE && + if (node->size_type () == AST_Type::VARIABLE && node->gen_out_impl () == -1) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp new file mode 100644 index 00000000000..3d9cd997639 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd.cpp @@ -0,0 +1,31 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_structure_fwd.cpp +// +// = DESCRIPTION +// Visitors for generation of code for be_structure_fwd +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_structure_fwd.h" + +#include "be_visitor_structure_fwd.h" +#include "be_visitor_context.h" +#include "be_helper.h" + +#include "be_visitor_structure_fwd/structure_fwd_ch.cpp" + +ACE_RCSID (be, + be_visitor_structure_fwd, + "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp new file mode 100644 index 00000000000..c923cfa3987 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_structure_fwd/structure_fwd_ch.cpp @@ -0,0 +1,53 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_fwd_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for be_structure_fwd node in the client header. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +ACE_RCSID (be_visitor_structure_fwd, + structure_fwd_ch, + "$Id$") + +be_visitor_structure_fwd_ch::be_visitor_structure_fwd_ch ( + be_visitor_context *ctx + ) + : be_visitor_decl (ctx) +{ +} + +be_visitor_structure_fwd_ch::~be_visitor_structure_fwd_ch (void) +{ +} + +// Visit the interface_fwd_ch node and its scope. +int +be_visitor_structure_fwd_ch::visit_structure_fwd (be_structure_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (node->cli_hdr_gen () || node->imported ()) + { + return 0; + } + + // Generate a forward declaration of the class. + *os << "struct " << node->local_name () << ";" << be_nl; + + node->cli_hdr_gen (I_TRUE); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp index ab00c6c0aca..9332f227883 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp @@ -49,7 +49,6 @@ int be_visitor_union_ch::visit_union (be_union *node) // Generate the ifdefined macro for the union type. os->gen_ifdef_macro (node->flat_name ()); - *os << "class " << node->local_name () << ";" << be_nl; *os << "class " << node->local_name () << "_var;" << be_nl << be_nl; *os << "class " << be_global->stub_export_macro () << " " @@ -207,7 +206,7 @@ int be_visitor_union_ch::visit_union (be_union *node) // A class is generated for an out defn only for a variable // length struct. - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { if (node->gen_out_defn () == -1) { diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp index 56971e41d03..fdfac26e17a 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/union_ci.cpp @@ -107,7 +107,7 @@ int be_visitor_union_ci::visit_union (be_union *node) // _out impl os->gen_ifdef_macro (node->flat_name (), "_out"); - if (node->size_type () == be_decl::VARIABLE + if (node->size_type () == AST_Type::VARIABLE && node->gen_out_impl () == -1) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp index 6a603f42b40..576444cd9e3 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp @@ -369,7 +369,7 @@ be_visitor_union_branch_private_ch::visit_structure (be_structure *node) TAO_OutStream *os = this->ctx_->stream (); // If we are variable sized, we need a pointer type. - if (node->size_type () == be_decl::VARIABLE + if (node->size_type () == AST_Type::VARIABLE || node->has_constructor ()) { *os << bt->nested_type_name (bu) << " *" << ub->local_name () diff --git a/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp new file mode 100644 index 00000000000..79ed60e34cc --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_fwd.cpp @@ -0,0 +1,31 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union_fwd.cpp +// +// = DESCRIPTION +// Visitors for generation of code for be_union_fwd +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#include "be_union_fwd.h" + +#include "be_visitor_union_fwd.h" +#include "be_visitor_context.h" +#include "be_helper.h" + +#include "be_visitor_union_fwd/union_fwd_ch.cpp" + +ACE_RCSID (be, + be_visitor_union_fwd, + "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp new file mode 100644 index 00000000000..ad86bed923b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_union_fwd/union_fwd_ch.cpp @@ -0,0 +1,53 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_fwd_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for be_union_fwd node in the client header. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +ACE_RCSID (be_visitor_union_fwd, + union_fwd_ch, + "$Id$") + +be_visitor_union_fwd_ch::be_visitor_union_fwd_ch ( + be_visitor_context *ctx + ) + : be_visitor_decl (ctx) +{ +} + +be_visitor_union_fwd_ch::~be_visitor_union_fwd_ch (void) +{ +} + +// Visit the interface_fwd_ch node and its scope. +int +be_visitor_union_fwd_ch::visit_union_fwd (be_union_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (node->cli_hdr_gen () || node->imported ()) + { + return 0; + } + + // Generate a forward declaration of the class. + *os << "class " << node->local_name () << ";" << be_nl; + + node->cli_hdr_gen (I_TRUE); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp index d79cf1e10e0..21138183912 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp @@ -33,8 +33,10 @@ #include "be_sequence.h" #include "be_string.h" #include "be_structure.h" +#include "be_structure_fwd.h" #include "be_typedef.h" #include "be_union.h" +#include "be_union_fwd.h" #include "be_valuetype.h" #include "be_valuetype_fwd.h" #include "be_helper.h" @@ -51,9 +53,11 @@ #include "be_visitor_operation.h" #include "be_visitor_sequence.h" #include "be_visitor_structure.h" +#include "be_visitor_structure_fwd.h" #include "be_visitor_typecode.h" #include "be_visitor_typedef.h" #include "be_visitor_union.h" +#include "be_visitor_union_fwd.h" #include "be_visitor_context.h" #include "be_visitor_valuetype/valuetype.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp index ac639ee46d5..f4345a6c608 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp @@ -576,6 +576,70 @@ be_visitor_valuetype::visit_structure (be_structure *node) } int +be_visitor_valuetype::visit_structure_fwd (be_structure_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_VALUETYPE_CH: + { + ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH); + be_visitor_structure_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_VALUETYPE_CI: + case TAO_CodeGen::TAO_VALUETYPE_CS: + case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH: + case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS: + case TAO_CodeGen::TAO_VALUETYPE_SH: + case TAO_CodeGen::TAO_VALUETYPE_IH: + case TAO_CodeGen::TAO_VALUETYPE_SI: + case TAO_CodeGen::TAO_VALUETYPE_SS: + case TAO_CodeGen::TAO_VALUETYPE_IS: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: + case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SH: + case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SS: + case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CH: + case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CS: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CH: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CI: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CS: + case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype::" + "visit_structure_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype::" + "visit_structure_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_valuetype::visit_union (be_union *node) { be_visitor_context ctx (*this->ctx_); @@ -672,6 +736,70 @@ be_visitor_valuetype::visit_union (be_union *node) } int +be_visitor_valuetype::visit_union_fwd (be_union_fwd *node) +{ + // Instantiate a visitor context with a copy of our context. This info + // will be modified based on what type of node we are visiting. + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + int status = 0; + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_VALUETYPE_CH: + { + ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH); + be_visitor_union_fwd_ch visitor (&ctx); + status = node->accept (&visitor); + break; + } + case TAO_CodeGen::TAO_VALUETYPE_CI: + case TAO_CodeGen::TAO_VALUETYPE_CS: + case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH: + case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CH: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI: + case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS: + case TAO_CodeGen::TAO_VALUETYPE_SH: + case TAO_CodeGen::TAO_VALUETYPE_IH: + case TAO_CodeGen::TAO_VALUETYPE_SI: + case TAO_CodeGen::TAO_VALUETYPE_SS: + case TAO_CodeGen::TAO_VALUETYPE_IS: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CI: + case TAO_CodeGen::TAO_VALUETYPE_OBV_CS: + case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SH: + case TAO_CodeGen::TAO_VALUETYPE_COLLOCATED_SS: + case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CH: + case TAO_CodeGen::TAO_VALUETYPE_MARSHAL_CS: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CH: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CI: + case TAO_CodeGen::TAO_VALUETYPE_INIT_CS: + case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH: + return 0; // nothing to be done + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype::" + "visit_union_fwd - " + "Bad context state\n"), + -1); + } + } + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype::" + "visit_union_fwd - " + "failed to accept visitor\n"), + -1); + } + + return 0; +} + +int be_visitor_valuetype::visit_typedef (be_typedef *node) { be_visitor_context ctx (*this->ctx_); diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index bab081e1aa8..4bfa4e1f274 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -451,6 +451,9 @@ public: TAO_STRUCT_CDR_OP_CI, TAO_STRUCT_CDR_OP_CS, + // Emitting code for a forward declared struct. + TAO_STRUCT_FWD_CH, + // Emitting code for typedefs. TAO_TYPEDEF_CH, TAO_TYPEDEF_CI, @@ -471,6 +474,9 @@ public: TAO_UNION_CDR_OP_CI, TAO_UNION_CDR_OP_CS, + // Emitting code for a forward declared union. + TAO_UNION_FWD_CH, + // Emitting code for the discriminant. TAO_UNION_DISCTYPEDEFN_CH, TAO_UNION_DISCTYPEDEFN_CI, diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index e6063fc8a63..f89bfa70bbd 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -36,15 +36,6 @@ class be_decl : public virtual AST_Decl // interface. // public: - enum SIZE_TYPE - { - SIZE_UNKNOWN, - FIXED, - VARIABLE - }; - // Undicates if we are fixed size or variable. Most useful for structs, - // unions, and arrays. - be_decl (void); // Default constructor. @@ -55,12 +46,6 @@ public: ~be_decl (void); // Destructor. - virtual void size_type (SIZE_TYPE); - // Set the size type. - - virtual SIZE_TYPE size_type (void); - // Return our size type. - const char *flat_name (void); // Return the flattened full scoped name. @@ -88,12 +73,6 @@ public: // Visiting virtual int accept (be_visitor *visitor); - idl_bool has_constructor (void); - // Accessor for protected member. - - void has_constructor (idl_bool value); - // Mutator for protected member. - virtual void destroy (void); // Cleanup function. @@ -134,9 +113,6 @@ public: DEF_NARROW_FROM_DECL (be_decl); protected: - virtual int compute_size_type (void); - // Determine our size type and set it if it is unknown. - virtual void compute_flat_name (void); // Compute the flattened fully scoped name. @@ -159,13 +135,6 @@ protected: char *flat_name_; // Flattened fully scoped name. - - SIZE_TYPE size_type_; - // Whether we are fixed or variable size (by default fixed). - - idl_bool has_constructor_; - // Attribute that helps a union determine whether a member - // should be included by value or by reference. }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_enum_val.h b/TAO/TAO_IDL/be_include/be_enum_val.h index 2019ee39258..50d10e42068 100644 --- a/TAO/TAO_IDL/be_include/be_enum_val.h +++ b/TAO/TAO_IDL/be_include/be_enum_val.h @@ -48,11 +48,6 @@ public: // Narrowing DEF_NARROW_METHODS2 (be_enum_val, AST_EnumVal, be_decl); DEF_NARROW_FROM_DECL (be_enum_val); - -protected: - virtual int compute_size_type (void); - // Trivial implementation, but it avoids a switch statement - // in be_decl::size_type(). }; #endif diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h index 1c9a8dae93d..95147f7bd91 100644 --- a/TAO/TAO_IDL/be_include/be_field.h +++ b/TAO/TAO_IDL/be_include/be_field.h @@ -45,10 +45,6 @@ public: // Narrowing. DEF_NARROW_METHODS2 (be_field, AST_Field, be_decl); DEF_NARROW_FROM_DECL (be_field); - -protected: - virtual int compute_size_type (void); - // Compute the size type if it is unknown. }; #endif diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h index a9476053201..a42f89107d8 100644 --- a/TAO/TAO_IDL/be_include/be_generator.h +++ b/TAO/TAO_IDL/be_include/be_generator.h @@ -116,6 +116,8 @@ public: idl_bool local, idl_bool abstract); + virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n); + virtual AST_Enum *create_enum (UTL_ScopedName *n, idl_bool local, idl_bool abstract); @@ -140,10 +142,12 @@ public: idl_bool local, idl_bool abstract); - virtual AST_Union *create_union(AST_ConcreteType *dt, - UTL_ScopedName *n, - idl_bool local, - idl_bool abstract); + virtual AST_Union *create_union (AST_ConcreteType *dt, + UTL_ScopedName *n, + idl_bool local, + idl_bool abstract); + + virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n); virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll, AST_Type *ft, diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h index 58f8a357795..9e9399b595b 100644 --- a/TAO/TAO_IDL/be_include/be_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h @@ -7,10 +7,10 @@ // TAO IDL // // = FILENAME -// be_interface.h +// be_interface_fwd.h // // = DESCRIPTION -// Extension of class AST_Interface_Fwd that provides additional +// Extension of class AST_InterfaceFwd that provides additional // means for C++ mapping of an interface. // // = AUTHOR @@ -36,7 +36,7 @@ class be_interface_fwd : public virtual AST_InterfaceFwd, // be_interface_fwd // // =DESCRIPTION - // Extensions to the AST_Interface_Fwd class + // Extensions to the AST_InterfaceFwd class public: be_interface_fwd (void); // Default constructor. diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h index 77f71fc0df4..1c6801addef 100644 --- a/TAO/TAO_IDL/be_include/be_module.h +++ b/TAO/TAO_IDL/be_include/be_module.h @@ -50,10 +50,6 @@ public: DEF_NARROW_METHODS3 (be_module, AST_Module, be_scope, be_decl); DEF_NARROW_FROM_DECL (be_module); DEF_NARROW_FROM_SCOPE (be_module); - -protected: - virtual int compute_size_type (void); - // Compute the size type if it is unknown. }; #endif diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index 2ded44fef52..97bd426b492 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -87,9 +87,6 @@ public: DEF_NARROW_FROM_SCOPE (be_operation); protected: - int compute_size_type (void); - // Compute the size type if it is unknown. - be_operation_strategy *strategy_; // Member for holding the strategy for covering // differences between various operations, e.g. sendc_, raise_ diff --git a/TAO/TAO_IDL/be_include/be_structure_fwd.h b/TAO/TAO_IDL/be_include/be_structure_fwd.h new file mode 100644 index 00000000000..6627e9ade78 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_structure_fwd.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_structure_fwd.h +// +// = DESCRIPTION +// Extension of class AST_StructureFwd that provides additional +// means for C++ mapping of a struct. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef BE_STRUCTURE_FWD_H +#define BE_STRUCTURE_FWD_H + +#include "be_type.h" +#include "ast_structure_fwd.h" + +class be_visitor; + +class be_structure_fwd : public virtual AST_StructureFwd, + public virtual be_type +{ + // =TITLE + // be_structure_fwd + // + // =DESCRIPTION + // Extensions to the AST_StructureFwd class +public: + be_structure_fwd (void); + // Default constructor. + + be_structure_fwd (UTL_ScopedName *n); + // Constructor. + + virtual ~be_structure_fwd (void); + // Destructor. + + virtual void destroy (void); + // Cleanup function. + + // Visiting. + virtual int accept (be_visitor* visitor); + + // Narrowing. + DEF_NARROW_METHODS2 (be_structure_fwd, AST_StructureFwd, be_type); + DEF_NARROW_FROM_DECL (be_structure_fwd); +}; + +#endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h index 2f90195ee4d..940fb93cdfe 100644 --- a/TAO/TAO_IDL/be_include/be_union_branch.h +++ b/TAO/TAO_IDL/be_include/be_union_branch.h @@ -57,10 +57,6 @@ public: // Narrowing. DEF_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl); DEF_NARROW_FROM_DECL (be_union_branch); - -protected: - virtual int compute_size_type (void); - // Compute the size type if it is unknown. }; #endif diff --git a/TAO/TAO_IDL/be_include/be_union_fwd.h b/TAO/TAO_IDL/be_include/be_union_fwd.h new file mode 100644 index 00000000000..c9d2132983a --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_union_fwd.h @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_union_fwd.h +// +// = DESCRIPTION +// Extension of class AST_UnionFwd that provides additional +// means for C++ mapping of a union. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef BE_UNION_FWD_H +#define BE_UNION_FWD_H + +#include "be_type.h" +#include "ast_union_fwd.h" + +class be_visitor; + +class be_union_fwd : public virtual AST_UnionFwd, + public virtual be_type +{ + // =TITLE + // be_union_fwd + // + // =DESCRIPTION + // Extensions to the AST_UnionFwd class +public: + be_union_fwd (void); + // Default constructor. + + be_union_fwd (UTL_ScopedName *n); + // Constructor. + + virtual ~be_union_fwd (void); + // Destructor. + + virtual void destroy (void); + // Cleanup function. + + // Visiting. + virtual int accept (be_visitor* visitor); + + // Narrowing. + DEF_NARROW_METHODS2 (be_union_fwd, AST_UnionFwd, be_type); + DEF_NARROW_FROM_DECL (be_union_fwd); +}; + +#endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h index 2434d5655b0..4224847778c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor.h +++ b/TAO/TAO_IDL/be_include/be_visitor.h @@ -36,6 +36,7 @@ class be_valuetype; class be_valuetype_fwd; class be_factory; class be_structure; +class be_structure_fwd; class be_exception; class be_expression; class be_enum; @@ -44,6 +45,7 @@ class be_field; class be_argument; class be_attribute; class be_union; +class be_union_fwd; class be_union_branch; class be_union_label; class be_constant; @@ -106,6 +108,9 @@ public: virtual int visit_structure (be_structure *node); // visit a structure + virtual int visit_structure_fwd (be_structure_fwd *node); + // visit a structure + virtual int visit_exception (be_exception *node); // visit exception @@ -130,6 +135,9 @@ public: virtual int visit_union (be_union *node); // visit union + virtual int visit_union_fwd (be_union_fwd *node); + // visit union + virtual int visit_union_branch (be_union_branch *node); // visit union branch diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h index 2f0961a36d0..4a5e57a4c2c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h @@ -23,7 +23,6 @@ #define _BE_VISITOR_ARGUMENT_H #include "be_visitor_decl.h" -#include "be_visitor_scope.h" #include "be_visitor_argument/argument.h" #include "be_visitor_argument/arglist.h" #include "be_visitor_argument/vardecl_ss.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h index 6edd77f21b1..346fe3154f8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h @@ -25,6 +25,7 @@ // ************************************************************ // class be_visitor_args_marshal_ss // ************************************************************ + class be_visitor_args_marshal_ss : public be_visitor_args { // diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h index 32ff63812a7..19a700546c8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h @@ -27,7 +27,7 @@ // class be_visitor_args_post_upcall_ss // ************************************************************ -class be_visitor_args_post_upcall_ss : public be_visitor_scope +class be_visitor_args_post_upcall_ss : public be_visitor_args { // // = TITLE diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h index c2eaac62162..0f0db659a35 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/upcall_ss.h @@ -25,6 +25,7 @@ // ************************************************************ // class be_visitor_args_upcall_ss // ************************************************************ + class be_visitor_args_upcall_ss : public be_visitor_args { // diff --git a/TAO/TAO_IDL/be_include/be_visitor_enum.h b/TAO/TAO_IDL/be_include/be_visitor_enum.h index 30cac6d835b..4aaffbd4825 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_enum.h +++ b/TAO/TAO_IDL/be_include/be_visitor_enum.h @@ -22,7 +22,6 @@ #ifndef TAO_BE_VISITOR_ENUM_H #define TAO_BE_VISITOR_ENUM_H -#include "be_visitor_decl.h" #include "be_visitor_scope.h" #include "be_visitor_enum/enum_ch.h" #include "be_visitor_enum/enum_cs.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_exception.h b/TAO/TAO_IDL/be_include/be_visitor_exception.h index 1e441f874df..e70a818f621 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_exception.h +++ b/TAO/TAO_IDL/be_include/be_visitor_exception.h @@ -22,7 +22,6 @@ #ifndef TAO_BE_VISITOR_EXCEPTION_H #define TAO_BE_VISITOR_EXCEPTION_H -#include "be_visitor_decl.h" #include "be_visitor_scope.h" #include "be_visitor_exception/exception.h" #include "be_visitor_exception/exception_ch.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface.h index e56fe93aa7f..8135651e883 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface.h @@ -23,7 +23,6 @@ #include "ace/SString.h" -#include "be_visitor_decl.h" #include "be_visitor_scope.h" #include "be_visitor_interface/interface.h" #include "be_visitor_interface/interface_ch.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h index c887e0ca515..b70d2c613d3 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/interface.h @@ -80,9 +80,15 @@ public: virtual int visit_structure (be_structure *node); // visit a structure + virtual int visit_structure_fwd (be_structure_fwd *node); + // visit a forward declared structure + virtual int visit_union (be_union *node); // visit a union + virtual int visit_union_fwd (be_union_fwd *node); + // visit a union + virtual int visit_typedef (be_typedef *node); // visit the typedef node diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h index 195162ae8b4..2168bfc80e8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface_fwd.h @@ -23,7 +23,6 @@ #define TAO_BE_VISITOR_INTERFACE_FWD_H #include "be_visitor_decl.h" -#include "be_visitor_scope.h" #include "be_visitor_interface_fwd/interface_fwd_ch.h" #include "be_visitor_interface_fwd/interface_fwd_ci.h" #include "be_visitor_interface_fwd/cdr_op_ch.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_module/module.h b/TAO/TAO_IDL/be_include/be_visitor_module/module.h index 156212e0c8a..a26aef94d1f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_module/module.h +++ b/TAO/TAO_IDL/be_include/be_visitor_module/module.h @@ -30,7 +30,7 @@ class be_visitor_module : public be_visitor_scope // be_visitor_module // // = DESCRIPTION - // This is a concrete visitor for module that abstracts all common tasks + // This is a concrete visitor for module that abstracts all common tasks. // public: @@ -69,9 +69,15 @@ public: virtual int visit_structure (be_structure *node); // visit a structure + virtual int visit_structure_fwd (be_structure_fwd *node); + // visit a structure + virtual int visit_union (be_union *node); // visit a union + virtual int visit_union_fwd (be_union_fwd *node); + // visit a union + virtual int visit_typedef (be_typedef *node); // visit the typedef node diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h index 523f903bc98..0054c042c2d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/buffer_type.h @@ -48,9 +48,11 @@ public: virtual int visit_valuetype (be_valuetype *node); virtual int visit_valuetype_fwd (be_valuetype_fwd *node); virtual int visit_structure (be_structure *node); + virtual int visit_structure_fwd (be_structure_fwd *node); virtual int visit_enum (be_enum *node); virtual int visit_exception (be_exception *node); virtual int visit_union (be_union *node); + virtual int visit_union_fwd (be_union_fwd *node); virtual int visit_array (be_array *node); virtual int visit_string (be_string *node); virtual int visit_sequence (be_sequence *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h index 993a9894fff..bc8e91ad47f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h @@ -51,9 +51,11 @@ public: virtual int visit_valuetype (be_valuetype *node); virtual int visit_valuetype_fwd (be_valuetype_fwd *node); virtual int visit_structure (be_structure *node); + virtual int visit_structure_fwd (be_structure_fwd *node); virtual int visit_enum (be_enum *node); virtual int visit_exception (be_exception *node); virtual int visit_union (be_union *node); + virtual int visit_union_fwd (be_union_fwd *node); virtual int visit_array (be_array *node); virtual int visit_sequence (be_sequence *node); virtual int visit_typedef (be_typedef *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h index 71bca6b32b2..aa27936a665 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/sequence_base.h @@ -54,9 +54,11 @@ public: virtual int visit_valuetype (be_valuetype *node); virtual int visit_valuetype_fwd (be_valuetype_fwd *node); virtual int visit_structure (be_structure *node); + virtual int visit_structure_fwd (be_structure_fwd *node); virtual int visit_enum (be_enum *node); virtual int visit_exception (be_exception *node); virtual int visit_union (be_union *node); + virtual int visit_union_fwd (be_union_fwd *node); virtual int visit_array (be_array *node); virtual int visit_string (be_string *node); virtual int visit_sequence (be_sequence *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h new file mode 100644 index 00000000000..fc0a7c6613d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd.h @@ -0,0 +1,28 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_structure_fwd.h +// +// = DESCRIPTION +// Concrete visitor for the be_structure_fwd class +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_VISITOR_STRUCTURE_FWD_H +#define TAO_BE_VISITOR_STRUCTURE_FWD_H + +#include "be_visitor_decl.h" +#include "be_visitor_structure_fwd/structure_fwd_ch.h" + +#endif /* TAO_BE_VISITOR_STRUCTURE_FWD_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h new file mode 100644 index 00000000000..fd4f84e9448 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_structure_fwd/structure_fwd_ch.h @@ -0,0 +1,42 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// structure_fwd_ch.h +// +// = DESCRIPTION +// Concrete visitor for the be_structure_fwd node. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef _BE_INTERFACE_STRUCTURE_FWD_CH_H_ +#define _BE_INTERFACE_STRUCTURE_FWD_CH_H_ + +class be_visitor_structure_fwd_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_structure_fwd_ch + // + // = DESCRIPTION + // This is the visitor for be_structure_fwd for the header file + // + // +public: + be_visitor_structure_fwd_ch (be_visitor_context *ctx); + + ~be_visitor_structure_fwd_ch (void); + + virtual int visit_structure_fwd (be_structure_fwd *node); +}; + +#endif /* _BE_INTERFACE_STRUCTURE_FWD_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode.h index a8282089607..c1865fcdaaa 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode.h @@ -22,7 +22,7 @@ #ifndef TAO_BE_VISITOR_TYPECODE_H #define TAO_BE_VISITOR_TYPECODE_H -#include "be_visitor_scope.h" +#include "be_visitor_decl.h" #include "be_visitor_typecode/typecode_decl.h" #include "be_visitor_typecode/typecode_defn.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_typedef.h b/TAO/TAO_IDL/be_include/be_visitor_typedef.h index 392b75257f9..26dd22be587 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typedef.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typedef.h @@ -22,7 +22,7 @@ #ifndef TAO_BE_VISITOR_TYPEDEF_H #define TAO_BE_VISITOR_TYPEDEF_H -#include "be_visitor_scope.h" +#include "be_visitor_decl.h" #include "be_visitor_typedef/typedef.h" #include "be_visitor_typedef/typedef_ch.h" #include "be_visitor_typedef/typedef_ci.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h new file mode 100644 index 00000000000..68640eb5cbe --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_fwd.h @@ -0,0 +1,28 @@ +/* -*- C++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_visitor_union_fwd.h +// +// = DESCRIPTION +// Concrete visitor for the be_union_fwd class +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef TAO_BE_VISITOR_UNION_FWD_H +#define TAO_BE_VISITOR_UNION_FWD_H + +#include "be_visitor_decl.h" +#include "be_visitor_union_fwd/union_fwd_ch.h" + +#endif /* TAO_BE_VISITOR_UNION_FWD_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h b/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h new file mode 100644 index 00000000000..54b3875ddc0 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_union_fwd/union_fwd_ch.h @@ -0,0 +1,42 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// union_fwd_ch.h +// +// = DESCRIPTION +// Concrete visitor for the be_union_fwd node. +// +// = AUTHOR +// Jeff Parsons +// +// ============================================================================ + +#ifndef _BE_INTERFACE_UNION_FWD_CH_H_ +#define _BE_INTERFACE_UNION_FWD_CH_H_ + +class be_visitor_union_fwd_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_union_fwd_ch + // + // = DESCRIPTION + // This is the visitor for be_union_fwd for the header file + // + // +public: + be_visitor_union_fwd_ch (be_visitor_context *ctx); + + ~be_visitor_union_fwd_ch (void); + + virtual int visit_union_fwd (be_union_fwd *node); +}; + +#endif /* _BE_INTERFACE_UNION_FWD_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h index fdb74a70d9f..7b58834188d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h @@ -75,9 +75,15 @@ public: virtual int visit_structure (be_structure *node); // visit a structure + virtual int visit_structure_fwd (be_structure_fwd *node); + // visit a forward declared structure + virtual int visit_union (be_union *node); // visit a union + virtual int visit_union_fwd (be_union_fwd *node); + // visit a forward declared union + virtual int visit_typedef (be_typedef *node); // visit the typedef node diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h index 129fd270c7b..d867c2d31d9 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h @@ -23,7 +23,7 @@ #ifndef TAO_BE_VISITOR_VALUETYPE_FWD_H #define TAO_BE_VISITOR_VALUETYPE_FWD_H -#include "be_visitor_scope.h" +#include "be_visitor_decl.h" #include "be_visitor_valuetype_fwd/valuetype_fwd_ch.h" #include "be_visitor_valuetype_fwd/valuetype_fwd_ci.h" #include "be_visitor_valuetype_fwd/cdr_op_ch.h" diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp index 6c70795f0b3..b139da41f32 100644 --- a/TAO/TAO_IDL/fe/fe_declarator.cpp +++ b/TAO/TAO_IDL/fe/fe_declarator.cpp @@ -89,12 +89,22 @@ FE_Declarator::FE_Declarator (UTL_ScopedName *n, AST_Type * FE_Declarator::compose (AST_Decl *d) { + AST_Decl::NodeType nt = d->node_type (); + + if (nt == AST_Decl::NT_struct_fwd || nt == AST_Decl::NT_union_fwd) + { + idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD, + d); + + return 0; + } + AST_Array *arr = 0; AST_Type *ct = 0; ct = AST_Type::narrow_from_decl (d); - // All uses of forward declared interfaces, structs and unions must + // All uses of forward declared interfaces must // not have a different prefix from the place of declaration. if (!ct->is_defined ()) { diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index 66297f2c388..3bd111d1ccf 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -92,6 +92,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_constant.h" #include "fe_declarator.h" #include "ast_union.h" +#include "ast_union_fwd.h" +#include "ast_structure_fwd.h" #include "ast_extern.h" #include "ast_enum.h" #include "ast_root.h" @@ -100,6 +102,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_factory.h" #include "ast_exception.h" #include "ast_array.h" +#include "nr_extern.h" #if (defined(apollo) || defined(hpux)) && defined(__cplusplus) extern "C" int yywrap(); @@ -244,7 +247,7 @@ extern int yyleng; %type <dcval> template_type_spec sequence_type_spec string_type_spec %type <dcval> struct_type enum_type switch_type_spec union_type %type <dcval> array_declarator op_type_spec seq_head wstring_type_spec -%type <dcval> param_type_spec +%type <dcval> param_type_spec %type <idlist> scoped_name %type <slval> opt_context at_least_one_string_literal @@ -284,13 +287,13 @@ extern int yyleng; %type <bval> opt_readonly, opt_truncatable -%type <idval> interface_decl value_decl id +%type <idval> interface_decl value_decl union_decl struct_decl id %type <ival> type_dcl %% /* - * Production starts here + * Production starts here. */ start : definitions ; @@ -307,8 +310,8 @@ definition } ';' { - idl_global->set_parse_state (IDL_GlobalData::PS_NoState); // ';' + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | typeid_dcl { @@ -437,7 +440,7 @@ module : IDL_MODULE // '}' idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen); /* - * Finished with this module - pop it from the scope stack + * Finished with this module - pop it from the scope stack. */ idl_global->scopes ().pop (); } @@ -445,7 +448,7 @@ module : IDL_MODULE interface_def : interface - | forward + | interface_forward ; interface : @@ -473,14 +476,16 @@ interface : AST_Interface::fwd_redefinition_helper (i, s); /* - * Add the interface to its definition scope + * Add the interface to its definition scope. */ (void) s->fe_add_interface (i); } + /* - * Push it on the scope stack + * Push it on the scope stack. */ idl_global->scopes ().push (i); + // This FE_InterfaceHeader class isn't destroyed with the AST. $1->interface_name ()->destroy (); delete $1; @@ -500,6 +505,7 @@ interface : { // '}' idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* * Done with this interface - pop it off the scopes stack */ @@ -526,6 +532,7 @@ interface_header : { // interface_header : interface_decl inheritance_spec idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen); + /* * Create an AST representation of the information in the header * part of an interface - this representation contains a computed @@ -544,6 +551,7 @@ interface_header : { // | IDL_LOCAL interface_decl inheritance_spec idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen); + /* * Create an AST representation of the information in the header * part of an interface - this representation contains a computed @@ -633,6 +641,7 @@ value_concrete_decl : */ (void) s->fe_add_interface (i); } + /* * Push it on the scope stack */ @@ -652,6 +661,7 @@ value_concrete_decl : { // '}' idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* * Done with this interface - pop it off the scopes stack */ @@ -687,7 +697,7 @@ value_abs_decl : ); i->set_abstract_valuetype (); AST_Interface::fwd_redefinition_helper (i, - s); + s); /* * Add the valuetype to its definition scope */ @@ -713,15 +723,15 @@ value_abs_decl : { // '}' idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* - * Done with this interface - pop it off the scopes stack + * Done with this interface - pop it off the scopes stack. */ UTL_Scope* s = idl_global->scopes ().top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); m->inherited_name_clash (); idl_global->scopes ().pop (); } - ; value_header : @@ -772,10 +782,10 @@ opt_truncatable : $$ = I_FALSE; } | /* EMPTY */ - { + { // | /* EMPTY */ - $$ = I_FALSE; - } + $$ = I_FALSE; + } ; supports_spec : @@ -804,8 +814,8 @@ value_forward_decl : UTL_ScopedName n ($2, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * valuetype. Store it in the enclosing scope @@ -815,7 +825,7 @@ value_forward_decl : f = idl_global->gen()->create_valuetype_fwd (&n); f->set_abstract_valuetype (); (void) s->fe_add_interface_fwd (f); - } + } } | value_decl @@ -825,8 +835,8 @@ value_forward_decl : UTL_ScopedName n ($1, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * valuetype. Store it in the enclosing scope @@ -839,7 +849,6 @@ value_forward_decl : } ; - value_box_decl : value_decl type_spec /* in this order %!?*/ { @@ -876,6 +885,7 @@ state_member member_i | IDL_PRIVATE { +// IDL_PRIVATE /* is $0 to member_i */ $<vival>$ = AST_Field::vis_PRIVATE; } @@ -974,7 +984,7 @@ export at_least_one_scoped_name : scoped_name scoped_names { -//at_least_one_scoped_name : scoped_name scoped_names +// at_least_one_scoped_name : scoped_name scoped_names ACE_NEW_RETURN ($$, UTL_NameList ($1, $2), @@ -989,7 +999,7 @@ scoped_names // scoped_names : scoped_names ',' idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen); } - scoped_name + scoped_name { // scoped_name idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen); @@ -1035,7 +1045,7 @@ scoped_name // | IDL_SCOPE_DELIMITOR idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } - id + id { // id idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); @@ -1060,7 +1070,7 @@ scoped_name // | scoped_name IDL_SCOPE_DELIMITOR idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } - id + id { // id idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); @@ -1085,16 +1095,16 @@ id: IDENTIFIER } ; -forward : +interface_forward : interface_decl { -// forward : interface_decl +// interface_forward : interface_decl UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n ($1, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -1115,8 +1125,10 @@ forward : UTL_ScopedName n ($2, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state ( + IDL_GlobalData::PS_InterfaceForwardSeen + ); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -1137,8 +1149,10 @@ forward : UTL_ScopedName n ($2, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state ( + IDL_GlobalData::PS_InterfaceForwardSeen + ); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -1181,8 +1195,8 @@ const_dcl : 0); UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Constant *c = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen); + /* * Create a node representing a constant declaration. Store * it in the enclosing scope. @@ -1585,30 +1599,35 @@ positive_int_expr : { good_expression = 0; } + break; case AST_Expression::EV_ulong: if (ev->u.ulval == 0) { good_expression = 0; } + break; case AST_Expression::EV_ulonglong: if (ev->u.ullval == 0) { good_expression = 0; } + break; case AST_Expression::EV_octet: if (ev->u.oval == 0) { good_expression = 0; } + break; case AST_Expression::EV_bool: if (ev->u.bval == 0) { good_expression = 0; } + break; default: good_expression = 0; @@ -1652,7 +1671,7 @@ type_dcl } | enum_type { -// | enum_type +// | enum_type $$ = 0; } | IDL_NATIVE simple_declarator @@ -1660,8 +1679,8 @@ type_dcl // | IDL_NATIVE simple_declarator UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Native *node = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen); + /* * Create a node representing a Native and add it to its * enclosing scope @@ -1678,6 +1697,11 @@ type_dcl (void) s->fe_add_native (node); } } + | constructed_forward_type_spec + { +// | constructed_forward_type_spec + $$ = 0; + } ; type_declarator : @@ -1692,8 +1716,8 @@ type_declarator : UTL_Scope *s = idl_global->scopes ().top_non_null (); FE_Declarator *d = 0; AST_Typedef *t = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen); + /* * Create a list of type renamings. Add them to the * enclosing scope @@ -1792,6 +1816,11 @@ constructed_type_spec | enum_type ; +constructed_forward_type_spec + : struct_forward_type + | union_forward_type + ; + at_least_one_declarator : declarator declarators { @@ -1810,7 +1839,7 @@ declarators // declarators : declarators ',' idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } - declarator + declarator { // declarator idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); @@ -1863,7 +1892,7 @@ simple_declarators // simple_declarators : simple_declarators ',' idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } - simple_declarator + simple_declarator { // simple_declarator idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); @@ -2037,21 +2066,30 @@ any_type } ; -struct_type : +struct_decl : IDL_STRUCT { -// struct_type : IDL_STRUCT +// struct_decl : IDL_STRUCT idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen); } id { // id + idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); + $$ = $3; + } + ; + + +struct_type + : struct_decl + { +// struct_type : struct_header UTL_Scope *s = idl_global->scopes ().top_non_null (); - UTL_ScopedName n ($3, + UTL_ScopedName n ($1, 0); AST_Structure *d = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); /* * Create a node representing a struct declaration. Add it * to the enclosing scope @@ -2066,13 +2104,15 @@ struct_type : ); (void) s->fe_add_structure (d); } + /* - * Push the scope of the struct on the scopes stack + * Push the scope of the struct on the scopes stack. */ idl_global->scopes ().push (d); } '{' { +// '{' idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen); } at_least_one_member @@ -2082,9 +2122,11 @@ struct_type : } '}' { +// '}' idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen); + /* - * Done with this struct. Pop its scope off the scopes stack + * Done with this struct. Pop its scope off the scopes stack. */ $$ = AST_Structure::narrow_from_scope ( idl_global->scopes ().top_non_null () @@ -2120,16 +2162,16 @@ member_i : // at_least_one_declarator idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen); } - ';' + ';' { // ';' UTL_Scope *s = idl_global->scopes ().top_non_null (); FE_Declarator *d = 0; AST_Field *f = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted); + /* - * Check for illegal recursive use of type + * Check for illegal recursive use of type. */ if ($1 != 0 && AST_illegal_recursive_type ($1)) @@ -2139,7 +2181,7 @@ member_i : } /* * Create a node representing a struct or exception member - * Add it to the enclosing scope + * Add it to the enclosing scope. */ else if (s != 0 && $1 != 0 @@ -2163,7 +2205,7 @@ member_i : continue; } - /* $0 denotes Visibility, must be on yacc reduction stack */ + /* $0 denotes Visibility, must be on yacc reduction stack. */ f = idl_global->gen ()->create_field ( tp, @@ -2172,14 +2214,14 @@ member_i : ); (void) s->fe_add_field (f); } - } + } } | error { // | error idl_global->err()->syntax_error (idl_global->parse_state ()); } - ';' + ';' { // ';' idl_global->set_parse_state (IDL_GlobalData::PS_NoState); @@ -2187,20 +2229,24 @@ member_i : } ; -union_type : +union_decl : IDL_UNION { -// union_type : IDL_UNION +// union_decl : IDL_UNION idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen); } id { // id idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen); + $$ = $3; } - IDL_SWITCH + ; + +union_type + : union_decl IDL_SWITCH { -// IDL_SWITCH +// union_type : union_decl IDL_SWITCH idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen); } '(' @@ -2217,25 +2263,24 @@ union_type : { // ')' UTL_Scope *s = idl_global->scopes ().top_non_null (); - UTL_ScopedName n ($3, + UTL_ScopedName n ($1, 0); AST_Union *u = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen); /* * Create a node representing a union. Add it to its enclosing - * scope + * scope. */ - if ($9 != 0 + if ($6 != 0 && s != 0) { AST_ConcreteType *tp = - AST_ConcreteType::narrow_from_decl ($9); + AST_ConcreteType::narrow_from_decl ($6); if (tp == 0) { - idl_global->err ()->not_a_type ($9); + idl_global->err ()->not_a_type ($6); } else { @@ -2267,8 +2312,9 @@ union_type : { // '}' idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen); + /* - * Done with this union. Pop its scope from the scopes stack + * Done with this union. Pop its scope from the scopes stack. */ $$ = AST_Union::narrow_from_scope ( idl_global->scopes ().top_non_null () @@ -2290,7 +2336,7 @@ switch_type_spec : | char_type { // | char_type - /* wchars are not allowed */ + /* wchars are not allowed. */ if ($1 == AST_Expression::EV_wchar) { idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); @@ -2304,7 +2350,7 @@ switch_type_spec : | octet_type { // | octet_type - /* octets are not allowed */ + /* octets are not allowed. */ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); $$ = idl_global->scopes ().bottom ()->lookup_primitive_type ($1); } @@ -2328,7 +2374,7 @@ switch_type_spec : * The discriminator is a scoped name. Try to resolve to * one of the scalar types or to an enum. Thread through * typedef's to arrive at the base type at the end of the - * chain + * chain. */ d = s->lookup_by_name ($1, I_TRUE); @@ -2429,13 +2475,12 @@ case_branch : // element_spec idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen); } - ';' + ';' { // ';' UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_UnionBranch *b = 0; AST_Field *f = $3; - idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted); /* @@ -2460,7 +2505,7 @@ case_branch : // | error idl_global->err()->syntax_error (idl_global->parse_state()); } - ';' + ';' { // ';' idl_global->set_parse_state (IDL_GlobalData::PS_NoState); @@ -2472,7 +2517,10 @@ at_least_one_case_label : case_label case_labels { // at_least_one_case_label : case_label case_labels - $$ = new UTL_LabelList ($1, $2); + ACE_NEW_RETURN ($$, + UTL_LabelList ($1, + $2), + 1); } ; @@ -2530,7 +2578,7 @@ case_label { idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen); } - ':' + ':' { // const_expr idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); @@ -2565,7 +2613,8 @@ element_spec : /* * Create a field in a union branch */ - else if ($1 == 0 || $3 == 0) + else if ($1 == 0 + || $3 == 0) { $$ = 0; } @@ -2588,6 +2637,45 @@ element_spec : } ; +struct_forward_type + : struct_decl + { +// struct_forward_type : struct_header + UTL_Scope *s = idl_global->scopes ().top_non_null (); + UTL_ScopedName n ($1, + 0); + AST_StructureFwd *d = 0; + + /* + * Create a node representing a forward declaration of a struct. + */ + if (s != 0) + { + d = idl_global->gen ()->create_structure_fwd (&n); + (void) s->fe_add_structure_fwd (d); + } + } + ; + +union_forward_type + : union_decl + { + UTL_Scope *s = idl_global->scopes ().top_non_null (); + UTL_ScopedName n ($1, + 0); + AST_UnionFwd *u = 0; + + /* + * Create a node representing a forward declaration of a union. + */ + if (s != 0) + { + u = idl_global->gen ()->create_union_fwd (&n); + (void) s->fe_add_union_fwd (u); + } + } + ; + enum_type : IDL_ENUM { @@ -2601,24 +2689,25 @@ enum_type : UTL_ScopedName n ($3, 0); AST_Enum *e = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen); /* * Create a node representing an enum and add it to its - * enclosing scope + * enclosing scope. */ - if (s != 0) { - e = idl_global->gen ()->create_enum (&n, - s->is_local (), - s->is_abstract ()); - /* - * Add it to its defining scope - */ - (void) s->fe_add_enum (e); - } + if (s != 0) + { + e = idl_global->gen ()->create_enum (&n, + s->is_local (), + s->is_abstract ()); + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum (e); + } + /* - * Push the enum scope on the scopes stack + * Push the enum scope on the scopes stack. */ idl_global->scopes ().push (e); } @@ -2636,8 +2725,9 @@ enum_type : { // '}' idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen); + /* - * Done with this enum. Pop its scope from the scopes stack + * Done with this enum. Pop its scope from the scopes stack. */ if (idl_global->scopes ().top () == 0) { @@ -2781,7 +2871,7 @@ sequence_type_spec UTL_Scope *s = idl_global->scopes ().top_non_null (); /* - * Create a node representing a sequence + * Create a node representing a sequence. */ if ($1 == 0) { @@ -2819,8 +2909,9 @@ seq_head : { // seq_head : IDL_SEQUENCE idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen); + /* - * Push a sequence marker on scopes stack + * Push a sequence marker on scopes stack. */ idl_global->scopes ().push (0); } @@ -2938,7 +3029,7 @@ wstring_type_spec { $$ = idl_global->gen ()->create_wstring ($4); /* - * Add this AST_String to the types defined in the global scope + * Add this AST_String to the types defined in the global scope. */ (void) idl_global->root ()->fe_add_string ( AST_String::narrow_from_decl ($$) @@ -2949,6 +3040,7 @@ wstring_type_spec { // | wstring_head idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); + /* * Create a node representing a wstring. */ @@ -2957,7 +3049,7 @@ wstring_type_spec idl_global->gen ()->create_expr ((unsigned long) 0) ); /* - * Add this AST_String to the types defined in the global scope + * Add this AST_String to the types defined in the global scope. */ (void) idl_global->root ()->fe_add_string ( AST_String::narrow_from_decl ($$) @@ -3095,7 +3187,6 @@ attribute : UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Attribute *a = 0; FE_Declarator *d = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted); /* @@ -3168,7 +3259,6 @@ exception : UTL_ScopedName n ($3, 0); AST_Exception *e = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen); /* @@ -3223,16 +3313,16 @@ operation : Identifier id ($4); UTL_ScopedName n (&id, 0); AST_Operation *o = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); /* * Create a node representing an operation on an interface - * and add it to its enclosing scope + * and add it to its enclosing scope. */ if (s != 0 && $2 != 0) { - AST_Type *tp = AST_Type::narrow_from_decl ($2); + AST_Type *tp = + AST_Type::narrow_from_decl ($2); if (tp == 0) { @@ -3258,7 +3348,7 @@ operation : $4 = 0; /* - * Push the operation scope onto the scopes stack + * Push the operation scope onto the scopes stack. */ idl_global->scopes ().push (o); } @@ -3277,7 +3367,6 @@ operation : // opt_context UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Operation *o = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted); /* @@ -3285,17 +3374,17 @@ operation : */ if (s != 0 && s->scope_node_type () == AST_Decl::NT_op) { - o = AST_Operation::narrow_from_scope (s); + o = AST_Operation::narrow_from_scope (s); - if ($8 != 0 && o != 0) - { - (void) o->fe_add_exceptions ($8); - } + if ($8 != 0 && o != 0) + { + (void) o->fe_add_exceptions ($8); + } - if ($10 != 0) - { - (void) o->fe_add_context ($10); - } + if ($10 != 0) + { + (void) o->fe_add_context ($10); + } } /* @@ -3363,7 +3452,6 @@ init_decl Identifier id ($3); UTL_ScopedName n (&id, 0); - AST_Factory *factory = 0; idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); @@ -3398,7 +3486,7 @@ init_parameter_list // init_parameter_list : '(' idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } - ')' + ')' { // ')' idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); @@ -3408,8 +3496,8 @@ init_parameter_list // | '(' idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } - at_least_one_in_parameter - ')' + at_least_one_in_parameter + ')' { // at_least_one_in_parameter ')' idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); @@ -3425,7 +3513,7 @@ in_parameters // in_parameters : in_parameters ',' idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } - in_parameter + in_parameter | /* EMPTY */ ; @@ -3445,7 +3533,6 @@ in_parameter : // declarator UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Argument *a = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen); /* @@ -3478,7 +3565,7 @@ parameter_list // parameter_list : '(' idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } - ')' + ')' { // ')' idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); @@ -3488,8 +3575,8 @@ parameter_list // | '(' idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } - at_least_one_parameter - ')' + at_least_one_parameter + ')' { // at_least_one_parameter ')' idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); @@ -3505,7 +3592,7 @@ parameters // parameters : parameters ',' idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } - parameter + parameter | /* EMPTY */ ; @@ -3525,12 +3612,11 @@ parameter : // declarator UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Argument *a = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen); /* * Create a node representing an argument to an operation - * Add it to the enclosing scope (the operation scope) + * Add it to the enclosing scope (the operation scope). */ if ($3 != 0 && $5 != 0 @@ -3548,15 +3634,17 @@ parameter : idl_global->lineno ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Cannot use a local type as an ") - ACE_TEXT ("argument of a remote operation\n"))); + ACE_TEXT ("argument of a remote ") + ACE_TEXT ("operation\n"))); } else { - a = idl_global->gen ()->create_argument ( - $1, - tp, - (UTL_IdList *) $5->name ()->copy () - ); + a = + idl_global->gen ()->create_argument ( + $1, + tp, + (UTL_IdList *) $5->name ()->copy () + ); (void) s->fe_add_argument (a); } } @@ -3588,8 +3676,23 @@ param_type_spec if (d == 0) { - idl_global->err ()->lookup_error ($1); + idl_global->err ()->lookup_error (tao_yyvsp[0].idlist); } + else + { + AST_Decl::NodeType nt = d->node_type (); + + if (nt == AST_Decl::NT_struct_fwd + || nt == AST_Decl::NT_union_fwd) + { + idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD, + d); + + // If we don't return here, we'll crash later. + return 1; + } + } + $$ = d; } @@ -3644,13 +3747,13 @@ opt_context // opt_context : IDL_CONTEXT idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen); } - '(' + '(' { idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen); // '(' } - at_least_one_string_literal - ')' + at_least_one_string_literal + ')' { // at_least_one_string_literal ')' idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen); @@ -3681,7 +3784,7 @@ string_literals // string_literals : string_literals ',' idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen); } - IDL_STRING_LITERAL + IDL_STRING_LITERAL { // IDL_STRING_LITERAL if ($1 == 0) @@ -3758,7 +3861,7 @@ typeprefix_dcl * ??? */ int -yywrap () +yywrap (void) { return 1; } diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index 4e20689564c..2366531e8b0 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -24,6 +24,8 @@ char tao_yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90 \n\ #include "ast_constant.h" #include "fe_declarator.h" #include "ast_union.h" +#include "ast_union_fwd.h" +#include "ast_structure_fwd.h" #include "ast_extern.h" #include "ast_enum.h" #include "ast_root.h" @@ -32,6 +34,7 @@ char tao_yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90 \n\ #include "ast_factory.h" #include "ast_exception.h" #include "ast_array.h" +#include "nr_extern.h" #if (defined(apollo) || defined(hpux)) && defined(__cplusplus) extern "C" int tao_yywrap(); @@ -153,42 +156,43 @@ typedef union { #define IDL_WSTRING_LITERAL 331 #define TAO_YYERRCODE 256 short tao_yylhs[] = { -1, - 0, 72, 72, 74, 73, 76, 73, 78, 73, 80, - 73, 82, 73, 84, 73, 86, 73, 88, 73, 89, - 73, 90, 91, 92, 93, 85, 83, 83, 96, 98, - 99, 94, 100, 68, 33, 33, 33, 101, 22, 22, - 87, 87, 87, 87, 102, 102, 107, 109, 110, 106, - 111, 112, 113, 103, 34, 114, 69, 67, 67, 24, - 24, 104, 104, 105, 108, 108, 115, 115, 115, 120, - 116, 121, 116, 97, 97, 122, 117, 123, 117, 124, - 117, 125, 117, 126, 117, 128, 117, 130, 117, 131, - 117, 20, 132, 21, 21, 16, 133, 16, 134, 16, - 70, 95, 95, 95, 135, 136, 137, 138, 79, 50, + 0, 74, 74, 76, 75, 78, 75, 80, 75, 82, + 75, 84, 75, 86, 75, 88, 75, 90, 75, 91, + 75, 92, 93, 94, 95, 87, 85, 85, 98, 100, + 101, 96, 102, 68, 33, 33, 33, 103, 22, 22, + 89, 89, 89, 89, 104, 104, 109, 111, 112, 108, + 113, 114, 115, 105, 34, 116, 69, 67, 67, 24, + 24, 106, 106, 107, 110, 110, 117, 117, 117, 122, + 118, 123, 118, 99, 99, 124, 119, 125, 119, 126, + 119, 127, 119, 128, 119, 130, 119, 132, 119, 133, + 119, 20, 134, 21, 21, 16, 135, 16, 136, 16, + 72, 97, 97, 97, 137, 138, 139, 140, 81, 50, 50, 50, 50, 50, 50, 50, 50, 50, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 46, 140, 71, 71, 71, 71, 71, 141, - 139, 1, 1, 2, 2, 2, 59, 59, 59, 59, - 59, 59, 59, 4, 4, 4, 3, 3, 3, 29, - 142, 30, 30, 63, 63, 31, 143, 32, 32, 64, - 65, 51, 51, 57, 57, 57, 58, 58, 58, 54, - 54, 54, 56, 52, 52, 60, 53, 55, 144, 145, - 147, 148, 7, 146, 150, 150, 151, 149, 152, 153, - 119, 154, 119, 155, 156, 157, 158, 159, 160, 162, - 163, 10, 9, 9, 9, 9, 9, 9, 161, 165, - 165, 166, 167, 164, 168, 164, 27, 28, 28, 169, - 48, 170, 171, 48, 172, 49, 173, 174, 176, 177, - 8, 175, 180, 179, 179, 178, 181, 182, 5, 5, - 183, 184, 13, 186, 187, 6, 6, 185, 189, 190, - 14, 14, 188, 191, 11, 25, 26, 26, 192, 193, - 47, 194, 195, 127, 66, 66, 196, 197, 198, 199, - 81, 200, 202, 203, 204, 129, 62, 62, 62, 12, - 12, 205, 207, 118, 208, 206, 210, 206, 209, 213, - 212, 212, 214, 215, 211, 216, 201, 218, 201, 217, - 221, 220, 220, 222, 223, 219, 15, 15, 15, 15, - 61, 61, 61, 224, 225, 23, 23, 226, 227, 17, - 17, 18, 228, 19, 19, 75, 77, + 45, 45, 46, 142, 73, 73, 73, 73, 73, 73, + 144, 141, 1, 1, 2, 2, 2, 59, 59, 59, + 59, 59, 59, 59, 4, 4, 4, 3, 3, 3, + 143, 143, 29, 147, 30, 30, 63, 63, 31, 148, + 32, 32, 64, 65, 51, 51, 57, 57, 57, 58, + 58, 58, 54, 54, 54, 56, 52, 52, 60, 53, + 55, 149, 71, 150, 152, 153, 7, 151, 155, 155, + 156, 154, 157, 158, 121, 159, 121, 160, 70, 161, + 162, 163, 164, 166, 167, 10, 9, 9, 9, 9, + 9, 9, 165, 169, 169, 170, 171, 168, 172, 168, + 27, 28, 28, 173, 48, 174, 175, 48, 176, 49, + 145, 146, 177, 178, 180, 181, 8, 179, 184, 183, + 183, 182, 185, 186, 5, 5, 187, 188, 13, 190, + 191, 6, 6, 189, 193, 194, 14, 14, 192, 195, + 11, 25, 26, 26, 196, 197, 47, 198, 199, 129, + 66, 66, 200, 201, 202, 203, 83, 204, 206, 207, + 208, 131, 62, 62, 62, 12, 12, 209, 211, 120, + 212, 210, 214, 210, 213, 217, 216, 216, 218, 219, + 215, 220, 205, 222, 205, 221, 225, 224, 224, 226, + 227, 223, 15, 15, 15, 15, 61, 61, 61, 228, + 229, 23, 23, 230, 231, 17, 17, 18, 232, 19, + 19, 77, 79, }; short tao_yylen[] = { 2, 1, 2, 0, 0, 3, 0, 3, 0, 3, 0, @@ -206,423 +210,434 @@ short tao_yylen[] = { 2, 1, 3, 1, 3, 1, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 2, 2, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 3, 1, 1, 1, 2, 0, - 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 0, 4, 0, 1, 1, 2, 0, 4, 0, 1, - 1, 1, 1, 1, 2, 1, 2, 3, 2, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 9, 2, 2, 0, 0, 2, 0, 0, - 5, 0, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 17, 1, 1, 1, 1, 1, 1, 2, 2, - 0, 0, 0, 5, 0, 3, 2, 2, 0, 0, - 3, 0, 0, 5, 0, 3, 0, 0, 0, 0, - 9, 2, 0, 4, 0, 1, 0, 0, 6, 2, - 0, 0, 5, 0, 0, 6, 1, 1, 0, 0, - 6, 1, 1, 0, 3, 2, 2, 0, 0, 0, - 5, 0, 0, 6, 1, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 0, 10, 1, 1, 0, 1, - 1, 0, 0, 5, 0, 3, 0, 4, 2, 0, - 4, 0, 0, 0, 5, 0, 3, 0, 4, 2, - 0, 4, 0, 0, 0, 5, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 6, 0, 0, 0, 6, - 0, 2, 0, 4, 0, 3, 3, + 1, 1, 1, 0, 3, 1, 1, 1, 2, 1, + 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 0, 4, 0, 1, 1, 2, 0, + 4, 0, 1, 1, 1, 1, 1, 2, 1, 2, + 3, 2, 1, 1, 2, 1, 1, 1, 1, 1, + 1, 0, 3, 0, 0, 0, 7, 2, 2, 0, + 0, 2, 0, 0, 5, 0, 3, 0, 3, 0, + 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, + 1, 1, 2, 2, 0, 0, 0, 5, 0, 3, + 2, 2, 0, 0, 3, 0, 0, 5, 0, 3, + 1, 1, 0, 0, 0, 0, 9, 2, 0, 4, + 0, 1, 0, 0, 6, 2, 0, 0, 5, 0, + 0, 6, 1, 1, 0, 0, 6, 1, 1, 0, + 3, 2, 2, 0, 0, 0, 5, 0, 0, 6, + 1, 0, 0, 0, 0, 0, 9, 0, 0, 0, + 0, 10, 1, 1, 0, 1, 1, 0, 0, 5, + 0, 3, 0, 4, 2, 0, 4, 0, 0, 0, + 5, 0, 3, 0, 4, 2, 0, 4, 0, 0, + 0, 5, 1, 1, 1, 1, 1, 1, 1, 0, + 0, 6, 0, 0, 0, 6, 0, 2, 0, 4, + 0, 3, 3, }; short tao_yydefred[] = { 3, - 0, 0, 20, 105, 22, 33, 154, 209, 224, 257, - 297, 0, 0, 0, 0, 56, 0, 0, 156, 158, - 157, 29, 47, 0, 0, 4, 2, 6, 8, 10, - 12, 14, 16, 18, 27, 28, 41, 42, 43, 44, - 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 101, 159, 190, 0, 51, 0, 0, 0, 45, 0, - 97, 0, 96, 0, 0, 0, 38, 35, 0, 196, - 0, 200, 201, 204, 205, 206, 207, 203, 208, 271, - 278, 283, 58, 64, 162, 163, 165, 174, 175, 177, - 179, 178, 0, 176, 0, 167, 169, 170, 168, 173, - 172, 192, 193, 164, 171, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 21, 116, 117, 0, - 106, 110, 111, 113, 114, 115, 112, 23, 34, 160, - 155, 210, 225, 258, 298, 36, 0, 37, 57, 0, - 356, 99, 357, 30, 48, 0, 195, 202, 0, 199, - 0, 267, 270, 0, 274, 279, 5, 7, 9, 11, - 13, 15, 17, 19, 0, 0, 0, 0, 0, 0, - 0, 52, 98, 0, 75, 66, 0, 39, 198, 272, - 0, 0, 55, 0, 0, 107, 24, 191, 161, 183, - 184, 185, 0, 211, 226, 259, 299, 75, 100, 0, - 0, 0, 0, 144, 145, 146, 148, 150, 151, 152, - 149, 147, 0, 0, 0, 0, 0, 153, 0, 0, - 0, 0, 0, 0, 133, 137, 142, 268, 0, 275, - 280, 0, 3, 0, 0, 217, 0, 0, 216, 0, - 90, 295, 307, 308, 0, 0, 76, 78, 80, 82, - 84, 0, 74, 86, 88, 312, 72, 70, 0, 65, - 67, 68, 0, 93, 273, 138, 139, 140, 0, 0, + 0, 0, 20, 105, 22, 33, 154, 212, 228, 263, + 303, 0, 0, 0, 0, 56, 0, 0, 156, 158, + 157, 29, 47, 0, 0, 0, 0, 4, 2, 6, + 8, 10, 12, 14, 16, 18, 27, 28, 41, 42, + 43, 44, 46, 160, 181, 182, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 101, 159, 193, 0, 51, + 0, 0, 0, 45, 0, 97, 0, 96, 0, 0, + 0, 38, 35, 0, 199, 0, 203, 204, 207, 208, + 209, 210, 206, 211, 277, 284, 289, 58, 64, 163, + 164, 166, 175, 176, 178, 180, 179, 0, 177, 0, + 168, 170, 171, 169, 174, 173, 195, 196, 165, 172, + 0, 0, 214, 0, 0, 230, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 21, 116, 117, 0, 106, + 110, 111, 113, 114, 115, 112, 23, 34, 161, 155, + 213, 229, 264, 304, 36, 0, 37, 57, 0, 362, + 99, 363, 30, 48, 0, 198, 205, 0, 202, 0, + 273, 276, 0, 280, 285, 0, 215, 5, 7, 9, + 11, 13, 15, 17, 19, 0, 0, 0, 0, 0, + 52, 98, 0, 75, 66, 0, 39, 201, 278, 0, + 0, 55, 0, 0, 231, 221, 107, 24, 194, 162, + 186, 187, 188, 0, 265, 305, 75, 100, 0, 0, + 0, 0, 144, 145, 146, 148, 150, 151, 152, 149, + 147, 0, 0, 0, 0, 0, 153, 0, 0, 0, + 0, 0, 0, 133, 137, 142, 274, 0, 281, 286, + 0, 216, 220, 0, 0, 3, 0, 0, 0, 220, + 0, 90, 301, 313, 314, 0, 0, 76, 78, 80, + 82, 84, 0, 74, 86, 88, 318, 72, 70, 0, + 65, 67, 68, 0, 93, 279, 138, 139, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 108, 0, 181, 289, 285, 288, 212, 216, - 0, 227, 266, 260, 265, 0, 0, 0, 311, 338, - 302, 339, 310, 0, 337, 292, 0, 0, 0, 0, + 0, 0, 0, 0, 241, 232, 0, 237, 238, 240, + 239, 0, 0, 226, 223, 222, 108, 0, 184, 295, + 291, 294, 272, 266, 271, 0, 0, 0, 317, 344, + 308, 345, 316, 0, 343, 298, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 50, 69, 0, 143, 0, 0, 0, 0, 0, 0, 0, 134, 135, - 136, 269, 276, 281, 0, 0, 0, 0, 0, 0, - 0, 222, 219, 218, 0, 0, 0, 215, 0, 54, - 91, 0, 0, 77, 79, 81, 83, 85, 87, 89, - 313, 73, 71, 0, 109, 119, 26, 182, 290, 287, - 213, 0, 0, 0, 237, 228, 0, 233, 234, 236, - 235, 261, 263, 301, 303, 293, 0, 0, 223, 220, - 0, 0, 0, 0, 0, 314, 291, 0, 229, 264, - 0, 304, 294, 189, 0, 0, 221, 0, 0, 0, - 0, 0, 316, 323, 0, 322, 230, 327, 341, 342, - 343, 334, 0, 333, 344, 305, 187, 0, 318, 0, - 0, 0, 329, 0, 0, 0, 0, 324, 320, 245, - 252, 250, 242, 249, 231, 241, 335, 331, 345, 348, - 306, 188, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 325, 321, 246, 253, 251, - 255, 243, 248, 232, 240, 336, 332, 0, 349, 0, - 0, 0, 346, 0, 254, 256, 244, 355, 0, 0, - 350, 353, 0, 354, + 136, 275, 282, 287, 0, 217, 219, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 54, 91, 0, + 0, 77, 79, 81, 83, 85, 87, 89, 319, 73, + 71, 0, 233, 227, 224, 109, 119, 26, 185, 296, + 293, 267, 269, 307, 309, 299, 0, 0, 0, 0, + 0, 0, 0, 0, 320, 234, 225, 297, 270, 0, + 310, 300, 192, 0, 0, 0, 0, 0, 0, 0, + 322, 329, 0, 328, 249, 256, 254, 246, 253, 235, + 245, 333, 347, 348, 349, 340, 0, 339, 350, 311, + 190, 0, 324, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 335, 0, 0, 0, 0, 330, 326, 250, + 257, 255, 259, 247, 252, 236, 244, 341, 337, 351, + 354, 312, 191, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 331, 327, 258, 260, 248, 342, 338, 0, + 355, 352, 0, 361, 0, 0, 356, 359, 0, 360, }; short tao_yydgoto[] = { 1, - 343, 85, 86, 87, 88, 89, 90, 91, 376, 92, - 188, 301, 93, 94, 303, 217, 451, 489, 490, 178, - 202, 68, 426, 183, 287, 339, 443, 459, 189, 234, - 403, 412, 22, 23, 365, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 288, 444, 472, 121, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 422, 245, 190, 191, 192, 246, 106, 24, 25, 63, - 247, 2, 27, 109, 248, 110, 249, 111, 250, 112, - 251, 113, 32, 114, 33, 115, 34, 116, 42, 44, - 166, 233, 336, 35, 36, 65, 200, 175, 252, 45, - 146, 37, 38, 39, 40, 41, 66, 201, 176, 259, - 137, 198, 297, 60, 260, 261, 253, 263, 344, 317, - 316, 307, 308, 309, 310, 311, 254, 313, 255, 314, - 298, 320, 140, 174, 43, 165, 232, 335, 131, 46, - 167, 337, 437, 47, 168, 289, 236, 340, 348, 296, - 291, 373, 398, 372, 48, 169, 237, 345, 391, 408, - 445, 431, 460, 446, 461, 458, 482, 455, 457, 456, - 480, 481, 49, 170, 294, 238, 346, 295, 347, 392, - 181, 280, 151, 203, 107, 184, 281, 108, 185, 282, - 235, 338, 388, 353, 394, 50, 171, 239, 349, 352, - 402, 393, 411, 436, 315, 396, 387, 405, 415, 406, - 416, 430, 454, 428, 453, 409, 423, 410, 424, 434, - 463, 432, 462, 435, 464, 465, 484, 493, + 305, 90, 91, 92, 93, 94, 95, 96, 296, 97, + 199, 321, 98, 99, 323, 226, 472, 495, 496, 187, + 211, 73, 440, 192, 311, 364, 428, 449, 200, 247, + 412, 420, 22, 23, 386, 227, 228, 229, 230, 231, + 232, 233, 234, 235, 236, 237, 312, 429, 464, 130, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 436, 256, 201, 202, 203, 257, 111, 24, 25, 112, + 113, 68, 258, 2, 29, 118, 259, 119, 260, 120, + 261, 121, 262, 122, 34, 123, 35, 124, 36, 125, + 47, 49, 177, 246, 361, 37, 38, 70, 209, 184, + 263, 50, 155, 39, 40, 41, 42, 43, 71, 210, + 185, 270, 146, 207, 317, 65, 271, 272, 264, 274, + 306, 337, 336, 327, 328, 329, 330, 331, 265, 333, + 266, 334, 318, 340, 149, 183, 48, 176, 245, 360, + 140, 51, 44, 178, 45, 46, 362, 457, 52, 117, + 242, 196, 302, 357, 303, 244, 359, 399, 358, 53, + 166, 241, 355, 398, 430, 416, 450, 431, 451, 448, + 478, 445, 447, 446, 476, 477, 54, 179, 314, 249, + 365, 315, 366, 401, 190, 291, 160, 212, 114, 193, + 292, 115, 194, 293, 248, 363, 400, 371, 403, 55, + 180, 250, 367, 370, 411, 402, 419, 456, 335, 405, + 397, 414, 423, 415, 424, 444, 475, 442, 474, 417, + 437, 418, 438, 454, 480, 452, 479, 455, 481, 482, + 493, 499, }; short tao_yysindex[] = { 0, - 0, 565, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -235, -231, -158, -236, 0, -164, -164, 0, 0, - 0, 0, 0, 31, 396, 0, 0, 0, 0, 0, + 0, 603, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -203, -202, -196, -234, 0, -228, -228, 0, 0, + 0, 0, 0, 22, 428, -191, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 52, 566, -137, -203, + 446, -203, -203, -203, -203, 0, 0, 0, 22, 0, + 22, -175, -175, 0, -203, 0, -159, 0, -155, 56, + 65, 0, 0, -76, 0, -109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 41, 541, -138, -235, 422, -235, -235, -235, -235, - 0, 0, 0, 31, 0, 31, -189, -189, 0, -235, - 0, -259, 0, -181, 16, 24, 0, 0, -211, 0, - -159, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 68, 0, -180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 73, 0, -204, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 31, 92, 105, 129, 136, - 139, 143, 145, 173, 175, 177, 0, 0, 0, -204, + 22, -191, 0, 100, 131, 0, 78, 148, 158, 184, + 208, 211, 217, 226, 229, 0, 0, 0, -180, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 137, 0, 0, -235, - 0, 0, 0, 0, 0, -164, 0, 0, -10, 0, - 186, 0, 0, -36, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -235, 150, -235, 158, -9, 161, - 162, 0, 0, -235, 0, 0, -204, 0, 0, 0, - 22, -164, 0, 22, 22, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 635, - 590, 244, 473, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 42, 42, 42, 22, -204, 0, 166, 197, - 254, -145, 149, 154, 0, 0, 0, 0, -204, 0, - 0, 233, 0, 249, 215, 0, 268, 52, 0, 635, - 0, 0, 0, 0, 491, 34, 0, 0, 0, 0, - 0, 194, 0, 0, 0, 0, 0, 0, 195, 0, - 0, 0, 252, 0, 0, 0, 0, 0, 280, 22, - 22, 22, 22, 22, 22, 22, 22, 22, 22, 261, - 262, 270, 0, 565, 0, 0, 0, 0, 0, 0, - 351, 0, 0, 0, 0, 0, 209, 277, 0, 0, - 0, 0, 0, -204, 0, 0, 279, 292, 295, 296, - 297, 0, 299, 300, 78, 351, 351, 0, 0, -164, - 0, 197, 254, -145, 149, 149, 154, 154, 0, 0, - 0, 0, 0, 0, 22, 214, -235, 22, 215, 235, - 0, 0, 0, 0, 379, 245, 336, 0, 256, 0, - 0, 117, 517, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -204, 0, 0, 0, 0, 0, 0, - 0, 324, -235, 122, 0, 0, -204, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 345, 294, 0, 0, - 352, 52, 358, -235, 0, 0, 0, 340, 0, 0, - 0, 0, 0, 0, 361, 119, 0, 282, 365, -67, - 120, 364, 0, 0, 368, 0, 0, 0, 0, 0, - 0, 0, 369, 0, 0, 0, 0, 517, 0, 370, - -111, 517, 0, 371, 373, 125, -235, 0, 0, 0, + 0, 0, 0, 0, 0, 166, 0, 0, -203, 0, + 0, 0, 0, 0, -228, 0, 0, 28, 0, 232, + 0, 0, -7, 0, 0, 255, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -203, 186, -203, 187, 188, + 0, 0, -203, 0, 0, -180, 0, 0, 0, -24, + -228, 0, -24, -24, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 675, 630, + 268, 497, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 37, 37, 37, -24, -180, 0, 192, 234, 292, + -118, 151, -3, 0, 0, 0, 0, -180, 0, 0, + 584, 0, 0, 403, 270, 0, 289, 245, 81, 0, + 675, 0, 0, 0, 0, 515, 60, 0, 0, 0, + 0, 0, 210, 0, 0, 0, 0, 0, 0, 216, + 0, 0, 0, 286, 0, 0, 0, 0, 0, 305, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + 287, 293, 304, 86, 0, 0, -180, 0, 0, 0, + 0, 248, 0, 0, 0, 0, 0, 603, 0, 0, + 0, 0, 0, 0, 0, 0, 249, 312, 0, 0, + 0, 0, 0, -180, 0, 0, 316, 317, 318, 323, + 328, 0, 329, 335, 94, 403, 403, 0, 0, -228, + 0, 234, 292, -118, 151, 151, -3, -3, 0, 0, + 0, 0, 0, 0, 354, 0, 0, 337, -203, -24, + 272, -203, -24, 245, 276, 358, 278, 0, 0, 147, + 541, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -180, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 365, 283, 348, 321, + 81, 371, -203, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 374, 128, -124, 376, -90, 127, 375, + 0, 0, 379, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 380, 0, 0, 0, + 0, 541, 0, 378, 364, -24, 368, 446, -59, 307, + -124, 541, 0, 385, 390, 142, -203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -235, 119, 359, 22, 362, 422, -11, 301, - -111, -235, -67, -164, 381, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 378, 0, 372, - -235, 363, 0, 106, 0, 0, 0, 0, 386, 389, - 0, 0, 112, 0, + 0, 0, 0, -203, 128, 377, -203, 382, -203, -90, + -228, 396, 0, 0, 0, 0, 0, 0, 0, 397, + 0, 0, 120, 0, 402, 400, 0, 0, 125, 0, }; short tao_yyrindex[] = { 0, - 0, 435, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 448, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -22, -9, 392, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -1, 17, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, + 69, 32, -23, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 27, 0, 56, 26, -26, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, + -91, 0, 0, 97, 121, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -97, 65, 70, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 181, + 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, + 0, 0, 326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, - 0, 0, 0, 316, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 340, 0, 0, 0, 0, 258, 284, + -26, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 14, 0, 172, 517, 540, + 246, 57, 24, 0, 0, 0, 0, 333, 0, 0, + 0, 0, 0, 0, 0, 0, 393, 0, 0, 0, + 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 189, 0, 0, 0, 0, 0, 0, 250, - 276, -24, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 0, 179, 508, - 131, 338, 116, 12, 0, 0, 0, 0, 326, 0, - 0, 0, 0, 394, 0, 0, 0, 0, 0, 318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 413, 0, 0, 416, 0, 0, 0, + 0, 0, 212, 0, 0, 0, 0, 334, 0, 0, + 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, + 0, 0, 0, 201, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 565, 560, 331, 111, 144, 51, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 195, 0, 336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 331, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, - 0, 0, 0, 198, 0, 0, 0, 0, 0, 0, + 0, -18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 533, 330, 399, 118, 123, 49, 75, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 156, 0, - 232, 0, 0, 0, 0, 0, 334, 0, 0, 0, + 0, 0, 0, -13, 0, 0, 0, 0, 0, -17, + 0, 0, 0, 0, 0, 0, 0, 0, -29, 401, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 419, 0, 0, 425, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -23, 0, 0, 0, 0, 0, - -27, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -25, 404, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 426, - 0, 0, 0, 427, 0, 277, 0, 0, 0, 0, + 0, 0, 0, 422, 0, 0, 0, 0, 469, 0, + 339, 0, 0, 429, 0, 412, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 448, 0, - 366, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 442, - 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 451, 0, 0, 0, 0, }; short tao_yygindex[] = { 0, - -22, 287, 0, 0, 0, -38, 13, 5, 0, 18, - 0, 0, 0, -37, -307, -16, 0, 0, 0, 60, - 0, 25, 0, 0, 0, 0, 0, 0, 152, 0, - 0, 0, 0, 512, 0, -197, 0, 257, 259, 260, - -30, -19, -51, 36, 0, -107, 192, 77, 0, 0, - -35, -33, -32, 507, 0, 509, 0, 0, -193, -31, - 0, 0, -295, -8, 0, 0, 0, 255, 263, -12, - 11, 320, 0, 0, 14, 0, 19, 0, 21, 0, - 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 353, 0, 0, 0, - 0, 0, 0, 0, 0, 542, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 355, 0, -34, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -20, 275, 0, 0, 0, -44, 9, 6, 0, 11, + 0, 0, 0, -42, -268, -15, 0, 0, 0, 13, + 0, 20, 0, 0, 0, 0, 0, 0, 134, 0, + 0, 0, 0, 481, 0, -198, 0, 218, 219, 215, + -32, -41, -39, -89, 0, -119, 136, 82, 0, 0, + -1, 23, 39, 484, 0, 485, 0, 0, -210, 45, + 0, 0, -284, -11, 0, 0, 0, 242, 244, 15, + 18, -12, 5, 288, 0, 0, 7, 0, 10, 0, + 12, 0, 16, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 350, 0, + 0, 0, 0, 0, 0, 0, 0, 520, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 330, 0, + -58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 322, 271, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 172, 0, 0, + 0, 0, 0, 342, 294, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 111, 0, 0, 0, 0, 0, 0, 0, 108, 0, - 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 89, 0, 0, 0, 0, 0, + 0, 0, 79, 0, 0, 0, 0, 0, 0, 0, + 0, 0, }; -#define TAO_YYTABLESIZE 952 -short tao_yytable[] = { 53, - 62, 64, 84, 52, 118, 119, 20, 122, 95, 123, - 124, 127, 26, 326, 19, 28, 92, 315, 269, 21, - 29, 51, 30, 130, 31, 40, 120, 95, 6, 95, - 95, 59, 129, 347, 132, 133, 134, 135, 141, 141, - 194, 368, 141, 141, 141, 386, 141, 139, 141, 130, - 147, 305, 130, 148, 130, 194, 130, 102, 194, 141, - 141, 216, 141, 141, 213, 16, 214, 142, 94, 130, - 130, 94, 166, 130, 59, 63, 230, 231, 136, 197, - 138, 216, 197, 59, 62, 103, 131, 166, 67, 131, - 166, 131, 51, 131, 141, 141, 59, 197, 92, 117, - 197, 6, 149, 150, 130, 130, 131, 131, 277, 95, - 131, 83, 132, 282, 104, 132, 152, 132, 128, 132, - 438, 40, 142, 277, 447, 141, 277, 173, 282, 177, - 154, 282, 132, 132, 153, 130, 132, 366, 144, 59, - 143, 131, 131, 16, 440, 142, 145, 215, 59, 40, - 94, 155, 186, 127, 193, 128, 127, 466, 128, 305, - 129, 199, 61, 129, 156, 229, 476, 132, 132, 441, - 442, 123, 131, 127, 127, 128, 128, 127, 40, 128, - 129, 129, 273, 274, 129, 486, 95, 157, 123, 123, - 279, 275, 123, 276, 158, 277, 286, 159, 132, 286, - 278, 160, 40, 161, 20, 20, 300, 302, 127, 127, - 128, 128, 19, 19, 286, 129, 129, 21, 21, 120, - 419, 420, 421, 123, 123, 329, 330, 331, 304, 190, - 369, 162, 190, 163, 305, 164, 120, 120, 305, 127, - 120, 128, 325, 326, 20, 180, 129, 190, 266, 267, - 268, 179, 19, 194, 123, 327, 328, 21, 469, 172, - 328, 328, 328, 182, 317, 195, 347, 54, 56, 441, - 442, 120, 187, 59, 95, 92, 57, 58, 51, 284, - 194, 362, 363, 196, 197, 166, 95, 264, 20, 270, - 271, 272, 285, 283, 26, 197, 19, 28, 51, 95, - 95, 21, 29, 364, 30, 286, 31, 292, 293, 378, - 319, 379, 380, 381, 300, 302, 59, 306, 312, 318, - 321, 277, 332, 333, 193, 59, 282, 94, 377, 141, - 141, 334, 300, 350, 361, 351, 304, 354, 367, 130, - 130, 204, 205, 206, 207, 208, 209, 210, 61, 375, - 355, 211, 212, 356, 357, 358, 214, 359, 360, 371, - 193, 204, 205, 206, 207, 208, 209, 210, 61, 382, - 124, 211, 212, 385, 31, 125, 131, 131, 125, 383, - 384, 53, 389, 147, 395, 404, 397, 124, 124, 300, - 302, 124, 399, 300, 302, 125, 125, 401, 407, 125, - 49, 413, 132, 132, 417, 418, 414, 427, 429, 433, - 425, 304, 449, 439, 448, 304, 450, 468, 483, 470, - 479, 487, 124, 124, 53, 474, 491, 488, 452, 485, - 125, 125, 492, 494, 1, 471, 126, 118, 61, 126, - 193, 95, 53, 127, 127, 128, 128, 177, 60, 193, - 129, 129, 180, 124, 340, 25, 126, 126, 262, 194, - 126, 125, 186, 217, 217, 238, 319, 330, 193, 217, - 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, - 217, 217, 352, 217, 217, 217, 217, 217, 217, 265, - 239, 126, 126, 217, 217, 217, 217, 217, 217, 217, - 217, 217, 217, 217, 217, 217, 309, 217, 217, 217, - 217, 309, 309, 309, 309, 309, 309, 309, 309, 309, - 309, 309, 126, 478, 390, 55, 322, 309, 309, 323, - 370, 324, 309, 296, 217, 473, 309, 309, 309, 309, - 309, 309, 309, 309, 309, 309, 309, 309, 121, 125, - 240, 126, 284, 309, 309, 262, 59, 290, 217, 296, - 341, 475, 309, 400, 467, 121, 121, 0, 0, 121, - 477, 0, 0, 122, 309, 0, 309, 0, 0, 309, - 309, 309, 309, 309, 309, 309, 309, 309, 309, 309, - 122, 122, 0, 0, 122, 309, 309, 0, 0, 0, - 121, 296, 309, 0, 309, 0, 342, 51, 0, 0, - 0, 0, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 8, 9, 122, 10, 80, 81, 82, - 0, 121, 0, 0, 0, 51, 0, 0, 0, 0, - 374, 70, 71, 0, 309, 74, 75, 76, 77, 0, - 0, 0, 51, 0, 10, 0, 122, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 8, 9, - 0, 10, 80, 81, 82, 0, 0, 61, 51, 0, - 0, 0, 0, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 8, 9, 83, 10, 80, 81, - 82, 0, 0, 0, 247, 61, 0, 0, 0, 247, - 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 61, 247, 247, 247, 247, 0, 0, 51, - 0, 0, 0, 0, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 0, 0, 51, 61, 80, - 81, 82, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 0, 0, 0, 0, 0, 81, 82, - 0, 0, 0, 51, 247, 0, 0, 299, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, - 0, 0, 0, 0, 81, 82, 0, 51, 0, 61, - 0, 0, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 0, 0, 0, 0, 0, 61, 81, 82, - 3, 0, 4, 5, 6, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 8, 9, 0, - 10, 0, 0, 61, 11, 241, 0, 4, 0, 0, - 7, 0, 0, 0, 0, 0, 0, 12, 13, 14, - 15, 0, 8, 9, 0, 10, 16, 61, 0, 11, - 0, 0, 242, 0, 243, 244, 0, 0, 0, 0, - 17, 18, 12, 0, 0, 0, 256, 257, 258, 0, - 241, 0, 4, 0, 0, 7, 0, 0, 0, 0, +#define TAO_YYTABLESIZE 992 +short tao_yytable[] = { 58, + 57, 67, 69, 127, 89, 128, 28, 20, 30, 100, + 19, 31, 21, 32, 92, 225, 26, 33, 222, 27, + 223, 95, 94, 332, 95, 94, 280, 321, 56, 353, + 139, 40, 129, 290, 59, 100, 102, 138, 288, 141, + 142, 143, 144, 289, 200, 325, 131, 200, 59, 63, + 141, 141, 148, 56, 141, 141, 141, 6, 141, 261, + 141, 130, 200, 6, 130, 200, 130, 16, 130, 197, + 132, 141, 141, 239, 240, 141, 225, 389, 145, 72, + 147, 130, 130, 116, 197, 130, 133, 197, 131, 59, + 62, 131, 136, 131, 127, 131, 92, 127, 66, 59, + 40, 224, 396, 95, 94, 16, 141, 141, 131, 131, + 126, 161, 131, 59, 127, 127, 130, 130, 127, 137, + 167, 132, 103, 214, 132, 88, 132, 104, 132, 162, + 163, 425, 277, 278, 279, 167, 182, 141, 167, 186, + 283, 132, 132, 131, 131, 132, 151, 130, 128, 127, + 127, 128, 158, 159, 59, 283, 426, 427, 283, 164, + 325, 387, 150, 197, 288, 204, 152, 151, 128, 128, + 208, 151, 128, 458, 131, 238, 132, 132, 153, 288, + 127, 129, 288, 468, 129, 156, 40, 154, 157, 483, + 165, 40, 486, 286, 488, 287, 100, 433, 434, 435, + 167, 129, 129, 128, 128, 129, 168, 132, 40, 284, + 285, 320, 120, 322, 20, 20, 169, 19, 19, 21, + 21, 426, 427, 26, 26, 297, 27, 27, 100, 120, + 120, 325, 56, 120, 128, 292, 129, 129, 292, 298, + 324, 325, 170, 390, 347, 348, 295, 461, 349, 350, + 351, 345, 346, 292, 59, 61, 20, 62, 63, 19, + 200, 21, 353, 299, 120, 26, 171, 129, 27, 172, + 334, 334, 334, 92, 323, 173, 59, 380, 381, 300, + 95, 94, 197, 125, 174, 301, 125, 175, 181, 188, + 59, 189, 191, 56, 195, 213, 214, 215, 216, 217, + 218, 219, 66, 125, 125, 220, 221, 125, 198, 205, + 206, 275, 28, 20, 30, 281, 19, 31, 21, 32, + 100, 100, 26, 33, 382, 27, 320, 282, 322, 283, + 307, 59, 309, 167, 332, 310, 218, 313, 125, 125, + 338, 141, 141, 326, 339, 341, 204, 156, 352, 204, + 379, 130, 130, 283, 353, 324, 213, 214, 215, 216, + 217, 218, 219, 66, 306, 354, 220, 221, 126, 125, + 369, 126, 356, 368, 372, 373, 374, 288, 131, 131, + 193, 375, 31, 193, 127, 127, 376, 377, 126, 126, + 58, 413, 126, 378, 383, 384, 388, 320, 193, 322, + 392, 393, 394, 395, 404, 406, 407, 320, 49, 322, + 410, 132, 132, 408, 421, 422, 432, 439, 441, 443, + 453, 459, 460, 126, 126, 462, 324, 463, 469, 470, + 290, 466, 100, 471, 485, 491, 324, 492, 128, 128, + 487, 494, 497, 498, 58, 473, 500, 1, 61, 53, + 262, 183, 118, 197, 126, 60, 242, 346, 25, 189, + 268, 204, 325, 243, 204, 186, 204, 221, 221, 336, + 357, 129, 129, 221, 221, 221, 221, 221, 221, 221, + 221, 221, 221, 221, 221, 221, 276, 221, 221, 221, + 221, 358, 385, 490, 60, 221, 221, 344, 342, 391, + 343, 221, 221, 221, 221, 221, 221, 221, 221, 221, + 221, 221, 221, 221, 315, 221, 221, 221, 221, 315, + 315, 315, 315, 315, 315, 315, 315, 315, 315, 315, + 465, 134, 135, 308, 64, 315, 315, 243, 221, 273, + 315, 302, 467, 316, 315, 315, 315, 315, 315, 315, + 315, 315, 315, 315, 315, 315, 251, 121, 489, 409, + 0, 315, 315, 484, 0, 0, 221, 302, 0, 0, + 315, 0, 0, 0, 121, 121, 0, 0, 121, 0, + 123, 315, 0, 0, 315, 0, 315, 315, 315, 315, + 315, 315, 315, 315, 315, 315, 315, 123, 123, 0, + 124, 123, 315, 315, 0, 122, 0, 0, 302, 121, + 315, 315, 0, 0, 0, 0, 0, 124, 124, 0, + 0, 124, 122, 122, 0, 0, 122, 0, 0, 0, + 0, 0, 123, 123, 0, 0, 0, 0, 0, 0, + 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 315, 124, 124, 0, 0, 0, 122, 304, 56, + 0, 0, 0, 123, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 8, 9, 0, 10, 85, + 86, 87, 0, 124, 56, 0, 0, 0, 122, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 8, 9, 56, 10, 85, 86, 87, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 8, 9, + 0, 10, 85, 86, 87, 251, 0, 0, 88, 66, + 251, 251, 251, 251, 251, 251, 251, 251, 251, 251, + 251, 251, 251, 0, 251, 251, 251, 251, 0, 0, + 0, 0, 0, 56, 66, 0, 0, 0, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 0, + 0, 56, 66, 85, 86, 87, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 0, 0, 0, + 0, 0, 86, 87, 0, 251, 0, 56, 0, 0, + 0, 319, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 0, 0, 0, 0, 0, 86, 87, + 0, 0, 56, 66, 0, 0, 0, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 0, 0, 0, + 56, 66, 0, 86, 87, 294, 75, 76, 0, 0, + 79, 80, 81, 82, 0, 0, 0, 0, 3, 10, + 4, 5, 6, 7, 0, 0, 0, 66, 0, 0, + 0, 0, 0, 0, 0, 8, 9, 0, 10, 0, + 0, 0, 11, 0, 0, 252, 0, 4, 0, 0, + 7, 0, 66, 0, 0, 12, 13, 14, 15, 0, + 0, 0, 8, 9, 16, 10, 0, 0, 0, 11, + 66, 0, 253, 0, 254, 255, 0, 0, 17, 18, + 0, 0, 12, 0, 0, 0, 267, 268, 269, 0, + 252, 0, 4, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 8, 9, 0, - 10, 0, 0, 0, 11, 0, 0, 242, 0, 243, - 244, 0, 0, 0, 0, 0, 0, 12, 0, 0, + 10, 0, 0, 0, 11, 0, 0, 253, 0, 254, + 255, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, }; short tao_yycheck[] = { 12, - 17, 18, 25, 12, 43, 43, 2, 43, 25, 43, - 43, 43, 2, 41, 2, 2, 41, 41, 216, 2, - 2, 257, 2, 46, 2, 123, 43, 41, 260, 46, - 44, 58, 45, 59, 47, 48, 49, 50, 37, 38, - 44, 337, 41, 42, 43, 353, 45, 60, 47, 38, - 262, 245, 41, 265, 43, 59, 45, 59, 62, 58, - 59, 40, 322, 62, 43, 302, 45, 327, 41, 58, - 59, 44, 44, 62, 58, 59, 184, 185, 54, 41, - 56, 40, 44, 58, 59, 59, 38, 59, 58, 41, - 62, 43, 257, 45, 93, 94, 123, 59, 123, 59, - 62, 260, 262, 263, 93, 94, 58, 59, 44, 123, - 62, 301, 38, 44, 59, 41, 44, 43, 257, 45, - 428, 123, 327, 59, 432, 124, 62, 140, 59, 146, - 106, 62, 58, 59, 62, 124, 62, 335, 123, 123, - 322, 93, 94, 302, 256, 327, 123, 126, 123, 123, - 123, 60, 165, 38, 167, 38, 41, 453, 41, 353, - 38, 174, 327, 41, 60, 182, 462, 93, 94, 281, - 282, 41, 124, 58, 59, 58, 59, 62, 123, 62, - 58, 59, 328, 329, 62, 481, 203, 59, 58, 59, - 37, 43, 62, 45, 59, 42, 41, 59, 124, 44, - 47, 59, 300, 59, 200, 201, 245, 245, 93, 94, - 93, 94, 200, 201, 59, 93, 94, 200, 201, 41, - 288, 289, 290, 93, 94, 277, 278, 279, 245, 41, - 338, 59, 44, 59, 428, 59, 58, 59, 432, 124, - 62, 124, 273, 274, 240, 60, 124, 59, 213, 214, - 215, 262, 240, 257, 124, 275, 276, 240, 456, 123, - 288, 289, 290, 300, 288, 275, 292, 13, 14, 281, - 282, 93, 123, 300, 291, 300, 14, 15, 257, 91, - 123, 316, 317, 123, 123, 257, 300, 44, 284, 124, - 94, 38, 44, 61, 284, 257, 284, 284, 257, 316, - 317, 284, 284, 320, 284, 91, 284, 40, 257, 345, - 59, 345, 345, 345, 353, 353, 300, 284, 125, 125, - 41, 257, 62, 62, 337, 300, 257, 300, 345, 328, - 329, 62, 125, 125, 257, 59, 353, 59, 125, 328, - 329, 320, 321, 322, 323, 324, 325, 326, 327, 345, - 59, 330, 331, 59, 59, 59, 125, 59, 59, 125, - 373, 320, 321, 322, 323, 324, 325, 326, 327, 125, - 41, 330, 331, 257, 125, 38, 328, 329, 41, 44, - 125, 394, 59, 262, 40, 394, 93, 58, 59, 428, - 428, 62, 41, 432, 432, 58, 59, 40, 59, 62, - 125, 41, 328, 329, 123, 41, 288, 44, 41, 41, - 291, 428, 40, 44, 44, 432, 292, 59, 41, 58, - 40, 59, 93, 94, 437, 125, 41, 322, 437, 58, - 93, 94, 44, 322, 0, 458, 38, 257, 123, 41, - 453, 458, 125, 328, 329, 328, 329, 464, 123, 462, - 328, 329, 59, 124, 257, 125, 58, 59, 125, 41, - 62, 124, 59, 256, 257, 41, 41, 41, 481, 262, + 12, 17, 18, 48, 25, 48, 2, 2, 2, 25, + 2, 2, 2, 2, 41, 40, 2, 2, 43, 2, + 45, 41, 41, 41, 44, 44, 225, 41, 257, 59, + 51, 123, 48, 37, 58, 51, 59, 50, 42, 52, + 53, 54, 55, 47, 41, 256, 48, 44, 58, 59, + 37, 38, 65, 257, 41, 42, 43, 260, 45, 59, + 47, 38, 59, 260, 41, 62, 43, 302, 45, 44, + 48, 58, 59, 193, 194, 62, 40, 362, 59, 58, + 61, 58, 59, 275, 59, 62, 48, 62, 38, 58, + 59, 41, 48, 43, 38, 45, 123, 41, 327, 123, + 123, 126, 371, 123, 123, 302, 93, 94, 58, 59, + 59, 44, 62, 123, 58, 59, 93, 94, 62, 257, + 44, 38, 59, 123, 41, 301, 43, 59, 45, 62, + 111, 256, 222, 223, 224, 59, 149, 124, 62, 155, + 44, 58, 59, 93, 94, 62, 327, 124, 38, 93, + 94, 41, 262, 263, 123, 59, 281, 282, 62, 60, + 371, 360, 322, 176, 44, 178, 322, 327, 58, 59, + 183, 327, 62, 442, 124, 191, 93, 94, 123, 59, + 124, 38, 62, 452, 41, 262, 123, 123, 265, 474, + 60, 123, 477, 43, 479, 45, 212, 288, 289, 290, + 123, 58, 59, 93, 94, 62, 59, 124, 300, 328, + 329, 256, 41, 256, 209, 210, 59, 209, 210, 209, + 210, 281, 282, 209, 210, 241, 209, 210, 244, 58, + 59, 442, 257, 62, 124, 41, 93, 94, 44, 241, + 256, 452, 59, 363, 286, 287, 241, 446, 288, 289, + 290, 284, 285, 59, 13, 14, 251, 14, 15, 251, + 257, 251, 292, 241, 93, 251, 59, 124, 251, 59, + 288, 289, 290, 300, 288, 59, 300, 336, 337, 241, + 300, 300, 257, 38, 59, 241, 41, 59, 123, 262, + 300, 60, 300, 257, 40, 320, 321, 322, 323, 324, + 325, 326, 327, 58, 59, 330, 331, 62, 123, 123, + 123, 44, 308, 308, 308, 124, 308, 308, 308, 308, + 336, 337, 308, 308, 340, 308, 371, 94, 371, 38, + 61, 300, 44, 257, 125, 91, 125, 257, 93, 94, + 125, 328, 329, 284, 59, 41, 359, 262, 62, 362, + 257, 328, 329, 257, 62, 371, 320, 321, 322, 323, + 324, 325, 326, 327, 125, 62, 330, 331, 38, 124, + 59, 41, 125, 125, 59, 59, 59, 257, 328, 329, + 41, 59, 125, 44, 328, 329, 59, 59, 58, 59, + 403, 403, 62, 59, 41, 59, 125, 442, 59, 442, + 125, 44, 125, 257, 40, 123, 59, 452, 125, 452, + 40, 328, 329, 93, 41, 288, 41, 291, 44, 41, + 41, 44, 59, 93, 94, 58, 442, 448, 44, 40, + 91, 125, 448, 292, 58, 40, 452, 41, 328, 329, + 59, 322, 41, 44, 457, 457, 322, 0, 123, 125, + 59, 59, 257, 41, 124, 123, 41, 257, 125, 59, + 125, 474, 41, 125, 477, 481, 479, 256, 257, 41, + 59, 328, 329, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 212, 276, 277, 278, + 279, 41, 359, 481, 14, 256, 257, 283, 281, 364, + 282, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 257, 276, 277, 278, 279, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 41, 276, 277, 278, 279, 256, 257, 203, - 125, 93, 94, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 257, 276, 277, 278, - 279, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 124, 464, 373, 14, 270, 278, 279, 271, - 339, 272, 257, 284, 327, 459, 287, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 41, 43, - 198, 43, 233, 278, 279, 201, 15, 236, 327, 284, - 290, 461, 287, 392, 454, 58, 59, -1, -1, 62, - 463, -1, -1, 41, 257, -1, 327, -1, -1, 262, + 449, 48, 48, 246, 15, 278, 279, 196, 327, 210, + 257, 284, 451, 250, 287, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 207, 41, 480, 401, + -1, 278, 279, 475, -1, -1, 327, 284, -1, -1, + 287, -1, -1, -1, 58, 59, -1, -1, 62, -1, + 41, 257, -1, -1, 327, -1, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 58, 59, -1, + 41, 62, 278, 279, -1, 41, -1, -1, 284, 93, + 327, 287, -1, -1, -1, -1, -1, 58, 59, -1, + -1, 62, 58, 59, -1, -1, 62, -1, -1, -1, + -1, -1, 93, 94, -1, -1, -1, -1, -1, -1, + 124, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 327, 93, 94, -1, -1, -1, 93, 256, 257, + -1, -1, -1, 124, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, -1, 276, 277, + 278, 279, -1, 124, 257, -1, -1, -1, 124, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 58, 59, -1, -1, 62, 278, 279, -1, -1, -1, - 93, 284, 327, -1, 287, -1, 256, 257, -1, -1, - -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 93, 276, 277, 278, 279, - -1, 124, -1, -1, -1, 257, -1, -1, -1, -1, - 262, 263, 264, -1, 327, 267, 268, 269, 270, -1, - -1, -1, 257, -1, 276, -1, 124, 262, 263, 264, + 273, 274, 257, 276, 277, 278, 279, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - -1, 276, 277, 278, 279, -1, -1, 327, 257, -1, - -1, -1, -1, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 301, 276, 277, 278, - 279, -1, -1, -1, 257, 327, -1, -1, -1, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 327, 276, 277, 278, 279, -1, -1, 257, - -1, -1, -1, -1, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, -1, -1, 257, 327, 277, - 278, 279, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, -1, -1, -1, -1, -1, 278, 279, - -1, -1, -1, 257, 327, -1, -1, 287, 262, 263, + -1, 276, 277, 278, 279, 257, -1, -1, 301, 327, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, -1, 276, 277, 278, 279, -1, -1, + -1, -1, -1, 257, 327, -1, -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, -1, - -1, -1, -1, -1, 278, 279, -1, 257, -1, 327, - -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, -1, -1, -1, -1, -1, 327, 278, 279, - 256, -1, 258, 259, 260, 261, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 273, 274, -1, - 276, -1, -1, 327, 280, 256, -1, 258, -1, -1, - 261, -1, -1, -1, -1, -1, -1, 293, 294, 295, - 296, -1, 273, 274, -1, 276, 302, 327, -1, 280, - -1, -1, 283, -1, 285, 286, -1, -1, -1, -1, - 316, 317, 293, -1, -1, -1, 297, 298, 299, -1, + -1, 257, 327, 277, 278, 279, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, -1, -1, -1, + -1, -1, 278, 279, -1, 327, -1, 257, -1, -1, + -1, 287, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, -1, -1, -1, -1, -1, 278, 279, + -1, -1, 257, 327, -1, -1, -1, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, -1, -1, -1, + 257, 327, -1, 278, 279, 262, 263, 264, -1, -1, + 267, 268, 269, 270, -1, -1, -1, -1, 256, 276, + 258, 259, 260, 261, -1, -1, -1, 327, -1, -1, + -1, -1, -1, -1, -1, 273, 274, -1, 276, -1, + -1, -1, 280, -1, -1, 256, -1, 258, -1, -1, + 261, -1, 327, -1, -1, 293, 294, 295, 296, -1, + -1, -1, 273, 274, 302, 276, -1, -1, -1, 280, + 327, -1, 283, -1, 285, 286, -1, -1, 316, 317, + -1, -1, 293, -1, -1, -1, 297, 298, 299, -1, 256, -1, 258, -1, -1, 261, -1, -1, -1, -1, -1, -1, -1, -1, -1, 316, 317, 273, 274, -1, 276, -1, -1, -1, 280, -1, -1, 283, -1, 285, @@ -691,7 +706,7 @@ const char *tao_yyrule[] = { "$$13 :", "module : IDL_MODULE $$10 IDENTIFIER $$11 '{' $$12 definitions $$13 '}'", "interface_def : interface", -"interface_def : forward", +"interface_def : interface_forward", "$$14 :", "$$15 :", "$$16 :", @@ -765,9 +780,9 @@ const char *tao_yyrule[] = { "$$38 :", "scoped_name : scoped_name IDL_SCOPE_DELIMITOR $$38 id", "id : IDENTIFIER", -"forward : interface_decl", -"forward : IDL_LOCAL interface_decl", -"forward : IDL_ABSTRACT interface_decl", +"interface_forward : interface_decl", +"interface_forward : IDL_LOCAL interface_decl", +"interface_forward : IDL_ABSTRACT interface_decl", "$$39 :", "$$40 :", "$$41 :", @@ -823,6 +838,7 @@ const char *tao_yyrule[] = { "type_dcl : union_type", "type_dcl : enum_type", "type_dcl : IDL_NATIVE simple_declarator", +"type_dcl : constructed_forward_type_spec", "$$44 :", "type_declarator : type_spec $$44 at_least_one_declarator", "type_spec : simple_type_spec", @@ -843,6 +859,8 @@ const char *tao_yyrule[] = { "constructed_type_spec : struct_type", "constructed_type_spec : union_type", "constructed_type_spec : enum_type", +"constructed_forward_type_spec : struct_forward_type", +"constructed_forward_type_spec : union_forward_type", "at_least_one_declarator : declarator declarators", "$$45 :", "declarators : declarators ',' $$45 declarator", @@ -873,10 +891,11 @@ const char *tao_yyrule[] = { "boolean_type : IDL_BOOLEAN", "any_type : IDL_ANY", "$$47 :", +"struct_decl : IDL_STRUCT $$47 id", "$$48 :", "$$49 :", "$$50 :", -"struct_type : IDL_STRUCT $$47 id $$48 '{' $$49 at_least_one_member $$50 '}'", +"struct_type : struct_decl $$48 '{' $$49 at_least_one_member $$50 '}'", "at_least_one_member : member members", "members : members member", "members :", @@ -888,14 +907,14 @@ const char *tao_yyrule[] = { "$$54 :", "member_i : error $$54 ';'", "$$55 :", +"union_decl : IDL_UNION $$55 id", "$$56 :", "$$57 :", "$$58 :", "$$59 :", "$$60 :", "$$61 :", -"$$62 :", -"union_type : IDL_UNION $$55 id $$56 IDL_SWITCH $$57 '(' $$58 switch_type_spec $$59 ')' $$60 '{' $$61 at_least_one_case_branch $$62 '}'", +"union_type : union_decl IDL_SWITCH $$56 '(' $$57 switch_type_spec $$58 ')' $$59 '{' $$60 at_least_one_case_branch $$61 '}'", "switch_type_spec : integer_type", "switch_type_spec : char_type", "switch_type_spec : octet_type", @@ -905,101 +924,103 @@ const char *tao_yyrule[] = { "at_least_one_case_branch : case_branch case_branches", "case_branches : case_branches case_branch", "case_branches :", +"$$62 :", "$$63 :", +"case_branch : at_least_one_case_label $$62 element_spec $$63 ';'", "$$64 :", -"case_branch : at_least_one_case_label $$63 element_spec $$64 ';'", -"$$65 :", -"case_branch : error $$65 ';'", +"case_branch : error $$64 ';'", "at_least_one_case_label : case_label case_labels", "case_labels : case_labels case_label", "case_labels :", +"$$65 :", +"case_label : IDL_DEFAULT $$65 ':'", "$$66 :", -"case_label : IDL_DEFAULT $$66 ':'", "$$67 :", +"case_label : IDL_CASE $$66 const_expr $$67 ':'", "$$68 :", -"case_label : IDL_CASE $$67 const_expr $$68 ':'", +"element_spec : type_spec $$68 declarator", +"struct_forward_type : struct_decl", +"union_forward_type : union_decl", "$$69 :", -"element_spec : type_spec $$69 declarator", "$$70 :", "$$71 :", "$$72 :", -"$$73 :", -"enum_type : IDL_ENUM $$70 id $$71 '{' $$72 at_least_one_enumerator $$73 '}'", +"enum_type : IDL_ENUM $$69 id $$70 '{' $$71 at_least_one_enumerator $$72 '}'", "at_least_one_enumerator : enumerator enumerators", -"$$74 :", -"enumerators : enumerators ',' $$74 enumerator", +"$$73 :", +"enumerators : enumerators ',' $$73 enumerator", "enumerators :", "enumerator : IDENTIFIER", +"$$74 :", "$$75 :", -"$$76 :", -"sequence_type_spec : seq_head ',' $$75 positive_int_expr $$76 '>'", +"sequence_type_spec : seq_head ',' $$74 positive_int_expr $$75 '>'", "sequence_type_spec : seq_head '>'", +"$$76 :", "$$77 :", +"seq_head : IDL_SEQUENCE $$76 '<' $$77 simple_type_spec", "$$78 :", -"seq_head : IDL_SEQUENCE $$77 '<' $$78 simple_type_spec", "$$79 :", -"$$80 :", -"string_type_spec : string_head '<' $$79 positive_int_expr $$80 '>'", +"string_type_spec : string_head '<' $$78 positive_int_expr $$79 '>'", "string_type_spec : string_head", "string_head : IDL_STRING", +"$$80 :", "$$81 :", -"$$82 :", -"wstring_type_spec : wstring_head '<' $$81 positive_int_expr $$82 '>'", +"wstring_type_spec : wstring_head '<' $$80 positive_int_expr $$81 '>'", "wstring_type_spec : wstring_head", "wstring_head : IDL_WSTRING", -"$$83 :", -"array_declarator : id $$83 at_least_one_array_dim", +"$$82 :", +"array_declarator : id $$82 at_least_one_array_dim", "at_least_one_array_dim : array_dim array_dims", "array_dims : array_dims array_dim", "array_dims :", +"$$83 :", "$$84 :", +"array_dim : '[' $$83 positive_int_expr $$84 ']'", "$$85 :", -"array_dim : '[' $$84 positive_int_expr $$85 ']'", "$$86 :", -"$$87 :", -"attribute : opt_readonly IDL_ATTRIBUTE $$86 param_type_spec $$87 at_least_one_simple_declarator", +"attribute : opt_readonly IDL_ATTRIBUTE $$85 param_type_spec $$86 at_least_one_simple_declarator", "opt_readonly : IDL_READONLY", "opt_readonly :", +"$$87 :", "$$88 :", "$$89 :", "$$90 :", +"exception : IDL_EXCEPTION $$87 id $$88 '{' $$89 members $$90 '}'", "$$91 :", -"exception : IDL_EXCEPTION $$88 id $$89 '{' $$90 members $$91 '}'", "$$92 :", "$$93 :", "$$94 :", -"$$95 :", -"operation : opt_op_attribute op_type_spec $$92 IDENTIFIER $$93 parameter_list $$94 opt_raises $$95 opt_context", +"operation : opt_op_attribute op_type_spec $$91 IDENTIFIER $$92 parameter_list $$93 opt_raises $$94 opt_context", "opt_op_attribute : IDL_ONEWAY", "opt_op_attribute : IDL_IDEMPOTENT", "opt_op_attribute :", "op_type_spec : param_type_spec", "op_type_spec : IDL_VOID", +"$$95 :", "$$96 :", +"init_decl : IDL_FACTORY $$95 IDENTIFIER $$96 init_parameter_list", "$$97 :", -"init_decl : IDL_FACTORY $$96 IDENTIFIER $$97 init_parameter_list", +"init_parameter_list : '(' $$97 ')'", "$$98 :", -"init_parameter_list : '(' $$98 ')'", -"$$99 :", -"init_parameter_list : '(' $$99 at_least_one_in_parameter ')'", +"init_parameter_list : '(' $$98 at_least_one_in_parameter ')'", "at_least_one_in_parameter : in_parameter in_parameters", -"$$100 :", -"in_parameters : in_parameters ',' $$100 in_parameter", +"$$99 :", +"in_parameters : in_parameters ',' $$99 in_parameter", "in_parameters :", +"$$100 :", "$$101 :", +"in_parameter : IDL_IN $$100 param_type_spec $$101 declarator", "$$102 :", -"in_parameter : IDL_IN $$101 param_type_spec $$102 declarator", +"parameter_list : '(' $$102 ')'", "$$103 :", -"parameter_list : '(' $$103 ')'", -"$$104 :", -"parameter_list : '(' $$104 at_least_one_parameter ')'", +"parameter_list : '(' $$103 at_least_one_parameter ')'", "at_least_one_parameter : parameter parameters", -"$$105 :", -"parameters : parameters ',' $$105 parameter", +"$$104 :", +"parameters : parameters ',' $$104 parameter", "parameters :", +"$$105 :", "$$106 :", -"$$107 :", -"parameter : direction $$106 param_type_spec $$107 declarator", +"parameter : direction $$105 param_type_spec $$106 declarator", "param_type_spec : base_type_spec", "param_type_spec : string_type_spec", "param_type_spec : wstring_type_spec", @@ -1007,17 +1028,17 @@ const char *tao_yyrule[] = { "direction : IDL_IN", "direction : IDL_OUT", "direction : IDL_INOUT", +"$$107 :", "$$108 :", -"$$109 :", -"opt_raises : IDL_RAISES $$108 '(' $$109 at_least_one_scoped_name ')'", +"opt_raises : IDL_RAISES $$107 '(' $$108 at_least_one_scoped_name ')'", "opt_raises :", +"$$109 :", "$$110 :", -"$$111 :", -"opt_context : IDL_CONTEXT $$110 '(' $$111 at_least_one_string_literal ')'", +"opt_context : IDL_CONTEXT $$109 '(' $$110 at_least_one_string_literal ')'", "opt_context :", "at_least_one_string_literal : IDL_STRING_LITERAL string_literals", -"$$112 :", -"string_literals : string_literals ',' $$112 IDL_STRING_LITERAL", +"$$111 :", +"string_literals : string_literals ',' $$111 IDL_STRING_LITERAL", "string_literals :", "typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL", "typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL", @@ -1049,7 +1070,7 @@ TAO_YYSTYPE tao_yyvs[TAO_YYSTACKSIZE]; * ??? */ int -tao_yywrap () +tao_yywrap (void) { return 1; } @@ -1376,8 +1397,8 @@ case 4: break; case 5: { - idl_global->set_parse_state (IDL_GlobalData::PS_NoState); /* ';'*/ + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 6: @@ -1525,7 +1546,7 @@ case 26: /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen); /* - * Finished with this module - pop it from the scope stack + * Finished with this module - pop it from the scope stack. */ idl_global->scopes ().pop (); } @@ -1554,14 +1575,16 @@ case 29: AST_Interface::fwd_redefinition_helper (i, s); /* - * Add the interface to its definition scope + * Add the interface to its definition scope. */ (void) s->fe_add_interface (i); } + /* - * Push it on the scope stack + * Push it on the scope stack. */ idl_global->scopes ().push (i); + /* This FE_InterfaceHeader class isn't destroyed with the AST.*/ tao_yyvsp[0].ihval->interface_name ()->destroy (); delete tao_yyvsp[0].ihval; @@ -1584,6 +1607,7 @@ case 32: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* * Done with this interface - pop it off the scopes stack */ @@ -1607,6 +1631,7 @@ case 35: { /* interface_header : interface_decl inheritance_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen); + /* * Create an AST representation of the information in the header * part of an interface - this representation contains a computed @@ -1625,6 +1650,7 @@ case 36: { /* | IDL_LOCAL interface_decl inheritance_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_InheritSpecSeen); + /* * Create an AST representation of the information in the header * part of an interface - this representation contains a computed @@ -1702,6 +1728,7 @@ case 47: */ (void) s->fe_add_interface (i); } + /* * Push it on the scope stack */ @@ -1724,6 +1751,7 @@ case 50: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* * Done with this interface - pop it off the scopes stack */ @@ -1756,7 +1784,7 @@ case 51: ); i->set_abstract_valuetype (); AST_Interface::fwd_redefinition_helper (i, - s); + s); /* * Add the valuetype to its definition scope */ @@ -1785,8 +1813,9 @@ case 54: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); + /* - * Done with this interface - pop it off the scopes stack + * Done with this interface - pop it off the scopes stack. */ UTL_Scope* s = idl_global->scopes ().top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); @@ -1838,8 +1867,8 @@ break; case 59: { /* | /* EMPTY * /*/ - tao_yyval.bval = I_FALSE; - } + tao_yyval.bval = I_FALSE; + } break; case 60: { @@ -1863,8 +1892,8 @@ case 62: UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * valuetype. Store it in the enclosing scope @@ -1874,7 +1903,7 @@ case 62: f = idl_global->gen()->create_valuetype_fwd (&n); f->set_abstract_valuetype (); (void) s->fe_add_interface_fwd (f); - } + } } break; case 63: @@ -1884,8 +1913,8 @@ case 63: UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * valuetype. Store it in the enclosing scope @@ -1918,6 +1947,7 @@ case 70: break; case 72: { +/* IDL_PRIVATE*/ /* is $0 to member_i */ tao_yyval.vival = AST_Field::vis_PRIVATE; } @@ -2021,7 +2051,7 @@ case 91: break; case 92: { -/*at_least_one_scoped_name : scoped_name scoped_names*/ +/* at_least_one_scoped_name : scoped_name scoped_names*/ ACE_NEW_RETURN (tao_yyval.nlval, UTL_NameList (tao_yyvsp[-1].idlist, tao_yyvsp[0].nlval), @@ -2132,13 +2162,13 @@ case 101: break; case 102: { -/* forward : interface_decl*/ +/* interface_forward : interface_decl*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceForwardSeen); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -2159,8 +2189,10 @@ case 103: UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state ( + IDL_GlobalData::PS_InterfaceForwardSeen + ); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -2181,8 +2213,10 @@ case 104: UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_InterfaceFwd *f = 0; + idl_global->set_parse_state ( + IDL_GlobalData::PS_InterfaceForwardSeen + ); - idl_global->set_parse_state (IDL_GlobalData::PS_ForwardDeclSeen); /* * Create a node representing a forward declaration of an * interface. Store it in the enclosing scope @@ -2227,8 +2261,8 @@ case 109: 0); UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Constant *c = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen); + /* * Create a node representing a constant declaration. Store * it in the enclosing scope. @@ -2609,30 +2643,35 @@ case 153: { good_expression = 0; } + break; case AST_Expression::EV_ulong: if (ev->u.ulval == 0) { good_expression = 0; } + break; case AST_Expression::EV_ulonglong: if (ev->u.ullval == 0) { good_expression = 0; } + break; case AST_Expression::EV_octet: if (ev->u.oval == 0) { good_expression = 0; } + break; case AST_Expression::EV_bool: if (ev->u.bval == 0) { good_expression = 0; } + break; default: good_expression = 0; @@ -2678,7 +2717,7 @@ case 157: break; case 158: { -/* | enum_type */ +/* | enum_type */ tao_yyval.ival = 0; } break; @@ -2687,8 +2726,8 @@ case 159: /* | IDL_NATIVE simple_declarator*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Native *node = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen); + /* * Create a node representing a Native and add it to its * enclosing scope @@ -2708,18 +2747,24 @@ case 159: break; case 160: { +/* | constructed_forward_type_spec*/ + tao_yyval.ival = 0; + } +break; +case 161: +{ /* type_declarator : type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen); } break; -case 161: +case 162: { /* at_least_one_declarator*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); FE_Declarator *d = 0; AST_Typedef *t = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen); + /* * Create a list of type renamings. Add them to the * enclosing scope @@ -2758,7 +2803,7 @@ case 161: } } break; -case 164: +case 165: { /* simple_type_spec : base_type_spec*/ tao_yyval.dcval = @@ -2767,7 +2812,7 @@ case 164: ); } break; -case 166: +case 167: { /* | template_type_spec*/ /* | scoped_name*/ @@ -2788,7 +2833,7 @@ case 166: tao_yyval.dcval = d; } break; -case 180: +case 183: { /* at_least_one_declarator : declarator declarators*/ ACE_NEW_RETURN (tao_yyval.dlval, @@ -2797,13 +2842,13 @@ case 180: 1); } break; -case 181: +case 184: { /* declarators : declarators ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } break; -case 182: +case 185: { /* declarator*/ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); @@ -2827,13 +2872,13 @@ case 182: } } break; -case 183: +case 186: { /* | /* EMPTY * /*/ tao_yyval.dlval = 0; } break; -case 186: +case 189: { /* at_least_one_simple_declarator : simple_declarator simple_declarators*/ ACE_NEW_RETURN (tao_yyval.dlval, @@ -2842,13 +2887,13 @@ case 186: 1); } break; -case 187: +case 190: { /* simple_declarators : simple_declarators ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } break; -case 188: +case 191: { /* simple_declarator*/ idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); @@ -2872,13 +2917,13 @@ case 188: } } break; -case 189: +case 192: { /* | /* EMPTY * /*/ tao_yyval.dlval = 0; } break; -case 190: +case 193: { /* simple_declarator : id*/ UTL_ScopedName *sn = 0; @@ -2893,7 +2938,7 @@ case 190: 1); } break; -case 191: +case 194: { /* complex_declarator : array_declarator*/ UTL_ScopedName *sn = 0; @@ -2908,61 +2953,61 @@ case 191: 1); } break; -case 194: +case 197: { /* signed_int : IDL_LONG*/ tao_yyval.etval = AST_Expression::EV_long; } break; -case 195: +case 198: { /* | IDL_LONG IDL_LONG*/ tao_yyval.etval = AST_Expression::EV_longlong; } break; -case 196: +case 199: { /* | IDL_SHORT*/ tao_yyval.etval = AST_Expression::EV_short; } break; -case 197: +case 200: { /* unsigned_int : IDL_UNSIGNED IDL_LONG*/ tao_yyval.etval = AST_Expression::EV_ulong; } break; -case 198: +case 201: { /* | IDL_UNSIGNED IDL_LONG IDL_LONG*/ tao_yyval.etval = AST_Expression::EV_ulonglong; } break; -case 199: +case 202: { /* | IDL_UNSIGNED IDL_SHORT*/ tao_yyval.etval = AST_Expression::EV_ushort; } break; -case 200: +case 203: { /* floating_pt_type : IDL_DOUBLE*/ tao_yyval.etval = AST_Expression::EV_double; } break; -case 201: +case 204: { /* | IDL_FLOAT*/ tao_yyval.etval = AST_Expression::EV_float; } break; -case 202: +case 205: { /* | IDL_LONG IDL_DOUBLE*/ tao_yyval.etval = AST_Expression::EV_longdouble; } break; -case 203: +case 206: { /* fixed_type : IDL_FIXED*/ ACE_DEBUG ((LM_DEBUG, @@ -2974,51 +3019,57 @@ case 203: ACE_TEXT (" fixed types yet\n"))); } break; -case 204: +case 207: { /* char_type : IDL_CHAR*/ tao_yyval.etval = AST_Expression::EV_char; } break; -case 205: +case 208: { /* | IDL_WCHAR*/ tao_yyval.etval = AST_Expression::EV_wchar; } break; -case 206: +case 209: { /* octet_type : IDL_OCTET*/ tao_yyval.etval = AST_Expression::EV_octet; } break; -case 207: +case 210: { /* boolean_type : IDL_BOOLEAN*/ tao_yyval.etval = AST_Expression::EV_bool; } break; -case 208: +case 211: { /* any_type : IDL_ANY*/ tao_yyval.etval = AST_Expression::EV_any; } break; -case 209: +case 212: { -/* struct_type : IDL_STRUCT*/ +/* struct_decl : IDL_STRUCT*/ idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen); } break; -case 210: +case 213: { /* id*/ + idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); + tao_yyval.idval = tao_yyvsp[0].idval; + } +break; +case 214: +{ +/* struct_type : struct_header*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_Structure *d = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); /* * Create a node representing a struct declaration. Add it * to the enclosing scope @@ -3033,28 +3084,32 @@ case 210: ); (void) s->fe_add_structure (d); } + /* - * Push the scope of the struct on the scopes stack + * Push the scope of the struct on the scopes stack. */ idl_global->scopes ().push (d); } break; -case 211: +case 215: { +/* '{'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen); } break; -case 212: +case 216: { /* at_least_one_member*/ idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen); } break; -case 213: +case 217: { +/* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen); + /* - * Done with this struct. Pop its scope off the scopes stack + * Done with this struct. Pop its scope off the scopes stack. */ tao_yyval.dcval = AST_Structure::narrow_from_scope ( idl_global->scopes ().top_non_null () @@ -3062,35 +3117,35 @@ case 213: idl_global->scopes ().pop (); } break; -case 217: +case 221: { /* member :*/ /* is $0 to member_i */ tao_yyval.vival = AST_Field::vis_NA; } break; -case 219: +case 223: { /* member_i : type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen); } break; -case 220: +case 224: { /* at_least_one_declarator*/ idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen); } break; -case 221: +case 225: { /* ';'*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); FE_Declarator *d = 0; AST_Field *f = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted); + /* - * Check for illegal recursive use of type + * Check for illegal recursive use of type. */ if (tao_yyvsp[-4].dcval != 0 && AST_illegal_recursive_type (tao_yyvsp[-4].dcval)) @@ -3100,7 +3155,7 @@ case 221: } /* * Create a node representing a struct or exception member - * Add it to the enclosing scope + * Add it to the enclosing scope. */ else if (s != 0 && tao_yyvsp[-4].dcval != 0 @@ -3124,7 +3179,7 @@ case 221: continue; } - /* $0 denotes Visibility, must be on yacc reduction stack */ + /* $0 denotes Visibility, must be on yacc reduction stack. */ f = idl_global->gen ()->create_field ( tp, @@ -3133,65 +3188,65 @@ case 221: ); (void) s->fe_add_field (f); } - } + } } break; -case 222: +case 226: { /* | error*/ idl_global->err()->syntax_error (idl_global->parse_state ()); } break; -case 223: +case 227: { /* ';'*/ idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; -case 224: +case 228: { -/* union_type : IDL_UNION*/ +/* union_decl : IDL_UNION*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen); } break; -case 225: +case 229: { /* id*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen); + tao_yyval.idval = tao_yyvsp[0].idval; } break; -case 226: +case 230: { -/* IDL_SWITCH*/ +/* union_type : union_decl IDL_SWITCH*/ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen); } break; -case 227: +case 231: { /* '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen); } break; -case 228: +case 232: { /* switch_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen); } break; -case 229: +case 233: { /* ')'*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); - UTL_ScopedName n (tao_yyvsp[-8].idval, + UTL_ScopedName n (tao_yyvsp[-7].idval, 0); AST_Union *u = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen); /* * Create a node representing a union. Add it to its enclosing - * scope + * scope. */ if (tao_yyvsp[-2].dcval != 0 && s != 0) @@ -3220,24 +3275,25 @@ case 229: idl_global->scopes ().push (u); } break; -case 230: +case 234: { /* '{'*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen); } break; -case 231: +case 235: { /* at_least_one_case_branch*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen); } break; -case 232: +case 236: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen); + /* - * Done with this union. Pop its scope from the scopes stack + * Done with this union. Pop its scope from the scopes stack. */ tao_yyval.dcval = AST_Union::narrow_from_scope ( idl_global->scopes ().top_non_null () @@ -3249,16 +3305,16 @@ case 232: } } break; -case 233: +case 237: { /* switch_type_spec : integer_type*/ tao_yyval.dcval = idl_global->scopes ().bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; -case 234: +case 238: { /* | char_type*/ - /* wchars are not allowed */ + /* wchars are not allowed. */ if (tao_yyvsp[0].etval == AST_Expression::EV_wchar) { idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); @@ -3270,21 +3326,21 @@ case 234: ); } break; -case 235: +case 239: { /* | octet_type*/ - /* octets are not allowed */ + /* octets are not allowed. */ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); tao_yyval.dcval = idl_global->scopes ().bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; -case 236: +case 240: { /* | boolean_type*/ tao_yyval.dcval = idl_global->scopes ().bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; -case 238: +case 242: { /* | enum_type*/ /* | scoped_name*/ @@ -3298,7 +3354,7 @@ case 238: * The discriminator is a scoped name. Try to resolve to * one of the scalar types or to an enum. Thread through * typedef's to arrive at the base type at the end of the - * chain + * chain. */ d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE); @@ -3380,25 +3436,24 @@ case 238: } } break; -case 242: +case 246: { /* case_branch : at_least_one_case_label*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen); } break; -case 243: +case 247: { /* element_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen); } break; -case 244: +case 248: { /* ';'*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_UnionBranch *b = 0; AST_Field *f = tao_yyvsp[-2].ffval; - idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted); /* @@ -3419,26 +3474,29 @@ case 244: } } break; -case 245: +case 249: { /* | error*/ idl_global->err()->syntax_error (idl_global->parse_state()); } break; -case 246: +case 250: { /* ';'*/ idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; -case 247: +case 251: { /* at_least_one_case_label : case_label case_labels*/ - tao_yyval.llval = new UTL_LabelList (tao_yyvsp[-1].ulval, tao_yyvsp[0].llval); + ACE_NEW_RETURN (tao_yyval.llval, + UTL_LabelList (tao_yyvsp[-1].ulval, + tao_yyvsp[0].llval), + 1); } break; -case 248: +case 252: { /* case_labels : case_labels case_label*/ if (tao_yyvsp[-1].llval == 0) @@ -3460,19 +3518,19 @@ case 248: } } break; -case 249: +case 253: { /* | /* EMPTY * /*/ tao_yyval.llval = 0; } break; -case 250: +case 254: { /* case_label : IDL_DEFAULT*/ idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen); } break; -case 251: +case 255: { /* ':'*/ idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); @@ -3483,18 +3541,18 @@ case 251: ); } break; -case 252: +case 256: { /* | IDL_CASE*/ idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen); } break; -case 253: +case 257: { idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen); } break; -case 254: +case 258: { /* const_expr*/ idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); @@ -3505,13 +3563,13 @@ case 254: ); } break; -case 255: +case 259: { /* element_spec : type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen); } break; -case 256: +case 260: { /* declarator*/ idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen); @@ -3528,7 +3586,8 @@ case 256: /* * Create a field in a union branch */ - else if (tao_yyvsp[-2].dcval == 0 || tao_yyvsp[0].deval == 0) + else if (tao_yyvsp[-2].dcval == 0 + || tao_yyvsp[0].deval == 0) { tao_yyval.ffval = 0; } @@ -3550,59 +3609,96 @@ case 256: } } break; -case 257: +case 261: +{ +/* struct_forward_type : struct_header*/ + UTL_Scope *s = idl_global->scopes ().top_non_null (); + UTL_ScopedName n (tao_yyvsp[0].idval, + 0); + AST_StructureFwd *d = 0; + + /* + * Create a node representing a forward declaration of a struct. + */ + if (s != 0) + { + d = idl_global->gen ()->create_structure_fwd (&n); + (void) s->fe_add_structure_fwd (d); + } + } +break; +case 262: +{ + UTL_Scope *s = idl_global->scopes ().top_non_null (); + UTL_ScopedName n (tao_yyvsp[0].idval, + 0); + AST_UnionFwd *u = 0; + + /* + * Create a node representing a forward declaration of a union. + */ + if (s != 0) + { + u = idl_global->gen ()->create_union_fwd (&n); + (void) s->fe_add_union_fwd (u); + } + } +break; +case 263: { /* enum_type : IDL_ENUM*/ idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen); } break; -case 258: +case 264: { /* id*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_Enum *e = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen); /* * Create a node representing an enum and add it to its - * enclosing scope + * enclosing scope. */ - if (s != 0) { - e = idl_global->gen ()->create_enum (&n, - s->is_local (), - s->is_abstract ()); - /* - * Add it to its defining scope - */ - (void) s->fe_add_enum (e); - } + if (s != 0) + { + e = idl_global->gen ()->create_enum (&n, + s->is_local (), + s->is_abstract ()); + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum (e); + } + /* - * Push the enum scope on the scopes stack + * Push the enum scope on the scopes stack. */ idl_global->scopes ().push (e); } break; -case 259: +case 265: { /* '{'*/ idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen); } break; -case 260: +case 266: { /* at_least_one_enumerator*/ idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen); } break; -case 261: +case 267: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen); + /* - * Done with this enum. Pop its scope from the scopes stack + * Done with this enum. Pop its scope from the scopes stack. */ if (idl_global->scopes ().top () == 0) { @@ -3617,13 +3713,13 @@ case 261: } } break; -case 263: +case 269: { /* enumerators : enumerators ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen); } break; -case 266: +case 272: { /* enumerator : IDENTIFIER*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); @@ -3654,19 +3750,19 @@ case 266: } } break; -case 267: +case 273: { /* sequence_type_spec : seq_head ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen); } break; -case 268: +case 274: { /* positive_int_expr*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen); } break; -case 269: +case 275: { /* '>'*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); @@ -3720,7 +3816,7 @@ case 269: } } break; -case 270: +case 276: { /* | seq_head '>'*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); @@ -3736,7 +3832,7 @@ case 270: UTL_Scope *s = idl_global->scopes ().top_non_null (); /* - * Create a node representing a sequence + * Create a node representing a sequence. */ if (tao_yyvsp[-1].dcval == 0) { @@ -3768,42 +3864,43 @@ case 270: } } break; -case 271: +case 277: { /* seq_head : IDL_SEQUENCE*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen); + /* - * Push a sequence marker on scopes stack + * Push a sequence marker on scopes stack. */ idl_global->scopes ().push (0); } break; -case 272: +case 278: { /* '<'*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen); } break; -case 273: +case 279: { /* simple_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen); tao_yyval.dcval = tao_yyvsp[0].dcval; } break; -case 274: +case 280: { /* string_type_spec : string_head '<'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } break; -case 275: +case 281: { /* positive_int_expr*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } break; -case 276: +case 282: { /* '>'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); @@ -3832,7 +3929,7 @@ case 276: } } break; -case 277: +case 283: { /* | string_head*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); @@ -3853,25 +3950,25 @@ case 277: ); } break; -case 278: +case 284: { /* string_head : IDL_STRING*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } break; -case 279: +case 285: { /* wstring_type_spec : wstring_head '<'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } break; -case 280: +case 286: { /* positive_int_expr*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } break; -case 281: +case 287: { /* '>'*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); @@ -3890,7 +3987,7 @@ case 281: { tao_yyval.dcval = idl_global->gen ()->create_wstring (tao_yyvsp[-2].exval); /* - * Add this AST_String to the types defined in the global scope + * Add this AST_String to the types defined in the global scope. */ (void) idl_global->root ()->fe_add_string ( AST_String::narrow_from_decl (tao_yyval.dcval) @@ -3898,10 +3995,11 @@ case 281: } } break; -case 282: +case 288: { /* | wstring_head*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); + /* * Create a node representing a wstring. */ @@ -3910,26 +4008,26 @@ case 282: idl_global->gen ()->create_expr ((unsigned long) 0) ); /* - * Add this AST_String to the types defined in the global scope + * Add this AST_String to the types defined in the global scope. */ (void) idl_global->root ()->fe_add_string ( AST_String::narrow_from_decl (tao_yyval.dcval) ); } break; -case 283: +case 289: { /* wstring_head : IDL_WSTRING*/ idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } break; -case 284: +case 290: { /* array_declarator : id*/ idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen); } break; -case 285: +case 291: { /* at_least_one_array_dim*/ idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted); @@ -3952,7 +4050,7 @@ case 285: } } break; -case 286: +case 292: { /* at_least_one_array_dim : array_dim array_dims*/ ACE_NEW_RETURN (tao_yyval.elval, @@ -3961,7 +4059,7 @@ case 286: 1); } break; -case 287: +case 293: { /* array_dims : array_dims array_dim*/ if (tao_yyvsp[-1].elval == 0) @@ -3983,25 +4081,25 @@ case 287: } } break; -case 288: +case 294: { /* | /* EMPTY * /*/ tao_yyval.elval = 0; } break; -case 289: +case 295: { /* array_dim : '['*/ idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen); } break; -case 290: +case 296: { /* positive_int_expr*/ idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen); } break; -case 291: +case 297: { /* ']'*/ idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen); @@ -4023,25 +4121,24 @@ case 291: } } break; -case 292: +case 298: { /* attribute : opt_readonly IDL_ATTRIBUTE*/ idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen); } break; -case 293: +case 299: { /* param_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen); } break; -case 294: +case 300: { /* at_least_one_simple_declarator*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Attribute *a = 0; FE_Declarator *d = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted); /* @@ -4086,33 +4183,32 @@ case 294: } } break; -case 295: +case 301: { /* opt_readonly : IDL_READONLY*/ idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen); tao_yyval.bval = I_TRUE; } break; -case 296: +case 302: { /* | /* EMPTY * /*/ tao_yyval.bval = I_FALSE; } break; -case 297: +case 303: { /* exception : IDL_EXCEPTION*/ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen); } break; -case 298: +case 304: { /* id*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n (tao_yyvsp[0].idval, 0); AST_Exception *e = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen); /* @@ -4133,19 +4229,19 @@ case 298: idl_global->scopes ().push (e); } break; -case 299: +case 305: { /* '{'*/ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen); } break; -case 300: +case 306: { /* members*/ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen); } break; -case 301: +case 307: { /* '}'*/ idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen); @@ -4155,29 +4251,29 @@ case 301: idl_global->scopes ().pop (); } break; -case 302: +case 308: { /* operation : opt_op_attribute op_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); } break; -case 303: +case 309: { /* IDENTIFIER*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); Identifier id (tao_yyvsp[0].strval); UTL_ScopedName n (&id, 0); AST_Operation *o = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); /* * Create a node representing an operation on an interface - * and add it to its enclosing scope + * and add it to its enclosing scope. */ if (s != 0 && tao_yyvsp[-2].dcval != 0) { - AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-2].dcval); + AST_Type *tp = + AST_Type::narrow_from_decl (tao_yyvsp[-2].dcval); if (tp == 0) { @@ -4203,29 +4299,28 @@ case 303: tao_yyvsp[0].strval = 0; /* - * Push the operation scope onto the scopes stack + * Push the operation scope onto the scopes stack. */ idl_global->scopes ().push (o); } break; -case 304: +case 310: { /* parameter_list*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted); } break; -case 305: +case 311: { /* opt_raises*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted); } break; -case 306: +case 312: { /* opt_context*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Operation *o = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted); /* @@ -4233,17 +4328,17 @@ case 306: */ if (s != 0 && s->scope_node_type () == AST_Decl::NT_op) { - o = AST_Operation::narrow_from_scope (s); + o = AST_Operation::narrow_from_scope (s); - if (tao_yyvsp[-2].nlval != 0 && o != 0) - { - (void) o->fe_add_exceptions (tao_yyvsp[-2].nlval); - } + if (tao_yyvsp[-2].nlval != 0 && o != 0) + { + (void) o->fe_add_exceptions (tao_yyvsp[-2].nlval); + } - if (tao_yyvsp[0].slval != 0) - { - (void) o->fe_add_context (tao_yyvsp[0].slval); - } + if (tao_yyvsp[0].slval != 0) + { + (void) o->fe_add_context (tao_yyvsp[0].slval); + } } /* @@ -4252,27 +4347,27 @@ case 306: idl_global->scopes ().pop (); } break; -case 307: +case 313: { /* opt_op_attribute : IDL_ONEWAY*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); tao_yyval.ofval = AST_Operation::OP_oneway; } break; -case 308: +case 314: { /* | IDL_IDEMPOTENT*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); tao_yyval.ofval = AST_Operation::OP_idempotent; } break; -case 309: +case 315: { /* | /* EMPTY * /*/ tao_yyval.ofval = AST_Operation::OP_noflags; } break; -case 311: +case 317: { /* op_type_spec : param_type_spec | IDL_VOID*/ tao_yyval.dcval = @@ -4281,14 +4376,14 @@ case 311: ); } break; -case 312: +case 318: { /* init_decl : IDL_FACTORY */ /*@@ PS_FactorySeen?*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); } break; -case 313: +case 319: { /* IDENTIFIER */ UTL_Scope *s = idl_global->scopes ().top_non_null (); @@ -4307,7 +4402,6 @@ case 313: Identifier id (tao_yyvsp[0].strval); UTL_ScopedName n (&id, 0); - AST_Factory *factory = 0; idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); @@ -4327,7 +4421,7 @@ case 313: idl_global->scopes ().push (factory); } break; -case 314: +case 320: { /* init_parameter_list*/ /* TODO: replace parameter_list with rule that accepts only IN args */ @@ -4336,54 +4430,53 @@ case 314: idl_global->scopes ().pop (); } break; -case 315: +case 321: { /* init_parameter_list : '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; -case 316: +case 322: { /* ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 317: +case 323: { /* | '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; -case 318: +case 324: { /* at_least_one_in_parameter ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 320: +case 326: { /* in_parameters : in_parameters ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } break; -case 323: +case 329: { /* in_parameter : IDL_IN*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); } break; -case 324: +case 330: { /* param_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); } break; -case 325: +case 331: { /* declarator*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Argument *a = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen); /* @@ -4409,59 +4502,58 @@ case 325: } } break; -case 326: +case 332: { /* parameter_list : '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; -case 327: +case 333: { /* ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 328: +case 334: { /* | '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; -case 329: +case 335: { /* at_least_one_parameter ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 331: +case 337: { /* parameters : parameters ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } break; -case 334: +case 340: { /* parameter : direction*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); } break; -case 335: +case 341: { /* param_type_spec*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); } break; -case 336: +case 342: { /* declarator*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_Argument *a = 0; - idl_global->set_parse_state (IDL_GlobalData::PS_OpParDeclSeen); /* * Create a node representing an argument to an operation - * Add it to the enclosing scope (the operation scope) + * Add it to the enclosing scope (the operation scope). */ if (tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].deval != 0 @@ -4479,28 +4571,30 @@ case 336: idl_global->lineno ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Cannot use a local type as an ") - ACE_TEXT ("argument of a remote operation\n"))); + ACE_TEXT ("argument of a remote ") + ACE_TEXT ("operation\n"))); } else { - a = idl_global->gen ()->create_argument ( - tao_yyvsp[-4].dival, - tp, - (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy () - ); + a = + idl_global->gen ()->create_argument ( + tao_yyvsp[-4].dival, + tp, + (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy () + ); (void) s->fe_add_argument (a); } } } } break; -case 337: +case 343: { /* param_type_spec : base_type_spec*/ tao_yyval.dcval = idl_global->scopes ().bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; -case 340: +case 346: { /* | string_type_spec*/ /* | wstring_type_spec*/ @@ -4518,79 +4612,93 @@ case 340: { idl_global->err ()->lookup_error (tao_yyvsp[0].idlist); } + else + { + AST_Decl::NodeType nt = d->node_type (); + + if (nt == AST_Decl::NT_struct_fwd + || nt == AST_Decl::NT_union_fwd) + { + idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_ADD, + d); + + // If we don't return here, we'll crash later. + return 1; + } + } tao_yyval.dcval = d; } break; -case 341: +case 347: { /* direction : IDL_IN*/ tao_yyval.dival = AST_Argument::dir_IN; } break; -case 342: +case 348: { /* | IDL_OUT*/ tao_yyval.dival = AST_Argument::dir_OUT; } break; -case 343: +case 349: { /* | IDL_INOUT*/ tao_yyval.dival = AST_Argument::dir_INOUT; } break; -case 344: +case 350: { /* opt_raises : IDL_RAISES*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen); } break; -case 345: +case 351: { /* '('*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen); } break; -case 346: +case 352: { /* at_least_one_scoped_name ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen); tao_yyval.nlval = tao_yyvsp[-1].nlval; } break; -case 347: +case 353: { tao_yyval.nlval = 0; /* | /* EMPTY * /*/ } break; -case 348: +case 354: { /* opt_context : IDL_CONTEXT*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen); } break; -case 349: +case 355: { idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen); /* '('*/ } break; -case 350: +case 356: { /* at_least_one_string_literal ')'*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen); tao_yyval.slval = tao_yyvsp[-1].slval; } break; -case 351: +case 357: { /* | /* EMPTY * /*/ tao_yyval.slval = 0; } break; -case 352: +case 358: { /* at_least_one_string_literal : IDL_STRING_LITERAL string_literals*/ ACE_NEW_RETURN (tao_yyval.slval, @@ -4599,13 +4707,13 @@ case 352: 1); } break; -case 353: +case 359: { /* string_literals : string_literals ','*/ idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen); } break; -case 354: +case 360: { /* IDL_STRING_LITERAL*/ if (tao_yyvsp[-3].slval == 0) @@ -4627,13 +4735,13 @@ case 354: } } break; -case 355: +case 361: { /* | /* EMPTY * /*/ tao_yyval.slval = 0; } break; -case 356: +case 362: { /* typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); @@ -4652,7 +4760,7 @@ case 356: } } break; -case 357: +case 363: { /* typeprefix_dcl : IDL_TYPEPREFIX scoped_name IDL_STRING_LITERAL*/ UTL_Scope *s = idl_global->scopes ().top_non_null (); diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h index 88461a0f50d..40889f9cca7 100644 --- a/TAO/TAO_IDL/include/ast_decl.h +++ b/TAO/TAO_IDL/include/ast_decl.h @@ -126,8 +126,10 @@ public: , NT_op // Denotes an operation , NT_argument // Denotes an op. argument , NT_union // Denotes a union + , NT_union_fwd // Fwd declared union , NT_union_branch // Denotes a union branch , NT_struct // Denotes a structure + , NT_struct_fwd // Fwd declared struct , NT_field // Denotes a field in structure , NT_enum // Denotes an enumeration , NT_enum_val // Denotes an enum. value diff --git a/TAO/TAO_IDL/include/ast_extern.h b/TAO/TAO_IDL/include/ast_extern.h index da0c4db0f56..0aadf08dd5d 100644 --- a/TAO/TAO_IDL/include/ast_extern.h +++ b/TAO/TAO_IDL/include/ast_extern.h @@ -69,18 +69,18 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "idl_bool.h" -class AST_InterfaceFwd; +class AST_Type; class AST_Decl; // Declares all global functions for the AST // Two functions are provided for storing AST nodes representing fwd -// declared interfaces, and for checking the stored nodes after parsing -// the entire AST. The check ensures that for each fwd declared interface -// the full definition was also seen. +// declared structs and unions, and for checking the stored nodes after +// parsing the entire AST. The check ensures that for each fwd declared +// type the full definition was also seen. -extern void AST_record_fwd_interface (AST_InterfaceFwd *i); -extern void AST_check_fwd_interface (void); +extern void AST_record_fwd_decl (AST_Type *i); +extern TAO_IDL_FE_Export void AST_check_fwd_decls (void); extern idl_bool AST_illegal_recursive_type (AST_Decl *t); #endif // _AST_EXTERN_AST_EXTERN_HH diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h index 2ecfdb5154a..1d89f6d5b26 100644 --- a/TAO/TAO_IDL/include/ast_generator.h +++ b/TAO/TAO_IDL/include/ast_generator.h @@ -75,6 +75,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. class AST_Root; class UTL_LabelList; class UTL_ExprList; +class AST_StructureFwd; +class AST_UnionFwd; // Defines base class for node generators. @@ -114,14 +116,14 @@ public: idl_bool abstract ); - // Create a node representing an valuetype. + // Create a node representing a valuetype. virtual AST_Interface *create_valuetype ( UTL_ScopedName *n, AST_Interface **ih, long nih ); - // Create a node representing a forward declaration of an valuetype. + // Create a node representing a forward declaration of a valuetype. virtual AST_InterfaceFwd *create_valuetype_fwd ( UTL_ScopedName *n ); @@ -140,6 +142,9 @@ public: idl_bool abstract ); + // Create a node representing a forward declaration of a structure. + virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n); + // Create a node representing an enum. virtual AST_Enum *create_enum (UTL_ScopedName *n, idl_bool local, @@ -183,6 +188,9 @@ public: idl_bool local, idl_bool abstract); + // Create a node representing a forward declaration of a union. + virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n); + // Create a node representing one branch in a union. virtual AST_UnionBranch *create_union_branch ( UTL_LabelList *ll, diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h index 7d21d6257fe..06ce7622a12 100644 --- a/TAO/TAO_IDL/include/ast_interface.h +++ b/TAO/TAO_IDL/include/ast_interface.h @@ -157,10 +157,6 @@ protected: // private: - // Helper function for fwd_redefinition_helper. - static idl_bool compare_names (AST_Interface *that, - AST_Interface *other); - // Data. // Immediate ancestors. @@ -188,6 +184,10 @@ private: virtual AST_Structure *fe_add_structure (AST_Structure *s); + virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u); + + virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s); + virtual AST_Enum *fe_add_enum (AST_Enum *e); virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v); diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h index 44b0996af64..3b15b0461bb 100644 --- a/TAO/TAO_IDL/include/ast_interface_fwd.h +++ b/TAO/TAO_IDL/include/ast_interface_fwd.h @@ -93,6 +93,9 @@ public: virtual idl_bool is_abstract_valuetype (void); virtual void set_abstract_valuetype (void); + // Cleanup function. + virtual void destroy (void); + // Narrowing. DEF_NARROW_METHODS1(AST_InterfaceFwd, AST_Type); DEF_NARROW_FROM_DECL(AST_InterfaceFwd); diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h index c7fb4923262..ba4fef1ffa4 100644 --- a/TAO/TAO_IDL/include/ast_module.h +++ b/TAO/TAO_IDL/include/ast_module.h @@ -146,8 +146,12 @@ private: virtual AST_Union *fe_add_union (AST_Union *u); + virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u); + virtual AST_Structure *fe_add_structure (AST_Structure *s); + virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s); + virtual AST_Enum *fe_add_enum (AST_Enum *e); virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v); diff --git a/TAO/TAO_IDL/include/ast_structure_fwd.h b/TAO/TAO_IDL/include/ast_structure_fwd.h new file mode 100644 index 00000000000..770642c0b81 --- /dev/null +++ b/TAO/TAO_IDL/include/ast_structure_fwd.h @@ -0,0 +1,45 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +#ifndef _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH +#define _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH + +#include "ast_type.h" + +class AST_Structure; + +// Representation of a forward structure declaration. + +class TAO_IDL_FE_Export AST_StructureFwd : public virtual AST_Type +{ +public: + AST_StructureFwd (void); + + AST_StructureFwd (UTL_ScopedName *n); + + virtual ~AST_StructureFwd (void); + + AST_Structure *full_definition (void); + void set_full_definition (AST_Structure *nfd); + + virtual idl_bool is_defined (void); + + // Cleanup function. + virtual void destroy (void); + + // Narrowing. + DEF_NARROW_METHODS1(AST_StructureFwd, AST_Type); + DEF_NARROW_FROM_DECL(AST_StructureFwd); + + // AST Dumping. + virtual void dump (ACE_OSTREAM_TYPE &); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); + +private: + AST_Structure *pd_full_definition; + // The structure this is a forward declaration of. +}; + +#endif // _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_type.h b/TAO/TAO_IDL/include/ast_type.h index 24a292fa610..4d39064dcf5 100644 --- a/TAO/TAO_IDL/include/ast_type.h +++ b/TAO/TAO_IDL/include/ast_type.h @@ -77,15 +77,22 @@ trademarks or registered trademarks of Sun Microsystems, Inc. class TAO_IDL_FE_Export AST_Type : public virtual AST_Decl { public: + enum SIZE_TYPE + { + SIZE_UNKNOWN, + FIXED, + VARIABLE + }; + // Indicates if we are fixed size or variable. Most useful for structs, + // unions, and arrays. + // Operations. - // Constructor(s). AST_Type (void); AST_Type (AST_Decl::NodeType nt, UTL_ScopedName *n); - // Destructor. virtual ~AST_Type (void); virtual idl_bool in_recursion (AST_Type *node = 0); @@ -97,8 +104,20 @@ public: // the corresponding forward declaration classes. virtual idl_bool is_defined (void); + virtual void size_type (SIZE_TYPE); + // Set the size type. + + virtual SIZE_TYPE size_type (void); + // Return our size type. + // Accessors/mutators for the private members. + idl_bool has_constructor (void); + // Accessor for protected member. + + void has_constructor (idl_bool value); + // Mutator for protected member. + idl_bool ifr_added (void); void ifr_added (idl_bool val); @@ -116,12 +135,22 @@ public: virtual void destroy (void); protected: + virtual int compute_size_type (void); + // Determine our size type and set it if it is unknown. + // Has the full definition been added to the Interface Repository? // Used for types which can have members and can be forward declared. idl_bool ifr_added_; // Has this node been forward declared in this IDL file? idl_bool ifr_fwd_added_; + + SIZE_TYPE size_type_; + // Whether we are fixed or variable size (by default fixed). + + idl_bool has_constructor_; + // Attribute that helps a union determine whether a member + // should be included by value or by reference. }; #endif // _AST_TYPE_AST_TYPE_HH diff --git a/TAO/TAO_IDL/include/ast_union_fwd.h b/TAO/TAO_IDL/include/ast_union_fwd.h new file mode 100644 index 00000000000..96115d06b32 --- /dev/null +++ b/TAO/TAO_IDL/include/ast_union_fwd.h @@ -0,0 +1,45 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +#ifndef _AST_UNION_FWD_AST_UNION_FWD_HH +#define _AST_UNION_FWD_AST_UNION_FWD_HH + +#include "ast_type.h" + +class AST_Union; + +// Representation of a forward union declaration. + +class TAO_IDL_FE_Export AST_UnionFwd : public virtual AST_Type +{ +public: + AST_UnionFwd (void); + + AST_UnionFwd (UTL_ScopedName *n); + + virtual ~AST_UnionFwd (void); + + AST_Union *full_definition (void); + void set_full_definition (AST_Union *nfd); + + virtual idl_bool is_defined (void); + + // Cleanup function. + virtual void destroy (void); + + // Narrowing. + DEF_NARROW_METHODS1(AST_UnionFwd, AST_Type); + DEF_NARROW_FROM_DECL(AST_UnionFwd); + + // AST Dumping. + virtual void dump (ACE_OSTREAM_TYPE &); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); + +private: + AST_Union *pd_full_definition; + // The union this is a forward declaration of. +}; + +#endif // _AST_UNION_FWD_AST_UNION_FWD_HH diff --git a/TAO/TAO_IDL/include/ast_visitor.h b/TAO/TAO_IDL/include/ast_visitor.h index 64d24d9582b..0e7b2fbad89 100644 --- a/TAO/TAO_IDL/include/ast_visitor.h +++ b/TAO/TAO_IDL/include/ast_visitor.h @@ -29,13 +29,9 @@ class AST_PredefinedType; class AST_Module; class AST_Interface; class AST_InterfaceFwd; - -// These classes don't exist now, but they may someday. -// class AST_Valuetype; -// class AST_ValuetypeFwd; class AST_Factory; - class AST_Structure; +class AST_StructureFwd; class AST_Exception; class AST_Expression; class AST_Enum; @@ -44,6 +40,7 @@ class AST_Field; class AST_Argument; class AST_Attribute; class AST_Union; +class AST_UnionFwd; class AST_UnionBranch; class AST_UnionLabel; class AST_Constant; @@ -109,6 +106,9 @@ public: virtual int visit_structure (AST_Structure *node) = 0; // Visit a structure. + virtual int visit_structure_fwd (AST_StructureFwd *node) = 0; + // Visit a structure. + virtual int visit_exception (AST_Exception *node) = 0; // Visit exception @@ -133,6 +133,9 @@ public: virtual int visit_union (AST_Union *node) = 0; // Visit union. + virtual int visit_union_fwd (AST_UnionFwd *node) = 0; + // Visit union. + virtual int visit_union_branch (AST_UnionBranch *node) = 0; // Visit union branch. diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index 9f0947b52e2..fcbbfaa558a 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -113,7 +113,7 @@ public: , PS_InterfaceSeen // Seen an INTERFACE keyword , PS_InterfaceIDSeen // Seen the interface ID , PS_InheritSpecSeen // Seen a complete inheritance spec - , PS_ForwardDeclSeen // Forward interface decl seen + , PS_InterfaceForwardSeen // Forward interface decl seen , PS_InterfaceSqSeen // '{' seen for interface , PS_InterfaceQsSeen // '}' seen for interface , PS_InterfaceBodySeen // Seen an interface body @@ -137,11 +137,13 @@ public: , PS_StructSqSeen // '{' seen for struct , PS_StructQsSeen // '}' seen for struct , PS_StructBodySeen // Seen complete body of struct decl + , PS_StructForwardSeen // Forward struct decl seen , PS_MemberTypeSeen // Seen type of struct or except member , PS_MemberDeclsSeen // Seen decls of struct or except members , PS_MemberDeclsCompleted // Completed one struct or except member to ';' , PS_UnionSeen // Seen a UNION keyword , PS_UnionIDSeen // Seen the union ID + , PS_UnionForwardSeen // Forward union decl seen , PS_SwitchSeen // Seen the SWITCH keyword , PS_SwitchOpenParSeen // Seen the switch open par. , PS_SwitchTypeSeen // Seen the switch type spec diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h index 24f1def016d..2da173f6a75 100644 --- a/TAO/TAO_IDL/include/utl_err.h +++ b/TAO/TAO_IDL/include/utl_err.h @@ -230,7 +230,7 @@ public: AST_Decl *d); // Report a forward declared interface which was never defined - void fwd_decl_not_defined (AST_Interface *d); + void fwd_decl_not_defined (AST_Type *d); // Report attempt to lookup in forward declared interface void fwd_decl_lookup (AST_Interface *d, diff --git a/TAO/TAO_IDL/include/utl_idlist.h b/TAO/TAO_IDL/include/utl_idlist.h index e6f1fa49bca..8825aec2132 100644 --- a/TAO/TAO_IDL/include/utl_idlist.h +++ b/TAO/TAO_IDL/include/utl_idlist.h @@ -110,6 +110,9 @@ public: Identifier *last_component (void); // Get last element in this list. + + int compare (UTL_IdList *other); + // Compares each component for equality. private: Identifier *pd_car_data; }; diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index f6d33c09d17..a0695c4971e 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -99,8 +99,10 @@ class AST_Attribute; class AST_Operation; class AST_Argument; class AST_Union; +class AST_UnionFwd; class AST_UnionBranch; class AST_Structure; +class AST_StructureFwd; class AST_Field; class AST_Enum; class AST_EnumVal; @@ -155,10 +157,14 @@ public: virtual AST_Union *add_union (AST_Union *u); + virtual AST_UnionFwd *add_union_fwd (AST_UnionFwd *u); + virtual AST_UnionBranch *add_union_branch (AST_UnionBranch *b); virtual AST_Structure *add_structure (AST_Structure *s); + virtual AST_StructureFwd *add_structure_fwd (AST_StructureFwd *s); + virtual AST_Field *add_field (AST_Field *f); virtual AST_Enum *add_enum (AST_Enum *e); @@ -277,6 +283,10 @@ protected: // and an IDL keyword? int idl_keyword_clash (Identifier *e); + // Checks for modules, or defns of forward declared struct or unions. + idl_bool redef_clash (AST_Decl::NodeType new_nt, + AST_Decl::NodeType scope_elem_nt); + private: // Data. @@ -338,10 +348,14 @@ private: virtual AST_Union *fe_add_union (AST_Union *u); + virtual AST_UnionFwd *fe_add_union_fwd (AST_UnionFwd *u); + virtual AST_UnionBranch *fe_add_union_branch (AST_UnionBranch *b); virtual AST_Structure *fe_add_structure (AST_Structure *s); + virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s); + virtual AST_Field *fe_add_field (AST_Field *f); virtual AST_Enum *fe_add_enum (AST_Enum *e); diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp index d8fdfc18c64..a7875e313e2 100644 --- a/TAO/TAO_IDL/tao_idl.cpp +++ b/TAO/TAO_IDL/tao_idl.cpp @@ -71,6 +71,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "global_extern.h" #include "fe_extern.h" #include "ast_root.h" +#include "ast_extern.h" #include "utl_string.h" #include "drv_extern.h" #include "ace/Process.h" @@ -310,7 +311,20 @@ DRV_drive (const char *s) s)); } - BE_produce (); + // Make sure all forward declared structs and unions are defined + // before proceeding to code generation. + AST_check_fwd_decls (); + long error_count = idl_global->err_count (); + + if (error_count == 0) + { + BE_produce (); + } + else + { + ACE_OS::exit (ACE_static_cast (int, + error_count)); + } // Exit cleanly. ACE_OS::exit (0); diff --git a/TAO/TAO_IDL/tao_idl_static.dsp b/TAO/TAO_IDL/tao_idl_static.dsp index b3ae1e8c64c..dbbfba7cb13 100644 --- a/TAO/TAO_IDL/tao_idl_static.dsp +++ b/TAO/TAO_IDL/tao_idl_static.dsp @@ -95,18 +95,10 @@ SOURCE=.\driver\drv_args.cpp # End Source File
# Begin Source File
-SOURCE=.\driver\drv_init.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\driver\drv_preproc.cpp
# End Source File
# Begin Source File
-SOURCE=.\driver\drv_private.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\tao_idl.cpp
# End Source File
# End Group
@@ -117,10 +109,6 @@ SOURCE=.\tao_idl.cpp SOURCE=.\include\drv_extern.h
# End Source File
-# Begin Source File
-
-SOURCE=.\include\drv_private.h
-# End Source File
# End Group
# End Target
# End Project
diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp index 79d4440eb6e..2eb869651db 100644 --- a/TAO/TAO_IDL/util/utl_err.cpp +++ b/TAO/TAO_IDL/util/utl_err.cpp @@ -127,7 +127,7 @@ error_string (UTL_Error::ErrorCode c) case UTL_Error::EIDL_LABEL_TYPE: return "label type incompatible with union discriminator type, "; case UTL_Error::EIDL_ILLEGAL_ADD: - return "illegal add operation, "; + return "forward declared type may be used only as a sequence element, "; case UTL_Error::EIDL_ILLEGAL_USE: return "illegal type used in expression, "; case UTL_Error::EIDL_ILLEGAL_RAISES: @@ -246,7 +246,7 @@ parse_state_to_error_message (IDL_GlobalData::ParseState ps) { switch (ps) { case IDL_GlobalData::PS_NoState: - return "Statement can not be parsed"; + return "Statement cannot be parsed"; case IDL_GlobalData::PS_TypeDeclSeen: return "Malformed typedef declaration"; case IDL_GlobalData::PS_ConstDeclSeen: @@ -281,7 +281,7 @@ parse_state_to_error_message (IDL_GlobalData::ParseState ps) return "Illegal syntax following interface identifier"; case IDL_GlobalData::PS_InheritSpecSeen: return "Missing '{' or illegal syntax following inheritance spec"; - case IDL_GlobalData::PS_ForwardDeclSeen: + case IDL_GlobalData::PS_InterfaceForwardSeen: return "Missing ';' following forward interface declaration"; case IDL_GlobalData::PS_InterfaceSqSeen: return "Illegal syntax following interface '{' opener"; @@ -902,7 +902,7 @@ UTL_Error::ambiguous (UTL_Scope *s, // Report a forward declared interface which was never defined. void -UTL_Error::fwd_decl_not_defined (AST_Interface *d) +UTL_Error::fwd_decl_not_defined (AST_Type *d) { idl_error_header (EIDL_DECL_NOT_DEFINED, d->line (), diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp index 967589476ac..00ab206611c 100644 --- a/TAO/TAO_IDL/util/utl_idlist.cpp +++ b/TAO/TAO_IDL/util/utl_idlist.cpp @@ -132,6 +132,37 @@ UTL_IdList::last_component (void) return ((UTL_IdList *) this->tail ())->last_component (); } +int +UTL_IdList::compare (UTL_IdList *other) +{ + long this_length = this->length (); + + if (this_length != other->length ()) + { + return 1; + } + + Identifier *this_id = 0; + Identifier *other_id = 0; + + for (UTL_IdListActiveIterator this_iter (this), other_iter (other); + !this_iter.is_done (); + this_iter.next (), other_iter.next ()) + { + this_id = this_iter.item (); + other_id = other_iter.item (); + + if (ACE_OS::strcmp (this_id->get_string (), + other_id->get_string ()) + != 0) + { + return 1; + } + } + + return 0; +} + // AST Dumping. void UTL_IdList::dump (ACE_OSTREAM_TYPE &o) diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index acded37d921..c4663212af5 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -79,13 +79,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_concrete_type.h" #include "ast_sequence.h" #include "ast_string.h" -#include "ast_structure.h" +#include "ast_structure_fwd.h" #include "ast_exception.h" #include "ast_constant.h" #include "ast_attribute.h" #include "ast_operation.h" #include "ast_argument.h" #include "ast_union.h" +#include "ast_union_fwd.h" #include "ast_union_branch.h" #include "ast_field.h" #include "ast_enum_val.h" @@ -391,6 +392,28 @@ UTL_Scope::idl_keyword_clash (Identifier *e) return 0; } +idl_bool +UTL_Scope::redef_clash (AST_Decl::NodeType new_nt, + AST_Decl::NodeType scope_elem_nt) +{ + switch (new_nt) + { + case AST_Decl::NT_module: + return scope_elem_nt != AST_Decl::NT_module; + case AST_Decl::NT_struct: + case AST_Decl::NT_struct_fwd: + return scope_elem_nt != AST_Decl::NT_struct_fwd; + case AST_Decl::NT_union: + case AST_Decl::NT_union_fwd: + return scope_elem_nt != AST_Decl::NT_union_fwd; + case AST_Decl::NT_interface: + case AST_Decl::NT_interface_fwd: + return scope_elem_nt != AST_Decl::NT_interface_fwd; + default: + return I_TRUE; + } +} + // Public operations. // Scope Management Protocol. @@ -555,6 +578,18 @@ UTL_Scope::add_union (AST_Union *u) return u; } +AST_UnionFwd * +UTL_Scope::add_union_fwd (AST_UnionFwd *u) +{ + if (u == 0) + { + return 0; + } + + u->set_added (I_TRUE); + return u; +} + AST_UnionBranch * UTL_Scope::add_union_branch (AST_UnionBranch *u) { @@ -587,6 +622,18 @@ UTL_Scope::add_structure (AST_Structure *s) return s; } +AST_StructureFwd * +UTL_Scope::add_structure_fwd (AST_StructureFwd *s) +{ + if (s == 0) + { + return 0; + } + + s->set_added (I_TRUE); + return s; +} + AST_Field * UTL_Scope::add_field (AST_Field *f) { @@ -806,6 +853,12 @@ UTL_Scope::fe_add_union (AST_Union *) return 0; } +AST_UnionFwd * +UTL_Scope::fe_add_union_fwd (AST_UnionFwd *) +{ + return 0; +} + AST_UnionBranch * UTL_Scope::fe_add_union_branch (AST_UnionBranch *) { @@ -818,6 +871,12 @@ UTL_Scope::fe_add_structure (AST_Structure *) return 0; } +AST_StructureFwd * +UTL_Scope::fe_add_structure_fwd (AST_StructureFwd *) +{ + return 0; +} + AST_Field * UTL_Scope::fe_add_field (AST_Field *) { @@ -1267,9 +1326,11 @@ UTL_Scope::lookup_by_name_local (Identifier *e, { if (index == 0) { - // Special case for forward declared interfaces. - // Look through the forward declaration and retrieve - // the full definition. + AST_Decl::NodeType nt = d->node_type (); + + // Special case for forward declared interfaces, + // In this case, we want to return + // the full definition member, whether defined yet or not if (d->node_type () == AST_Decl::NT_interface_fwd) { d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition (); @@ -1708,9 +1769,7 @@ UTL_Scope::add_to_scope (AST_Decl *e, // then only the top level of whatever scoped name // is used may clash with a local declaration. UTL_ScopedName *s = (*tmp)->name (); - UTL_IdListActiveIterator iter (s); - ref_name = iter.item (); ref_string = ref_name->get_string (); @@ -1729,13 +1788,11 @@ UTL_Scope::add_to_scope (AST_Decl *e, // error, unless they're both modules (which can be // reopened) or we have a belated definition of a // forward-declared interface. - AST_Decl::NodeType nt = e->node_type (); + AST_Decl::NodeType new_nt = e->node_type (); + AST_Decl::NodeType scope_elem_nt = (*tmp)->node_type (); if (decl_name->compare (ref_name) == I_TRUE - && nt != AST_Decl::NT_module - && nt != AST_Decl::NT_interface_fwd - && ((*tmp)->node_type () != AST_Decl::NT_interface_fwd - || nt != AST_Decl::NT_interface)) + && this->redef_clash (new_nt, scope_elem_nt) == I_TRUE) { idl_global->err ()->redef_error (decl_string, ref_string); @@ -1894,14 +1951,16 @@ UTL_Scope::referenced (AST_Decl *e, return I_TRUE; } - if ((*tmp)->node_type () == AST_Decl::NT_interface_fwd - && e->node_type () == AST_Decl::NT_interface) + // Are we definging a forward declared struct, union, or interface, + // or reopening a module? + idl_bool forward_redef = this->redef_clash (e->node_type (), + (*tmp)->node_type ()); + + if (forward_redef == I_FALSE) { member = (*tmp)->local_name (); test = e->local_name (); - // If we're just defining a forward - // declared interface, no need to go any further. if (member->compare (test) == I_TRUE) { return I_FALSE; |