diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-12-31 17:34:56 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-12-31 17:34:56 +0000 |
commit | 85c5c6cf44fb4ae2199fc2656629f3d2b96c1584 (patch) | |
tree | 6ed27dc6a4b35eca1e746e6fc13ba844b6d390f6 /TAO | |
parent | e2e227be5fbd05023bae3299c9139f8f17732661 (diff) | |
download | ATCD-85c5c6cf44fb4ae2199fc2656629f3d2b96c1584.tar.gz |
ChangeLogTag: Mon Dec 31 11:01:29 2001 Jeff Parsons <parsons@cs.wustl.edu>
Diffstat (limited to 'TAO')
220 files changed, 8116 insertions, 5934 deletions
diff --git a/TAO/TAO_IDL/Makefile.BE b/TAO/TAO_IDL/Makefile.BE index 91b79a8ddc6..75621448870 100644 --- a/TAO/TAO_IDL/Makefile.BE +++ b/TAO/TAO_IDL/Makefile.BE @@ -31,6 +31,7 @@ FILES = be/be_array \ be/be_enum_val \ be/be_exception \ be/be_expression \ + be/be_factory \ be/be_field \ be/be_global \ be/be_interface \ @@ -86,7 +87,8 @@ FILES = be/be_array \ be/be_visitor_typecode \ be/be_visitor_typedef \ be/be_visitor_union \ - be/be_visitor_union_branch + be/be_visitor_union_branch \ + be/be_tmplinst LSRC = $(addsuffix .cpp,$(FILES)) diff --git a/TAO/TAO_IDL/Makefile.FE b/TAO/TAO_IDL/Makefile.FE index 030a5fa529a..328738f7025 100644 --- a/TAO/TAO_IDL/Makefile.FE +++ b/TAO/TAO_IDL/Makefile.FE @@ -27,6 +27,7 @@ FILES = fe/fe_declarator \ fe/fe_extern \ fe/fe_global \ fe/fe_interface_header \ + fe/fe_tmplinst \ fe/y.tab \ fe/lex.yy \ ast/ast_array \ @@ -40,6 +41,7 @@ FILES = fe/fe_declarator \ ast/ast_enum_val \ ast/ast_exception \ ast/ast_expression \ + ast/ast_factory \ ast/ast_field \ ast/ast_interface \ ast/ast_interface_fwd \ diff --git a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp index 298aa1871c1..4fc9f86597c 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_DLL.dsp @@ -142,6 +142,10 @@ SOURCE=.\be\be_expression.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_factory.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_field.cpp
# End Source File
# Begin Source File
@@ -222,6 +226,10 @@ SOURCE=.\be\be_sunsoft.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_type.cpp
# End Source File
# Begin Source File
@@ -406,6 +414,10 @@ SOURCE=.\be_include\be_expression.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_factory.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_field.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 ccd4c21e600..0be11d06abe 100644 --- a/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_BE_LIB.dsp @@ -135,6 +135,10 @@ SOURCE=.\be\be_expression.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_factory.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_field.cpp
# End Source File
# Begin Source File
@@ -215,6 +219,10 @@ SOURCE=.\be\be_sunsoft.cpp # End Source File
# Begin Source File
+SOURCE=.\be\be_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\be\be_type.cpp
# End Source File
# Begin Source File
@@ -399,6 +407,10 @@ SOURCE=.\be_include\be_expression.h # End Source File
# Begin Source File
+SOURCE=.\be_include\be_factory.h
+# End Source File
+# Begin Source File
+
SOURCE=.\be_include\be_field.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp index b2339f5b18d..0db8938c969 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_DLL.dsp @@ -146,6 +146,10 @@ SOURCE=.\ast\ast_expression.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_factory.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_field.cpp
# End Source File
# Begin Source File
@@ -254,6 +258,10 @@ SOURCE=.\fe\fe_private.cpp # End Source File
# Begin Source File
+SOURCE=.\fe\fe_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\fe\lex.yy.cpp
# End Source File
# Begin Source File
@@ -378,6 +386,10 @@ SOURCE=.\include\ast_extern.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_factory.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_field.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 26f28fdc764..7af58f7dd53 100644 --- a/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp +++ b/TAO/TAO_IDL/TAO_IDL_FE_LIB.dsp @@ -139,6 +139,10 @@ SOURCE=.\ast\ast_expression.cpp # End Source File
# Begin Source File
+SOURCE=.\ast\ast_factory.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ast\ast_field.cpp
# End Source File
# Begin Source File
@@ -247,6 +251,10 @@ SOURCE=.\fe\fe_private.cpp # End Source File
# Begin Source File
+SOURCE=.\fe\fe_tmplinst.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\fe\lex.yy.cpp
# End Source File
# Begin Source File
@@ -371,6 +379,10 @@ SOURCE=.\include\ast_extern.h # End Source File
# Begin Source File
+SOURCE=.\include\ast_factory.h
+# End Source File
+# Begin Source File
+
SOURCE=.\include\ast_field.h
# End Source File
# Begin Source File
diff --git a/TAO/TAO_IDL/ast/ast_argument.cpp b/TAO/TAO_IDL/ast/ast_argument.cpp index 31829254e15..c1f53cdc18b 100644 --- a/TAO/TAO_IDL/ast/ast_argument.cpp +++ b/TAO/TAO_IDL/ast/ast_argument.cpp @@ -103,15 +103,12 @@ AST_Argument::AST_Argument (void) AST_Argument::AST_Argument (Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Field (AST_Decl::NT_argument, ft, - n, - p), + n), AST_Decl (AST_Decl::NT_argument, - n, - p), + n), pd_direction (d) { } diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp index dbedae746a7..5fee73926d6 100644 --- a/TAO/TAO_IDL/ast/ast_array.cpp +++ b/TAO/TAO_IDL/ast/ast_array.cpp @@ -91,7 +91,6 @@ AST_Array::AST_Array (UTL_ScopedName *n, idl_bool abstract) : AST_Decl (AST_Decl::NT_array, n, - 0, I_TRUE), COMMON_Base (local, abstract), diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp index d2b367704ab..f229ecde2c3 100644 --- a/TAO/TAO_IDL/ast/ast_attribute.cpp +++ b/TAO/TAO_IDL/ast/ast_attribute.cpp @@ -84,17 +84,14 @@ AST_Attribute::AST_Attribute (void) AST_Attribute::AST_Attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Field (AST_Decl::NT_attr, - ft, - n, - p), - AST_Decl (AST_Decl::NT_attr, - n, - p), - COMMON_Base (local, + : AST_Field (AST_Decl::NT_attr, + ft, + n), + AST_Decl (AST_Decl::NT_attr, + n), + COMMON_Base (local, abstract), pd_readonly (ro) { diff --git a/TAO/TAO_IDL/ast/ast_concrete_type.cpp b/TAO/TAO_IDL/ast/ast_concrete_type.cpp index bfb3a2d30ec..75da41444db 100644 --- a/TAO/TAO_IDL/ast/ast_concrete_type.cpp +++ b/TAO/TAO_IDL/ast/ast_concrete_type.cpp @@ -78,11 +78,9 @@ AST_ConcreteType::AST_ConcreteType (void) } AST_ConcreteType::AST_ConcreteType (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Decl (nt, - n, - p) + n) { } diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp index 68f69de3e9b..e4aab6b7f03 100644 --- a/TAO/TAO_IDL/ast/ast_constant.cpp +++ b/TAO/TAO_IDL/ast/ast_constant.cpp @@ -137,29 +137,25 @@ AST_Constant::AST_Constant (void) // Used in constructing AST_EnumVal nodes. AST_Constant::AST_Constant (AST_Expression::ExprType t, - AST_Decl::NodeType nt, - AST_Expression *v, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (nt, - n, - p), - pd_constant_value (idl_global->gen ()->create_expr (v, t)), - pd_et (t), + AST_Decl::NodeType nt, + AST_Expression *v, + UTL_ScopedName *n) + : AST_Decl (nt, + n), + pd_constant_value (idl_global->gen ()->create_expr (v, t)), + pd_et (t), ifr_added_ (0) { } // Used when constructing AST_Constant nodes. AST_Constant::AST_Constant (AST_Expression::ExprType t, - AST_Expression *v, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_const, - n, - p), - pd_constant_value (idl_global->gen ()->create_expr (v, t)), - pd_et (t), + AST_Expression *v, + UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_const, + n), + pd_constant_value (idl_global->gen ()->create_expr (v, t)), + pd_et (t), ifr_added_ (0) { } diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index b3acf6ec605..61c7d35c753 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -69,7 +69,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. * * AST_Decl is the base class for all AST nodes except AST_Expression. * AST_Decls have a node type (a value from the enum AST_Decl::NodeType) - * a name (a UTL_ScopedName) and a list of pragmas (a UTL_StrList). + * and a name (a UTL_ScopedName). * Additionally AST_Decl nodes record the scope of definition, the * file name in which they were defined, the line on which they were * defined in that file, and a boolean denoting whether this is the @@ -119,17 +119,16 @@ AST_Decl::AST_Decl (void) pd_name (0), pd_local_name (0), pd_original_local_name (0), - pd_pragmas (0), pd_added (I_FALSE), full_name_ (0), prefix_ (0), + version_ (0), anonymous_ (I_FALSE) { } AST_Decl::AST_Decl (NodeType nt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool anonymous) : repoID_ (0), pd_imported (idl_global->imported ()), @@ -142,13 +141,25 @@ AST_Decl::AST_Decl (NodeType nt, pd_file_name (idl_global->filename ()), pd_name (0), pd_local_name (n == 0 ? 0 : n->last_component ()->copy ()), - pd_pragmas (p), pd_added (I_FALSE), full_name_ (0), prefix_ (0), + version_ (0), anonymous_ (anonymous) { - compute_full_name (n); + this->compute_full_name (n); + + char *prefix = 0; + idl_global->pragma_prefixes ().top (prefix); + + if (prefix == 0) + { + this->prefix_ = ACE::strnew (""); + } + else + { + this->prefix_ = ACE::strnew (prefix); + } // Keep the name _cxx_ removed, if any. if (n != 0) @@ -232,85 +243,6 @@ AST_Decl::compute_full_name (UTL_ScopedName *n) } } -// Compoute stringified prefix. -void -AST_Decl::compute_prefix (void) -{ - const char* pragma = 0; - - if (this->pragmas () != 0) - { - for (UTL_StrlistActiveIterator i (this->pragmas ()); - !i.is_done (); - i.next ()) - { - const char* s = i.item ()->get_string (); - - if (ACE_OS::strncmp (s, "#pragma prefix", 14) == 0) - { - pragma = s; - } - } - } - - if (pragma != 0) - { - // Get pointers to each end of the substring between the quotes. - const char* start = ACE_OS::strchr (pragma, '"') + 1; - const char* end = ACE_OS::strchr (start, '"'); - - if (end == 0) - { - idl_global->err ()->syntax_error ( - IDL_GlobalData::PS_PragmaPrefixSyntax - ); - this->prefix_ = ACE::strnew (""); - return; - } - - int len = end - start; - - ACE_NEW (this->prefix_, - char[len + 1]); - - ACE_OS::strncpy (this->prefix_, - start, - len); - - this->prefix_[len] = 0; - return; - } - - // Could not find it in the local scope, try to recurse to the top - // scope... - if (this->defined_in () == 0) - { - this->prefix_ = ACE::strnew (""); - } - else - { - UTL_Scope *scope = this->defined_in (); - - if (scope == 0) - { - this->prefix_ = ACE::strnew (""); - } - else - { - AST_Decl *d = ScopeAsDecl (scope); - - if (d != 0) - { - this->prefix_ = ACE::strnew (d->prefix ()); - } - else - { - this->prefix_ = ACE::strnew (""); - } - } - } -} - // Protected operations. // Compute stringified fully scoped name. @@ -420,18 +352,27 @@ AST_Decl::compute_repoID (void) } else { - long namelen = 8; // for the prefix "IDL:" and suffix ":1.0" - UTL_IdListActiveIterator *i = 0; + long namelen = 4; // for the prefix "IDL:" long first = I_TRUE; long second = I_FALSE; // in the first loop compute the total length - namelen += ACE_OS::strlen (this->prefix ()) + 1; + namelen += ACE_OS::strlen (this->prefix_) + 1; - ACE_NEW (i, - UTL_IdListActiveIterator (this->name ())); + if (this->version_ != 0) + { + // Version member string + ':' + namelen += ACE_OS::strlen (this->version_) + 1; + } + else + { + // For ":1.0" + namelen += 4; + } - while (!(i->is_done ())) + UTL_IdListActiveIterator i (this->name ()); + + while (!(i.is_done ())) { if (!first) { @@ -443,11 +384,11 @@ AST_Decl::compute_repoID (void) } // Print the identifier. - namelen += ACE_OS::strlen (i->item ()->get_string ()); + namelen += ACE_OS::strlen (i.item ()->get_string ()); if (first) { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + if (ACE_OS::strcmp (i.item ()->get_string (), "") != 0) { // Does not start with a "". first = I_FALSE; @@ -458,11 +399,9 @@ AST_Decl::compute_repoID (void) } } - i->next (); + i.next (); } - delete i; - ACE_NEW (this->repoID_, char[namelen + 1]); @@ -472,22 +411,21 @@ AST_Decl::compute_repoID (void) "%s", "IDL:"); - ACE_OS::strcat (this->repoID_, - this->prefix ()); + ACE_OS::strcat (this->repoID_, + this->prefix_); // Add the "/" only if there is a prefix. - if (ACE_OS::strcmp (this->prefix (), "") != 0) + if (ACE_OS::strcmp (this->prefix_, "") != 0) { ACE_OS::strcat (this->repoID_, "/"); } - ACE_NEW (i, - UTL_IdListActiveIterator (this->name ())); + UTL_IdListActiveIterator j (this->name ()); first = I_TRUE; second = I_FALSE; - while (!(i->is_done ())) + while (!(j.is_done ())) { if (!first) { @@ -499,11 +437,12 @@ AST_Decl::compute_repoID (void) } // Print the identifier. - ACE_OS::strcat (this->repoID_, i->item ()->get_string ()); + ACE_OS::strcat (this->repoID_, + j.item ()->get_string ()); if (first) { - if (ACE_OS::strcmp (i->item ()->get_string (), "") != 0) + if (ACE_OS::strcmp (j.item ()->get_string (), "") != 0) { // Does not start with a "". first = I_FALSE; @@ -514,12 +453,21 @@ AST_Decl::compute_repoID (void) } } - i->next (); + j.next (); } - delete i; - ACE_OS::strcat (this->repoID_, - ":1.0"); + if (this->version_ != 0) + { + ACE_OS::strcat (this->repoID_, + ":"); + ACE_OS::strcat (this->repoID_, + this->version_); + } + else + { + ACE_OS::strcat (this->repoID_, + ":1.0"); + } } return; @@ -594,26 +542,17 @@ AST_Decl::destroy (void) delete this->pd_original_local_name; this->pd_original_local_name = 0; - if (this->full_name_ != 0) - { - delete [] this->full_name_; - this->full_name_ = 0; - } + delete [] this->full_name_; + this->full_name_ = 0; - if (this->repoID_ != 0) - { - delete [] this->repoID_; - this->repoID_ = 0; - } + delete [] this->repoID_; + this->repoID_ = 0; - if (this->prefix_ != 0) - { - delete [] this->prefix_; - this->prefix_ = 0; - } + delete [] this->prefix_; + this->prefix_ = 0; - // Pragmas will be done in IDL_GlobalData - // because they're not copied. + delete [] this->version_; + this->version_ = 0; } const char * @@ -638,15 +577,81 @@ AST_Decl::repoID (void) return this->repoID_; } +void +AST_Decl::repoID (char *value) +{ + if (this->repoID_ == 0) + { + this->repoID_ = value; + + // Forces version to be set to the last id component. + delete [] this->version_; + this->version_ = 0; + const char *tmp = this->version (); + } + else if (ACE_OS::strcmp (this->repoID_, value) != 0) + { + idl_global->err ()->id_reset_error (this->repoID_, + value); + } +} + const char * AST_Decl::prefix (void) { - if (this->prefix_ == 0) + return this->prefix_; +} + +void +AST_Decl::prefix (char *value) +{ + this->prefix_ = value; +} + +const char * +AST_Decl::version (void) +{ + if (this->version_ == 0) { - this->compute_prefix (); + // Calling the method will compute if necessary. + const char *repo_id = this->repoID (); + + // All forms of repo id should contain two colons, the + // version coming after the second one. + const char *tail1 = 0; + const char *tail2 = 0; + + if (repo_id != 0) + { + tail1 = ACE_OS::strchr (repo_id, + ':'); + } + + if (tail1 != 0) + { + tail2 = ACE_OS::strchr (tail1 + 1, + ':'); + } + + this->version_ = (tail2 == 0) ? ACE::strnew ("1.0") + : ACE::strnew (tail2 + 1); } - return this->prefix_; + return this->version_; +} + +void +AST_Decl::version (char *value) +{ + // Previous #pragma version or #pragma id make this illegal. + if (this->version_ == 0 && this->repoID_ == 0) + { + this->version_ = value; + } + else + { + idl_global->err ()->version_reset_error (); + } } idl_bool @@ -897,34 +902,6 @@ AST_Decl::original_local_name (void) return this->pd_original_local_name; } -void -AST_Decl::add_pragmas (UTL_StrList *p) -{ - if (p != 0) - { - if (this->pd_pragmas != 0) - { - this->pd_pragmas->nconc (p); - } - else - { - this->pd_pragmas = p; - } - } -} - -UTL_StrList * -AST_Decl::pragmas (void) -{ - return this->pd_pragmas; -} - -void -AST_Decl:: pragmas (UTL_StrList *p) -{ - this->pd_pragmas = p; -} - //Narrowing methods for AST_Decl. IMPL_NARROW_METHODS0(AST_Decl) IMPL_NARROW_FROM_DECL(AST_Decl) diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp index 7ce13d55804..4181d8d5d1a 100644 --- a/TAO/TAO_IDL/ast/ast_enum.cpp +++ b/TAO/TAO_IDL/ast/ast_enum.cpp @@ -78,14 +78,12 @@ AST_Enum::AST_Enum (void) } AST_Enum::AST_Enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (AST_Decl::NT_enum, - n, - p), - UTL_Scope (AST_Decl::NT_enum), - COMMON_Base (local, + : AST_Decl (AST_Decl::NT_enum, + n), + UTL_Scope (AST_Decl::NT_enum), + COMMON_Base (local, abstract), pd_enum_counter (0), member_count_ (-1) @@ -262,8 +260,7 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t) t->constant_value ()->coerce (AST_Expression::EV_ulong)->u.ulval; t1 = idl_global->gen ()->create_enum_val (tmp, - t->name (), - t->pragmas ()); + t->name ()); t->set_name (munge_name_for_enumval (t->name (), t->local_name ())); diff --git a/TAO/TAO_IDL/ast/ast_enum_val.cpp b/TAO/TAO_IDL/ast/ast_enum_val.cpp index 2243a37cbb6..7489c9b66ac 100644 --- a/TAO/TAO_IDL/ast/ast_enum_val.cpp +++ b/TAO/TAO_IDL/ast/ast_enum_val.cpp @@ -78,17 +78,14 @@ AST_EnumVal::AST_EnumVal (void) { } -AST_EnumVal::AST_EnumVal (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p) +AST_EnumVal::AST_EnumVal (unsigned long v, + UTL_ScopedName *n) : AST_Constant (AST_Expression::EV_ulong, - AST_Decl::NT_enum_val, - new AST_Expression (v), - n, - p), - AST_Decl (AST_Decl::NT_enum_val, - n, - p) + AST_Decl::NT_enum_val, + new AST_Expression (v), + n), + AST_Decl (AST_Decl::NT_enum_val, + n) { } diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp index eb5f18a04e2..27c04286cb8 100644 --- a/TAO/TAO_IDL/ast/ast_exception.cpp +++ b/TAO/TAO_IDL/ast/ast_exception.cpp @@ -79,19 +79,16 @@ AST_Exception::AST_Exception (void) } AST_Exception::AST_Exception(UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Structure (AST_Decl::NT_except, - n, - p, - local, + : AST_Structure (AST_Decl::NT_except, + n, + local, abstract), UTL_Scope (AST_Decl::NT_except), - AST_Decl (AST_Decl::NT_except, - n, - p), - COMMON_Base (local, + AST_Decl (AST_Decl::NT_except, + n), + COMMON_Base (local, abstract) { } diff --git a/TAO/TAO_IDL/ast/ast_factory.cpp b/TAO/TAO_IDL/ast/ast_factory.cpp new file mode 100644 index 00000000000..53567ff97d3 --- /dev/null +++ b/TAO/TAO_IDL/ast/ast_factory.cpp @@ -0,0 +1,260 @@ +// $Id$ + +/* + +COPYRIGHT + +Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United +States of America. All Rights Reserved. + +This product is protected by copyright and distributed under the following +license restricting its use. + +The Interface Definition Language Compiler Front End (CFE) is made +available for your use provided that you include this license and copyright +notice on all media and documentation and the software program in which +this product is incorporated in whole or part. You may copy and extend +functionality (but may not remove functionality) of the Interface +Definition Language CFE without charge, but you are not authorized to +license or distribute it to anyone else except as part of a product or +program developed by you or with the express written consent of Sun +Microsystems, Inc. ("Sun"). + +The names of Sun Microsystems, Inc. and any of its subsidiaries or +affiliates may not be used in advertising or publicity pertaining to +distribution of Interface Definition Language CFE as permitted herein. + +This license is effective until terminated by Sun for failure to comply +with this license. Upon termination, you shall destroy or return all code +and documentation for the Interface Definition Language CFE. + +INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF +ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS +FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF +DEALING, USAGE OR TRADE PRACTICE. + +INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT +ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES +TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT. + +SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH +RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY +INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF. + +IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR +ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL +DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +Use, duplication, or disclosure by the government is subject to +restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in +Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR +52.227-19. + +Sun, Sun Microsystems and the Sun logo are trademarks or registered +trademarks of Sun Microsystems, Inc. + +SunSoft, Inc. +2550 Garcia Avenue +Mountain View, California 94043 + +NOTE: + +SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are +trademarks or registered trademarks of Sun Microsystems, Inc. + +*/ + +// AST_Factory nodes denote OBV factory construct declarations +// AST_Factory is a subclass of AST_Decl (it is not a type!) +// and of UTL_Scope (the arguments are managed in a scope). + +#include "idl.h" +#include "idl_extern.h" + +ACE_RCSID(ast, ast_factory, "$Id$") + +// Constructor(s) and destructor. + +AST_Factory::AST_Factory (void) + : argument_count_ (-1), + has_native_ (0) +{ +} + +AST_Factory::AST_Factory (UTL_ScopedName *n) + : AST_Decl(AST_Decl::NT_factory, + n), + UTL_Scope(AST_Decl::NT_factory), + COMMON_Base (1, + 0), //@@ Always local, never abstract + argument_count_ (-1), + has_native_ (0) +{ +} + +AST_Factory::~AST_Factory (void) +{ +} + +// Public operations. + +// Return the member count. +int +AST_Factory::argument_count (void) +{ + this->compute_argument_attr (); + + return this->argument_count_; +} + +// Return if any argument or the return type is a <native> type. +int +AST_Factory::has_native (void) +{ + this->compute_argument_attr (); + + return this->has_native_; +} + +void +AST_Factory::destroy (void) +{ +} + +// Private operations. + +// Compute total number of members. +int +AST_Factory::compute_argument_attr (void) +{ + if (this->argument_count_ != -1) + { + return 0; + } + + AST_Decl *d = 0; + AST_Type *type = 0; + AST_Argument *arg = 0; + + this->argument_count_ = 0; + + // If there are elements in this scope. + if (this->nmembers () > 0) + { + // Instantiate a scope iterator. + UTL_ScopeActiveIterator si (this, + UTL_Scope::IK_decls); + + while (!si.is_done ()) + { + // Get the next AST decl node. + d = si.item (); + + if (d->node_type () == AST_Decl::NT_argument) + { + this->argument_count_++; + + arg = AST_Argument::narrow_from_decl (d); + + type = AST_Type::narrow_from_decl (arg->field_type ()); + + if (type->node_type () == AST_Decl::NT_native) + { + this->has_native_ = 1; + } + } + + si.next (); + } + } + + return 0; +} + +// Add this AST_Argument node (an factory argument declaration) +// to this scope. +AST_Argument * +AST_Factory::fe_add_argument (AST_Argument *t) +{ + AST_Decl *d = 0; + + // Already defined and cannot be redefined? Or already used? + if ((d = lookup_by_name_local (t->local_name(), 0)) != 0) + { + 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; + } + + if (t->has_ancestor (d)) + { + idl_global->err ()->redefinition_in_scope (t, + 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 ()); + + return t; +} + +// Dump this AST_Factory node (an OBV factory construct) to the ostream o. +void +AST_Factory::dump (ostream &o) +{ + AST_Decl *d = 0; + UTL_ScopeActiveIterator i (this, + IK_decls); + + o << "factory "; + this->local_name ()->dump (o); + o << "("; + + while (!i.is_done()) + { + d = i.item (); + d->dump (o); + i.next (); + + if (!i.is_done()) + { + o << ", "; + } + } + + o << ")"; + +} + +int +AST_Factory::ast_accept (ast_visitor *visitor) +{ + return visitor->visit_factory (this); +} + +// Data accessors + +// Narrowing. +IMPL_NARROW_METHODS2(AST_Factory, AST_Decl, UTL_Scope) +IMPL_NARROW_FROM_DECL(AST_Factory) +IMPL_NARROW_FROM_SCOPE(AST_Factory) diff --git a/TAO/TAO_IDL/ast/ast_field.cpp b/TAO/TAO_IDL/ast/ast_field.cpp index 8d016f8b2a1..7904d773c44 100644 --- a/TAO/TAO_IDL/ast/ast_field.cpp +++ b/TAO/TAO_IDL/ast/ast_field.cpp @@ -89,14 +89,12 @@ AST_Field::AST_Field (void) } // To be used when constructing an AST_Field node. -AST_Field::AST_Field (AST_Type *ft, +AST_Field::AST_Field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, Visibility vis) - : AST_Decl (AST_Decl::NT_field, - n, - p), - pd_field_type (ft), + : AST_Decl (AST_Decl::NT_field, + n), + pd_field_type (ft), pd_visibility (vis) { } @@ -104,13 +102,11 @@ AST_Field::AST_Field (AST_Type *ft, // To be used when constructing a node of a subclass of AST_Field. AST_Field::AST_Field (AST_Decl::NodeType nt, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p, + UTL_ScopedName *n, Visibility vis) - : AST_Decl (nt, - n, - p), - pd_field_type (ft), + : AST_Decl (nt, + n), + pd_field_type (ft), pd_visibility (vis) { } diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp index e38a44f193b..832920820c0 100644 --- a/TAO/TAO_IDL/ast/ast_generator.cpp +++ b/TAO/TAO_IDL/ast/ast_generator.cpp @@ -82,14 +82,12 @@ ACE_RCSID(ast, ast_generator, "$Id$") // Construct an AST_PredefinedType node (a predefined type). AST_PredefinedType * AST_Generator::create_predefined_type (AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_PredefinedType *retval = 0; ACE_NEW_RETURN (retval, AST_PredefinedType (t, - n, - p), + n), 0); return retval; @@ -98,16 +96,14 @@ AST_Generator::create_predefined_type (AST_PredefinedType::PredefinedType t, // Construct an AST_Module node (a module). AST_Module * AST_Generator::create_module (UTL_Scope *s, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { // We create this first so if we find a module with the // same name from an included file, we can add its // members to the new module's scope. AST_Module *retval = 0; ACE_NEW_RETURN (retval, - AST_Module (n, - p), + AST_Module (n), 0); AST_Decl *d = 0; @@ -177,13 +173,11 @@ AST_Generator::create_module (UTL_Scope *s, // Construct an AST_Root node (a node representing the root of an AST). AST_Root * -AST_Generator::create_root (UTL_ScopedName *n, - UTL_StrList *p) +AST_Generator::create_root (UTL_ScopedName *n) { AST_Root *retval = 0; ACE_NEW_RETURN (retval, - AST_Root (n, - p), + AST_Root (n), 0); return retval; @@ -196,7 +190,6 @@ AST_Generator::create_interface (UTL_ScopedName *n, long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool l, idl_bool a) { @@ -207,7 +200,6 @@ AST_Generator::create_interface (UTL_ScopedName *n, nih, ih_flat, nih_flat, - p, l, a), 0); @@ -219,7 +211,6 @@ AST_Generator::create_interface (UTL_ScopedName *n, // declaration of an interface). AST_InterfaceFwd * AST_Generator::create_interface_fwd (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -230,11 +221,9 @@ AST_Generator::create_interface_fwd (UTL_ScopedName *n, -1, 0, 0, - p, local, abstract), - n, - p), + n), 0); return retval; @@ -244,18 +233,15 @@ AST_Generator::create_interface_fwd (UTL_ScopedName *n, AST_Interface * AST_Generator::create_valuetype (UTL_ScopedName *n, AST_Interface **ih, - long nih, - UTL_StrList *p) + long nih) { -#ifdef IDL_HAS_VALUETYPE AST_Interface *retval = 0; ACE_NEW_RETURN (retval, AST_Interface (n, ih, nih, 0, - 0, - p, + 0, 0, 0), 0); @@ -276,55 +262,39 @@ AST_Generator::create_valuetype (UTL_ScopedName *n, } return retval; -#else - ACE_ERROR_RETURN ((LM_ERROR, - "Valuetype support not enabled\n"), - 0); -#endif /* IDL_HAS_VALUETYPE */ } // Create an AST_InterfaceFwd node whose full_definition // member is a valuetype. AST_InterfaceFwd * -AST_Generator::create_valuetype_fwd (UTL_ScopedName *n, - UTL_StrList *p) +AST_Generator::create_valuetype_fwd (UTL_ScopedName *n) { // See note in create_valuetype(). // Dummy placeholder must return true from is_valuetype(). -#ifdef IDL_HAS_VALUETYPE AST_Interface *dummy = this->create_valuetype (n, 0, - -1, - p); + -1); AST_InterfaceFwd *retval = 0; ACE_NEW_RETURN (retval, AST_InterfaceFwd (dummy, - n, - p), + n), 0); return retval; -#else - ACE_ERROR_RETURN ((LM_ERROR, - "Valuetype support not enabled\n"), - 0); -#endif /* IDL_HAS_VALUETYPE */ } // Construct an AST_Exception node (an exception). AST_Exception * AST_Generator::create_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { AST_Exception *retval = 0; ACE_NEW_RETURN (retval, AST_Exception (n, - p, local, abstract), 0); @@ -335,14 +305,12 @@ AST_Generator::create_exception (UTL_ScopedName *n, // Construct an AST_Structure node (a struct). AST_Structure * AST_Generator::create_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { AST_Structure *retval = 0; ACE_NEW_RETURN (retval, AST_Structure (n, - p, local, abstract), 0); @@ -353,14 +321,12 @@ AST_Generator::create_structure (UTL_ScopedName *n, // Construct an AST_Enum node (an enum). AST_Enum * AST_Generator::create_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { AST_Enum *retval = 0; ACE_NEW_RETURN (retval, AST_Enum (n, - p, local, abstract), 0); @@ -373,7 +339,6 @@ AST_Operation * AST_Generator::create_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -382,7 +347,6 @@ AST_Generator::create_operation (AST_Type *rt, AST_Operation (rt, fl, n, - p, local, abstract), 0); @@ -394,14 +358,12 @@ AST_Generator::create_operation (AST_Type *rt, AST_Field * AST_Generator::create_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, AST_Field::Visibility vis) { AST_Field *retval = 0; ACE_NEW_RETURN (retval, AST_Field (ft, n, - p, vis), 0); @@ -412,15 +374,13 @@ AST_Generator::create_field (AST_Type *ft, AST_Argument * AST_Generator::create_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_Argument *retval = 0; ACE_NEW_RETURN (retval, AST_Argument (d, ft, - n, - p), + n), 0); return retval; @@ -431,7 +391,6 @@ AST_Attribute * AST_Generator::create_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -440,7 +399,6 @@ AST_Generator::create_attribute (idl_bool ro, AST_Attribute (ro, ft, n, - p, local, abstract), 0); @@ -452,7 +410,6 @@ AST_Generator::create_attribute (idl_bool ro, AST_Union * AST_Generator::create_union (AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -460,7 +417,6 @@ AST_Generator::create_union (AST_ConcreteType *dt, ACE_NEW_RETURN (retval, AST_Union (dt, n, - p, local, abstract), 0); @@ -472,15 +428,13 @@ AST_Generator::create_union (AST_ConcreteType *dt, AST_UnionBranch * AST_Generator::create_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_UnionBranch *retval = 0; ACE_NEW_RETURN (retval, AST_UnionBranch (ll, ft, - n, - p), + n), 0); return retval; @@ -504,15 +458,13 @@ AST_Generator::create_union_label (AST_UnionLabel::UnionLabel ul, AST_Constant * AST_Generator::create_constant (AST_Expression::ExprType et, AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_Constant *retval = 0; ACE_NEW_RETURN (retval, AST_Constant (et, ev, - n, - p), + n), 0); return retval; @@ -664,14 +616,12 @@ AST_Generator::create_expr (double d) // Construct an AST_EnumVal node (an enumerator). AST_EnumVal * AST_Generator::create_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_EnumVal *retval = 0; ACE_NEW_RETURN (retval, AST_EnumVal (v, - n, - p), + n), 0); return retval; @@ -744,7 +694,6 @@ AST_Generator::create_wstring (AST_Expression *ms) AST_Typedef * AST_Generator::create_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -752,7 +701,6 @@ AST_Generator::create_typedef (AST_Type *bt, ACE_NEW_RETURN (retval, AST_Typedef (bt, n, - p, local, abstract), 0); @@ -762,15 +710,23 @@ AST_Generator::create_typedef (AST_Type *bt, // Construct an AST_Native node. AST_Native * -AST_Generator::create_native (UTL_ScopedName *n, - UTL_StrList *p) +AST_Generator::create_native (UTL_ScopedName *n) { AST_Native *retval = 0; ACE_NEW_RETURN (retval, - AST_Native (n, - p), + AST_Native (n), 0); return retval; } +AST_Factory * +AST_Generator::create_factory (UTL_ScopedName *n) +{ + AST_Factory *retval = 0; + ACE_NEW_RETURN (retval, + AST_Factory (n), + 0); + + return retval; +} diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp index 0f545d8a55f..c549987dc23 100644 --- a/TAO/TAO_IDL/ast/ast_interface.cpp +++ b/TAO/TAO_IDL/ast/ast_interface.cpp @@ -92,12 +92,10 @@ AST_Interface::AST_Interface(UTL_ScopedName *n, long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (AST_Decl::NT_interface, - n, - p), + : AST_Decl (AST_Decl::NT_interface, + n), UTL_Scope (AST_Decl::NT_interface), COMMON_Base (local, abstract), @@ -328,7 +326,6 @@ AST_Interface::fe_add_attribute (AST_Attribute *t) AST_Field * AST_Interface::fe_add_field (AST_Field *t) { -#ifdef IDL_HAS_VALUETYPE AST_Decl *d = 0; // Already defined and cannot be redefined? Or already used? @@ -369,11 +366,6 @@ AST_Interface::fe_add_field (AST_Field *t) t->local_name ()); return t; - -#else /* IDL_HAS_VALUETYPE */ - ACE_ASSERT (0); - return 0; -#endif /* IDL_HAS_VALUETYPE */ } // Add an AST_Operation node (an operation declaration) to this scope. @@ -764,6 +756,60 @@ AST_Interface::fe_add_native (AST_Native *t) return t; } +AST_Factory * +AST_Interface::fe_add_factory (AST_Factory *f) +{ + AST_Decl *d = 0; + + // Can't add to interface which was not yet defined. + if (!this->is_defined ()) + { + idl_global->err ()->error2 (UTL_Error::EIDL_DECL_NOT_DEFINED, + this, + f); + return 0; + } + + // Already defined and cannot be redefined? Or already used? + if ((d = this->lookup_for_add (f, I_FALSE)) != 0) + { + if (!can_be_redefined (d)) + { + idl_global->err ()->error3 (UTL_Error::EIDL_REDEF, + f, + this, + d); + return 0; + } + + if (this->referenced (d, f->local_name ())) + { + idl_global->err ()->error3 (UTL_Error::EIDL_DEF_USE, + f, + this, + d); + return 0; + } + + if (f->has_ancestor (d)) + { + idl_global->err ()->redefinition_in_scope (f, + d); + return 0; + } + } + + // Add it to scope. + this->add_to_scope (f); + + // Add it to set of locally referenced symbols. + this->add_to_referenced (f, + I_FALSE, + f->local_name ()); + + return f; +} + // Dump this AST_Interface node to the ostream o. void AST_Interface::dump (ACE_OSTREAM_TYPE &o) @@ -817,8 +863,7 @@ AST_Interface::dump (ACE_OSTREAM_TYPE &o) void AST_Interface::fwd_redefinition_helper (AST_Interface *&i, - UTL_Scope *s, - UTL_StrList *p) + UTL_Scope *s) { if (i == 0) { @@ -834,6 +879,15 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, if (d != 0) { + // Full definition must have the same prefix as the forward declaration. + if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0) + { + idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT, + i); + + return; + } + // If this interface has been forward declared in a previous opening // of the module it's defined in, the lookup will find the // forward declaration. @@ -875,12 +929,10 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, { // Only redefinition of the same kind. if (i->is_local () != fd->is_local () -# ifdef IDL_HAS_VALUETYPE || i->is_valuetype () != fd->is_valuetype () || i->is_abstract_valuetype () != fd->is_abstract_valuetype () || i->is_abstract () != fd->is_abstract () -# endif /* IDL_HAS_VALUETYPE */ ) { idl_global->err ()->error2 (UTL_Error::EIDL_REDEF, @@ -889,8 +941,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, return; } - fd->redefine (i, - p); + fd->redefine (i); // Use full definition node. delete i; @@ -903,8 +954,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i, // Data accessors. void -AST_Interface::redefine (AST_Interface *from, - UTL_StrList *p) +AST_Interface::redefine (AST_Interface *from) { // 'this' is the full_definition member of a forward // declared interface. 'from' is the actual full @@ -916,26 +966,8 @@ AST_Interface::redefine (AST_Interface *from, this->set_inherits_flat (from->inherits_flat ()); this->set_n_inherits_flat (from->n_inherits_flat ()); - // If we were forward declared in another file, then forward - // declared in this file, then fully defined, there's a - // possibility of a cycle in the list of pragma strings. We - // want only those pragmas associated with the full definition - // anyway, so we just replace the list in this case. - if (this->imported ()) - { - this->pragmas (p); - } - else - { - // If we are being defined from a forward declaration in - // the same scope (i.e., the same opening of the enclosing - // module), the two pragma lists will share the same pointer. - // In this case, addition would lead to infinite recursion. - if (this->pragmas () != p) - { - this->add_pragmas (p); - } - } + // We've already checked for inconsistent prefixes. + this->prefix (ACE::strnew (from->prefix ())); this->set_defined_in (from->defined_in ()); this->set_imported (idl_global->imported ()); diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp index 141e70b6e89..acfa38aa60b 100644 --- a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp +++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp @@ -81,11 +81,9 @@ AST_InterfaceFwd::AST_InterfaceFwd (void) } AST_InterfaceFwd::AST_InterfaceFwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_interface_fwd, - n, - p) + UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_interface_fwd, + n) { // Create a dummy placeholder for the forward declared interface. This // interface node is not yet defined (n_inherits < 0), so some operations @@ -181,6 +179,12 @@ AST_InterfaceFwd::set_full_definition (AST_Interface *nfd) this->pd_full_definition = nfd; } +idl_bool +AST_InterfaceFwd::is_defined (void) +{ + return this->pd_full_definition->is_defined (); +} + // 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 56d29feb99e..1a66956b33f 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -81,11 +81,9 @@ AST_Module::AST_Module () { } -AST_Module::AST_Module (UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_module, - n, - p), +AST_Module::AST_Module (UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_module, + n), UTL_Scope (AST_Decl::NT_module), pd_has_nested_valuetype (0) { @@ -813,8 +811,7 @@ AST_Module::add_CORBA_members (void) AST_PredefinedType *pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - sn, - 0 + sn ); this->fe_add_predefined_type (pdt); @@ -829,8 +826,7 @@ AST_Module::add_CORBA_members (void) pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - sn, - 0 + sn ); this->fe_add_predefined_type (pdt); @@ -930,16 +926,3 @@ IMPL_NARROW_METHODS2(AST_Module, AST_Decl, UTL_Scope) IMPL_NARROW_FROM_DECL(AST_Module) IMPL_NARROW_FROM_SCOPE(AST_Module) -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Node<AST_Decl *>; -template class ACE_Unbounded_Set<AST_Decl *>; -template class ACE_Unbounded_Set_Iterator<AST_Decl *>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Node<AST_Decl *> -#pragma instantiate ACE_Unbounded_Set<AST_Decl *> -#pragma instantiate ACE_Unbounded_Set_Iterator<AST_Decl *> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/ast/ast_native.cpp b/TAO/TAO_IDL/ast/ast_native.cpp index a98b3d58fd4..89032f1de31 100644 --- a/TAO/TAO_IDL/ast/ast_native.cpp +++ b/TAO/TAO_IDL/ast/ast_native.cpp @@ -14,11 +14,9 @@ AST_Native::AST_Native (void) { } -AST_Native::AST_Native(UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_native, - n, - p) +AST_Native::AST_Native(UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_native, + n) { } diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp index ecbbd824e15..f66f59d05d9 100644 --- a/TAO/TAO_IDL/ast/ast_operation.cpp +++ b/TAO/TAO_IDL/ast/ast_operation.cpp @@ -94,12 +94,10 @@ AST_Operation::AST_Operation (void) AST_Operation::AST_Operation (AST_Type *rt, Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl(AST_Decl::NT_op, - n, - p), + : AST_Decl(AST_Decl::NT_op, + n), UTL_Scope(AST_Decl::NT_op), COMMON_Base (local, abstract), diff --git a/TAO/TAO_IDL/ast/ast_predefined_type.cpp b/TAO/TAO_IDL/ast/ast_predefined_type.cpp index 2e192565aae..2d21884e054 100644 --- a/TAO/TAO_IDL/ast/ast_predefined_type.cpp +++ b/TAO/TAO_IDL/ast/ast_predefined_type.cpp @@ -82,12 +82,10 @@ AST_PredefinedType::AST_PredefinedType (void) { } -AST_PredefinedType::AST_PredefinedType (PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_pre_defined, +AST_PredefinedType::AST_PredefinedType (PredefinedType t, + UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_pre_defined, n, - p, I_TRUE), pd_pt (t) { diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp index 943d507e64e..c018ab97118 100644 --- a/TAO/TAO_IDL/ast/ast_redef.cpp +++ b/TAO/TAO_IDL/ast/ast_redef.cpp @@ -98,6 +98,7 @@ can_be_redefined (AST_Decl *d) case AST_Decl::NT_attr: case AST_Decl::NT_op: case AST_Decl::NT_pre_defined: + case AST_Decl::NT_factory: default: return I_FALSE; } diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp index d073adbbef5..1b08ab56cdf 100644 --- a/TAO/TAO_IDL/ast/ast_root.cpp +++ b/TAO/TAO_IDL/ast/ast_root.cpp @@ -79,12 +79,10 @@ AST_Root::AST_Root (void) { } -AST_Root::AST_Root (UTL_ScopedName *n, - UTL_StrList *p) - : AST_Decl (AST_Decl::NT_module, - n, - p), - UTL_Scope (AST_Decl::NT_module) +AST_Root::AST_Root (UTL_ScopedName *n) + : AST_Decl (AST_Decl::NT_module, + n), + UTL_Scope (AST_Decl::NT_module) { } diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp index c90257f0435..6f0baadb99f 100644 --- a/TAO/TAO_IDL/ast/ast_sequence.cpp +++ b/TAO/TAO_IDL/ast/ast_sequence.cpp @@ -78,7 +78,7 @@ ACE_RCSID(ast, ast_sequence, "$Id$") // Constructor(s) and destructor. AST_Sequence::AST_Sequence (void) : pd_max_size (0), - pd_base_type (0) + pd_base_type (0) { } @@ -89,7 +89,6 @@ AST_Sequence::AST_Sequence (AST_Expression *ms, : AST_Decl(AST_Decl::NT_sequence, new UTL_ScopedName (new Identifier ("sequence"), 0), - 0, I_TRUE), COMMON_Base (bt->is_local () || local, abstract), diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp index cab0a2ad70d..d9ee786d29d 100644 --- a/TAO/TAO_IDL/ast/ast_string.cpp +++ b/TAO/TAO_IDL/ast/ast_string.cpp @@ -84,7 +84,6 @@ AST_String::AST_String (AST_Expression *ms) : AST_Decl (AST_Decl::NT_string, new UTL_ScopedName (new Identifier ("string"), 0), - 0, I_TRUE), pd_max_size (ms), pd_width (sizeof (char)) @@ -101,7 +100,6 @@ AST_String::AST_String (AST_Expression *ms, new Identifier ((wide == (long) sizeof (char)) ? "string" : "wstring"), 0 ), - 0, I_TRUE ), pd_max_size (ms), diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp index 8c354f72204..8292258397f 100644 --- a/TAO/TAO_IDL/ast/ast_structure.cpp +++ b/TAO/TAO_IDL/ast/ast_structure.cpp @@ -81,12 +81,10 @@ AST_Structure::AST_Structure (void) } AST_Structure::AST_Structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (AST_Decl::NT_struct, - n, - p), + : AST_Decl (AST_Decl::NT_struct, + n), UTL_Scope (AST_Decl::NT_struct), COMMON_Base (local, abstract), @@ -97,12 +95,10 @@ AST_Structure::AST_Structure (UTL_ScopedName *n, AST_Structure::AST_Structure (AST_Decl::NodeType nt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (nt, - n, - p), + : AST_Decl (nt, + n), UTL_Scope (nt), COMMON_Base (local, abstract), @@ -546,16 +542,3 @@ IMPL_NARROW_METHODS2(AST_Structure, AST_ConcreteType, UTL_Scope) IMPL_NARROW_FROM_DECL(AST_Structure) IMPL_NARROW_FROM_SCOPE(AST_Structure) -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Node<AST_Field *>; -template class ACE_Unbounded_Queue<AST_Field *>; -template class ACE_Unbounded_Queue_Iterator<AST_Field *>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Node<AST_Decl *> -#pragma instantiate ACE_Unbounded_Queue<AST_Decl *> -#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Decl *> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/ast/ast_type.cpp b/TAO/TAO_IDL/ast/ast_type.cpp index 59aeb18bee6..20a1383f9d8 100644 --- a/TAO/TAO_IDL/ast/ast_type.cpp +++ b/TAO/TAO_IDL/ast/ast_type.cpp @@ -80,11 +80,9 @@ AST_Type::AST_Type (void) } AST_Type::AST_Type (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Decl (nt, - n, - p), + n), ifr_added_ (0), ifr_fwd_added_ (0) { @@ -103,6 +101,14 @@ AST_Type::in_recursion (AST_Type *) return 0; } +idl_bool +AST_Type::is_defined (void) +{ + // AST_Interface, AST_Structure, and AST_Union will + // override this, as will AST_InterfaceFwd, etc. + return 1; +} + idl_bool AST_Type::ifr_added (void) { diff --git a/TAO/TAO_IDL/ast/ast_typedef.cpp b/TAO/TAO_IDL/ast/ast_typedef.cpp index 0c3775270b0..7003476579a 100644 --- a/TAO/TAO_IDL/ast/ast_typedef.cpp +++ b/TAO/TAO_IDL/ast/ast_typedef.cpp @@ -1,4 +1,4 @@ -// $Id$ +/ $Id$ /* @@ -83,13 +83,11 @@ AST_Typedef::AST_Typedef (void) AST_Typedef::AST_Typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (AST_Decl::NT_typedef, - n, - p), - COMMON_Base (bt->is_local () || local, + : AST_Decl (AST_Decl::NT_typedef, + n), + COMMON_Base (bt->is_local () || local, abstract), pd_base_type (bt) { diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp index 4fa62ef8fb8..16b6ee564b7 100644 --- a/TAO/TAO_IDL/ast/ast_union.cpp +++ b/TAO/TAO_IDL/ast/ast_union.cpp @@ -85,12 +85,10 @@ AST_Union::AST_Union (void) AST_Union::AST_Union (AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Decl (AST_Decl::NT_union, - n, - p), + : AST_Decl (AST_Decl::NT_union, + n), UTL_Scope (AST_Decl::NT_union), COMMON_Base (local, abstract), diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp index a11bf95bc8e..53aba9bb907 100644 --- a/TAO/TAO_IDL/ast/ast_union_branch.cpp +++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp @@ -82,16 +82,13 @@ AST_UnionBranch::AST_UnionBranch (void) AST_UnionBranch::AST_UnionBranch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Field (AST_Decl::NT_union_branch, - ft, - n, - p), - AST_Decl (AST_Decl::NT_union_branch, - n, - p), - pd_ll (ll) + UTL_ScopedName *n) + : AST_Field (AST_Decl::NT_union_branch, + ft, + n), + AST_Decl (AST_Decl::NT_union_branch, + n), + pd_ll (ll) { } diff --git a/TAO/TAO_IDL/be/Makefile.am b/TAO/TAO_IDL/be/Makefile.am index 48c819054d1..39e7c1f3b71 100644 --- a/TAO/TAO_IDL/be/Makefile.am +++ b/TAO/TAO_IDL/be/Makefile.am @@ -82,7 +82,8 @@ libbe_la_SOURCES = \ be_visitor_union.cpp \ be_visitor_union_branch.cpp \ be_visitor_valuetype.cpp \ - be_visitor_valuetype_fwd.cpp + be_visitor_valuetype_fwd.cpp \ + tmplinst.cpp dist-hook: diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp index 0cadc03fefc..0030e0882ce 100644 --- a/TAO/TAO_IDL/be/be_argument.cpp +++ b/TAO/TAO_IDL/be/be_argument.cpp @@ -31,19 +31,15 @@ be_argument::be_argument (void) be_argument::be_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Argument (d, ft, - n, - p), + n), AST_Field (AST_Decl::NT_argument, ft, - n, - p), + n), AST_Decl (AST_Decl::NT_argument, - n, - p) + n) { } diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp index 04a32cf5e51..4771a00999d 100644 --- a/TAO/TAO_IDL/be/be_array.cpp +++ b/TAO/TAO_IDL/be/be_array.cpp @@ -42,7 +42,6 @@ be_array::be_array (UTL_ScopedName *n, abstract), AST_Decl (AST_Decl::NT_array, n, - 0, I_TRUE), COMMON_Base (local, abstract), diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp index 7aa6986a4c8..b7bde916774 100644 --- a/TAO/TAO_IDL/be/be_attribute.cpp +++ b/TAO/TAO_IDL/be/be_attribute.cpp @@ -41,22 +41,18 @@ be_attribute::be_attribute (void) be_attribute::be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Attribute (ro, ft, n, - p, local, abstract), AST_Field (AST_Decl::NT_attr, ft, - n, - p), + n), AST_Decl (AST_Decl::NT_attr, - n, - p), + n), COMMON_Base (local, abstract) { diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 05ce50c41d8..7d072ad5590 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -1286,10 +1286,3 @@ TAO_CodeGen::gen_standard_include (TAO_OutStream *stream, << end_delimiter << "\n"; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp index 23b5a9759d0..74db9dcea4d 100644 --- a/TAO/TAO_IDL/be/be_constant.cpp +++ b/TAO/TAO_IDL/be/be_constant.cpp @@ -32,15 +32,12 @@ be_constant::be_constant (void) be_constant::be_constant (AST_Expression::ExprType et, AST_Expression *v, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Constant (et, v, - n, - p), + n), AST_Decl (AST_Decl::NT_const, - n, - p) + n) { this->size_type (be_decl::FIXED); } diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index f191d095623..4616f4c9dd9 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -49,11 +49,9 @@ be_decl::be_decl (void) // Constructor be_decl::be_decl (AST_Decl::NodeType type, - UTL_ScopedName *n, - UTL_StrList *pragmas) + UTL_ScopedName *n) : AST_Decl (type, - n, - pragmas), + n), cli_hdr_gen_ (I_FALSE), cli_stub_gen_ (I_FALSE), cli_inline_gen_ (I_FALSE), @@ -583,6 +581,8 @@ be_decl::scope (void) return be_enum::narrow_from_decl (d); case AST_Decl::NT_op: return be_operation::narrow_from_decl (d); + case AST_Decl::NT_factory: + return be_factory::narrow_from_decl (d); case AST_Decl::NT_sequence: return be_sequence::narrow_from_decl (d); default: diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp index 19713ec8fce..61a761908f8 100644 --- a/TAO/TAO_IDL/be/be_enum.cpp +++ b/TAO/TAO_IDL/be/be_enum.cpp @@ -31,16 +31,13 @@ be_enum::be_enum (void) } be_enum::be_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Enum (n, - p, local, abstract), AST_Decl (AST_Decl::NT_enum, - n, - p), + n), UTL_Scope (AST_Decl::NT_enum), COMMON_Base (local, abstract) diff --git a/TAO/TAO_IDL/be/be_enum_val.cpp b/TAO/TAO_IDL/be/be_enum_val.cpp index 34bdaab781d..467182d36b8 100644 --- a/TAO/TAO_IDL/be/be_enum_val.cpp +++ b/TAO/TAO_IDL/be/be_enum_val.cpp @@ -30,16 +30,13 @@ be_enum_val::be_enum_val (void) } be_enum_val::be_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Constant (AST_Expression::EV_ulong, AST_Decl::NT_enum_val, new AST_Expression(v), - n, - p), + n), AST_Decl (AST_Decl::NT_enum_val, - n, - p) + n) { } diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp index 5581a1c2fc6..84edf8dd324 100644 --- a/TAO/TAO_IDL/be/be_exception.cpp +++ b/TAO/TAO_IDL/be/be_exception.cpp @@ -32,15 +32,12 @@ be_exception::be_exception (void) } be_exception::be_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Decl (AST_Decl::NT_except, - n, - p), + n), AST_Structure (AST_Decl::NT_except, n, - p, local, abstract), UTL_Scope (AST_Decl::NT_except), diff --git a/TAO/TAO_IDL/be/be_factory.cpp b/TAO/TAO_IDL/be/be_factory.cpp new file mode 100644 index 00000000000..f34748ac21a --- /dev/null +++ b/TAO/TAO_IDL/be/be_factory.cpp @@ -0,0 +1,66 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_factory.cpp +// +// = DESCRIPTION +// Extension of class AST_Factory that provides additional means for C++ +// mapping. +// +// = AUTHOR +// Copyright 1994-1995 by Sun Microsystems, Inc. +// and +// Boris Kolpackov <bosk@ipmce.ru> +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +ACE_RCSID(be, be_factory, "$Id$") + +be_factory::be_factory (void) +{ +} + +be_factory::be_factory (UTL_ScopedName *n) + : + AST_Factory (n), + + AST_Decl (AST_Decl::NT_factory, + n), + UTL_Scope (AST_Decl::NT_factory), + COMMON_Base (1, + 0) //@@ Always local, never abstract +{ +} + + +be_factory::~be_factory (void) +{ +} + +void +be_factory::destroy (void) +{ + // Call the destroy methods of our base classes. + be_scope::destroy (); + be_decl::destroy (); +} + +int +be_factory::accept (be_visitor *visitor) +{ + return visitor->visit_factory (this); +} + +// Narrowing +IMPL_NARROW_METHODS3 (be_factory, AST_Factory, be_scope, be_decl) +IMPL_NARROW_FROM_DECL (be_factory) +IMPL_NARROW_FROM_SCOPE (be_factory) diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp index c0ab867c8bc..e013b6c55e6 100644 --- a/TAO/TAO_IDL/be/be_field.cpp +++ b/TAO/TAO_IDL/be/be_field.cpp @@ -31,15 +31,12 @@ be_field::be_field (void) be_field::be_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, Visibility vis) : AST_Field (ft, n, - p, vis), AST_Decl (AST_Decl::NT_field, - n, - p), + n), COMMON_Base (ft->is_local (), ft->is_abstract ()) { diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp index 54e45fdbc16..e22b03879cf 100644 --- a/TAO/TAO_IDL/be/be_generator.cpp +++ b/TAO/TAO_IDL/be/be_generator.cpp @@ -77,13 +77,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc. ACE_RCSID(be, be_generator, "$Id$") AST_Root * -be_generator::create_root (UTL_ScopedName *n, - UTL_StrList *p) +be_generator::create_root (UTL_ScopedName *n) { be_root *retval = 0; ACE_NEW_RETURN (retval, - be_root (n, - p), + be_root (n), 0); return retval; @@ -91,14 +89,12 @@ be_generator::create_root (UTL_ScopedName *n, AST_PredefinedType * be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { be_predefined_type *retval = 0; ACE_NEW_RETURN (retval, be_predefined_type (t, - n, - p), + n), 0); return retval; @@ -106,8 +102,7 @@ be_generator::create_predefined_type (AST_PredefinedType::PredefinedType t, AST_Module * be_generator::create_module (UTL_Scope *s, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { AST_Decl *d = 0; AST_Module *m = 0; @@ -123,8 +118,7 @@ be_generator::create_module (UTL_Scope *s, // members to the new module's scope. AST_Module *retval = 0; ACE_NEW_RETURN (retval, - be_module (n, - p), + be_module (n), 0); @@ -195,7 +189,6 @@ be_generator::create_interface (UTL_ScopedName *n, long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool l, idl_bool a) { @@ -206,7 +199,6 @@ be_generator::create_interface (UTL_ScopedName *n, nih, ih_flat, nih_flat, - p, l, a), 0); @@ -216,7 +208,6 @@ be_generator::create_interface (UTL_ScopedName *n, AST_InterfaceFwd * be_generator::create_interface_fwd (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -227,11 +218,9 @@ be_generator::create_interface_fwd (UTL_ScopedName *n, -1, 0, 0, - p, local, abstract), - n, - p), + n), 0); return retval; @@ -240,59 +229,40 @@ be_generator::create_interface_fwd (UTL_ScopedName *n, AST_Interface * be_generator::create_valuetype (UTL_ScopedName *n, AST_Interface **ih, - long nih, - UTL_StrList *p) + long nih) { -#ifdef IDL_HAS_VALUETYPE be_valuetype *retval = 0; ACE_NEW_RETURN (retval, be_valuetype (n, ih, - nih, - p), + nih), 0); return retval; -#else - ACE_ERROR_RETURN ((LM_ERROR, - "Valuetype support not enabled\n"), - 0); -#endif /* IDL_HAS_VALUETYPE */ } AST_InterfaceFwd * -be_generator::create_valuetype_fwd (UTL_ScopedName *n, - UTL_StrList *p) +be_generator::create_valuetype_fwd (UTL_ScopedName *n) { -#ifdef IDL_HAS_VALUETYPE be_valuetype_fwd *retval = 0; ACE_NEW_RETURN (retval, be_valuetype_fwd (this->create_valuetype (n, 0, - -1, - p), - n, - p), + -1), + n), 0); return retval; -#else - ACE_ERROR_RETURN ((LM_ERROR, - "Valuetype support not enabled\n"), - 0); -#endif /* IDL_HAS_VALUETYPE */ } AST_Exception * be_generator::create_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { be_exception *retval = 0; ACE_NEW_RETURN (retval, be_exception (n, - p, local, abstract), 0); @@ -302,14 +272,12 @@ be_generator::create_exception (UTL_ScopedName *n, AST_Structure * be_generator::create_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { be_structure *retval = 0; ACE_NEW_RETURN (retval, be_structure (n, - p, local, abstract), 0); @@ -319,14 +287,12 @@ be_generator::create_structure (UTL_ScopedName *n, AST_Enum * be_generator::create_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { be_enum *retval = 0; ACE_NEW_RETURN (retval, be_enum (n, - p, local, abstract), 0); @@ -338,7 +304,6 @@ AST_Operation * be_generator::create_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -347,7 +312,6 @@ be_generator::create_operation (AST_Type *rt, be_operation (rt, fl, n, - p, local, abstract), 0); @@ -358,14 +322,12 @@ be_generator::create_operation (AST_Type *rt, AST_Field * be_generator::create_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, AST_Field::Visibility vis) { be_field *retval = 0; ACE_NEW_RETURN (retval, be_field (ft, n, - p, vis), 0); @@ -375,15 +337,13 @@ be_generator::create_field (AST_Type *ft, AST_Argument * be_generator::create_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { be_argument *retval = 0; ACE_NEW_RETURN (retval, be_argument (d, ft, - n, - p), + n), 0); return retval; @@ -393,7 +353,6 @@ AST_Attribute * be_generator::create_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -402,7 +361,6 @@ be_generator::create_attribute (idl_bool ro, be_attribute (ro, ft, n, - p, local, abstract), 0); @@ -413,7 +371,6 @@ be_generator::create_attribute (idl_bool ro, AST_Union * be_generator::create_union (AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -421,7 +378,6 @@ be_generator::create_union (AST_ConcreteType *dt, ACE_NEW_RETURN (retval, be_union (dt, n, - p, local, abstract), 0); @@ -432,15 +388,13 @@ be_generator::create_union (AST_ConcreteType *dt, AST_UnionBranch * be_generator::create_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { be_union_branch *retval = 0; ACE_NEW_RETURN (retval, be_union_branch (ll, ft, - n, - p), + n), 0); return retval; @@ -462,15 +416,13 @@ be_generator::create_union_label (AST_UnionLabel::UnionLabel ul, AST_Constant * be_generator::create_constant (AST_Expression::ExprType et, AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { be_constant *retval = 0; ACE_NEW_RETURN (retval, be_constant (et, ev, - n, - p), + n), 0); return retval; @@ -607,14 +559,12 @@ be_generator::create_expr (double d) AST_EnumVal * be_generator::create_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) { be_enum_val *retval = 0; ACE_NEW_RETURN (retval, be_enum_val (v, - n, - p), + n), 0); return retval; @@ -682,7 +632,6 @@ be_generator::create_wstring (AST_Expression *v) AST_Typedef * be_generator::create_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) { @@ -690,7 +639,6 @@ be_generator::create_typedef (AST_Type *bt, ACE_NEW_RETURN (retval, be_typedef (bt, n, - p, local, abstract), 0); @@ -699,13 +647,22 @@ be_generator::create_typedef (AST_Type *bt, } AST_Native * -be_generator::create_native (UTL_ScopedName *n, - UTL_StrList *p) +be_generator::create_native (UTL_ScopedName *n) { be_native *retval = 0; ACE_NEW_RETURN (retval, - be_native (n, - p), + be_native (n), + 0); + + return retval; +} + +AST_Factory * +be_generator::create_factory (UTL_ScopedName *n) +{ + be_factory *retval = 0; + ACE_NEW_RETURN (retval, + be_factory (n), 0); return retval; diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 9a36eb232e0..4c883e1dea7 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -828,24 +828,3 @@ BE_GlobalData::destroy (void) { } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Node <be_interface *>; -template class ACE_Unbounded_Queue <be_interface *>; -template class ACE_Unbounded_Queue_Iterator <be_interface *>; - -template class ACE_Node <be_interface_fwd *>; -template class ACE_Unbounded_Queue <be_interface_fwd *>; -template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Node <be_interface *> -#pragma instantiate ACE_Unbounded_Queue <be_interface *> -#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface *> - -#pragma instantiate ACE_Node <be_interface_fwd *> -#pragma instantiate ACE_Unbounded_Queue <be_interface_fwd *> -#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface_fwd *> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index aeeb44fe819..a3baea7fc02 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -28,7 +28,6 @@ ACE_RCSID(be, be_interface, "$Id$") - // Default constructor. be_interface::be_interface (void) : skel_count_ (0), @@ -47,7 +46,6 @@ be_interface::be_interface (UTL_ScopedName *n, long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Interface (n, @@ -55,12 +53,10 @@ be_interface::be_interface (UTL_ScopedName *n, nih, ih_flat, nih_flat, - p, local, abstract), AST_Decl (AST_Decl::NT_interface, - n, - p), + n), UTL_Scope (AST_Decl::NT_interface), COMMON_Base (local, abstract), diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp index fa14d82cbb8..bb1f0a88717 100644 --- a/TAO/TAO_IDL/be/be_interface_fwd.cpp +++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp @@ -32,14 +32,11 @@ be_interface_fwd::be_interface_fwd (void) } be_interface_fwd::be_interface_fwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_InterfaceFwd (dummy, - n, - p), + n), AST_Decl (AST_Decl::NT_interface_fwd, - n, - p) + n) { // Always the case. this->size_type (be_decl::VARIABLE); diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp index 3f8eba1a1cc..d0175436120 100644 --- a/TAO/TAO_IDL/be/be_interface_strategy.cpp +++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp @@ -24,23 +24,23 @@ ACE_RCSID(be, be_interface_strategy, "$Id$") - be_interface_strategy::be_interface_strategy (be_interface *node, - Strategy_Kind strategy_type) - : local_name_(0), - full_name_(0), - flat_name_(0), - repoID_(0), - full_skel_name_(0), - full_coll_name_(0), - local_coll_name_(0), - relative_skel_name_(0), - node_ (node), - cached_type_ (-1), - strategy_type_ (strategy_type) -{ -} - -be_interface_strategy::~be_interface_strategy () +be_interface_strategy::be_interface_strategy (be_interface *node, + Strategy_Kind strategy_type) + : local_name_(0), + full_name_(0), + flat_name_(0), + repoID_(0), + full_skel_name_(0), + full_coll_name_(0), + local_coll_name_(0), + relative_skel_name_(0), + node_ (node), + cached_type_ (-1), + strategy_type_ (strategy_type) +{ +} + +be_interface_strategy::~be_interface_strategy (void) { if (this->local_name_ != 0) delete [] this->local_name_; diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp index 32c7d3bf60c..d808eaee384 100644 --- a/TAO/TAO_IDL/be/be_module.cpp +++ b/TAO/TAO_IDL/be/be_module.cpp @@ -29,13 +29,10 @@ be_module::be_module (void) { } -be_module::be_module (UTL_ScopedName *n, - UTL_StrList *p) - : AST_Module (n, - p), +be_module::be_module (UTL_ScopedName *n) + : AST_Module (n), AST_Decl (AST_Decl::NT_module, - n, - p), + n), UTL_Scope (AST_Decl::NT_module) { } diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp index dc82c776c8f..cd1065cb7aa 100644 --- a/TAO/TAO_IDL/be/be_native.cpp +++ b/TAO/TAO_IDL/be/be_native.cpp @@ -27,13 +27,10 @@ be_native::be_native (void) { } -be_native::be_native (UTL_ScopedName *n, - UTL_StrList *p) - : AST_Native (n, - p), +be_native::be_native (UTL_ScopedName *n) + : AST_Native (n), AST_Decl (AST_Decl::NT_native, - n, - p) + n) { } diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index d470bef61b1..0e251e7f8ab 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -34,18 +34,15 @@ be_operation::be_operation (void) be_operation::be_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Operation (rt, fl, n, - p, local, abstract), AST_Decl (AST_Decl::NT_op, - n, - p), + n), UTL_Scope (AST_Decl::NT_op), COMMON_Base (local, abstract) diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index 4110de644f8..a5263719724 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -30,14 +30,11 @@ be_predefined_type::be_predefined_type (void) } be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_PredefinedType (t, - n, - p), + n), AST_Decl (AST_Decl::NT_pre_defined, n, - p, I_TRUE) { // Generate a new Scoped Name for us such that we belong to the CORBA diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp index 626f13ebdf3..d3a9048f596 100644 --- a/TAO/TAO_IDL/be/be_root.cpp +++ b/TAO/TAO_IDL/be/be_root.cpp @@ -31,13 +31,10 @@ be_root::be_root (void) } // Constructor used to build the root of the abstract syntax tree (AST). -be_root::be_root (UTL_ScopedName *n, - UTL_StrList *p) - : AST_Root (n, - p), +be_root::be_root (UTL_ScopedName *n) + : AST_Root (n), AST_Decl (AST_Decl::NT_root, - n, - p), + n), UTL_Scope (AST_Decl::NT_root) { diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp index 3f26593323e..277aad714f1 100644 --- a/TAO/TAO_IDL/be/be_scope.cpp +++ b/TAO/TAO_IDL/be/be_scope.cpp @@ -61,6 +61,8 @@ be_scope::decl (void) return be_enum::narrow_from_scope (this); case AST_Decl::NT_op: return be_operation::narrow_from_scope (this); + case AST_Decl::NT_factory: + return be_factory::narrow_from_scope (this); default: return (be_decl *)0; } diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index b166fc951f7..fa8e37aec83 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -45,7 +45,6 @@ be_sequence::be_sequence (AST_Expression *v, abstract), AST_Decl (AST_Decl::NT_sequence, 0, - 0, I_TRUE), COMMON_Base (t->is_local () || local, abstract), @@ -220,8 +219,27 @@ be_sequence::managed_type (void) { case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: + { + int is_valuetype = 0; + be_interface *bf = be_interface::narrow_from_decl (prim_type); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (prim_type); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + if (is_valuetype) + { + this->mt_ = be_sequence::MNG_VALUE; + } + else + { this->mt_ = be_sequence::MNG_OBJREF; + } break; + } case AST_Decl::NT_string: this->mt_ = be_sequence::MNG_STRING; break; @@ -340,6 +358,21 @@ be_sequence::instance_name () this->max_size ()->ev ()->u.ulval); } break; + case be_sequence::MNG_VALUE: + if (this->unbounded ()) + { + ACE_OS::sprintf (namebuf, + "_TAO_Unbounded_Valuetype_Sequence_%s", + this->flat_name ()); + } + else + { + ACE_OS::sprintf (namebuf, + "_TAO_Bounded_Valuetype_Sequence_%s_%lu", + this->flat_name (), + this->max_size ()->ev ()->u.ulval); + } + break; case be_sequence::MNG_STRING: if (this->unbounded ()) { diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp index cb0c7518dbb..ea293d78f01 100644 --- a/TAO/TAO_IDL/be/be_string.cpp +++ b/TAO/TAO_IDL/be/be_string.cpp @@ -36,7 +36,6 @@ be_string::be_string (AST_Expression *v) AST_Decl (AST_Decl::NT_string, new UTL_ScopedName (new Identifier ("string"), 0), - 0, I_TRUE) { // Always the case. @@ -54,7 +53,6 @@ be_string::be_string (AST_Expression *v, 0) : new UTL_ScopedName (new Identifier ("wstring"), 0), - 0, I_TRUE) { // Always the case. diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp index 2612da8d7ff..0530a2db8bf 100644 --- a/TAO/TAO_IDL/be/be_structure.cpp +++ b/TAO/TAO_IDL/be/be_structure.cpp @@ -30,12 +30,10 @@ be_structure::be_structure (void) } be_structure::be_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Decl (AST_Decl::NT_struct, - n, - p), + n), UTL_Scope (AST_Decl::NT_struct), COMMON_Base (local, abstract) diff --git a/TAO/TAO_IDL/be/be_tmplinst.cpp b/TAO/TAO_IDL/be/be_tmplinst.cpp new file mode 100644 index 00000000000..b288ffdb3c6 --- /dev/null +++ b/TAO/TAO_IDL/be/be_tmplinst.cpp @@ -0,0 +1,47 @@ +// $Id$ + +#include "ace/ACE.h" +#include "be_visitor_typecode/typecode_defn.h" +#include "be_stream_factory.h" +#include "be_visitor_factory.h" + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>; +template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; +template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; +template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; + +template class ACE_Node <be_interface *>; +template class ACE_Unbounded_Queue <be_interface *>; +template class ACE_Unbounded_Queue_Iterator <be_interface *>; + +template class ACE_Node<be_visitor_typecode_defn::QNode*>; +template class ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>; +template class ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>; + +template class ACE_Node <be_interface_fwd *>; +template class ACE_Unbounded_Queue <be_interface_fwd *>; +template class ACE_Unbounded_Queue_Iterator <be_interface_fwd *>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> +#pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> + +#pragma instantiate ACE_Node <be_interface *> +#pragma instantiate ACE_Unbounded_Queue <be_interface *> +#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface *> + +#pragma instantiate ACE_Node<be_visitor_typecode_defn::QNode*> +#pragma instantiate ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*> +#pragma instantiate ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*> + +#pragma instantiate ACE_Node <be_interface_fwd *> +#pragma instantiate ACE_Unbounded_Queue <be_interface_fwd *> +#pragma instantiate ACE_Unbounded_Queue_Iterator <be_interface_fwd *> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp index 756def6f12d..ec34b33ad20 100644 --- a/TAO/TAO_IDL/be/be_type.cpp +++ b/TAO/TAO_IDL/be/be_type.cpp @@ -32,11 +32,9 @@ be_type::be_type (void) } be_type::be_type (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_Decl (nt, - n, - p), + n), tc_name_ (0), nested_type_name_ (0) { diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp index 42d2fb763c2..14533244c72 100644 --- a/TAO/TAO_IDL/be/be_typedef.cpp +++ b/TAO/TAO_IDL/be/be_typedef.cpp @@ -33,19 +33,15 @@ be_typedef::be_typedef (void) be_typedef::be_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Typedef (bt, - n, - p, - bt->is_local () || local, + : AST_Typedef (bt, + n, + bt->is_local () || local, abstract), - AST_Decl (AST_Decl::NT_typedef, - n, - p), - - COMMON_Base (bt->is_local () || local, + AST_Decl (AST_Decl::NT_typedef, + n), + COMMON_Base (bt->is_local () || local, abstract) { } diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index 72e630495b4..36ba45049ae 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -34,22 +34,18 @@ be_union::be_union (void) be_union::be_union (AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract) : AST_Union (dt, n, - p, local, abstract), AST_Structure (AST_Decl::NT_union, n, - p, local, abstract), AST_Decl (AST_Decl::NT_union, - n, - p), + n), UTL_Scope (AST_Decl::NT_union), COMMON_Base (local, abstract) diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp index 0d20ee99a56..b1c5c0d8835 100644 --- a/TAO/TAO_IDL/be/be_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_union_branch.cpp @@ -31,19 +31,15 @@ be_union_branch::be_union_branch (void) be_union_branch::be_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : AST_UnionBranch (ll, ft, - n, - p), + n), AST_Field (AST_Decl::NT_union_branch, ft, - n, - p), + n), AST_Decl (AST_Decl::NT_union_branch, - n, - p), + n), COMMON_Base (ft->is_local (), ft->is_abstract ()) { diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp index e2edec79ca7..3098c97a0e3 100644 --- a/TAO/TAO_IDL/be/be_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_valuetype.cpp @@ -23,8 +23,6 @@ #include "idl_extern.h" #include "be.h" -#ifdef IDL_HAS_VALUETYPE - ACE_RCSID(be, be_valuetype, "$Id$") // Default constructor. @@ -52,14 +50,12 @@ be_valuetype::be_valuetype (void) be_valuetype::be_valuetype (UTL_ScopedName *n, AST_Interface **ih, long nih, - UTL_StrList *p, idl_bool set_abstract) : be_interface (n, ih, nih, 0, 0, - p, 0, set_abstract), AST_Interface (n, @@ -67,12 +63,10 @@ be_valuetype::be_valuetype (UTL_ScopedName *n, nih, 0, 0, - p, 0, set_abstract), AST_Decl (AST_Decl::NT_interface, // It's like an interface. - n, - p), + n), UTL_Scope (AST_Decl::NT_interface), COMMON_Base (0, set_abstract), @@ -103,11 +97,9 @@ be_valuetype::~be_valuetype (void) } void -be_valuetype::redefine (AST_Interface *from, - UTL_StrList *p) +be_valuetype::redefine (AST_Interface *from) { - this->AST_Interface::redefine (from, - p); + this->AST_Interface::redefine (from); this->is_abstract_ = from->is_abstract_valuetype (); } @@ -128,7 +120,6 @@ be_valuetype::compute_fullobvskelname (void) this->full_obv_skel_name_); } - // Retrieve the fully scoped skeleton name. const char* be_valuetype::full_obv_skel_name (void) @@ -141,8 +132,6 @@ be_valuetype::full_obv_skel_name (void) return this->full_obv_skel_name_; } - - // Generate the var definition. int be_valuetype::gen_var_defn (char *) @@ -232,7 +221,7 @@ int be_valuetype::gen_var_impl (char *, char *) { - TAO_OutStream *ci = 0; + TAO_OutStream *cs = 0; TAO_NL be_nl; // To hold the full and local _var names. @@ -255,183 +244,178 @@ be_valuetype::gen_var_impl (char *, "%s_var", this->local_name ()); - ci = tao_cg->client_inline (); + cs = tao_cg->client_inline (); // Generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account // for over here. - ci->indent (); // start with whatever was our current indent level + cs->indent (); // start with whatever was our current indent level - *ci << "// *************************************************************" + *cs << "// *************************************************************" << be_nl; - *ci << "// Inline operations for class " << fname << be_nl; - *ci << "// *************************************************************\n\n"; + *cs << "// Inline operations for class " << fname << be_nl; + *cs << "// *************************************************************\n\n"; // Default constructor. - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << + *cs << "ACE_INLINE" << be_nl; + *cs << fname << "::" << lname << " (void) // default constructor" << be_nl; - *ci << " " << ": ptr_ (0)" << be_nl; - *ci << "{}\n\n"; + *cs << " " << ": ptr_ (0)" << be_nl; + *cs << "{}\n\n"; // Constructor from a pointer. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (" + cs->indent (); + *cs << "ACE_INLINE" << be_nl; + *cs << fname << "::" << lname << " (" << this->local_name () << "* p)" << be_nl; - *ci << " : ptr_ (p)" << be_nl; - *ci << "{}\n\n"; + *cs << " : ptr_ (p)" << be_nl; + *cs << "{}\n\n"; // Constructor from a const pointer. // TAO extension - it appears that there are problems with at least g++ // which reclaims amguity between T(T*) and T(const T_var &) - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (const " + cs->indent (); + *cs << fname << "::" << lname << " (const " << this->local_name () << "* p)" << be_nl; - *ci << " : ptr_ (ACE_const_cast(" + *cs << " : ptr_ (ACE_const_cast(" << this->local_name () << "*, p))" << be_nl; - *ci << "{}\n\n"; + *cs << "{}\n\n"; // The additional ptr () member function. This member function must be // defined before the remaining member functions including the copy // constructor because this inline function is used elsewhere. Hence to make // inlining of this function possible, we must define it before its use. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* " << be_nl; - *ci << fname << "::ptr (void) const" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << this->name () << "* " << be_nl; + *cs << fname << "::ptr (void) const" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Copy constructor. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (const " << lname << + cs->indent (); + *cs << fname << "::" << lname << " (const " << lname << " &p) // copy constructor" << be_nl; - *ci << "{" << be_idt_nl + *cs << "{" << be_idt_nl << "CORBA::add_ref (p.ptr ());" << be_nl << "this->ptr_ = p.ptr ();" << be_uidt_nl << "}\n\n"; // Destructor. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::~" << lname << " (void) // destructor" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::remove_ref (this->ptr_);\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << fname << "::~" << lname << " (void) // destructor" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "CORBA::remove_ref (this->ptr_);\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Assignment operator. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << be_nl; - *ci << fname << "::operator= (" << this->local_name () + cs->indent (); + *cs << fname << " &" << be_nl; + *cs << fname << "::operator= (" << this->local_name () << "* p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::remove_ref (this->ptr_);" << be_nl; - *ci << "this->ptr_ = p;" << be_nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "{\n"; + cs->incr_indent (); + *cs << "CORBA::remove_ref (this->ptr_);" << be_nl; + *cs << "this->ptr_ = p;" << be_nl; + *cs << "return *this;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Assignment operator from _var. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << be_nl; - *ci << fname << "::operator= (const " << lname + cs->indent (); + *cs << fname << " &" << be_nl; + *cs << fname << "::operator= (const " << lname << " &p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "if (this != &p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::remove_ref (this->ptr_);" << be_nl + *cs << "{\n"; + cs->incr_indent (); + *cs << "if (this != &p)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "CORBA::remove_ref (this->ptr_);" << be_nl << this->local_name() << "* tmp = p.ptr ();" << be_nl << "CORBA::add_ref (tmp);" << be_nl << "this->ptr_ = tmp;\n"; - ci->decr_indent (); - *ci << "}" << be_nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->decr_indent (); + *cs << "}" << be_nl; + *cs << "return *this;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Other extra methods - cast operator (). - ci->indent (); - *ci << "ACE_INLINE " << be_nl; - *ci << fname << "::operator const " << this->name () + cs->indent (); + *cs << fname << "::operator const " << this->name () << "* () const // cast" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << be_nl; - *ci << fname << "::operator " << this->name () + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; + + cs->indent (); + *cs << fname << "::operator " << this->name () << "* () // cast " << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // operator-> - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* " << be_nl; - *ci << fname << "::operator-> (void) const" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << this->name () << "* " << be_nl; + *cs << fname << "::operator-> (void) const" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // in, inout, out, and _retn. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "*" << be_nl; - *ci << fname << "::in (void) const" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* &" << be_nl; - *ci << fname << "::inout (void)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* &" << be_nl; - *ci << fname << "::out (void)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::remove_ref (this->ptr_);" << be_nl; - *ci << "this->ptr_ = 0;" << be_nl; - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* " << be_nl; - *ci << fname << "::_retn (void)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "// yield ownership of managed obj reference" << be_nl; - *ci << this->local_name () << "* tmp = this->ptr_;" << be_nl; - *ci << "this->ptr_ = 0;" << be_nl; - *ci << "return tmp;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << this->name () << "*" << be_nl; + *cs << fname << "::in (void) const" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; + + cs->indent (); + *cs << this->name () << "* &" << be_nl; + *cs << fname << "::inout (void)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; + + cs->indent (); + *cs << this->name () << "* &" << be_nl; + *cs << fname << "::out (void)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "CORBA::remove_ref (this->ptr_);" << be_nl; + *cs << "this->ptr_ = 0;" << be_nl; + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; + + cs->indent (); + *cs << this->name () << "* " << be_nl; + *cs << fname << "::_retn (void)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "// yield ownership of managed obj reference" << be_nl; + *cs << this->local_name () << "* tmp = this->ptr_;" << be_nl; + *cs << "this->ptr_ = 0;" << be_nl; + *cs << "return tmp;\n"; + cs->decr_indent (); + *cs << "}\n\n"; return 0; } @@ -504,7 +488,7 @@ int be_valuetype::gen_out_impl (char *, char *) { - TAO_OutStream *ci = 0; + TAO_OutStream *cs = 0; TAO_NL be_nl; // To hold the full and local _out names. @@ -527,121 +511,202 @@ be_valuetype::gen_out_impl (char *, "%s_out", this->local_name ()); - ci = tao_cg->client_inline (); + cs = tao_cg->client_inline (); // Generate the var implementation in the inline file // Depending upon the data type, there are some differences which we account // for over here. // Start with whatever was our current indent level. - ci->indent (); + cs->indent (); - *ci << "// *************************************************************" + *cs << "// *************************************************************" << be_nl; - *ci << "// Inline operations for class " << fname << be_nl; - *ci << "// *************************************************************\n\n"; + *cs << "// Inline operations for class " << fname << be_nl; + *cs << "// *************************************************************\n\n"; // Constructor from a pointer. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (" << this->local_name () + cs->indent (); + *cs << fname << "::" << lname << " (" << this->local_name () << "* &p)" << be_nl; - *ci << " : ptr_ (p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = 0;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << " : ptr_ (p)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "this->ptr_ = 0;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Constructor from _var &. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (" << this->local_name () + cs->indent (); + *cs << fname << "::" << lname << " (" << this->local_name () << "_var &p) // constructor from _var" << be_nl; - *ci << " : ptr_ (p.out ())" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::remove_ref (this->ptr_);" << be_nl; - *ci << "this->ptr_ = 0;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << " : ptr_ (p.out ())" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "CORBA::remove_ref (this->ptr_);" << be_nl; + *cs << "this->ptr_ = 0;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Copy constructor. - ci->indent (); - *ci << "ACE_INLINE" << be_nl; - *ci << fname << "::" << lname << " (const " << lname + cs->indent (); + *cs << fname << "::" << lname << " (const " << lname << " &p) // copy constructor" << be_nl; - *ci << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << be_nl; - *ci << "{}\n\n"; + *cs << " : ptr_ (ACE_const_cast (" << lname << "&,p).ptr_)" << be_nl; + *cs << "{}\n\n"; // Assignment operator from _out &. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << be_nl; - *ci << fname << "::operator= (const " << lname << + cs->indent (); + *cs << fname << " &" << be_nl; + *cs << fname << "::operator= (const " << lname << " &p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = ACE_const_cast (" << lname << "&,p).ptr_;" << be_nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "{\n"; + cs->incr_indent (); + *cs << "this->ptr_ = ACE_const_cast (" << lname << "&,p).ptr_;" << be_nl; + *cs << "return *this;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Assignment operator from _var. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << be_nl; - *ci << fname << "::operator= (const " << this->local_name () + cs->indent (); + *cs << fname << " &" << be_nl; + *cs << fname << "::operator= (const " << this->local_name () << "_var &p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << this->local_name () << "* tmp = p.ptr ();" << be_nl + *cs << "{\n"; + cs->incr_indent (); + *cs << this->local_name () << "* tmp = p.ptr ();" << be_nl << "CORBA::add_ref (tmp);" << be_nl << "this->ptr_ = tmp;" << be_nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "return *this;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Assignment operator from *. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << be_nl; - *ci << fname << "::operator= (" << this->local_name () + cs->indent (); + *cs << fname << " &" << be_nl; + *cs << fname << "::operator= (" << this->local_name () << "* p)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = p;" << be_nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "{\n"; + cs->incr_indent (); + *cs << "this->ptr_ = p;" << be_nl; + *cs << "return *this;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // Other extra methods - cast operator (). - ci->indent (); - *ci << "ACE_INLINE " << be_nl; - *ci << fname << "::operator " << this->name () + cs->indent (); + *cs << fname << "::operator " << this->name () << "* &() // cast" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // ptr function. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* &" << be_nl; - *ci << fname << "::ptr (void) // ptr" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << this->name () << "* &" << be_nl; + *cs << fname << "::ptr (void) // ptr" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; // operator-> - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "* " << be_nl; - *ci << fname << "::operator-> (void)" << be_nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; + cs->indent (); + *cs << this->name () << "* " << be_nl; + *cs << fname << "::operator-> (void)" << be_nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "return this->ptr_;\n"; + cs->decr_indent (); + *cs << "}\n\n"; + + return 0; +} + +int +be_valuetype::gen_helper_header (char* , + char* ) +{ + TAO_OutStream *os = 0; + + os = tao_cg->client_header (); + + *os << "//@@ Boris: begin experimental" << be_nl + << "TAO_NAMESPACE CORBA" << be_nl + << "{" + << be_idt_nl + << "void add_ref (" << this->full_name () << " *);" << be_nl + << "void remove_ref (" << this->full_name () << " *);" + << be_uidt_nl + << "}" << be_nl + << "TAO_NAMESPACE_CLOSE" << be_nl + << "//@@ Boris: end experimental" << be_nl << be_nl; + + return 0; +} + +int +be_valuetype::gen_helper_inline (char* , + char* ) +{ + TAO_OutStream *os = 0; + + os = tao_cg->client_inline (); + + *os << "//@@ Boris: begin experimental" << be_nl + << "TAO_NAMESPACE CORBA" << be_nl + << "{" + << be_idt_nl + << "void add_ref (" << this->full_name () << " *);" << be_nl + << "void remove_ref (" << this->full_name () << " *);" + << be_uidt_nl + << "}" << be_nl + << "TAO_NAMESPACE_CLOSE" << be_nl + << "//@@ Boris: end experimental" << be_nl << be_nl; + + return 0; +} + + +int +be_valuetype::gen_helper_stubs (char* , + char* ) +{ + TAO_OutStream *os = 0; + + os = tao_cg->client_stubs (); + + *os << "//@@ Boris: begin experimental" << be_nl + // add_ref + << "void" << be_nl + << "CORBA::add_ref (" << this->full_name () << " * vt)" << be_nl + << "{" + << be_idt_nl + << "if (vt != 0)" << be_nl + << "{" + << be_idt_nl + << "vt->_add_ref ();" + << be_uidt_nl + << "}" + << be_uidt_nl + << "}" << be_nl << be_nl + // remove_ref + << "void" << be_nl + << "CORBA::remove_ref (" << this->full_name () << " * vt)" << be_nl + << "{" + << be_idt_nl + << "if (vt != 0)" << be_nl + << "{" + << be_idt_nl + << "vt->_remove_ref ();" + << be_uidt_nl + << "}" + << be_uidt_nl + << "}" << be_nl << be_nl + << "//@@ Boris: end experimental" << be_nl; return 0; } @@ -690,4 +755,3 @@ IMPL_NARROW_METHODS1 (be_valuetype, be_interface) IMPL_NARROW_FROM_DECL (be_valuetype) IMPL_NARROW_FROM_SCOPE (be_valuetype) -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp index 894febbcccc..8c7452fb4ed 100644 --- a/TAO/TAO_IDL/be/be_valuetype_fwd.cpp +++ b/TAO/TAO_IDL/be/be_valuetype_fwd.cpp @@ -25,8 +25,6 @@ #include "idl_extern.h" #include "be.h" -#ifdef IDL_HAS_VALUETYPE - ACE_RCSID(be, be_valuetype_fwd, "$Id$") be_valuetype_fwd::be_valuetype_fwd (void) @@ -34,17 +32,13 @@ be_valuetype_fwd::be_valuetype_fwd (void) } be_valuetype_fwd::be_valuetype_fwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n) : be_interface_fwd (dummy, - n, - p), + n), AST_InterfaceFwd (dummy, - n, - p), + n), AST_Decl (AST_Decl::NT_interface_fwd, - n, - p) + n) { } @@ -59,509 +53,6 @@ be_valuetype_fwd::set_abstract_valuetype (void) this->full_definition ()->set_abstract_valuetype (); } -// Generate the var definition -int -be_valuetype_fwd::gen_var_defn (char *) -{ - ACE_ASSERT (0); - TAO_OutStream *ch = 0; - TAO_NL nl; - char namebuf [NAMEBUFSIZE]; - - ACE_OS::memset (namebuf, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (namebuf, - "%s_var", - this->local_name ()->get_string ()); - - ch = tao_cg->client_header (); - - // Generate the var definition (always in the client header). - // Depending upon the data type, there are some differences which we account - // for over here. - - // Start with whatever was our current indent level. - ch->indent (); - *ch << "class " << be_global->stub_export_macro () - << " " << namebuf << nl; - *ch << "{" << nl; - *ch << "public:\n"; - ch->incr_indent (); - - // Default constructor. - *ch << namebuf << " (void); // default constructor" << nl; - *ch << namebuf << " (" << this->local_name () << "_ptr);" << nl; - - // Copy constructor. - *ch << namebuf << " (const " << namebuf << - " &); // copy constructor" << nl; - - // Destructor. - *ch << "~" << namebuf << " (void); // destructor" << nl; - *ch << nl; - - // Assignment operator from a pointer. - *ch << namebuf << " &operator= (" << this->local_name () - << "_ptr);" << nl; - - // Assignment from _var. - *ch << namebuf << " &operator= (const " << namebuf << - " &);" << nl; - - // Arrow operator. - *ch << this->local_name () << "_ptr operator-> (void) const;" << nl; - - *ch << nl; - - // Other extra types (cast operators, [] operator, and others). - *ch << "operator const " << this->local_name () - << "_ptr &() const;" << nl; - *ch << "operator " << this->local_name () << "_ptr &();" << nl; - - *ch << "// in, inout, out, _retn " << nl; - // The return types of in, out, inout, and _retn are based on the parameter - // passing rules and the base type. - *ch << this->local_name () << "_ptr in (void) const;" << nl; - *ch << this->local_name () << "_ptr &inout (void);" << nl; - *ch << this->local_name () << "_ptr &out (void);" << nl; - *ch << this->local_name () << "_ptr _retn (void);" << nl; - - // Generate an additional member function that returns - // the underlying pointer. - *ch << this->local_name () << "_ptr ptr (void) const;\n"; - - *ch << "\n"; - ch->decr_indent (); - - // Private. - *ch << "private:\n"; - ch->incr_indent (); - *ch << this->local_name () << "_ptr ptr_;\n"; - - ch->decr_indent (); - *ch << "};\n\n"; - - return 0; -} - -// Implementation of the _var class. All of these get generated in the inline -// file. -int -be_valuetype_fwd::gen_var_impl (char *, - char *) -{ - ACE_ASSERT (0); - TAO_OutStream *ci = 0; - TAO_NL nl; - - // To hold the full and local _var names. - char fname [NAMEBUFSIZE]; - char lname [NAMEBUFSIZE]; - - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (fname, - "%s_var", - this->full_name ()); - - ACE_OS::memset (lname, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (lname, - "%s_var", - this->local_name ()->get_string ()); - - ci = tao_cg->client_inline (); - - // Generate the var implementation in the inline file - // Depending upon the data type, there are some differences which we account - // for over here. - - // Start with whatever was our current indent level. - ci->indent (); - - *ci << "// *************************************************************" - << nl; - *ci << "// Inline operations for class " << fname << nl; - *ci << "// *************************************************************\n\n"; - - // Default constructor. - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname - << " (void) // default constructor" << nl; - *ci << " " << ": ptr_ (" << this->name () << "::_nil ())" << nl; - *ci << "{}\n\n"; - - // Constructor from a _ptr. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname << " (" << this->name () - << "_ptr p)" << nl; - *ci << " : ptr_ (p)" << nl; - *ci << "{}\n\n"; - - // The additional ptr () member function. This member function must be - // defined before the remaining member functions including the copy - // constructor because this inline function is used elsewhere. Hence to make - // inlining of this function possible, we must define it before its use. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr " << nl; - *ci << fname << "::ptr (void) const" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Copy constructor. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname << " (const " << fname - << " &p) // copy constructor" << nl; - *ci << " : ptr_ (" << this->name () << "::_duplicate (p.ptr ()))" << nl; - *ci << "{}\n\n"; - - // Destructor. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::~" << lname << " (void) // destructor" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::release (this->ptr_);\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Assignment operator. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << nl; - *ci << fname << "::operator= (" << this->name () - << "_ptr p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::release (this->ptr_);" << nl; - *ci << "this->ptr_ = p;" << nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Assignment operator from _var. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << nl; - *ci << fname << "::operator= (const " << fname - << " &p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "if (this != &p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::release (this->ptr_);" << nl; - *ci << "this->ptr_ = " << name () << "::_duplicate (p.ptr ());\n"; - ci->decr_indent (); - *ci << "}" << nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Other extra methods - cast operator (). - ci->indent (); - *ci << "ACE_INLINE " << nl; - *ci << fname << "::operator const " << this->name () - << "_ptr &() const // cast" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << nl; - *ci << fname << "::operator " << this->name () - << "_ptr &() // cast " << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // operator-> - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr " << nl; - *ci << fname << "::operator-> (void) const" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // in, inout, out, and _retn. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr" << nl; - *ci << fname << "::in (void) const" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl; - *ci << fname << "::inout (void)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl; - *ci << fname << "::out (void)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::release (this->ptr_);" << nl; - *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl; - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr " << nl; - *ci << fname << "::_retn (void)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "// yield ownership of managed obj reference" << nl; - *ci << this->name () << "_ptr val = this->ptr_;" << nl; - *ci << "this->ptr_ = " << this->name () << "::_nil ();" << nl; - *ci << "return val;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - return 0; -} - -// Generate the _out definition. -int -be_valuetype_fwd::gen_out_defn (char *) -{ - ACE_ASSERT (0); - TAO_OutStream *ch = 0; - TAO_NL nl; - char namebuf [NAMEBUFSIZE]; - - ACE_OS::memset (namebuf, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (namebuf, - "%s_out", - this->local_name ()->get_string ()); - - ch = tao_cg->client_header (); - - // Generate the out definition (always in the client header). - - // Start with whatever was our current indent level. - ch->indent (); - - *ch << "class " << be_global->stub_export_macro () - << " " << namebuf << nl; - *ch << "{" << nl; - *ch << "public:\n"; - ch->incr_indent (); - - // No default constructor. - - // Constructor from a pointer. - *ch << namebuf << " (" << this->local_name () << "_ptr &);" << nl; - - // Constructor from a _var &. - *ch << namebuf << " (" << this->local_name () << "_var &);" << nl; - - // Constructor from a _out &. - *ch << namebuf << " (const " << namebuf << " &);" << nl; - - // Assignment operator from a _out &. - *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl; - - // Assignment operator from a pointer &, cast operator, ptr fn, operator - // -> and any other extra operators. - // Only valuetype allows assignment from var &. - *ch << namebuf << " &operator= (const " << this->local_name () - << "_var &);" << nl; - *ch << namebuf << " &operator= (" << this->local_name () - << "_ptr);" << nl; - - // Cast. - *ch << "operator " << this->local_name () << "_ptr &();" << nl; - - // ptr function. - *ch << this->local_name () << "_ptr &ptr (void);" << nl; - - // operator -> - *ch << this->local_name () << "_ptr operator-> (void);" << nl; - - *ch << "\n"; - ch->decr_indent (); - *ch << "private:\n"; - ch->incr_indent (); - *ch << this->local_name () << "_ptr &ptr_;\n"; - - ch->decr_indent (); - *ch << "};" << be_nl << be_nl; - - return 0; -} - -int -be_valuetype_fwd::gen_out_impl (char *, - char *) -{ - ACE_ASSERT (0); - TAO_OutStream *ci = 0; - TAO_NL nl; - - // To hold the full and local _out names. - char fname [NAMEBUFSIZE]; - char lname [NAMEBUFSIZE]; - - ACE_OS::memset (fname, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (fname, - "%s_out", - this->full_name ()); - - ACE_OS::memset (lname, - '\0', - NAMEBUFSIZE); - - ACE_OS::sprintf (lname, - "%s_out", - this->local_name ()->get_string ()); - - ci = tao_cg->client_inline (); - - // Generate the var implementation in the inline file - // Depending upon the data type, there are some differences which we account - // for over here. - - // Start with whatever was our current indent level. - ci->indent (); - - *ci << "// *************************************************************" - << nl; - *ci << "// Inline operations for class " << fname << nl; - *ci << "// *************************************************************\n\n"; - - // Constructor from a _ptr. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname << " (" << this->name () - << "_ptr &p)" << nl; - *ci << " : ptr_ (p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = " << this->name () << "::_nil ();\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Constructor from _var &. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname << " (" << this->name () - << "_var &p) // constructor from _var" << nl; - *ci << " : ptr_ (p.out ())" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "CORBA::release (this->ptr_);" << nl; - *ci << "this->ptr_ = " << this->name () << "::_nil ();\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Copy constructor. - ci->indent (); - *ci << "ACE_INLINE" << nl; - *ci << fname << "::" << lname << " (const " << fname - << " &p) // copy constructor" << nl; - *ci << " : ptr_ (ACE_const_cast (" << fname - << "&,p).ptr_)" << nl; - *ci << "{}\n\n"; - - // Assignment operator from _out &. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << nl; - *ci << fname << "::operator= (const " << fname - << " &p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = ACE_const_cast (" << fname << "&,p).ptr_;" << nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Assignment operator from _var. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << nl; - *ci << fname << "::operator= (const " << this->name () - << "_var &p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = " << this->name () << "::_duplicate (p.ptr ());" << nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Assignment operator from _ptr. - ci->indent (); - *ci << "ACE_INLINE " << fname << " &" << nl; - *ci << fname << "::operator= (" << this->name () - << "_ptr p)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->ptr_ = p;" << nl; - *ci << "return *this;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // Other extra methods - cast operator (). - ci->indent (); - *ci << "ACE_INLINE " << nl; - *ci << fname << "::operator " << this->name () - << "_ptr &() // cast" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // ptr function. - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr &" << nl; - *ci << fname << "::ptr (void) // ptr" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - // operator-> - ci->indent (); - *ci << "ACE_INLINE " << this->name () << "_ptr " << nl; - *ci << fname << "::operator-> (void)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "return this->ptr_;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - - return 0; -} - int be_valuetype_fwd::accept (be_visitor *visitor) { @@ -572,4 +63,3 @@ be_valuetype_fwd::accept (be_visitor *visitor) IMPL_NARROW_METHODS1 (be_valuetype_fwd, be_interface_fwd) IMPL_NARROW_FROM_DECL (be_valuetype_fwd) -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor.cpp b/TAO/TAO_IDL/be/be_visitor.cpp index 999042799ea..440c1f9a3b3 100644 --- a/TAO/TAO_IDL/be/be_visitor.cpp +++ b/TAO/TAO_IDL/be/be_visitor.cpp @@ -71,7 +71,6 @@ int be_visitor::visit_interface_fwd (be_interface_fwd *) return 0; } -#ifdef IDL_HAS_VALUETYPE int be_visitor::visit_valuetype (be_valuetype *) { return 0; @@ -81,7 +80,11 @@ int be_visitor::visit_valuetype_fwd (be_valuetype_fwd *) { return 0; } -#endif /* IDL_HAS_VALUETYPE */ + +int be_visitor::visit_factory (be_factory *) +{ + return 0; +} int be_visitor::visit_structure (be_structure *) { 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 2fa7340918d..90e1ed10b13 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -60,7 +60,9 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node) { if (!node->imported () && !node->is_local ()) { - AST_Module *module = AST_Module::narrow_from_scope (node->defined_in ()); + AST_Module *module = + AST_Module::narrow_from_scope (node->defined_in ()); + if (!module) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_amh_pre_proc::" @@ -121,7 +123,9 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node) /* // Set the strategy be_interface_strategy *old_strategy = - excep_holder->set_strategy (new be_interface_ami_exception_holder_strategy (excep_holder)); + excep_holder->set_strategy ( + new be_interface_ami_exception_holder_strategy (excep_holder) + ); if (old_strategy) delete old_strategy; */ @@ -135,7 +139,8 @@ be_visitor_amh_pre_proc::visit_interface (be_interface *node) -1); } - be_interface *response_handler = this->create_response_handler (node, excep_holder); + be_interface *response_handler = + this->create_response_handler (node, excep_holder); if (response_handler) { response_handler->set_defined_in (node->defined_in ()); @@ -247,7 +252,9 @@ be_visitor_amh_pre_proc::visit_attribute (be_attribute *node) // Retrieve the strategy set by the visit operation be_operation_strategy *set_operation_strategy = - set_operation->set_strategy (new be_operation_default_strategy (set_operation)); + set_operation->set_strategy ( + new be_operation_default_strategy (set_operation) + ); // Assign it to the attribute as set_operation strategy if (set_operation_strategy) @@ -260,7 +267,9 @@ be_visitor_amh_pre_proc::visit_attribute (be_attribute *node) this->visit_operation (get_operation); be_operation_strategy *get_operation_strategy = - get_operation->set_strategy (new be_operation_default_strategy (get_operation)); + get_operation->set_strategy ( + new be_operation_default_strategy (get_operation) + ); if (get_operation_strategy) delete node->set_get_strategy (get_operation_strategy); @@ -275,8 +284,8 @@ be_valuetype * be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) { - // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder" - // from which we inherit. + // Create a virtual module named "Messaging" and a valuetype + // "ExceptionHolder" from which we inherit. UTL_ScopedName *inherit_name = new UTL_ScopedName (new Identifier ("Messaging"), 0); @@ -290,10 +299,10 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) 0); inherit_vt->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), - 0), - 0); - + be_module *msg = + new be_module (new UTL_ScopedName (new Identifier ("Messaging"), + 0)); + // Notice the valuetype "ExceptionHolder" that it is defined in the // "Messaging" module inherit_vt->set_defined_in (msg); @@ -305,17 +314,20 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) node->name ()->last_component ()->get_string(), ""); - UTL_ScopedName *excep_holder_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); - excep_holder_name->last_component ()->replace_string (excep_holder_local_name.rep ()); + UTL_ScopedName *excep_holder_name = + ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); + excep_holder_name->last_component ()->replace_string ( + excep_holder_local_name.rep () + ); AST_Interface_ptr *p_intf = new AST_Interface_ptr[1]; p_intf[0] = ACE_static_cast (AST_Interface *, inherit_vt); - be_valuetype *excep_holder = new be_valuetype (excep_holder_name, // name - p_intf, // list of inherited - 1, // number of inherited - 0, // pragmas - 0); // set abstract + be_valuetype *excep_holder = + new be_valuetype (excep_holder_name, // name + p_intf, // list of inherited + 1, // number of inherited + 0); // set abstract excep_holder->set_name (excep_holder_name); // Now our customized valuetype is created, we have to @@ -333,15 +345,18 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) while (!si->is_done ()) { AST_Decl *d = si->item (); + if (!d) { delete si; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_amh_pre_proc::visit_interface - " + "(%N:%l) be_visitor_amh_pre_proc::" + "visit_interface - " "bad node in this scope\n"), 0); } + be_decl *op = be_decl::narrow_from_decl (d); if (d->node_type () == AST_Decl::NT_attr) @@ -388,8 +403,11 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node) node->name ()->last_component ()->get_string(), ""); - UTL_ScopedName *amh_class_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); - amh_class_name->last_component ()->replace_string (amh_class_local_name.rep ()); + UTL_ScopedName *amh_class_name = + ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); + amh_class_name->last_component ()->replace_string ( + amh_class_local_name.rep () + ); // AST_Interface_ptr *p_intf = new AST_Interface_ptr[1]; @@ -399,7 +417,6 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node) 0, // number of inherited 0, // list of ancestors 0, // number of ancestors - 0, // pragmas 0, // non-local 0); // non-abstract amh_class->set_name (amh_class_name); @@ -437,7 +454,8 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node) if (!attribute) return 0; - /* be_operation *get_operation = this->generate_get_operation (attribute); + /* + be_operation *get_operation = this->generate_get_operation (attribute); this->create_response_handler_operation (get_operation, response_handler); @@ -497,20 +515,22 @@ be_visitor_amh_pre_proc::create_amh_class (be_interface *node) node->name ()->last_component ()->get_string(), "ResponseHandler"); - UTL_ScopedName *rh_class_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); - rh_class_name->last_component ()->replace_string (rh_class_local_name.rep ()); + UTL_ScopedName *rh_class_name = + ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); + rh_class_name->last_component ()->replace_string ( + rh_class_local_name.rep () + ); // AST_Interface_ptr *p_intf = new AST_Interface_ptr[1]; be_interface *rh_class = new be_interface (rh_class_name, // name - 0, // list of inherited - 0, // number of inherited - 0, // list of ancestors - 0, // number of ancestors - 0, // pragmas - 0, // non-local - 0); // non-abstract + 0, // list of inherited + 0, // number of inherited + 0, // list of ancestors + 0, // number of ancestors + 0, // non-local + 0); // non-abstract rh_class->set_name (rh_class_name); return rh_class; @@ -531,21 +551,18 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, return 0; // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), //1, 0, I_FALSE), - 0), - 0); - - ACE_CString original_op_name (node - ->name () - ->last_component () - ->get_string ()); - - UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ()); - op_name->nconc (new UTL_ScopedName ( - new Identifier ( - original_op_name.rep ()), + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); + + ACE_CString original_op_name ( + node->name ()->last_component ()->get_string () + ); + + UTL_ScopedName *op_name = + ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ()); + op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()), 0)); // Create the operation @@ -553,14 +570,14 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); ACE_CString new_op_name = ACE_CString ("reply_") + original_op_name; - UTL_ScopedName *rtop_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ()); + UTL_ScopedName *rtop_name = + ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ()); op_name->last_component ()->replace_string (new_op_name.rep ()); // Create the operation @@ -568,7 +585,6 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, AST_Operation::OP_noflags, rtop_name, 0, - 0, 0); rtoperation->set_name (op_name); @@ -600,7 +616,8 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, { delete si; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_amh_pre_proc::create_response_handler_operation - " + "(%N:%l) be_visitor_amh_pre_proc::" + "create_response_handler_operation - " "bad node in this scope\n"), -1); @@ -614,8 +631,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (original_arg->direction (), original_arg->field_type (), - original_arg->name (), - 0); + original_arg->name ()); operation->add_argument_to_scope (arg); } @@ -625,8 +641,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (original_arg->direction (), original_arg->field_type (), - original_arg->name (), - 0); + original_arg->name ()); rtoperation->add_argument_to_scope (arg); } @@ -657,8 +672,10 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, be_interface * -be_visitor_amh_pre_proc::create_response_handler (be_interface *node, - be_valuetype * /*excep_holder*/) +be_visitor_amh_pre_proc::create_response_handler ( + be_interface *node, + be_valuetype * /*excep_holder*/ + ) { // Generate 'Stock::AMH_QuoterResponseHandler' ACE_CString class_name (node->client_enclosing_scope ()); @@ -668,14 +685,14 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, UTL_ScopedName *inherit_name = new UTL_ScopedName (new Identifier (class_name.rep ()), 0); - be_interface *inherit_intf = new be_interface (inherit_name, - 0, // inherited interfaces - 0, // number of inherited interfaces - 0, // ancestors - 0, // number of ancestors - 0, // pragmas - 1, // not local - 0); // not abstract + be_interface *inherit_intf = + new be_interface (inherit_name, + 0, // inherited interfaces + 0, // number of inherited interfaces + 0, // ancestors + 0, // number of ancestors + 0, // not local + 0); // not abstract inherit_intf->set_name (inherit_name); // Generate 'TAO_AMH_ResponseHandler': This is fixed and same for any RH. @@ -683,14 +700,14 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, UTL_ScopedName *tao_inherit_name = new UTL_ScopedName (new Identifier (tao_rh_name.rep ()), 0); - be_interface *tao_inherit_intf = new be_interface (tao_inherit_name, - 0, // inherited interfaces - 0, // number of inherited interfaces - 0, // ancestors - 0, // number of ancestors - 0, // pragmas - 1, // not local - 0); // not abstract + be_interface *tao_inherit_intf = + new be_interface (tao_inherit_name, + 0, // inherited interfaces + 0, // number of inherited interfaces + 0, // ancestors + 0, // number of ancestors + 1, // not local + 0); // not abstract tao_inherit_intf->set_name (tao_inherit_name); @@ -702,8 +719,11 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, node->name ()->last_component ()->get_string(), "ResponseHandler"); - UTL_ScopedName *response_handler_name = ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); - response_handler_name->last_component ()->replace_string (response_handler_local_name.rep ()); + UTL_ScopedName *response_handler_name = + ACE_static_cast (UTL_ScopedName *, node->name ()->copy ()); + response_handler_name->last_component ()->replace_string ( + response_handler_local_name.rep () + ); AST_Interface_ptr *p_intf = new AST_Interface_ptr[2]; p_intf[0] = ACE_static_cast (AST_Interface *, inherit_intf); @@ -714,8 +734,7 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, p_intf, // list of inherited 2, // number of inherited p_intf, // list of ancestors - 2, // number of ancestors - 0, // pragmas + 1, // number of ancestors 0, // non-local 0); // non-abstract response_handler->set_name (response_handler_name); @@ -740,7 +759,8 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, { delete si; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_amh_pre_proc::visit_interface - " + "(%N:%l) be_visitor_amh_pre_proc::" + "visit_interface - " "bad node in this scope\n"), 0); @@ -751,17 +771,20 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, be_attribute *attribute = be_attribute::narrow_from_decl (d); if (!attribute) - return 0; - /* - be_operation *get_operation = this->generate_get_operation (attribute); - this->create_response_handler_operation (get_operation, - response_handler); + { + return 0; + } +/* + be_operation *get_operation = + this->generate_get_operation (attribute); + this->create_response_handler_operation (get_operation, + response_handler); - this->create_excep_operation (get_operation, - response_handler, - excep_holder); + this->create_excep_operation (get_operation, + response_handler, + excep_holder); - if (!attribute->readonly ()) + if (!attribute->readonly ()) { be_operation *set_operation = this->generate_set_operation (attribute); this->create_response_handler_operation (set_operation, @@ -771,26 +794,29 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, response_handler, excep_holder); } - */ +*/ } else { - be_operation* operation = be_operation::narrow_from_decl (d); + if (operation) { this->create_response_handler_operation (operation, response_handler); - /* this->create_excep_operation (be_operation::narrow_from_decl (d), - response_handler, - excep_holder); + /* + this->create_excep_operation (be_operation::narrow_from_decl (d), + response_handler, + excep_holder); */ } } + si->next (); } // end of while loop + delete si; } // end of if @@ -816,36 +842,35 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node, } // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), - 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // Name the operation properly UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, excep_holder->name ()-> copy ()); ACE_CString new_local_name ("raise_"); + if (operation_kind == SET_OPERATION) - new_local_name += "set_"; + { + new_local_name += "set_"; + } else if (operation_kind == GET_OPERATION) - new_local_name += "get_"; - new_local_name += node - ->name () - ->last_component () - ->get_string (); - - op_name->nconc (new UTL_ScopedName ( - new Identifier ( - new_local_name.rep ()), + { + new_local_name += "get_"; + } + + new_local_name += node->name ()->last_component ()->get_string (); + + op_name->nconc (new UTL_ScopedName (new Identifier (new_local_name.rep ()), 0)); be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); operation->set_defined_in (excep_holder); @@ -865,9 +890,14 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node, // Set the proper strategy be_operation_strategy *old_strategy = - operation->set_strategy (new be_operation_ami_exception_holder_raise_strategy (operation)); + operation->set_strategy ( + new be_operation_ami_exception_holder_raise_strategy (operation) + ); + if (old_strategy) - delete old_strategy; + { + delete old_strategy; + } // After having generated the operation we insert it into the // exceptionholder valuetype. @@ -876,171 +906,43 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node, return 0; } -/* -be_operation * -be_visitor_amh_pre_proc::create_sendc_operation (be_operation *node, -int for_arguments) -{ -if (node->flags () == AST_Operation::OP_oneway) -// We do nothing for oneways! -return 0; - -// Create the return type, which is "void" -be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, -new UTL_ScopedName -(new Identifier ("void", 1, 0, I_FALSE), -0), -0); - -// Create the new name -// Prepend "sendc_" to the name of the operation -ACE_CString original_op_name (node -->name () -->last_component () -->get_string ()); -ACE_CString new_op_name = ACE_CString ("sendc_") + original_op_name; - -UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, node->name ()-> copy ()); -op_name->last_component ()->replace_string (new_op_name.rep ()); - -// Create the operation -be_operation * op = new be_operation (rt, -AST_Operation::OP_noflags, -op_name, -0, -0, -0); - -// Create the first argument, which is a Response Handler - -if (for_arguments) -{ -// Create the field type -be_decl *parent = be_scope::narrow_from_scope (node->defined_in ())->decl (); - -// Add the pre- and suffix -ACE_CString excep_holder_name; -this->generate_name (excep_holder_name, -"AMI_", -parent -->name () -->last_component () -->get_string (), -"Handler"); -UTL_ScopedName *field_name = ACE_static_cast (UTL_ScopedName *, parent->name ()->copy ()); -field_name->last_component ()->replace_string (excep_holder_name.rep ()); -be_interface *field_type= new be_interface (field_name, -0, -0, -0, -0, -0, -0, -0); -field_type->set_defined_in (node->defined_in ()); - -// Create the argument -be_argument *arg = new be_argument (AST_Argument::dir_IN, -field_type, // is also a valuetype -new UTL_ScopedName ( -new Identifier ( -"ami_handler", -1, -0, -I_FALSE -), -0 -), -0); - -// Add the response handler to the argument list -op->add_argument_to_scope (arg); - -} - -// Iterate over the arguments and put all the in and inout -// into the new method. -if (node->nmembers () > 0) -{ -// initialize an iterator to iterate thru our scope -UTL_ScopeActiveIterator *si; -ACE_NEW_RETURN (si, -UTL_ScopeActiveIterator (node, -UTL_Scope::IK_decls), -0); - -// continue until each element is visited -while (!si->is_done ()) -{ -AST_Decl *d = si->item (); -if (!d) -{ -delete si; -ACE_ERROR_RETURN ((LM_ERROR, -"(%N:%l) be_visitor_amh_pre_proc::create_sendc_method - " -"bad node in this scope\n"), -0); - -} -//be_decl *arg = be_decl::narrow_from_decl (d); -AST_Argument *original_arg = AST_Argument::narrow_from_decl (d); - -if (original_arg->direction () == AST_Argument::dir_IN || -original_arg->direction () == AST_Argument::dir_INOUT) -{ -// Create the argument -be_argument *arg = new be_argument (AST_Argument::dir_IN, -original_arg->field_type (), -original_arg->name (), -0); - -op->add_argument_to_scope (arg); -} -si->next (); -} // end of while loop -delete si; -} // end of if - -return op; -} -*/ - - int -be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node, - be_interface *response_handler) +be_visitor_amh_pre_proc::create_response_handler_operation ( + be_operation *node, + be_interface *response_handler + ) { if (!node) - return -1; + { + return -1; + } if (node->flags () == AST_Operation::OP_oneway) - // We do nothing for oneways! - return 0; + { + // We do nothing for oneways! + return 0; + } // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void") //, 1, 0, I_FALSE) - , 0), - 0); - - ACE_CString original_op_name (node - ->name () - ->last_component () - ->get_string ()); - - UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ()); - op_name->nconc (new UTL_ScopedName ( - new Identifier ( - original_op_name.rep ()) //, 1, 0, I_FALSE), - , 0)); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); + + ACE_CString original_op_name ( + node->name ()->last_component ()->get_string () + ); + + UTL_ScopedName *op_name = + ACE_static_cast (UTL_ScopedName *, response_handler->name ()-> copy ()); + op_name->nconc (new UTL_ScopedName (new Identifier (original_op_name.rep ()), + 0)); // Create the operation be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); @@ -1050,12 +952,11 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node, { // Create the argument - be_argument *arg = new be_argument (AST_Argument::dir_IN, - node->return_type (), - new UTL_ScopedName - (new Identifier ("return_value") //, 1, 0, I_FALSE) - , 0), - 0); + be_argument *arg = + new be_argument (AST_Argument::dir_IN, + node->return_type (), + new UTL_ScopedName (new Identifier ("return_value"), + 0)); // Add the response handler to the argument list operation->add_argument_to_scope (arg); @@ -1076,15 +977,18 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node, while (!si->is_done ()) { AST_Decl *d = si->item (); + if (!d) { delete si; ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_amh_pre_proc::create_response_handler_operation - " + "(%N:%l) be_visitor_amh_pre_proc::" + "create_response_handler_operation - " "bad node in this scope\n"), -1); } + //be_decl *arg = be_decl::narrow_from_decl (d); AST_Argument *original_arg = AST_Argument::narrow_from_decl (d); @@ -1094,23 +998,16 @@ be_visitor_amh_pre_proc::create_response_handler_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, original_arg->field_type (), - original_arg->name (), - 0); + original_arg->name ()); operation->add_argument_to_scope (arg); } si->next (); } // end of while loop + delete si; } // end of if - /* - // Set the proper strategy - be_operation_strategy *old_strategy = - operation->set_strategy (new be_operation_ami_handler_response_stub_strategy (operation)); - if (old_strategy) - delete old_strategy; -*/ operation->set_defined_in (response_handler); // We do not copy the exceptions because the exceptions @@ -1312,7 +1209,6 @@ be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node) AST_Operation::OP_noflags, get_name, 0, - 0, 0); operation->set_name (get_name); operation->set_defined_in (node->defined_in ()); @@ -1323,10 +1219,9 @@ be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node) be_operation * be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node) { - ACE_CString original_op_name (node - ->name () - ->last_component () - ->get_string ()); + ACE_CString original_op_name ( + node->name ()->last_component ()->get_string () + ); ACE_CString new_op_name = ACE_CString ("set_") + original_op_name; UTL_ScopedName *set_name = ACE_static_cast (UTL_ScopedName *, @@ -1334,17 +1229,15 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node) set_name->last_component ()->replace_string (new_op_name.rep ()); // the return type is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier - ("void"), 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, node->field_type (), - set_name, - 0); + set_name); arg->set_name (node->name ()); // create the operation @@ -1352,7 +1245,6 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node) AST_Operation::OP_noflags, set_name, 0, - 0, 0); operation->set_name (set_name); operation->set_defined_in (node->defined_in ()); 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 2480039d9c1..d0dec09ed9a 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -254,8 +254,7 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) inherit_vt->set_name (inherit_name); be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), - 0), - 0); + 0)); // Notice the valuetype "ExceptionHolder" that it is defined in the // "Messaging" module @@ -277,7 +276,6 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) be_valuetype *excep_holder = new be_valuetype (excep_holder_name, // name p_intf, // list of inherited 1, // number of inherited - 0, // pragmas 0); // set abstract excep_holder->set_name (excep_holder_name); @@ -359,14 +357,12 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, 0, // number of inherited interfaces 0, // ancestors 0, // number of ancestors - 0, // pragmas 0, // not local 0); // not abstract inherit_intf->set_name (inherit_name); be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), - 0), - 0); + 0)); // Notice the interface "ReplyHandler" that it is defined in the // "Messaging" module @@ -392,7 +388,6 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, 1, // number of inherited p_intf, // list of ancestors 1, // number of ancestors - 0, // pragmas 0, // non-local 0); // non-abstract reply_handler->set_name (reply_handler_name); @@ -491,11 +486,11 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, } // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), - 0), - 0); + be_predefined_type *rt = new be_predefined_type ( + AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0) + ); // Name the operation properly UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, @@ -520,7 +515,6 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); operation->set_defined_in (excep_holder); @@ -560,11 +554,11 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, return 0; // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), - 0), - 0); + be_predefined_type *rt = new be_predefined_type ( + AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0) + ); // Create the new name // Prepend "sendc_" to the name of the operation @@ -582,7 +576,6 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, AST_Operation::OP_noflags, op_name, 0, - 0, 0); // Create the first argument, which is a Reply Handler @@ -609,20 +602,15 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, 0, 0, 0, - 0, 0); field_type->set_defined_in (node->defined_in ()); // Create the argument - be_argument *arg = new be_argument (AST_Argument::dir_IN, - field_type, // is also a valuetype - new UTL_ScopedName ( - new Identifier ( - "ami_handler" - ), - 0 - ), - 0); + be_argument *arg = + new be_argument (AST_Argument::dir_IN, + field_type, // is also a valuetype + new UTL_ScopedName (new Identifier ("ami_handler"), + 0)); // Add the reply handler to the argument list op->add_argument_to_scope (arg); @@ -662,8 +650,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, original_arg->field_type (), - original_arg->name (), - 0); + original_arg->name ()); op->add_argument_to_scope (arg); } @@ -691,11 +678,10 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, return 0; // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), - 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); ACE_CString original_op_name (node ->name () @@ -713,7 +699,6 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); @@ -723,13 +708,11 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, { // Create the argument - be_argument *arg = new be_argument (AST_Argument::dir_IN, - node->return_type (), - new UTL_ScopedName - (new Identifier - ("ami_return_val"), - 0), - 0); + be_argument *arg = + new be_argument (AST_Argument::dir_IN, + node->return_type (), + new UTL_ScopedName (new Identifier ("ami_return_val"), + 0)); // Add the reply handler to the argument list operation->add_argument_to_scope (arg); @@ -768,8 +751,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, // Create the argument be_argument *arg = new be_argument (AST_Argument::dir_IN, original_arg->field_type (), - original_arg->name (), - 0); + original_arg->name ()); operation->add_argument_to_scope (arg); } @@ -809,41 +791,32 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, return 0; // Create the return type, which is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier ("void"), - 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // Create the argument - be_argument *arg = new be_argument (AST_Argument::dir_IN, - excep_holder, // is also a valuetype - new UTL_ScopedName ( - new Identifier ( - "excep_holder"), - 0), - 0); + be_argument *arg = + new be_argument (AST_Argument::dir_IN, + excep_holder, // is also a valuetype + new UTL_ScopedName (new Identifier ("excep_holder"), + 0)); // Create the new name // Append _execp to the name of the operation - ACE_CString original_op_name (node - ->name () - ->last_component () - ->get_string ()); + ACE_CString original_op_name (node->name ()->last_component ()->get_string ()); ACE_CString new_op_name = original_op_name + ACE_CString ("_excep"); UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, reply_handler->name ()-> copy ()); - op_name->nconc (new UTL_ScopedName - (new Identifier - (new_op_name.rep ()), - 0)); + op_name->nconc (new UTL_ScopedName (new Identifier (new_op_name.rep ()), + 0)); // create the operation be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, op_name, 0, - 0, 0); operation->set_name (op_name); operation->add_argument_to_scope (arg); @@ -983,7 +956,6 @@ be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node) AST_Operation::OP_noflags, get_name, 0, - 0, 0); operation->set_name (get_name); operation->set_defined_in (node->defined_in ()); @@ -1005,17 +977,15 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) set_name->last_component ()->replace_string (new_op_name.rep ()); // the return type is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier - ("void"), 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, node->field_type (), - set_name, - 0); + set_name); arg->set_name (node->name ()); // create the operation @@ -1023,7 +993,6 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) AST_Operation::OP_noflags, set_name, 0, - 0, 0); operation->set_name (set_name); operation->set_defined_in (node->defined_in ()); diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp index a23feda8a3f..b591c362a4f 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp @@ -23,6 +23,7 @@ #include "be.h" #include "be_visitor_array.h" +#include "be_visitor_enum.h" ACE_RCSID(be_visitor_array, array, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index 14f61f6631d..556c516f9c9 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -73,7 +73,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node) be_operation *op = new be_operation (node->field_type (), AST_Operation::OP_noflags, node->name (), - 0, node->is_local (), node->is_abstract ()); op->set_name ((UTL_IdList *) node->name ()->copy ()); @@ -218,22 +217,19 @@ be_visitor_attribute::visit_attribute (be_attribute *node) // Create the set method. // the return type is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier - ("void"), 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, node->field_type (), - node->name (), - 0); + node->name ()); arg->set_name ((UTL_IdList *) node->name ()->copy ()); // create the operation op = new be_operation (rt, AST_Operation::OP_noflags, node->name (), - 0, node->is_local (), node->is_abstract ()); op->set_name ((UTL_IdList *) node->name ()->copy ()); diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index b2b91d27be4..7a20344fa03 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -262,7 +262,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH: return new be_visitor_interface_fwd_any_op_ch (new_ctx); -# ifdef IDL_HAS_VALUETYPE + // Valuetype-related visitors case TAO_CodeGen::TAO_VALUETYPE_CH: return new be_visitor_valuetype_ch (new_ctx); @@ -271,12 +271,15 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_VALUETYPE_CI: return new be_visitor_valuetype_ci (new_ctx); -#if 0 case TAO_CodeGen::TAO_VALUETYPE_FWD_CH: return new be_visitor_valuetype_fwd_ch (new_ctx); case TAO_CodeGen::TAO_VALUETYPE_FWD_CI: return new be_visitor_valuetype_fwd_ci (new_ctx); -#endif /* 0 */ + + case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH: + return new be_visitor_valuetype_fwd_cdr_op_ch (new_ctx); + case TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI: + return new be_visitor_valuetype_fwd_cdr_op_ci (new_ctx); case TAO_CodeGen::TAO_VALUETYPE_OBV_CH: return new be_visitor_valuetype_obv_ch (new_ctx); @@ -304,13 +307,21 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CI: return new be_visitor_valuetype_cdr_op_ci (new_ctx); case TAO_CodeGen::TAO_VALUETYPE_CDR_OP_CS: - return new be_visitor_decl (new_ctx); // noop + return new be_visitor_valuetype_cdr_op_cs (new_ctx); case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CH: case TAO_CodeGen::TAO_VALUETYPE_ANY_OP_CS: return new be_visitor_decl (new_ctx); // @@ TODO -# endif /* IDL_HAS_VALUETYPE */ + case TAO_CodeGen::TAO_VALUETYPE_INIT_CH: + return new be_visitor_valuetype_init_ch (new_ctx); + case TAO_CodeGen::TAO_VALUETYPE_INIT_CI: + return new be_visitor_valuetype_init_ci (new_ctx); + case TAO_CodeGen::TAO_VALUETYPE_INIT_CS: + return new be_visitor_valuetype_init_cs (new_ctx); + + case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH: + return new be_visitor_valuetype_init_arglist_ch (new_ctx); case TAO_CodeGen::TAO_STRUCT_CH: return new be_visitor_structure_ch (new_ctx); @@ -790,10 +801,3 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) } } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index fd4a7b041f9..fc31f03ac39 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -43,6 +43,12 @@ be_visitor_module::~be_visitor_module (void) // visit the Module node and its scope int be_visitor_module::visit_module (be_module *node) { + if (node->nmembers () == 0) + { + idl_global->err ()->error1 (UTL_Error::EIDL_EMPTY_MODULE, + node); + } + // all we have to do is to visit the scope if (this->visit_scope (node) == -1) { @@ -50,6 +56,7 @@ int be_visitor_module::visit_module (be_module *node) "(%N:%l) be_visitor_module::visit_module - " "codegen for scope failed\n"), -1); } + return 0; } @@ -473,8 +480,6 @@ be_visitor_module::visit_interface_fwd (be_interface_fwd *node) return 0; } -#ifdef IDL_HAS_VALUETYPE - // visit an valuetype int be_visitor_module::visit_valuetype (be_valuetype *node) @@ -583,7 +588,7 @@ be_visitor_module::visit_valuetype (be_valuetype *node) return 0; } -// visit an valuetype_fwd +// visit a valuetype_fwd int be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node) { @@ -604,21 +609,21 @@ be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node) case TAO_CodeGen::TAO_MODULE_CI: ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CI); break; + case TAO_CodeGen::TAO_MODULE_CDR_OP_CH: + ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CH); + break; case TAO_CodeGen::TAO_MODULE_CDR_OP_CI: ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI); break; case TAO_CodeGen::TAO_MODULE_CDR_OP_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CS); - break; case TAO_CodeGen::TAO_MODULE_ANY_OP_CH: case TAO_CodeGen::TAO_MODULE_ANY_OP_CS: - case TAO_CodeGen::TAO_MODULE_CDR_OP_CH: 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_IS: case TAO_CodeGen::TAO_MODULE_IH: + case TAO_CodeGen::TAO_MODULE_IS: return 0; // nothing to be done default: { @@ -653,8 +658,6 @@ be_visitor_module::visit_valuetype_fwd (be_valuetype_fwd *node) return 0; } -#endif /* IDL_HAS_VALUETYPE */ - // visit an structure int be_visitor_module::visit_structure (be_structure *node) diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index d57cf009866..9852c8857f5 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -143,7 +143,6 @@ int be_visitor_root::visit_root (be_root *node) be_visitor *visitor; be_visitor_context ctx (*this->ctx_); -#ifdef IDL_HAS_VALUETYPE // make one more pass over the entire tree and generate the OBV_ namespaces // and OBV_ classes @@ -187,7 +186,6 @@ int be_visitor_root::visit_root (be_root *node) } delete visitor; } -#endif /* IDL_HAS_VALUETYPE */ // The next thing we need to do is make one more pass thru the entire tree // and generate code for all the <<= and >>= operators for all the @@ -763,9 +761,7 @@ be_visitor_root::visit_interface_fwd (be_interface_fwd *node) return 0; } -#ifdef IDL_HAS_VALUETYPE - -// visit an valuetype +// visit a valuetype int be_visitor_root::visit_valuetype (be_valuetype *node) { @@ -901,8 +897,6 @@ be_visitor_root::visit_valuetype_fwd (be_valuetype_fwd *node) ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CI); break; case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - ctx.state (TAO_CodeGen::TAO_VALUETYPE_FWD_CDR_OP_CS); - break; case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: case TAO_CodeGen::TAO_ROOT_CS: @@ -945,9 +939,7 @@ be_visitor_root::visit_valuetype_fwd (be_valuetype_fwd *node) return 0; } -#endif /* IDL_HAS_VALUETYPE */ - -// visit an module +// visit a module int be_visitor_root::visit_module (be_module *node) { 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 8c71efb085c..ae3536245da 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp @@ -100,6 +100,18 @@ be_visitor_sequence_buffer_type::visit_interface_fwd (be_interface_fwd *node) } int +be_visitor_sequence_buffer_type::visit_valuetype (be_valuetype *node) +{ + return this->visit_interface (node); +} + +int +be_visitor_sequence_buffer_type::visit_valuetype_fwd (be_valuetype_fwd *node) +{ + return this->visit_interface_fwd (node); +} + +int be_visitor_sequence_buffer_type::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp index 399992eadfb..3258ee8ddc0 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp @@ -266,6 +266,18 @@ be_visitor_sequence_cdr_op_cs::visit_interface_fwd (be_interface_fwd *node) } int +be_visitor_sequence_cdr_op_cs::visit_valuetype (be_valuetype *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_cdr_op_cs::visit_valuetype_fwd (be_valuetype_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_cdr_op_cs::visit_predefined_type (be_predefined_type *node) { TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp index 7ce182d7966..1232a499956 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp @@ -142,6 +142,33 @@ be_visitor_sequence_elemtype::visit_interface (be_interface *node) } int +be_visitor_sequence_elemtype::visit_valuetype (be_valuetype *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH) + { + *os << "TAO_Valuetype_Manager<"; + *os << bt->nested_type_name (this->ctx_->scope ()) << ", "; + *os << bt->nested_type_name (this->ctx_->scope (), "_var") << ">"; + } + else + { + *os << "TAO_Valuetype_Manager<"; + *os << bt->name () << ", "; + *os << bt->name () << "_var>"; + } + + return 0; +} + +int be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) { TAO_OutStream *os = this->ctx_->stream (); @@ -169,6 +196,33 @@ be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) } int +be_visitor_sequence_elemtype::visit_valuetype_fwd (be_valuetype_fwd *node) +{ + TAO_OutStream *os = this->ctx_->stream (); + be_type *bt; + + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (this->ctx_->state () == TAO_CodeGen::TAO_SEQELEM_RETTYPE_CH) + { + *os << "TAO_Valuetype_Manager<"; + *os << bt->nested_type_name (this->ctx_->scope ()) << ","; + *os << bt->nested_type_name (this->ctx_->scope (), "_var") << ">"; + } + else + { + *os << "TAO_Valuetype_Manager<"; + *os << bt->name () << ","; + *os << bt->name () << "_var>"; + } + + return 0; +} + +int be_visitor_sequence_elemtype::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp index 7e00afcdf5e..ffdbd9d742d 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ch.cpp @@ -113,6 +113,7 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node) && prim && prim->pt () == AST_PredefinedType::PT_pseudo && ACE_OS::strcmp (prim->local_name ()->get_string (), "Object") != 0; + int is_valuetype = 0; // operator[] if (is_pseudo_object) @@ -121,6 +122,19 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node) } else { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + + if (is_valuetype) + *os << "TAO_Valuetype_Manager<"; + else *os << "TAO_Object_Manager<"; } @@ -171,7 +185,7 @@ be_visitor_sequence_ch::gen_bounded_obj_sequence (be_sequence *node) << "CORBA::ULong ol" << be_uidt_nl << ");" << be_uidt_nl << be_nl; - if (!is_pseudo_object) + if (! (is_pseudo_object || is_valuetype)) { // Pseudo objects do not require these methods. *os << "virtual void _downcast (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp index 6d0af4f55a4..73c86e19f8e 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_ci.cpp @@ -151,7 +151,24 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) << "{" << be_idt_nl << "buf[i] = "; - if (bt_is_defined) + int is_valuetype = 0; + { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + } + + if (is_valuetype) + { + *os << "0;"; + } + else if (bt_is_defined) { bt->accept (visitor); @@ -180,7 +197,14 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) << "{" << be_idt_nl << "if (buffer[i] != "; - if (bt_is_defined) + if (is_valuetype) + { + *os << "0)" << be_idt_nl + << "{" << be_idt_nl + << "buffer[i]->_remove_ref ();" << be_nl + << "buffer[i] = 0;" << be_uidt_nl; + } + else if (bt_is_defined) { bt->accept (visitor); @@ -256,9 +280,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) *os << "** ACE_CAST_CONST, rhs.buffer_);" << be_nl << "for (CORBA::ULong i = 0; i < rhs.length_; i++)" << be_idt_nl - << "{" << be_idt_nl - << "tmp1[i] = "; + << "{" << be_idt_nl; + if (is_valuetype) + { + *os << "if (tmp2[i] != 0)" << be_idt_nl + << "tmp2[i]->_add_ref ();" << be_uidt_nl + << "tmp1[i] = tmp2[i];"; + } + else + { + *os << "tmp1[i] = "; if (bt_is_defined) { bt->accept (visitor); @@ -269,6 +301,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) { *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);"; } + } *os << be_uidt_nl << "}" << be_uidt_nl << be_nl @@ -304,7 +337,13 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl << "{" << be_idt_nl; - if (bt_is_defined) + if (is_valuetype) + { + *os << "if (tmp[i] != 0)" << be_idt_nl + << "tmp[i]->_remove_ref ();" << be_uidt_nl + << "tmp[i] = 0;"; + } + else if (bt_is_defined) { *os << "CORBA::release (tmp[i]);" << be_nl << "tmp[i] = "; @@ -346,9 +385,17 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) *os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl << "for (CORBA::ULong i=0; i < rhs.length_; ++i)" << be_idt_nl - << "{" << be_idt_nl - << "tmp1[i] = "; + << "{" << be_idt_nl; + if (is_valuetype) + { + *os << "if (tmp2[i] != 0)" << be_idt_nl + << "tmp2[i]->_add_ref ();" << be_uidt_nl + << "tmp1[i] = tmp2[i];"; + } + else + { + *os << "tmp1[i] = "; if (bt_is_defined) { bt->accept (visitor); @@ -359,6 +406,7 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) { *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);"; } + } *os << be_uidt_nl << "}" << be_uidt_nl << be_nl @@ -374,7 +422,6 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) && prim && prim->pt () == AST_PredefinedType::PT_pseudo && ACE_OS::strcmp (prim->local_name ()->get_string (), "Object") != 0; - // operator[]. if (is_pseudo_object) { @@ -382,6 +429,9 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) } else { + if (is_valuetype) + *os << "TAO_Valuetype_Manager<"; + else *os << "ACE_INLINE TAO_Object_Manager<"; } @@ -406,6 +456,9 @@ be_visitor_sequence_ci::gen_bounded_obj_sequence (be_sequence *node) } else { + if (is_valuetype) + *os << "return TAO_Valuetype_Manager<"; + else *os << "return TAO_Object_Manager<"; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp index 5bf1fa9988d..09ca692b39e 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_bounded_obj_sequence_cs.cpp @@ -80,6 +80,19 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node) bt_is_defined = ibt->is_defined (); } + int is_valuetype = 0; + { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + } + const char * class_name = node->instance_name (); static char full_class_name [NAMEBUFSIZE]; @@ -179,7 +192,13 @@ be_visitor_sequence_cs::gen_bounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = nl; i < ol; ++i)" << be_nl << "{" << be_idt_nl; - if (bt_is_defined) + if (is_valuetype) + { + *os << "if (tmp[i] != 0)" << be_idt_nl + << "tmp[i]->_remove_ref ();" << be_uidt_nl + << "tmp[i] = 0;"; + } + else if (bt_is_defined) { *os << "CORBA::release (tmp[i]);" << be_nl << "tmp[i] = "; diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp index eeaa464acf9..e2f621e3aff 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ch.cpp @@ -118,6 +118,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node) && prim && prim->pt () == AST_PredefinedType::PT_pseudo && ACE_OS::strcmp (prim->local_name ()->get_string (), "Object") != 0; + int is_valuetype = 0; if (is_pseudo_object) { @@ -125,6 +126,19 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node) } else { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + + if (is_valuetype) + *os << "TAO_Valuetype_Manager<"; + else *os << "TAO_Object_Manager<"; } @@ -176,7 +190,7 @@ be_visitor_sequence_ch::gen_unbounded_obj_sequence (be_sequence *node) << "CORBA::ULong ol" << be_uidt_nl << ");" << be_uidt_nl << be_nl; - if (!is_pseudo_object) + if (! (is_pseudo_object || is_valuetype)) { // Pseudo objects do not require these methods. *os << "virtual void _downcast (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp index aefb0f1509a..d3801f4644a 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_ci.cpp @@ -147,7 +147,24 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) << "{" << be_idt_nl << "buf[i] = "; - if (bt_is_defined) + int is_valuetype = 0; + { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + } + + if (is_valuetype) + { + *os << "0;"; + } + else if (bt_is_defined) { bt->accept (visitor); @@ -233,9 +250,17 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) *os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl << be_nl << "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl - << "{" << be_idt_nl - << "tmp1[i] = "; + << "{" << be_idt_nl; + if (is_valuetype) + { + *os << "if (tmp2[i] != 0)" << be_idt_nl + << "tmp2[i]->_add_ref ();" << be_uidt_nl + << "tmp1[i] = tmp2 [i];"; + } + else + { + *os << "tmp1[i] = "; if (bt_is_defined) { bt->accept (visitor); @@ -246,6 +271,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) { *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);"; } + } *os << be_uidt_nl << "}" << be_uidt_nl << be_nl @@ -280,7 +306,13 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_nl << "{" << be_idt_nl; - if (bt_is_defined) + if (is_valuetype) + { + *os << "if (tmp[i] != 0)" << be_idt_nl + << "tmp[i]->_remove_ref ();" << be_uidt_nl + << "tmp[i] = 0;"; + } + else if (bt_is_defined) { *os << "CORBA::release (tmp[i]);" << be_nl << "tmp[i] = "; @@ -329,9 +361,17 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) *os << " ** ACE_CAST_CONST, rhs.buffer_);" << be_nl << be_nl << "for (CORBA::ULong i = 0; i < rhs.length_; ++i)" << be_idt_nl - << "{" << be_idt_nl - << "tmp1[i] = "; + << "{" << be_idt_nl; + if (is_valuetype) + { + *os << "if (tmp2[i] != 0)" << be_idt_nl + << "tmp2[i]->_add_ref ();" << be_uidt_nl + << "tmp1[i] = tmp2 [i];"; + } + else + { + *os << "tmp1[i] = "; if (bt_is_defined) { bt->accept (visitor); @@ -342,7 +382,7 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) { *os << "tao_" << pt->flat_name () << "_duplicate (tmp2[i]);"; } - + } *os << be_uidt_nl << "}" << be_uidt_nl << be_nl << "return *this;" << be_uidt_nl @@ -356,13 +396,15 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) && prim && prim->pt () == AST_PredefinedType::PT_pseudo && ACE_OS::strcmp (prim->local_name ()->get_string (), "Object") != 0; - if (is_pseudo_object) { *os << "ACE_INLINE TAO_Pseudo_Object_Manager<"; } else { + if (is_valuetype) + *os << "ACE_INLINE TAO_Valuetype_Manager<"; + else *os << "ACE_INLINE TAO_Object_Manager<"; } @@ -388,6 +430,9 @@ be_visitor_sequence_ci::gen_unbounded_obj_sequence (be_sequence *node) } else { + if (is_valuetype) + *os << "return TAO_Valuetype_Manager<"; + else *os << "return TAO_Object_Manager<"; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp index fc74d1b974c..00d7afbae3b 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/gen_unbounded_obj_sequence_cs.cpp @@ -79,6 +79,19 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) bt_is_defined = ibt->is_defined (); } + int is_valuetype = 0; + { + be_interface *bf = be_interface::narrow_from_decl (pt); + if (bf != 0) + is_valuetype = bf->is_valuetype (); + else + { + be_interface_fwd *bff = be_interface_fwd::narrow_from_decl (pt); + if (bff != 0) + is_valuetype = bff->is_valuetype (); + } + } + const char * class_name = node->instance_name (); static char full_class_name [NAMEBUFSIZE]; @@ -140,9 +153,17 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl << "{" << be_idt_nl << "if (!this->release_)" << be_idt_nl - << "{" << be_idt_nl - << "tmp[i] = "; + << "{" << be_idt_nl; + if (is_valuetype) + { + *os << "if (old[i] != 0)" << be_idt_nl + << "old[i]->_add_ref ();" << be_uidt_nl + << "tmp[i] = old[i];"; + } + else + { + *os << "tmp[i] = "; if (bt_is_defined) { bt->accept (visitor); @@ -153,6 +174,7 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) { *os << "tao_" << pt->flat_name () << "_duplicate (old[i]);"; } + } *os << be_uidt_nl << "}" << be_uidt_nl @@ -187,7 +209,13 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = 0; i < this->length_; ++i)" << be_idt_nl << "{" << be_idt_nl; - if (bt_is_defined) + if (is_valuetype) + { + *os << "if (tmp[i] != 0)" << be_idt_nl + << "tmp[i]->_remove_ref ();" << be_uidt_nl + << "tmp[i] = 0;"; + } + else if (bt_is_defined) { *os << "CORBA::release (tmp[i]);" << be_nl << "tmp[i] = "; @@ -233,7 +261,13 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) << "for (CORBA::ULong i = nl; i < ol; ++i)" << be_idt_nl << "{" << be_idt_nl; - if (bt_is_defined) + if (is_valuetype) + { + *os << "if (tmp[i] != 0)" << be_idt_nl + << "tmp[i]->_remove_ref ();" << be_uidt_nl + << "tmp[i] = 0;"; + } + else if (bt_is_defined) { *os << "CORBA::release (tmp[i]);" << be_nl << "tmp[i] = "; @@ -256,7 +290,8 @@ be_visitor_sequence_cs::gen_unbounded_obj_sequence (be_sequence *node) be_predefined_type *prim = be_predefined_type::narrow_from_decl (pt); - if ((pt->node_type () != AST_Decl::NT_pre_defined) || + if (! is_valuetype + && (pt->node_type () != AST_Decl::NT_pre_defined) || (prim && (prim->pt () == AST_PredefinedType::PT_pseudo) && (!ACE_OS::strcmp (prim->local_name ()->get_string (), "Object")))) { 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 e1abbe883f1..cef298252f5 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_base.cpp @@ -108,6 +108,18 @@ be_visitor_sequence_base::visit_interface_fwd (be_interface_fwd *node) } int +be_visitor_sequence_base::visit_valuetype (be_valuetype *node) +{ + return this->visit_node (node); +} + +int +be_visitor_sequence_base::visit_valuetype_fwd (be_valuetype_fwd *node) +{ + return this->visit_node (node); +} + +int be_visitor_sequence_base::visit_string (be_string *) { // NO-OP, we have ad-hoc classes from strings. @@ -163,22 +175,6 @@ be_visitor_sequence_base::visit_typedef (be_typedef *node) return 0; } -#if defined(IDL_HAS_VALUETYPE) - -int -be_visitor_sequence_base::visit_valuetype (be_valuetype *node) -{ - return this->visit_node (node); -} - -int -be_visitor_sequence_base::visit_valuetype_fwd (be_valuetype_fwd *node) -{ - return this->visit_node (node); -} -#endif /*IDL_HAS_VALUETYPE*/ - - be_visitor_sequence_base_template_args:: be_visitor_sequence_base_template_args (be_visitor_context *ctx, be_sequence *seq) @@ -256,6 +252,20 @@ be_visitor_sequence_base_template_args::visit_interface_fwd ( } int +be_visitor_sequence_base_template_args::visit_valuetype (be_valuetype *node) +{ + return this->visit_interface (node); +} + +int +be_visitor_sequence_base_template_args::visit_valuetype_fwd ( + be_valuetype_fwd *node + ) +{ + return this->visit_interface_fwd (node); +} + +int be_visitor_sequence_base_template_args::visit_predefined_type ( be_predefined_type *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 a516a5ab189..a61157f193c 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp @@ -90,6 +90,17 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node) } break; + case be_sequence::MNG_VALUE: + if (node->unbounded ()) + { + *os << "TAO_Unbounded_Valuetype_Sequence<"; + } + else + { + *os << "TAO_Bounded_Valuetype_Sequence<"; + } + + break; case be_sequence::MNG_STRING: if (node->unbounded ()) { @@ -225,6 +236,7 @@ be_visitor_sequence_ch::instantiate_sequence (be_sequence *node) { case be_sequence::MNG_PSEUDO: case be_sequence::MNG_OBJREF: + case be_sequence::MNG_VALUE: if (node->unbounded ()) { this->gen_unbounded_obj_sequence (node); 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 151610e5c37..397f094f9c8 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp @@ -114,6 +114,7 @@ be_visitor_sequence_ci::instantiate_sequence (be_sequence *node) { case be_sequence::MNG_PSEUDO: case be_sequence::MNG_OBJREF: + case be_sequence::MNG_VALUE: if (node->unbounded ()) { this->gen_unbounded_obj_sequence (node); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp index ba0e7ecb4e6..e02b632b837 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp @@ -83,6 +83,12 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node) else *os << "TAO_Bounded_Pseudo_Sequence<"; break; + case be_sequence::MNG_VALUE: + if (node->unbounded ()) + *os << "TAO_Unbounded_Valuetype_Sequence<"; + else + *os << "TAO_Bounded_Valuetype_Sequence<"; + break; case be_sequence::MNG_STRING: if (node->unbounded ()) *os << "TAO_Unbounded_String_Sequence"; @@ -341,6 +347,7 @@ be_visitor_sequence_cs::instantiate_sequence (be_sequence *node) { case be_sequence::MNG_PSEUDO: case be_sequence::MNG_OBJREF: + case be_sequence::MNG_VALUE: if (node->unbounded ()) this->gen_unbounded_obj_sequence (node); else diff --git a/TAO/TAO_IDL/be/be_visitor_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode.cpp index 5012a6f795b..9267ece581e 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode.cpp @@ -30,12 +30,3 @@ ACE_RCSID(be, be_visitor_typecode, "$Id$") -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Node<be_visitor_typecode_defn::QNode*>; -template class ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*>; -template class ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Node<be_visitor_typecode_defn::QNode*> -#pragma instantiate ACE_Unbounded_Queue<be_visitor_typecode_defn::QNode*> -#pragma instantiate ACE_Unbounded_Queue_Iterator<be_visitor_typecode_defn::QNode*> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp index 314d324164e..084e20f9aa3 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp @@ -206,30 +206,37 @@ int be_visitor_union_cdr_op_ci::pre_process (be_decl *bd) { if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE) - return 0; + { + return 0; + } TAO_OutStream *os = this->ctx_->stream (); be_union_branch* b = be_union_branch::narrow_from_decl (bd); - for (unsigned long i = 0; - i < b->label_list_length (); - ++i) + for (unsigned long i = 0; i < b->label_list_length (); ++i) { // check if we are printing the default case if (b->label (i)->label_kind () == AST_UnionLabel::UL_default) - *os << "default:"; + { + *os << "default:"; + } else { *os << "case "; b->gen_label_value (os, i); *os << ":"; } + if (i == (b->label_list_length () - 1)) - *os << be_idt_nl; + { + *os << be_idt_nl; + } else - *os << be_nl; + { + *os << be_nl; + } } *os << "{" << be_idt_nl; @@ -237,10 +244,12 @@ be_visitor_union_cdr_op_ci::pre_process (be_decl *bd) } int -be_visitor_union_cdr_op_ci::post_process (be_decl *) +be_visitor_union_cdr_op_ci::post_process (be_decl *bd) { if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_SCOPE) - return 0; + { + return 0; + } TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp index 05c2f5658e4..9b587156792 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp @@ -23,8 +23,6 @@ #include "idl_extern.h" #include "be.h" -#ifdef IDL_HAS_VALUETYPE - #include "be_visitor_valuetype.h" #include "be_visitor_valuetype/valuetype.cpp" @@ -36,6 +34,7 @@ #include "be_visitor_valuetype/valuetype_cs.cpp" #include "be_visitor_valuetype/cdr_op_ch.cpp" #include "be_visitor_valuetype/cdr_op_ci.cpp" +#include "be_visitor_valuetype/cdr_op_cs.cpp" #include "be_visitor_valuetype/marshal_ch.cpp" #include "be_visitor_valuetype/marshal_cs.cpp" #include "be_visitor_valuetype/arglist.cpp" @@ -47,6 +46,10 @@ #include "be_visitor_valuetype/obv_module.cpp" #include "be_visitor_valuetype/ami_exception_holder_ch.cpp" #include "be_visitor_valuetype/ami_exception_holder_cs.cpp" +#include "be_visitor_valuetype/valuetype_init.cpp" +#include "be_visitor_valuetype/valuetype_init_ch.cpp" +#include "be_visitor_valuetype/valuetype_init_ci.cpp" +#include "be_visitor_valuetype/valuetype_init_cs.cpp" +#include "be_visitor_valuetype/valuetype_init_arglist_ch.cpp" -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp index a448991e636..33aff951ba3 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_ch.cpp @@ -76,24 +76,6 @@ be_visitor_valuetype_ami_exception_holder_ch::visit_valuetype (be_valuetype *nod *os << be_uidt_nl << "};" << be_nl << be_nl; - - // Create code for the valuetype factory - - *os << "class " << node->local_name () << "_factory" << be_idt_nl - << ": public " - << node->full_name () << "_init" << be_uidt_nl - << "{" << be_idt_nl - << "friend class " << node->local_name () << ";" << be_uidt_nl - << "public:" << be_idt_nl - << "// create (...) would go here" << be_nl - << be_uidt_nl << "private:" << be_idt_nl; - - *os << "virtual ~" << node->local_name () << "_factory ();" << be_nl << be_nl; - - *os << "TAO_OBV_CREATE_RETURN_TYPE (" << node->local_name () - << ") create_for_unmarshal ();" << be_nl << be_uidt_nl - << "};" << be_uidt_nl; - return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp index 02bf3872d27..8d22f9cdae1 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/ami_exception_holder_cs.cpp @@ -70,30 +70,6 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_valuetype (be_valuetype *nod "codegen for scope failed\n"), -1); } - - // Create the code for the valuetype factory - os->indent (); - - if (node->is_nested () && - node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - *os << "OBV_"; - - *os << node->full_name () << "_factory::~" << node->local_name () << "_factory ()" - << "{ }" << be_nl << be_nl; - - *os << "TAO_OBV_CREATE_RETURN_TYPE (" << node->local_name () << ")" << be_nl; - - if (node->is_nested () && - node->defined_in ()->scope_node_type () == AST_Decl::NT_module) - *os << "OBV_"; - - *os << node->full_name () << "_factory::create_for_unmarshal ()" << be_nl - << "{" << be_idt_nl - << "//return 0;" << be_nl - << "return new " << node->compute_local_name ("_tao_", "") << ";" << be_uidt_nl - << "}" << be_nl - << "\n"; - return 0; } @@ -104,6 +80,7 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *nod be_visitor_context ctx (*this->ctx_); ctx.state (TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS); be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) { ACE_ERROR_RETURN ((LM_ERROR, @@ -122,6 +99,7 @@ be_visitor_valuetype_ami_exception_holder_cs::visit_operation (be_operation *nod "codegen for argument list failed\n"), -1); } + delete visitor; return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp index 16a266dfc79..9e668a4b1ec 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp @@ -102,17 +102,17 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node) { case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: // Each method is pure virtual in the Valuetype class. - *os << " = 0;" << be_uidt_nl; + *os << " = 0;" << be_nl; break; case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: break; case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: break; case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CH: - *os << ";\n"; + *os << ";" << be_nl; case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS: default: - *os << "\n"; + *os << be_nl; } if (!this->ctx_->attribute ()) // hack to get a nice newline diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp index b23d0243509..6d0eb38c78f 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ch.cpp @@ -42,20 +42,39 @@ be_visitor_valuetype_cdr_op_ch::~be_visitor_valuetype_cdr_op_ch (void) int be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node) { - if (node->cli_hdr_cdr_op_gen () || node->imported ()) - return 0; + if (node->imported ()) + { + return 0; + } TAO_OutStream *os = this->ctx_->stream (); + os->indent (); //start with whatever indentation level we are at now + + if (!node->cli_hdr_cdr_op_gen ()) + { + // Generate helper functions declaration. + if (node->gen_helper_header () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cdr_op_ch::" + "visit_valuetype - " + "codegen for helper functions failed\n"), -1); + } - // generate the CDR << and >> operator declarations (prototypes) + // generate the CDR << and >> operator declarations (prototypes) - os->indent (); - *os << be_global->stub_export_macro () << " CORBA::Boolean" - << " operator<< (TAO_OutputCDR &, const " << node->full_name () - << " *); // " << be_nl; - *os << be_global->stub_export_macro () << " CORBA::Boolean" - << " operator>> (TAO_InputCDR &, " - << node->full_name () << " *&);\n"; + os->indent (); //start with whatever indentation level we are at now + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator<< (TAO_OutputCDR &, const " + << node->full_name () << " *);" << be_nl; + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator>> (TAO_InputCDR &, " + << node->full_name () << " *&);" << be_nl; + + node->cli_hdr_cdr_op_gen (1); + } // set the substate as generating code for the types defined in our scope this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_SCOPE); @@ -66,17 +85,17 @@ be_visitor_valuetype_cdr_op_ch::visit_valuetype (be_valuetype *node) "(%N:%l) be_visitor_valuetype_cdr_op_ch::" "visit_valuetype - " "codegen for scope failed\n"), -1); - } - + } + //@@ Boris: that's suck! if (!node->is_abstract_valuetype ()) - { // functions that marshal state + { + // functions that marshal state be_visitor_context* new_ctx = new be_visitor_context (*this->ctx_); be_visitor_valuetype_marshal_ch visitor (new_ctx); visitor.visit_valuetype (node); - } + } - node->cli_hdr_cdr_op_gen (1); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp index 69b995d08c8..074f7c95084 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/cdr_op_ci.cpp @@ -47,7 +47,37 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node) if (node->cli_inline_cdr_op_gen () || node->imported ()) return 0; + // Generate helper functions implementation. + if (node->gen_helper_inline () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cdr_op_ci::" + "visit_valuetype - " + "codegen for helper functions failed\n"), -1); + } + TAO_OutStream *os = this->ctx_->stream (); + os->indent (); //start with whatever indentation level we are at now + + // Generate CDR << and >> operator signatures + + //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?) + + //This is just declaration so no ACE_INLINE + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator<< (TAO_OutputCDR &, const " + << node->full_name () << " *);" << be_nl; + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator>> (TAO_InputCDR &, " + << node->full_name () << " *&);" << be_nl; + + + + // Generate marshaling code if any + + // @@ Boris: the next statement is patrue anymore since I moved code + // to stubs. // First generate code for our children. The reason we do this first is // because the inlined code for our children must be available before we use @@ -64,50 +94,6 @@ be_visitor_valuetype_cdr_op_ci::visit_valuetype (be_valuetype *node) "codegen for scope failed\n"), -1); } - // set the sub state as generating code for the output operator - this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT); - os->indent (); - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator<< (TAO_OutputCDR &strm, const " - << node->full_name () - << " *_tao_valuetype)" << be_nl - << "{" << be_idt_nl; - *os << "return CORBA_ValueBase::_tao_marshal (strm," << be_idt_nl - << "ACE_const_cast (" << node->full_name () << "*, _tao_valuetype)," << be_nl - << "(ptr_arith_t) &" << node->full_name() <<"::_downcast);" - << be_uidt<< be_uidt_nl - << "}\n\n"; - - // set the substate as generating code for the input operator - //this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator>> (TAO_InputCDR &strm, " - << node->full_name () - << " *&_tao_valuetype)" << be_nl - << "{" << be_idt_nl; - *os << "return " << node->full_name() << "::_tao_unmarshal (strm, _tao_valuetype);" -#ifdef obv_marshal_old_version - *os << "CORBA::ValueBase *ptr;" << be_nl - << "int retval = CORBA_ValueBase::_tao_unmarshal (strm," - << be_idt_nl << "ptr, (ptr_arith_t) &" << node->full_name() <<"::_downcast);" - << be_uidt_nl - << "if (retval) {" << be_idt_nl - << "_tao_valuetype = " << node->full_name() << "::_downcast (ptr);" - << be_nl << "if (_tao_valuetype) retval = 1;" - << be_uidt_nl << "}" << be_idt_nl - << "return retval;" -#endif /* obv_marshal_old_version */ - << be_uidt_nl - << "}\n\n"; - - if (!node->is_abstract_valuetype ()) - { // functions that marshal state - be_visitor_context* new_ctx = - new be_visitor_context (*this->ctx_); - be_visitor_valuetype_marshal_cs visitor (new_ctx); - visitor.visit_valuetype (node); - } - - node->cli_inline_cdr_op_gen (1); + node->cli_inline_cdr_op_gen (I_TRUE); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp index bfa8140455d..4bd7adf690b 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp @@ -404,7 +404,7 @@ be_visitor_valuetype_field_cs::visit_valuetype (be_valuetype *node) << "* val)// set" << be_nl << "{\n"; os->incr_indent (); - *os << "if (val) val->_add_ref ();" << be_nl + *os << "CORBA::add_ref (val);" << be_nl << "this->" << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() << " = val;" << be_uidt_nl; @@ -455,28 +455,28 @@ be_visitor_valuetype_field_cs::visit_valuetype_fwd (be_valuetype_fwd *node) // set method os->indent (); // start from current indentation *os << "// accessor to set the member" << be_nl - << this->pre_op() << "void" << be_nl; - this->op_name(bu,os); + << this->pre_op () << "void" << be_nl; + this->op_name (bu, os); *os << "::" << ub->local_name () << " (" << bt->name () << "* val)// set" << be_nl << "{\n"; os->incr_indent (); - *os << "if (val) val->_add_ref ();" << be_nl + *os << "CORBA::add_ref (val);" << be_nl << "this->" - << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() + << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix() << " = val;" << be_uidt_nl; *os << "}" << be_nl; // get method *os << "// retrieve the member" << be_nl - << this->pre_op() << bt->name () << "* " << be_nl; - this->op_name(bu,os); + << this->pre_op () << bt->name () << "* " << be_nl; + this->op_name (bu, os); *os << "::" << ub->local_name () << " () const" << be_nl << "{\n"; os->incr_indent (); *os << "return this->" - << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() + << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix() << ".ptr ();\n"; os->decr_indent (); *os << "}\n\n"; diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp index e23026108de..b00c5805a9d 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/marshal_cs.cpp @@ -45,8 +45,8 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) TAO_OutStream *os = this->ctx_->stream (); this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_OUTPUT); - os->indent (); - *os << "ACE_INLINE CORBA::Boolean" << be_nl; + + *os << "CORBA::Boolean" << be_nl; this->class_name (node, os); *os << "::_tao_marshal_state (TAO_OutputCDR &strm)" << be_nl << "{" << be_idt_nl; @@ -87,8 +87,8 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) // set the substate as generating code for the input operator this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); - os->indent (); - *os << "ACE_INLINE CORBA::Boolean" << be_nl; + + *os << "CORBA::Boolean" << be_nl; this->class_name (node, os); *os << "::_tao_unmarshal_state (TAO_InputCDR &strm)" << be_nl << "{" << be_idt_nl; @@ -133,10 +133,15 @@ be_visitor_valuetype_marshal_cs::visit_valuetype (be_valuetype *node) // retrieve the fully scoped skeleton name void be_visitor_valuetype_marshal_cs::class_name (be_valuetype *node, - TAO_OutStream *os) + TAO_OutStream *os) { if (node->opt_accessor ()) - *os << node->name (); + { + be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); + *os << "ACE_NESTED_CLASS (" + << scope->name () << "," + << node->local_name () << ")"; + } else *os << node->full_obv_skel_name (); } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp index 6c2793fd9ef..dd059c42b3a 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp @@ -44,7 +44,6 @@ be_visitor_valuetype::visit_valuetype (be_valuetype *) return -1; } - // visit the scope of the valuetype node // (in public/private field order) int @@ -201,7 +200,6 @@ be_visitor_valuetype::visit_attribute (be_attribute *node) AST_Operation::OP_noflags, node->name (), 0, - 0, 0); op->set_name ((UTL_IdList *) node->name ()->copy ()); if (!op || this->visit_operation (op) == -1) @@ -219,23 +217,20 @@ be_visitor_valuetype::visit_attribute (be_attribute *node) // the set method. // the return type is "void" - be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, - new UTL_ScopedName - (new Identifier - ("void"), 0), - 0); + be_predefined_type *rt = + new be_predefined_type (AST_PredefinedType::PT_void, + new UTL_ScopedName (new Identifier ("void"), + 0)); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, node->field_type (), - node->name (), - 0); + node->name ()); arg->set_name ((UTL_IdList *) node->name ()->copy ()); // create the operation op = new be_operation (rt, AST_Operation::OP_noflags, node->name (), 0, - 0, 0); op->set_name ((UTL_IdList *) node->name ()->copy ()); op->add_argument_to_scope (arg); @@ -419,12 +414,11 @@ be_visitor_valuetype::visit_operation (be_operation *) int be_visitor_valuetype::visit_exception (be_exception *) { - cerr << "! be_visitor_valuetype::visit_exception() --- not allowed\n"; ACE_ASSERT (0); return 0; } -// visit an structure +// visit a structure int be_visitor_valuetype::visit_structure (be_structure *node) { @@ -859,3 +853,249 @@ be_visitor_valuetype::gen_init_impl (be_valuetype *node) return 0; } + +be_visitor_valuetype::FactoryStyle +be_visitor_valuetype::determine_factory_style (be_valuetype* node) +{ + FactoryStyle factory_style = FS_UNKNOWN; + + if (node == 0) + { + return factory_style; + } + + // Check whether we have at least one operation or not + idl_bool have_operation = be_visitor_valuetype::have_operation(node); + + + idl_bool have_factory = 0; + + // Try only our own scope + if (node->nmembers () > 0) + { + // initialize an iterator to iterate thru our scope + UTL_ScopeActiveIterator si (node, + UTL_Scope::IK_decls); + + // Continue until each element is visited. + for (; !si.is_done (); si.next()) + { + AST_Decl *d = si.item (); + + if (!d) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init::" + "determine_factory_style" + "bad node in this scope\n"), + factory_style); + + } + + AST_Decl::NodeType node_type = d->node_type(); + + if (node_type == AST_Decl::NT_factory) + { + have_factory = 1; + break; + } + + } // end of for loop + } // end of if + + if(!have_operation && !have_factory) + { + factory_style = FS_CONCRETE_FACTORY; + } + else if(have_operation && !have_factory) + { + factory_style = FS_NO_FACTORY; + } + else + { + factory_style = FS_ABSTRACT_FACTORY; + } + + return factory_style; +} + +idl_bool +be_visitor_valuetype::have_operation(be_valuetype* node) +{ + // Check whatever scope we get for operations/attributes + + if (node == 0) + { + return 0; + } + + idl_bool have_operation = 0; + + // Operations are either operations or attributes of: + // -its own + // -derived (abstract VT | VT | abstract iface | iface) + // + + // First try our own scope + if (node->nmembers () > 0) + { + // Initialize an iterator to iterate thru our scope + UTL_ScopeActiveIterator si (node, + UTL_Scope::IK_decls); + + // Continue until each element is checked. + for (; !si.is_done (); si.next()) + { + AST_Decl *d = si.item (); + + if (!d) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init::" + "has_operation" + "bad node in this scope\n"), + 0); + + } + + AST_Decl::NodeType node_type = d->node_type(); + + if(node_type == AST_Decl::NT_op) + { + have_operation = 1; + continue; + } + + if(node_type == AST_Decl::NT_attr) + { + have_operation = 1; + continue; + } + + if(node_type == AST_Decl::NT_factory) + { + continue; + } + + if(node_type == AST_Decl::NT_field) + { + continue; + } + + } // end of for loop + } // end of if + + //Now traverse inheritance tree. + int i; // loop index + + AST_Interface *iface = + AST_Interface::narrow_from_scope (node); + + for (i = 0; i < iface->n_inherits (); ++i) + { + AST_Interface *inherited = + AST_Interface::narrow_from_decl (iface->inherits ()[i]); + + if (!inherited || !inherited->is_valuetype()) + { + continue; + } + + be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]); + + if (vt != 0) + { + have_operation = have_operation || + be_visitor_valuetype::have_operation(vt); + + if(have_operation) + { + break; + } + } + } // end of for loop + + return have_operation; +} + +idl_bool +be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node) +{ + // VT needs RefCounter if it has concrete factory and + // none of its base VT has ref_counter + + if (determine_factory_style(node) != FS_CONCRETE_FACTORY) + { + return 0; + } + + // now go thru our base VTs and see if one has already + + int i; // loop index + + for (i = 0; i < node->n_inherits (); ++i) + { + AST_Interface *inherited = + AST_Interface::narrow_from_decl (node->inherits ()[i]); + + if (!inherited || !inherited->is_valuetype()) + { + continue; + } + + be_valuetype *vt = be_valuetype::narrow_from_decl(node->inherits ()[i]); + + if (vt != 0) + { + if (obv_have_ref_counter (vt)) + { + return 0; + } + } + } // end of for loop + + return 1; +} + +idl_bool +be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node) +{ + + // just try to find a VT with concrete factory in inheritance tree + if(node == 0) + { + return 0; + } + + if (determine_factory_style(node) == FS_CONCRETE_FACTORY) + { + return 1; + } + + // now go thru our base VTs + + int i; // loop index + + for (i = 0; i < node->n_inherits (); ++i) + { + AST_Interface *inherited = + AST_Interface::narrow_from_decl (node->inherits ()[i]); + + if (!inherited || !inherited->is_valuetype()) + { + continue; + } + + be_valuetype *vt = be_valuetype::narrow_from_decl (node->inherits ()[i]); + + if (vt != 0) + { + if (obv_have_ref_counter (vt)) + { + return 1; + } + } + } // end of for loop + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp index 8906470b2be..3d9efe86477 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp @@ -45,21 +45,24 @@ be_visitor_valuetype_ch::~be_visitor_valuetype_ch (void) int be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) { - TAO_OutStream *os; // output stream + TAO_OutStream *os = this->ctx_->stream (); if (!node->cli_hdr_gen () && !node->imported ()) { - os = this->ctx_->stream (); *os << "// Valuetype class" << be_nl; // == STEP 1: Generate the class name and class names we inherit == // Forward declaration. *os << "class " << node->local_name () << ";" << be_nl; + + os->gen_ifdef_macro (node->flat_name (), "_ptr"); *os << "typedef " << node->local_name () << " *" << node->local_name () << "_ptr;" << be_nl; + os->gen_endif (); + // Generate the ifdefined macro for the _var type. os->gen_ifdef_macro (node->flat_name (), "_var"); @@ -75,10 +78,10 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) os->gen_endif (); - // Generate the ifdef macro for the _out class. + // Generate the ifdef macro for the _out class. os->gen_ifdef_macro (node->flat_name (), "_out"); - // Generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec. + // Generate the _out declaration if (node->gen_out_defn () == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -88,216 +91,232 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node) } // generate the endif macro. - os->gen_endif (); - - // Generate the ifdef macro for the _init class. - os->gen_ifdef_macro (node->flat_name (), "_init"); - - // Generate the _init declaration - ptc/98-09-03 20.17.10 p.20-93. - if (this->gen_init_defn (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "codegen for _init failed\n"), -1); - } - - // Generate the endif macro. - os->gen_endif (); + os->gen_endif (); + } - // Now the valuetype definition itself. - os->gen_ifdef_macro (node->flat_name ()); + if (node->imported ()) + { + return 0; + } + + // Now the valuetype definition itself. + os->gen_ifdef_macro (node->flat_name ()); - // Now generate the class definition. - *os << "class " << be_global->stub_export_macro () - << " " << node->local_name (); + // Now generate the class definition. + *os << "class " << be_global->stub_export_macro () + << " " << node->local_name (); - // Node valuetype inherits from other valuetypes (OMG 20.17.9) - // (ordinary (not abstract) interfaces ignored). + // Node valuetype inherits from other valuetypes (OMG 20.17.9) + // (ordinary (not abstract) interfaces ignored). - *os << be_idt_nl <<": "; - int i; // loop index - int n_inherits_valuetypes = 0; - idl_bool valuebase_inherited = 0; + *os << be_idt_nl <<": "; + int i; // loop index + int n_inherits_valuetypes = 0; + idl_bool valuebase_inherited = 0; - if (node->n_inherits () > 0) + if (node->n_inherits () > 0) + { + for (i = 0; i < node->n_inherits (); i++) { - for (i = 0; i < node->n_inherits (); i++) + // %! move is_nested() and nested_type_name() to + // AST_Interface, then type AST_Interface can be used + be_interface *inherited = + be_interface::narrow_from_decl (node->inherits ()[i]); + + if (!inherited->is_valuetype () + && !inherited->is_abstract ()) { - // %! move is_nested() and nested_type_name() to - // AST_Interface, then type AST_Interface can be used - be_interface *inherited = - be_interface::narrow_from_decl (node->inherits ()[i]); + continue; + } - if (!inherited->is_valuetype () - && !inherited->is_abstract ()) - { - continue; - } + ++ n_inherits_valuetypes; - ++ n_inherits_valuetypes; + if (inherited->is_valuetype()) + { + valuebase_inherited = 1; + } - if (inherited->is_valuetype()) - { - valuebase_inherited = 1; - } + if (n_inherits_valuetypes > 1) + { + *os << ","; - if (n_inherits_valuetypes > 1) + if (i == 1) { - *os << ","; - - if (i == 1) - { - *os << be_idt_nl; - } - else - { - *os << be_nl; - } + *os << be_idt_nl; } - - be_decl *scope = 0; - - if (inherited->is_nested ()) + else { - // Inherited node is used in the scope of "node" node. - scope = - be_scope::narrow_from_scope (node->defined_in ())->decl (); + *os << be_nl; } + } - // Dump the scoped name. - *os << "public virtual "; - *os << inherited->nested_type_name (scope); - } // end of for loop + be_decl *scope = 0; - if (n_inherits_valuetypes > 0) + if (inherited->is_nested ()) { - if (n_inherits_valuetypes > 1) - { - *os << be_uidt; - } - - *os << be_uidt_nl; + // Inherited node is used in the scope of "node" node. + scope = + be_scope::narrow_from_scope (node->defined_in ())->decl (); } - } - if (!valuebase_inherited) + // Dump the scoped name. + *os << "public virtual "; + *os << inherited->nested_type_name (scope); + } // end of for loop + + if (n_inherits_valuetypes > 0) { - // We do not inherit from any valuetype, hence we do so from the base - // CORBA::ValueBase class. if (n_inherits_valuetypes > 1) { - *os << ", "; + *os << be_uidt; } - *os << "public virtual CORBA_ValueBase" << be_uidt_nl; - } + *os << be_uidt_nl; + } + } - // Generate the body. - *os << "{" << be_nl - << "public:" << be_idt_nl - - // Generate the _ptr_type and _var_type typedef - // but we must protect against certain versions of g++ - << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)" - << be_nl - << "typedef " << node->local_name () << "* _ptr_type;" << be_nl - << "typedef " << node->local_name () << "_var _var_type;\n" - << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl - - // Generate the static _downcast operation. - // (see OMG 20.17.{4,5}). - << "static " << node->local_name () << "* " - << "_downcast (CORBA::ValueBase* );" << be_nl - << "// The address of static _downcast is implicit used as type id\n" - << be_nl - << "// (TAO extensions or internals)" << be_nl - << "static CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl - << "TAO_InputCDR &," << be_nl - << node->local_name () << " *&" << be_uidt_nl - << ");" << be_uidt_nl - << "virtual const char* " - << "_tao_obv_repository_id () const;" - << be_nl - << "static const char* " - << "_tao_obv_static_repository_id ();" << be_nl << be_nl; - - // Generate code for the valuetype definition. - if (this->visit_valuetype_scope (node) == -1) + if (!valuebase_inherited) + { + // We do not inherit from any valuetype, hence we do so from the base + // CORBA::ValueBase class. + if (n_inherits_valuetypes > 1) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_ch::" - "visit_valuetype - " - "codegen for scope failed\n"), - -1); + *os << ", "; } - // Protected member: + *os << "public virtual CORBA_ValueBase" << be_uidt_nl; + } - // Generate the "protected" constructor so that users cannot - // instantiate us. - *os << be_uidt_nl << "protected:" << be_idt_nl - << node->local_name () - << " ();" << be_nl - << "virtual ~" << node->local_name () << " ();\n" << be_nl; + // Generate the body. + *os << "{" << be_nl + << "public:" << be_idt_nl + + // Generate the _ptr_type and _var_type typedef + // but we must protect against certain versions of g++ + << "\n#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)" + << be_nl + << "typedef " << node->local_name () << "* _ptr_type;" << be_nl + << "typedef " << node->local_name () << "_var _var_type;\n" + << "#endif /* ! __GNUC__ || g++ >= 2.8 */" << be_nl << be_nl + + // Generate the static _downcast operation. + // (see OMG 20.17.{4,5}). + << "static " << node->local_name () << "* " + << "_downcast (CORBA::ValueBase* );" << be_nl + << "// The address of static _downcast is implicit used as type id\n" + << be_nl + << "// (TAO extensions or internals)" << be_nl + << "static CORBA::Boolean _tao_unmarshal (" << be_idt << be_idt_nl + << "TAO_InputCDR &," << be_nl + << node->local_name () << " *&" << be_uidt_nl + << ");" << be_uidt_nl + << "virtual const char* " + << "_tao_obv_repository_id () const;" + << be_nl + << "static const char* " + << "_tao_obv_static_repository_id ();" << be_nl << be_nl; + + // Generate code for the valuetype definition. + if (this->visit_valuetype_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "codegen for scope failed\n"), + -1); + } - *os << "// TAO internals" << be_nl - << "virtual void *_tao_obv_narrow (ptr_arith_t);" << be_nl; + // Protected member: - // Support for marshalling. - if (!node->is_abstract_valuetype ()) - { - *os << "virtual CORBA::Boolean " - << "_tao_marshal_v (TAO_OutputCDR &);" << be_nl; - *os << "virtual CORBA::Boolean " - << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl; - // %! optimize _downcast away: extra parameter with type info - // set (void *) in CDR Stream with the right derived pointer. - } + // Generate the "protected" constructor so that users cannot + // instantiate us. + *os << be_uidt_nl << "protected:" << be_idt_nl + << node->local_name () + << " ();" << be_nl + << "virtual ~" << node->local_name () << " ();\n" << be_nl; + *os << "// TAO internals" << be_nl + << "virtual void *_tao_obv_narrow (ptr_arith_t);" << be_nl; + + // Support for marshalling. + if (!node->is_abstract_valuetype ()) + { + *os << "virtual CORBA::Boolean " + << "_tao_marshal_v (TAO_OutputCDR &);" << be_nl; + *os << "virtual CORBA::Boolean " + << "_tao_unmarshal_v (TAO_InputCDR &);" << be_nl; + // %! optimize _downcast away: extra parameter with type info + // set (void *) in CDR Stream with the right derived pointer. + } - // Private member: - // Private copy constructor and assignment operator. These are not - // allowed, hence they are private. - *os << be_uidt_nl << "private:" << be_idt_nl; - *os << node->local_name () << " (const " << node->local_name () << " &);" - << be_nl - << "void operator= (const " << node->local_name () << " &);" - << be_nl; + // Private member: + + // Private copy constructor and assignment operator. These are not + // allowed, hence they are private. + *os << be_uidt_nl << "private:" << be_idt_nl; + *os << node->local_name () << " (const " << node->local_name () << " &);" + << be_nl + << "void operator= (const " << node->local_name () << " &);" + << be_nl; // Map fields to private data (if optimizing). - if (node->opt_accessor ()) + if (node->opt_accessor ()) + { + *os << be_uidt_nl << "protected:" << be_idt_nl; + *os << "CORBA::Boolean " + << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl + << "CORBA::Boolean " + << "_tao_unmarshal_state (TAO_InputCDR &);" + << be_uidt_nl << be_nl; + *os << "private:" << be_idt_nl; + this->gen_pd (node); + } + else // Need a way to access the state of derived OBV_ classes. + { + if (!node->is_abstract_valuetype ()) { *os << be_uidt_nl << "protected:" << be_idt_nl; - *os << "CORBA::Boolean " - << "_tao_marshal_state (TAO_OutputCDR &);" << be_nl - << "CORBA::Boolean " - << "_tao_unmarshal_state (TAO_InputCDR &);" - << be_uidt_nl << be_nl; - *os << "private:" << be_idt_nl; - this->gen_pd (node); - } - else // Need a way to access the state of derived OBV_ classes. - { - if (!node->is_abstract_valuetype ()) - { - *os << be_uidt_nl << "protected:" << be_idt_nl; - *os << "virtual CORBA::Boolean _tao_marshal__" - << node->flat_name () << " (TAO_OutputCDR &) = 0;" - << be_nl; - *os << "virtual CORBA::Boolean _tao_unmarshal__" - << node->flat_name () << " (TAO_InputCDR &) = 0;" - << be_nl; - } + *os << "virtual CORBA::Boolean _tao_marshal__" + << node->flat_name () << " (TAO_OutputCDR &) = 0;" + << be_nl; + *os << "virtual CORBA::Boolean _tao_unmarshal__" + << node->flat_name () << " (TAO_InputCDR &) = 0;" + << be_nl; } + } - *os << be_uidt_nl << "};" << be_nl; - os->gen_endif (); + *os << be_uidt_nl << "};" << be_nl; + os->gen_endif (); + + + // Generate the _init -related declarations. + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CH); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "NULL visitor.\n" + ), -1); + } - node->cli_hdr_gen (I_TRUE); + if (visitor->visit_valuetype(node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "failed to generate _init construct.\n" + ), -1); } + delete visitor; + + node->cli_hdr_gen (I_TRUE); + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp index 6ee52bcc6f9..584f1777f9d 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ci.cpp @@ -49,6 +49,7 @@ be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node) if (node->cli_inline_gen () || node->imported ()) return 0; + //@@ What is that? // need to access it in visit_field () if (node->opt_accessor ()) this->opt_accessor_ = 1; @@ -74,37 +75,40 @@ be_visitor_valuetype_ci::visit_valuetype (be_valuetype *node) << "return \"" << node->repoID () << "\";" << be_uidt_nl << "}\n\n"; - // generate the ifdefined macro for the _var type - os->gen_ifdef_macro (node->flat_name (), "_var"); - if (node->gen_var_impl () == -1) + // generate inline methods for elements of our scope + if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_ci::" "visit_valuetype - " - "codegen for _var failed\n"), -1); + "codegen for scope failed\n"), -1); } - os->gen_endif (); - // generate the ifdefined macro for the _out type - os->gen_ifdef_macro (node->flat_name (), "_out"); - if (node->gen_out_impl () == -1) + // Generate the _init -related code. + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CI); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_ci::" "visit_valuetype - " - "codegen for _out failed\n"), -1); + "NULL visitor.\n" + ), -1); } - os->gen_endif (); - - // generate inline methods for elements of our scope - if (this->visit_scope (node) == -1) + + if (visitor->visit_valuetype(node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_ci::" "visit_valuetype - " - "codegen for scope failed\n"), -1); + "failed to generate _init construct.\n" + ), -1); } + delete visitor; + return 0; } @@ -119,6 +123,7 @@ be_visitor_valuetype_ci::visit_field (be_field *node) new be_visitor_valuetype_field_cs (ctx); visitor->in_obv_space_ = 0; visitor->setenclosings ("ACE_INLINE "); + if (visitor->visit_field (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -127,7 +132,9 @@ be_visitor_valuetype_ci::visit_field (be_field *node) "visit_field failed\n" ), -1); } + delete visitor; } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp index c7dc7f9b12d..29f150dc868 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp @@ -47,12 +47,33 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) TAO_OutStream *os; // output stream if (node->cli_stub_gen () || node->imported ()) - return 0; + { + return 0; + } os = this->ctx_->stream (); os->indent (); // start with whatever indentation level we are at + // Generate methods for _var class + if (node->gen_var_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cs::" + "visit_valuetype - " + "codegen for _var failed\n"), -1); + } + + // Generate methods for _out class + if (node->gen_out_impl () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cs::" + "visit_valuetype - " + "codegen for _out failed\n"), -1); + } + + // The _downcast method // %! use ACE_xxx_cast here ? *os << node->name() << "* " << node->name() << "::_downcast (CORBA::ValueBase* v)" << be_nl @@ -80,15 +101,18 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) // Find the possible base classes. int n_inherits_downcastable = 0; + for (int i = 0; i < node->n_inherits (); i++) { AST_Interface *inherited = AST_Interface::narrow_from_decl (node->inherits ()[i]); + if (inherited->is_valuetype()) { ++n_inherits_downcastable; *os << "if (rval == 0)" << be_idt_nl << "rval = "; + if (inherited->defined_in ()->scope_node_type () == AST_Decl::NT_module) { be_decl *scope = be_scope::narrow_from_scope (inherited->defined_in ())->decl (); @@ -97,7 +121,10 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) << inherited->local_name () << ")"; } else - *os << inherited->name (); + { + *os << inherited->name (); + } + *os << "::_tao_obv_narrow (type_id);" << be_uidt_nl; } } @@ -109,14 +136,17 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) if (!node->is_abstract_valuetype ()) { // The virtual _tao_marshal_v method - *os << "CORBA::Boolean " << node->name() + *os << "CORBA::Boolean " << node->name () << "::_tao_marshal_v (TAO_OutputCDR & strm)" << be_nl << "{" << be_idt_nl << "return "; if (node->opt_accessor ()) { - *os << node->name () + be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); + *os << "ACE_NESTED_CLASS (" + << scope->name () << "," + << node->local_name () << ")" <<"::_tao_marshal_state (strm);" << be_uidt_nl; } else @@ -124,17 +154,21 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) *os << "this->_tao_marshal__" << node->flat_name () << " (strm);" << be_uidt_nl; } + *os << "}\n" << be_nl; // The virtual _tao_unmarshal_v method - *os << "CORBA::Boolean " << node->name() + *os << "CORBA::Boolean " << node->name () << "::_tao_unmarshal_v (TAO_InputCDR & strm)" << be_nl << "{" << be_idt_nl << "return "; if (node->opt_accessor ()) { - *os << node->name () + be_decl *scope = be_scope::narrow_from_scope (node->defined_in ())->decl (); + *os << "ACE_NESTED_CLASS (" + << scope->name () << "," + << node->local_name () << ")" <<"::_tao_unmarshal_state (strm);" << be_uidt_nl; } else @@ -142,8 +176,9 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) *os << "this->_tao_unmarshal__" << node->flat_name () << " (strm);" << be_uidt_nl; } + *os << "}\n" << be_nl; - } // !node->is_abstract_valuetype () + } // The static T::_tao_unmarshal method ---------------------------- @@ -189,30 +224,45 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) // The static T::_tao_unmarshal method ------------------------ end - // generate the ifdefined macro for the _init type - os->gen_ifdef_macro (node->flat_name (), "_init"); - if (this->gen_init_impl (node) == -1) + // generate code for the elements of the valuetype + if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_valuetype_cs::" "visit_valuetype - " - "codegen for _init failed\n"), -1); + "codegen for scope failed\n"), -1); } - os->gen_endif (); - // generate code for the elements of the valuetype - if (this->visit_scope (node) == -1) + // Generate the _init -related code. + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_CS); + be_visitor *visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_cs::" + "(%N:%l) be_visitor_valuetype_ch::" "visit_valuetype - " - "codegen for scope failed\n"), -1); + "NULL visitor.\n" + ), -1); } + + if (visitor->visit_valuetype(node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "failed to generate _init construct.\n" + ), -1); + } + + delete visitor; + // by using a visitor to declare and define the TypeCode, we have the // added advantage to conditionally not generate any code. This will be // based on the command line options. This is still TO-DO - // (see interface code how to do this. not yet impl.) + // (see interface code how to do this. not yet impl.) return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp new file mode 100644 index 00000000000..0a2db0f822b --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init.cpp @@ -0,0 +1,110 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init.cpp +// +// = DESCRIPTION +// Coomon visitor for valuetypes factory construct +// (see IDL to C++ mapping). Based on ptc/00-01-02. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype.h" + +ACE_RCSID(be_visitor_valuetype, valuetype_init, "$Id$") + +be_visitor_valuetype_init::be_visitor_valuetype_init ( + be_visitor_context *ctx + ) + : be_visitor_valuetype (ctx) +{ +} + +be_visitor_valuetype_init::~be_visitor_valuetype_init (void) +{ +} + +int +be_visitor_valuetype_init::visit_attribute (be_attribute *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_constant (be_constant *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_enum (be_enum *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_operation (be_operation *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_exception (be_exception *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_structure (be_structure *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_union (be_union *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_typedef (be_typedef *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_field (be_field *) +{ + return 0; +} + +int +be_visitor_valuetype_init::visit_factory (be_factory *) +{ + return 0; +} + +void +be_visitor_valuetype_init::begin_public (void) +{ +} + +void +be_visitor_valuetype_init::begin_private (void) +{ +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp new file mode 100644 index 00000000000..4013f3552ea --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp @@ -0,0 +1,124 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_arglist_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for the parameter list of the OBV factory +// signature. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype.h" + +ACE_RCSID(be_visitor_valuetype_init, arglist_ch, "$Id$") + + +be_visitor_valuetype_init_arglist_ch:: +be_visitor_valuetype_init_arglist_ch (be_visitor_context *ctx) + : be_visitor_scope (ctx) +{ +} + +be_visitor_valuetype_init_arglist_ch:: +~be_visitor_valuetype_init_arglist_ch (void) +{ +} + +int +be_visitor_valuetype_init_arglist_ch::visit_factory (be_factory *node) +{ + TAO_OutStream& os = *(this->ctx_->stream ()); + os << " (" << be_idt // idt = 1 + << be_idt_nl; // idt = 2 + + // all we do is hand over code generation to our scope + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_arglist_ch::" + "visit_factory - " + "codegen for scope failed\n"), + -1); + } + + os << be_uidt_nl // idt = 1 + << ")" << be_uidt; // idt = 0 + + return 0; +} + +int +be_visitor_valuetype_init_arglist_ch::visit_argument (be_argument *node) +{ + // get the visitor that will dump the argument's mapping in the operation + // signature. + be_visitor_context ctx (*this->ctx_); + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH: + ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH); + break; + default: + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_arglist_ch::" + "visit_argument - " + "Bad context\n"), + -1); + } + } + + // grab a visitor + be_visitor *visitor = tao_cg->make_visitor (&ctx); + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_arglist_ch::" + "visit_argument - " + "Bad visitor\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_arglist_ch::" + "visit_argument - " + "codegen for arglist failed\n"), + -1); + } + + delete visitor; + return 0; +} + +int +be_visitor_valuetype_init_arglist_ch::post_process (be_decl *bd) +{ + TAO_OutStream *os = this->ctx_->stream (); + + // if we are not the last node in the list of arguments, generate a comma. + if (!this->last_node (bd)) + { + *os << "," << be_nl; + } + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp new file mode 100644 index 00000000000..2344ff7ed80 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ch.cpp @@ -0,0 +1,196 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_ch.cpp +// +// = DESCRIPTION +// Visitor generating code for Valuetypes factory in the client header +// (see IDL to C++ mapping). Based on ptc/00-01-02. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype.h" + +ACE_RCSID(be_visitor_valuetype, valuetype_init_ch, "$Id$") + +be_visitor_valuetype_init_ch::be_visitor_valuetype_init_ch ( + be_visitor_context *ctx + ) + : be_visitor_valuetype_init (ctx) +{ +} + +be_visitor_valuetype_init_ch::~be_visitor_valuetype_init_ch (void) +{ +} + +int +be_visitor_valuetype_init_ch::visit_valuetype (be_valuetype *node) +{ + + if (node->is_abstract_valuetype ()) + { + return 0; + } + + // There are three possible situations. + // (1) If there is no initializers but at least one operation. + // In this case we don't need to bother about factory. + // + // (2) There are no (operations or initializers) (i.e. only state + // members) then we need a concrete type-specific factory + // class whose create_for_unmarshal creates OBV_ class. + // + // (3) There is at least one operation and at least one initializer. + // In this case we need to generate abstract factory class. + + FactoryStyle factory_style = determine_factory_style (node); + + if(factory_style == FS_NO_FACTORY) // nothing to do + { + return 0; // bail out + } + + TAO_OutStream& os = *(this->ctx_->stream ()); + + // Generate the ifdef macro for the _init class. + os.gen_ifdef_macro (node->flat_name (), "_init"); + + + //@@ If I'm generating concrete class I need a RefCounter + os << "class " << be_global->stub_export_macro () + << " " << node->local_name () + << "_init : public virtual CORBA_ValueFactoryBase" << be_nl; + + // generate the body + os << "{" << be_nl + << "public:" << be_idt_nl; + + if(factory_style == FS_CONCRETE_FACTORY) + { + // public ctor + os << node->local_name () << "_init ();" << be_nl; + } + + // virtual public dtor + os << "virtual ~" << node->local_name () << "_init ();" << be_nl; + + + // custom methods + os << be_nl; + + if (this->visit_valuetype_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_ch::" + "visit_valuetype - " + "codegen for scope failed\n"), + -1); + } + + os << be_nl; + + // generate _downcast method + os << "static " << node->local_name () << "_init* " + << "_downcast (CORBA_ValueFactoryBase* );" << be_nl; + + if(factory_style == FS_CONCRETE_FACTORY) + { + //@@ Boris: create_for_unmarshal is still public... + // generate create_for_unmarshal + os << be_nl + << "virtual CORBA_ValueBase* " + << "create_for_unmarshal" << " " + << "(void);" << be_nl; + } + + os << be_nl; + + // propriate extensions + os << "// TAO-specific extensions" + << be_uidt_nl + << "public:" << be_idt_nl; + + os << "virtual const char* tao_repository_id (void);\n"; + + if(factory_style == FS_ABSTRACT_FACTORY) + { + // protected ctor + os << be_uidt_nl + << "protected:" << be_idt_nl; + + os << node->local_name () << "_init ();"; + + } + + os << be_uidt_nl << "};" << be_nl; + + // Generate the endif macro. + os.gen_endif (); + + return 0; +} + +int +be_visitor_valuetype_init_ch::visit_factory (be_factory *node) +{ + + TAO_OutStream& os = *(this->ctx_->stream ()); + + be_valuetype *vt = + be_valuetype::narrow_from_decl (this->ctx_->scope ()); + + + // STEP I: Generate preambule. + os << "virtual " << vt->local_name () << "* "; + + // STEP 2: Generate the operation name. + os << node->local_name (); + + // STEP 3: Generate the argument list with the appropriate mapping. For these + // we grab a visitor that generates the parameter listing. + be_visitor_context ctx (*this->ctx_); + ctx.state (TAO_CodeGen::TAO_VALUETYPE_INIT_ARGLIST_CH); + be_visitor* visitor = tao_cg->make_visitor (&ctx); + + if (!visitor) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_valuetype_init_ch::" + "visit_factory - " + "Bad visitor to argument list\n"), + -1); + } + + if (node->accept (visitor) == -1) + { + delete visitor; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_init_arglist__ch::" + "visit_operation - " + "codegen for argument list failed\n"), + -1); + } + + delete visitor; + + // make pure virtual + os << " = 0;" << be_nl; + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp new file mode 100644 index 00000000000..2255defdcd0 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_ci.cpp @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for Valuetypes factory in the client header +// (see IDL to C++ mapping) +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype.h" + +ACE_RCSID(be_visitor_valuetype, valuetype_init_ci, "$Id$") + +be_visitor_valuetype_init_ci::be_visitor_valuetype_init_ci ( + be_visitor_context *ctx + ) + : be_visitor_valuetype_init (ctx) +{ +} + +be_visitor_valuetype_init_ci::~be_visitor_valuetype_init_ci (void) +{ +} + +int +be_visitor_valuetype_init_ci::visit_valuetype (be_valuetype *) +{ + return 0; +} + +int +be_visitor_valuetype_init_ci::visit_factory (be_factory *) +{ + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp new file mode 100644 index 00000000000..73fbcde518f --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp @@ -0,0 +1,127 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for Valuetypes factory in the client header +// (see IDL to C++ mapping) +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype.h" + +ACE_RCSID(be_visitor_valuetype, valuetype_init_cs, "$Id$") + + +be_visitor_valuetype_init_cs::be_visitor_valuetype_init_cs ( + be_visitor_context *ctx + ) + : be_visitor_valuetype_init (ctx) +{ +} + +be_visitor_valuetype_init_cs::~be_visitor_valuetype_init_cs (void) +{ +} + +int +be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node) +{ + if (node->is_abstract_valuetype ()) + { + return 0; + } + + // There are three possible situations. + // (1) If there is no initializers but at least one operation. + // In this case we don't need to bother about factory. + // + // (2) There are no (operations or initializers) (i.e. only state + // members) then we need a concrete type-specific factory + // class whose create_for_unmarshal creates OBV_ class. + // + // (3) There is at least one operation and at least one initializer. + // In this case we need to generate abstract factory class. + + FactoryStyle factory_style = determine_factory_style (node); + + if(factory_style == FS_NO_FACTORY) // nothing to do + { + return 0; // bail out + } + + + TAO_OutStream *os; // output stream + + os = this->ctx_->stream (); + + os->indent (); // start with whatever indentation level we are at + + char fname [NAMEBUFSIZE]; // to hold the full and + char lname [NAMEBUFSIZE]; // local _out names + + ACE_OS::memset (fname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (fname, "%s_init", node->full_name ()); + + ACE_OS::memset (lname, '\0', NAMEBUFSIZE); + ACE_OS::sprintf (lname, "%s_init", node->local_name ()); + + // ctor + *os << fname << "::" << lname << " ()" << be_nl + << "{" << be_nl << "}\n"; + + // dtor + *os << be_nl + << fname << "::~" << lname << " ()" << be_nl + << "{" << be_nl << "}\n"; + + //tao_repository_id + *os << be_nl + << "const char* " << be_nl + << fname << "::tao_repository_id (void)" << be_nl + << "{" << be_idt_nl + << "return " << node->full_name () + << "::_tao_obv_static_repository_id ();" + << be_uidt_nl << "}\n"; + + + if(factory_style == FS_CONCRETE_FACTORY) + { + // generate create_for_unmarshal() + *os << be_nl + << "CORBA_ValueBase* " << be_nl + << fname << "::create_for_unmarshal" << " " + << "(void)" << be_nl + << "{" << be_idt_nl + << "CORBA_ValueBase* ret_val = 0;" << be_nl + << "ACE_NEW_RETURN(ret_val, " << be_nl + << " OBV_" << node->full_name () << ", " << be_nl + << " 0);" << be_nl + << "return ret_val;" + << be_uidt_nl << "}\n"; + } + + return 0; +} + +int +be_visitor_valuetype_init_cs::visit_factory (be_factory *) +{ + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp index 649fe94cd4f..353d08649e7 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_obv_ch.cpp @@ -84,7 +84,58 @@ be_visitor_valuetype_obv_ch::visit_valuetype (be_valuetype *node) *os << node->local_name () << be_idt_nl << ": public virtual " - << node->full_name () << be_uidt_nl; + << node->full_name (); + + // STEP 1a (about which previous implementer forgot ): + // Generate inheritance from corresponding OBV_ classes. + +//------>>> + + // Here we need to be careful. There are few cases to consider: + // + // (1) We have VT with concrete factory and no inhereted VT with + // concrete factory then we need to mix-in RefCounter + // + // (2) We have VT with concerete factory and inheretence from + // another (not abstract or empty abstract <would like to + // know how to go there>) then its OBV_ already has mix-in + // (3) The rest. Don't need to bother about anything, just inherit + // whatever there is. + // + + int i = 0; + idl_bool inherited_from_value = 0; + for (; i < node->n_inherits (); ++i) + { + AST_Interface *inherited = + AST_Interface::narrow_from_decl(node->inherits ()[i]); + + // we need only concrete valuetypes + if (!inherited->is_valuetype () + || inherited->is_abstract ()) + { + continue; + } + + *os << "," << be_nl; + + // dump the scoped name. + *os << " public virtual OBV_"; + *os << inherited->full_name(); + inherited_from_value = 1; + } // end of for loop + + if (obv_need_ref_counter (node)) + { + *os << "," << be_nl; + + // dump the scoped name. + *os << " public virtual CORBA_DefaultValueRefCountBase"; + } + + *os << be_uidt_nl; + +//------>>> // STEP 2: Generate the body == diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp index 1d3c8a5fba7..fc13b3c768c 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd.cpp @@ -23,18 +23,15 @@ #include "idl_extern.h" #include "be.h" -#ifdef IDL_HAS_VALUETYPE - #include "be_visitor_valuetype_fwd.h" // include all the individual files -#if 0 + // Not implemented yet. #include "be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp" #include "be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp" +#include "be_visitor_valuetype_fwd/cdr_op_ch.cpp" #include "be_visitor_valuetype_fwd/cdr_op_ci.cpp" -#endif /* 0 */ ACE_RCSID(be, be_visitor_valuetype_fwd, "$Id$") -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp new file mode 100644 index 00000000000..6f2387900f4 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ch.cpp @@ -0,0 +1,93 @@ +// +// $Id$ +// + +// ================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_fwd_cdr_op_ci.cpp +// +// = DESCRIPTION +// Visitor generating code for CDR operators for forward +// declarations of valuetypes. This uses compiled marshaling. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// base on code from Torsten Kuepper +// based on code from Aniruddha Gokhale & Carlos O'Ryan (cdr_op_ci.cpp) +// +// ================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_valuetype_fwd.h" + +ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_cdr_op_ch, "$Id$") + + +be_visitor_valuetype_fwd_cdr_op_ch::be_visitor_valuetype_fwd_cdr_op_ch ( + be_visitor_context *ctx + ) + : be_visitor_decl (ctx) +{ +} + +be_visitor_valuetype_fwd_cdr_op_ch::~be_visitor_valuetype_fwd_cdr_op_ch (void) +{ +} + +int +be_visitor_valuetype_fwd_cdr_op_ch::visit_valuetype_fwd ( + be_valuetype_fwd *node + ) +{ + AST_Interface *fd = node->full_definition (); + be_valuetype *bfd = be_valuetype::narrow_from_decl (fd); + + // If this forward declared vt is defined later in the file, + // the CDR operator declaration (along with the corresponding + // declarations for members of the interface's scope) will be + // generated then. + if (fd->is_defined ()) + { + return 0; + } + + // Check if it's imported vt or CDR ops already generated. + if (node->cli_hdr_cdr_op_gen () || node->imported ()) + { + return 0; + } + + // Generate helper functions declaration. + if (bfd->gen_helper_header () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cdr_op_ch::" + "visit_valuetype - " + "codegen for helper functions failed\n"), -1); + } + + TAO_OutStream *os = this->ctx_->stream (); + + // generate the CDR << and >> operator declarations (prototypes) + + //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?) + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator<< (TAO_OutputCDR &, const " + << node->full_name () << " *);" << be_nl; + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator>> (TAO_InputCDR &, " + << node->full_name () << " *&);" << be_nl; + + node->cli_hdr_cdr_op_gen (I_TRUE); + + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp index a290ee99010..917d0ce7a11 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/cdr_op_ci.cpp @@ -37,9 +37,6 @@ be_visitor_valuetype_fwd_cdr_op_ci:: be_visitor_valuetype_fwd_cdr_op_ci (be_visitor_context *ctx) : be_visitor_decl (ctx) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_cdr_op_ci::" - "must be implemented\n"), -1); } be_visitor_valuetype_fwd_cdr_op_ci:: @@ -48,27 +45,52 @@ be_visitor_valuetype_fwd_cdr_op_ci:: } int -be_visitor_valuetype_fwd_cdr_op_ci:: -visit_valuetype_fwd (be_valuetype_fwd *node) +be_visitor_valuetype_fwd_cdr_op_ci::visit_valuetype_fwd ( + be_valuetype_fwd *node + ) { + AST_Interface *fd = node->full_definition (); + be_valuetype *bfd = be_valuetype::narrow_from_decl (fd); + + // Check if it's imported vt or CDR ops already generated. if (node->cli_inline_cdr_op_gen () || node->imported ()) - return 0; + { + return 0; + } + // Is we are defined leater then let the real VT to generate + // all this stuff. + if (bfd->is_defined ()) + { + return 0; + } + + // Generate helper functions declaration. + if (bfd->gen_helper_inline () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_cdr_op_ch::" + "visit_valuetype - " + "codegen for helper functions failed\n"), -1); + } + TAO_OutStream *os = this->ctx_->stream (); - // generate the CDR << and >> operator declarations - os->indent (); - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator<< (" << be_idt << be_idt_nl - << "TAO_OutputCDR &," << be_nl - << "const " << node->name () << "_ptr" << be_uidt_nl - << ");" << be_uidt_nl; - *os << "ACE_INLINE CORBA::Boolean" << be_nl - << "operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &," << be_nl - << node->name () << "_ptr &" << be_uidt_nl - << ");" << be_uidt << "\n"; - - node->cli_inline_cdr_op_gen (1); + // generate the CDR << and >> operator declarations (prototypes) + + //@@ Boris: Can I move this to be_valuetype? (as with _var, _out, etc?) + + //This is just declaration so no ACE_INLINE + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator<< (TAO_OutputCDR &, const " + << node->full_name () << " *);" << be_nl; + + *os << be_global->stub_export_macro () + << "CORBA::Boolean operator>> (TAO_InputCDR &, " + << node->full_name () << " *&);" << be_nl; + + // Done with this. + node->cli_inline_cdr_op_gen (I_TRUE); + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp index 4edf19ad739..704ab42516b 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ch.cpp @@ -14,7 +14,8 @@ // Visitor generating code for Interface_Fwd node in the client header. // // = AUTHOR -// Torsten Kuepper +// Boris Kolpackov <bosk@ipmce.ru> +// based on code from Torsten Kuepper // based on code from Aniruddha Gokhale (interface_fwd_ch.cpp) // // ============================================================================ @@ -28,17 +29,9 @@ ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ch, "$Id$") -// ******************************************************************** -// Visitor implementation for the Interface_Fwd type -// This one for the client header file -// ******************************************************************** - be_visitor_valuetype_fwd_ch::be_visitor_valuetype_fwd_ch (be_visitor_context *ctx) : be_visitor_decl (ctx) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ch::" - "must be implemented\n"), -1); } be_visitor_valuetype_fwd_ch::~be_visitor_valuetype_fwd_ch (void) @@ -49,55 +42,69 @@ be_visitor_valuetype_fwd_ch::~be_visitor_valuetype_fwd_ch (void) int be_visitor_valuetype_fwd_ch::visit_valuetype_fwd (be_valuetype_fwd *node) { + if (node->cli_hdr_gen () || node->imported ()) + { + return 0; + } + + AST_Interface *fd = node->full_definition (); + be_valuetype *bfd = be_valuetype::narrow_from_decl (fd); + + if (!fd->is_defined ()) + { + // To generate extern declarations after all modules are closed. + be_global->non_defined_interfaces.enqueue_tail (node); + } + TAO_OutStream *os = this->ctx_->stream (); - if (!node->cli_hdr_gen () && !node->imported ()) + *os << "// Valuetype class" << be_nl; + + // == STEP 1: Generate the class name and class names we inherit == + + // Forward declaration. + *os << "class " << node->local_name () << ";" << be_nl; + + // Generate _ptr declaration + os->gen_ifdef_macro (node->flat_name (), "_ptr"); + + *os << "typedef " << node->local_name () + << " *" << node->local_name () << "_ptr;" << be_nl; + + os->gen_endif (); + + // Generate the ifdefined macro for the _var type. + os->gen_ifdef_macro (node->flat_name (), "_var"); + + // Generate the _var declaration. + if (bfd->gen_var_defn () == -1) { - // All we do in this is generate a forward declaration of the class. - *os << "class " << node->local_name () << ";" << be_nl; - - // Generate the ifdefined macro for the _ptr type. - os->gen_ifdef_macro (node->flat_name (), "_ptr"); - - // Generate the _ptr declaration. - *os << "typedef " << node->local_name () << " *" << node->local_name () - << "_ptr;" << be_nl; - - os->gen_endif (); - - // Enclose under an ifdef macro. - os->gen_ifdef_macro (node->flat_name (), "_var"); - - // generate the _var declaration. - if (node->gen_var_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ch::" - "visit_valuetype_fwd - " - "codegen for _var failed\n"), - s-1); - } - - // Generate an endif. - os->gen_endif (); - - // enclose under an ifdef macro. - os->gen_ifdef_macro (node->flat_name (), "_out"); - - // Generate the _out declaration - ORBOS/97-05-15 pg 16-20 spec. - if (node->gen_out_defn () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ch::" - "visit_valuetype_fwd - " - "codegen for _out failed\n"), - -1); - } - - // generate the endif macro. - os->gen_endif (); - node->cli_hdr_gen (I_TRUE); + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "codegen for _var failed\n"), + -1); } + os->gen_endif (); + + // Generate the ifdef macro for the _out class. + os->gen_ifdef_macro (node->flat_name (), "_out"); + + // Generate the _out declaration + if (bfd->gen_out_defn () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_valuetype_ch::" + "visit_valuetype - " + "codegen for _out failed\n"), -1); + } + + // generate the endif macro. + os->gen_endif (); + + node->cli_hdr_gen (I_TRUE); + bfd->cli_hdr_gen (I_TRUE); + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp index e14028a0034..ba6aa3972f0 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype_fwd/valuetype_fwd_ci.cpp @@ -27,59 +27,19 @@ ACE_RCSID(be_visitor_valuetype_fwd, valuetype_fwd_ci, "$Id$") - -// ******************************************************************** -// Visitor implementation for the Interface_Fwd type -// This one for the client inline file -// ******************************************************************** - -be_visitor_valuetype_fwd_ci::be_visitor_valuetype_fwd_ci (be_visitor_context *ctx) +be_visitor_valuetype_fwd_ci::be_visitor_valuetype_fwd_ci ( + be_visitor_context *ctx + ) : be_visitor_decl (ctx) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ci::" - "must be implemented\n"), -1); } be_visitor_valuetype_fwd_ci::~be_visitor_valuetype_fwd_ci (void) { } -// visit the Interface_Fwd_ci node and its scope int -be_visitor_valuetype_fwd_ci::visit_valuetype_fwd (be_valuetype_fwd *node) +be_visitor_valuetype_fwd_ci::visit_valuetype_fwd (be_valuetype_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); - - if (!node->cli_inline_gen () && !node->imported ()) - { - - // generate the ifdefined macro for the _var type - os->gen_ifdef_macro (node->flat_name (), "_var"); - - if (node->gen_var_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ci::" - "visit_valuetype_fwd - " - "codegen for _var failed\n"), -1); - } - - os->gen_endif (); - - // generate the ifdefined macro for the _out type - os->gen_ifdef_macro (node->flat_name (), "_out"); - - if (node->gen_out_impl () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_valuetype_fwd_ci::" - "visit_valuetype_fwd - " - "codegen for _out failed\n"), -1); - } - os->gen_endif (); - - node->cli_stub_gen (I_TRUE); - } return 0; } diff --git a/TAO/TAO_IDL/be_include/be.h b/TAO/TAO_IDL/be_include/be.h index 07574c7b570..888cec56aef 100644 --- a/TAO/TAO_IDL/be_include/be.h +++ b/TAO/TAO_IDL/be_include/be.h @@ -127,6 +127,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "be_typedef.h" // class BE_Typedef #include "be_root.h" // class BE_Root #include "be_native.h" // class BE_Native +#include "be_factory.h" // class be_factory #include "be_helper.h" // helper functions #include "be_codegen.h" // code generator diff --git a/TAO/TAO_IDL/be_include/be_argument.h b/TAO/TAO_IDL/be_include/be_argument.h index 1c229668c82..4096eab1b35 100644 --- a/TAO/TAO_IDL/be_include/be_argument.h +++ b/TAO/TAO_IDL/be_include/be_argument.h @@ -26,7 +26,6 @@ #include "ast_argument.h" class AST_Type; -class UTL_StrList; class be_visitor; class be_argument : public virtual AST_Argument, @@ -39,8 +38,7 @@ public: // Constructor. be_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Visiting. virtual int accept (be_visitor *visitor); diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h index 205a54c3ffd..19d327edea0 100644 --- a/TAO/TAO_IDL/be_include/be_attribute.h +++ b/TAO/TAO_IDL/be_include/be_attribute.h @@ -27,7 +27,6 @@ #include "be_operation_strategy.h" class AST_Type; -class UTL_StrList; class be_visitor; class be_attribute : public virtual AST_Attribute, @@ -40,7 +39,6 @@ public: be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index 7015b283078..efadd94f14f 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -34,726 +34,730 @@ class be_decl; class TAO_IDL_BE_Export TAO_CodeGen { - // = TITLE - // TAO_CodeGen - // - // = DESCRIPTION - // Holds global parameters for the Back End and - // generates the C++ mapping. - // - public: - - // Define all the code generation states. - // The first letter C/S of the suffix stands for client/server-side - // The second letter H/I/S stands for header/inline/impl file. - // These are used to denote the state or the context of code - // generation we are in and serves to produce the right kind of - // visitor for us. - - enum CG_STATE - { - // Initial state. - TAO_INITIAL, - - // Rest of the state in alphabetical order of the types. - - // Emitting code for arguments of an operation. No distinction between - // headers, inlines, stubs. - TAO_ARGUMENT_ARGLIST_CH, // argument in op signature of - // ... client header - TAO_ARGUMENT_ARGLIST_SH, // argument in op signature of - // ... server header - TAO_ARGUMENT_INVOKE_ARG_LIST, - - TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CH, // ... client header - TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS, // ... client source - TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH, // ... client header - TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS, // ... client source - TAO_ARGUMENT_INTERCEPTORS_PARAMLIST, // ... client source - TAO_ARGUMENT_INTERCEPTORS_RESULT, // ... client source - TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SH, // ... server header - TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS, // ... server source - TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_SS, // ... server source - TAO_ARGUMENT_ARGLIST_OTHERS, // ... in other cases - TAO_ARGUMENT_PRE_INVOKE_CS, // preprocessing of argument - // variable before passing to - // do_static_call (in stub) - TAO_ARGUMENT_INVOKE_CS, // passing argument variable to do_static_call - TAO_ARGUMENT_POST_INVOKE_CS, // postprocessing of argument - // variable after do_static_call - TAO_ARGUMENT_VARDECL_SS, // declaration of argument - // variable in skeleton (server) - TAO_ARGUMENT_MARSHAL_SS, // passing argument node to the - TAO_ARGUMENT_DEMARSHAL_SS, // demarshal and marshal - // operations - TAO_ARGUMENT_UPCALL_SS, // passing argument variable to upcall - TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument - // variable to upcall - - // emitting code for attributes. - TAO_ATTRIBUTE_CH, // in client header - TAO_ATTRIBUTE_CS, // in client stubs - TAO_ATTRIBUTE_SH, // in server header - TAO_ATTRIBUTE_IH, // in implementation header - TAO_ATTRIBUTE_SS, // in server skeletons - TAO_ATTRIBUTE_IS, // in implementation skeletons - TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SH, // in server header for collocated - TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SS, // in server skeletons for - // collocated - TAO_ATTRIBUTE_DIRECT_COLLOCATED_SH, // in server header for collocated - TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS, // in server skeletons for - // collocated - - TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH, // Proxy Impl Related Attribute visitors. - - TAO_ATTRIBUTE_PROXY_IMPL_XH, - - TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS, - TAO_ATTRIBUTE_THRU_POA_PROXY_IMPL_SS, - TAO_ATTRIBUTE_DIRECT_PROXY_IMPL_SS, - - TAO_ATTRIBUTE_SMART_PROXY_CH, // in client header - TAO_ATTRIBUTE_SMART_PROXY_CS, // in client source - TAO_ATTRIBUTE_INTERCEPTORS_CH, // in client header - TAO_ATTRIBUTE_INTERCEPTORS_CS, // in client source - TAO_ATTRIBUTE_INTERCEPTORS_SH, // in server header - TAO_ATTRIBUTE_INTERCEPTORS_SS, // in server source - - TAO_ATTRIBUTE_TIE_SH, - TAO_ATTRIBUTE_TIE_SI, - - // Emitting code for array defn. - TAO_ARRAY_CH, - TAO_ARRAY_CI, - TAO_ARRAY_CS, - TAO_ARRAY_ANY_OP_CH, - TAO_ARRAY_ANY_OP_CS, - TAO_ARRAY_CDR_OP_CH, - TAO_ARRAY_CDR_OP_CI, - TAO_ARRAY_CDR_OP_CS, - - // Emitting code for the constants. - TAO_CONSTANT_CH, // in client header - TAO_CONSTANT_CI, // XXXASG rm? - TAO_CONSTANT_CS, // in client stub - - // Emitting code for enums. - TAO_ENUM_CH, // in client header - TAO_ENUM_CS, // in client stubs - TAO_ENUM_ANY_OP_CH, - TAO_ENUM_ANY_OP_CS, - TAO_ENUM_CDR_OP_CH, - TAO_ENUM_CDR_OP_CI, - TAO_ENUM_CDR_OP_CS, - - // Emitting code for exceptions. - TAO_EXCEPTION_CH, - TAO_EXCEPTION_CTOR_CH, - TAO_EXCEPTION_CI, - TAO_EXCEPTION_CS, - TAO_EXCEPTION_CTOR_CS, - TAO_EXCEPTION_CTOR_ASSIGN_CS, - TAO_EXCEPTION_ANY_OP_CH, - TAO_EXCEPTION_ANY_OP_CS, - TAO_EXCEPTION_CDR_OP_CH, - TAO_EXCEPTION_CDR_OP_CI, - TAO_EXCEPTION_CDR_OP_CS, - - // Emitting fields i.e., struct members. - TAO_FIELD_CH, - TAO_FIELD_CI, - TAO_FIELD_CS, - TAO_FIELD_CDR_OP_CH, - TAO_FIELD_CDR_OP_CI, - TAO_FIELD_CDR_OP_CS, - TAO_FIELD_OBV_CH, - - // Emitting code for the interface. - TAO_INTERFACE_CH, - TAO_INTERFACE_CI, - TAO_INTERFACE_CS, - TAO_INTERFACE_SH, - TAO_INTERFACE_IH, - TAO_INTERFACE_SI, - TAO_INTERFACE_SS, - TAO_INTERFACE_IS, - TAO_INTERFACE_THRU_POA_COLLOCATED_SH, - TAO_INTERFACE_THRU_POA_COLLOCATED_SS, - TAO_INTERFACE_DIRECT_COLLOCATED_SH, - TAO_INTERFACE_DIRECT_COLLOCATED_SS, - TAO_INTERFACE_ANY_OP_CH, - TAO_INTERFACE_ANY_OP_CS, - TAO_INTERFACE_CDR_OP_CH, - TAO_INTERFACE_CDR_OP_CI, - TAO_INTERFACE_CDR_OP_CS, - TAO_INTERFACE_TIE_SH, - TAO_INTERFACE_TIE_SI, - TAO_INTERFACE_SMART_PROXY_CH, - TAO_INTERFACE_SMART_PROXY_CS, - TAO_INTERFACE_INTERCEPTORS_CH, - TAO_INTERFACE_INTERCEPTORS_CS, - TAO_INTERFACE_INTERCEPTORS_SH, - TAO_INTERFACE_INTERCEPTORS_SS, - TAO_INTERFACE_PROXY_BROKERS_CH, - TAO_INTERFACE_PROXY_BROKERS_CS, - TAO_INTERFACE_PROXY_BROKERS_SH, - TAO_INTERFACE_PROXY_BROKERS_SS, - TAO_INTERFACE_BASE_PROXY_BROKER_CH, - TAO_INTERFACE_BASE_PROXY_BROKER_CS, - TAO_INTERFACE_REMOTE_PROXY_BROKER_CH, - TAO_INTERFACE_REMOTE_PROXY_BROKER_CS, - TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH, - TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS, - TAO_INTERFACE_PROXY_IMPLS_CH, - TAO_INTERFACE_PROXY_IMPLS_CS, - - TAO_INTERFACE_PROXY_IMPLS_SH, - - TAO_INTERFACE_PROXY_IMPLS_SS, - TAO_INTERFACE_BASE_PROXY_IMPL_CH, - TAO_INTERFACE_BASE_PROXY_IMPL_CS, - TAO_INTERFACE_REMOTE_PROXY_IMPL_CH, - TAO_INTERFACE_REMOTE_PROXY_IMPL_CS, - TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH, - TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS, - TAO_INTERFACE_DIRECT_PROXY_IMPL_SH, - TAO_INTERFACE_DIRECT_PROXY_IMPL_SS, - - // Emitting code for the interface forward declaration. - TAO_INTERFACE_FWD_CH, - TAO_INTERFACE_FWD_CI, - TAO_INTERFACE_FWD_CS, - TAO_INTERFACE_FWD_CDR_OP_CH, - TAO_INTERFACE_FWD_CDR_OP_CI, - TAO_INTERFACE_FWD_CDR_OP_CS, - TAO_INTERFACE_FWD_ANY_OP_CH, - - // Emitting code for the valuetype. - TAO_VALUETYPE_CH, - TAO_VALUETYPE_CI, - TAO_VALUETYPE_CS, - TAO_VALUETYPE_SH, - TAO_VALUETYPE_IH, - TAO_VALUETYPE_SI, - TAO_VALUETYPE_SS, - TAO_VALUETYPE_IS, - TAO_VALUETYPE_OBV_CH, // OBV_ class - TAO_VALUETYPE_OBV_CI, - TAO_VALUETYPE_OBV_CS, - TAO_VALUETYPE_COLLOCATED_SH, - TAO_VALUETYPE_COLLOCATED_SS, - TAO_VALUETYPE_ANY_OP_CH, - TAO_VALUETYPE_ANY_OP_CS, - TAO_VALUETYPE_MARSHAL_CH, // the actual generation of CDR in header - TAO_VALUETYPE_MARSHAL_CS, // and the implementation, activated from: - TAO_VALUETYPE_CDR_OP_CH, - TAO_VALUETYPE_CDR_OP_CI, - TAO_VALUETYPE_CDR_OP_CS, - - // Emitting code for the valuetype forward declaration. - TAO_VALUETYPE_FWD_CH, - TAO_VALUETYPE_FWD_CI, - TAO_VALUETYPE_FWD_CS, - TAO_VALUETYPE_FWD_CDR_OP_CH, - TAO_VALUETYPE_FWD_CDR_OP_CI, - TAO_VALUETYPE_FWD_CDR_OP_CS, - - // Emitting code for the module, - TAO_MODULE_CH, - TAO_MODULE_CI, - TAO_MODULE_CS, - TAO_MODULE_SH, - TAO_MODULE_SI, - TAO_MODULE_IH, - TAO_MODULE_SS, - TAO_MODULE_IS, - TAO_MODULE_ANY_OP_CH, - TAO_MODULE_ANY_OP_CS, - TAO_MODULE_CDR_OP_CH, - TAO_MODULE_CDR_OP_CI, - TAO_MODULE_CDR_OP_CS, - TAO_MODULE_OBV_CH, // for OBV_ (cmp. POA_ namespace) - TAO_MODULE_OBV_CI, - TAO_MODULE_OBV_CS, - - // Emitting code for an operation. - TAO_OPERATION_CH, // in client header - TAO_OPERATION_CS, // in client stubs - TAO_OPERATION_SH, // in server header - TAO_OPERATION_IH, // in implementation header - TAO_OPERATION_SS, // in server skeletons - TAO_OPERATION_IS, // in server skeletons - TAO_OPERATION_THRU_POA_COLLOCATED_SH, // in collocated server header - TAO_OPERATION_THRU_POA_COLLOCATED_SS, // in collocated server skel - TAO_OPERATION_DIRECT_COLLOCATED_SH, // in collocated server header - TAO_OPERATION_DIRECT_COLLOCATED_SS, // in collocated server skel - - TAO_OPERATION_BASE_PROXY_IMPL_CH, // Proxy_Impl operation gen. - // in client header - TAO_OPERATION_PROXY_IMPL_XH, - TAO_OPERATION_REMOTE_PROXY_IMPL_CS, - TAO_OPERATION_THRU_POA_PROXY_IMPL_SS, - TAO_OPERATION_DIRECT_PROXY_IMPL_SS, - - TAO_OPERATION_SMART_PROXY_CH, // in client header - TAO_OPERATION_SMART_PROXY_CS, // in client stubs - TAO_OPERATION_INTERCEPTORS_CH, // in client header - TAO_OPERATION_INTERCEPTORS_CS, // in client source - TAO_OPERATION_INTERCEPTORS_SH, // in server header - TAO_OPERATION_INTERCEPTORS_SS, // in server source - - TAO_OPERATION_RETTYPE_CH, // return type in client header op - // signature - TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH, // return type in client header op - // signature for RequestInfo class - TAO_OPERATION_RETTYPE_SH, // return type in server header op - // signature - TAO_OPERATION_RETTYPE_IS, // return type in client header op - TAO_OPERATION_RETTYPE_OTHERS, // ... in other cases - - TAO_OPERATION_INVOKE_ARG_LIST, // Generate the signature needed to invoke - // the operation given. The signature generated - // consists of the name of the arguments, without - // any type - - TAO_OPERATION_ARGLIST_CH, // parameter list in op signature - // ... for client header - TAO_OPERATION_ARGLIST_SH, // ... for server header - TAO_OPERATION_INTERCEPTORS_ARGLIST_CH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS, // arglist for request info obj instantiation - TAO_OPERATION_INTERCEPTORS_ARGLIST_CS, // private member list list for request info // ... for client source - TAO_OPERATION_INTERCEPTORS_PARAMLIST, // create the paramlist on demand - TAO_OPERATION_INTERCEPTORS_RESULT, // create the result on demand - TAO_OPERATION_INTERCEPTORS_EXCEPTLIST, // create the exceptionlist on demand - TAO_OPERATION_INTERCEPTORS_ARGLIST_SH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH, // private member list list for request info - TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS, // arglist for request info obj instantiation - TAO_OPERATION_INTERCEPTORS_ARGLIST_SS, // private member list list for request info // ... for server source - - // TAO_OPERATION_ARGLIST_PROXY_IMPL_CH, // Proxy impl arg list generation - // in client header - - TAO_OPERATION_ARGLIST_PROXY_IMPL_XH, // Proxy impl arg list generation - // in client/server header - TAO_OPERATION_ARGLIST_PROXY_IMPL_XS, - - TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH, - - TAO_OPERATION_ARGLIST_IH, // ... for implementation header - TAO_OPERATION_ARGLIST_IS, // ... for implementation header - TAO_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server - TAO_OPERATION_ARGLIST_OTHERS, // ... for all other cases - TAO_OPERATION_RETVAL_DECL_CS, // return value variable declaration - TAO_OPERATION_RETVAL_PRE_INVOKE_CS, // preprocessing for return value - // before sending over the wire - TAO_OPERATION_ARG_PRE_INVOKE_CS, // preprocessing of arguments - // before do_static_call - TAO_OPERATION_RETVAL_INVOKE_CS, // passing the return type - // variable to do_static_call - TAO_OPERATION_ARG_INVOKE_CS, // passing argument variable to do_static_call - // after do_static_call - TAO_OPERATION_ARG_POST_INVOKE_CS, // processing of arg after do_static_call - TAO_OPERATION_RETVAL_RETURN_CS, // returning the return type - // variable - TAO_OPERATION_EXCEPTLIST_CS, // generating the exception list - TAO_OPERATION_RETVAL_DECL_SS, // return type decl in skeleton - TAO_OPERATION_ARG_DECL_SS, // argument decl in skeleton - TAO_OPERATION_ARG_DEMARSHAL_SS, // and argument variables to the - TAO_OPERATION_RETVAL_MARSHAL_SS, // marshal and demarshal operations - TAO_OPERATION_ARG_MARSHAL_SS, - TAO_OPERATION_RETVAL_ASSIGN_SS, // assigning to return type - // variable - TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall - TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS, // variables to upcall for - // collocated op - TAO_OPERATION_ARG_POST_UPCALL_SS, // return and argument variables - TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS, // Interceptor args - TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS, // Interceptor args - TAO_OPERATION_RESULT_SS, // XXXASG rm? - TAO_OPERATION_TIE_SH, - TAO_OPERATION_TIE_SI, - - TAO_OBV_OPERATION_ARGLIST_CH, // parameter list in obv op signature - // ... for client header - TAO_OBV_OPERATION_ARGLIST_OBV_CH, // ... for OBV_ class - TAO_OBV_OPERATION_ARGLIST_SH, // ... for server header - TAO_OBV_OPERATION_ARGLIST_IH, // ... for implementation header - TAO_OBV_OPERATION_ARGLIST_IS, // ... for implementation header - TAO_OBV_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server - TAO_OBV_OPERATION_ARGLIST_OTHERS, // ... for all other cases - TAO_OBV_OPERATION_ARGLIST_IMPL_CH, // for implementations, e.g. exception holders - TAO_OBV_OPERATION_ARGLIST_IMPL_CS, // for implementations, e.g. exception holders - - // AMI next generation states - TAO_AMI_INTERFACE_CH, - TAO_AMI_SENDC_OPERATION_CH, - TAO_AMI_SENDC_OPERATION_CS, - TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH, - TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS, - TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH, - TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS, - TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS, - - // AMH next state generation - TAO_INTERFACE_AMH_SH, - TAO_INTERFACE_AMH_SS, - TAO_OPERATION_AMH_SH, // added 12/11 - TAO_OPERATION_AMH_SS, - TAO_INTERFACE_AMH_RH_SH, // added 12/19 - TAO_INTERFACE_AMH_RH_SS, - TAO_OPERATION_AMH_RH_SH, - TAO_OPERATION_AMH_RH_SS, - - // Emitting code for root. - TAO_ROOT_CH, - TAO_ROOT_CI, - TAO_ROOT_CS, - TAO_ROOT_SH, - TAO_ROOT_SI, - TAO_ROOT_SS, - TAO_ROOT_TIE_SH, - TAO_ROOT_IH, - TAO_ROOT_IS, - TAO_ROOT_ANY_OP_CH, - TAO_ROOT_ANY_OP_CS, - TAO_ROOT_CDR_OP_CH, - TAO_ROOT_CDR_OP_CI, - TAO_ROOT_CDR_OP_CS, - - // Emitting sequences. - TAO_SEQUENCE_CH, - TAO_SEQUENCE_CI, - TAO_SEQUENCE_CS, - TAO_SEQUENCE_ANY_OP_CH, - TAO_SEQUENCE_ANY_OP_CS, - TAO_SEQUENCE_CDR_OP_CH, - TAO_SEQUENCE_CDR_OP_CI, - TAO_SEQUENCE_CDR_OP_CS, - - // Emitting code for sequence base type. - TAO_SEQUENCE_BASE_CH, - TAO_SEQUENCE_BASE_CI, - TAO_SEQUENCE_BASE_CS, - - // For special sequnce elements. - TAO_SEQELEM_RETTYPE_CH, - TAO_SEQELEM_RETTYPE_CI, - TAO_SEQELEM_RETTYPE_CS, - - // For sequence buffer types. - TAO_SEQUENCE_BUFFER_TYPE_CH, - TAO_SEQUENCE_BUFFER_TYPE_CI, - TAO_SEQUENCE_BUFFER_TYPE_CS, - - // Emitting code for struct and its members. - TAO_STRUCT_CH, - TAO_STRUCT_CI, - TAO_STRUCT_CS, - TAO_STRUCT_ANY_OP_CH, - TAO_STRUCT_ANY_OP_CS, - TAO_STRUCT_CDR_OP_CH, - TAO_STRUCT_CDR_OP_CI, - TAO_STRUCT_CDR_OP_CS, - - // Emitting code for typedefs. - TAO_TYPEDEF_CH, - TAO_TYPEDEF_CI, - TAO_TYPEDEF_CS, - TAO_TYPEDEF_ANY_OP_CH, - TAO_TYPEDEF_ANY_OP_CS, - TAO_TYPEDEF_CDR_OP_CH, - TAO_TYPEDEF_CDR_OP_CI, - TAO_TYPEDEF_CDR_OP_CS, - - // Emitting code for unions. - TAO_UNION_CH, - TAO_UNION_CI, - TAO_UNION_CS, - TAO_UNION_ANY_OP_CH, - TAO_UNION_ANY_OP_CS, - TAO_UNION_CDR_OP_CH, - TAO_UNION_CDR_OP_CI, - TAO_UNION_CDR_OP_CS, - - // Emitting code for the discriminant. - TAO_UNION_DISCTYPEDEFN_CH, - TAO_UNION_DISCTYPEDEFN_CI, - TAO_UNION_DISCTYPEDEFN_CS, - - // Emitting code for the public members of the union. - TAO_UNION_PUBLIC_CH, - TAO_UNION_PUBLIC_CI, - TAO_UNION_PUBLIC_CS, - TAO_UNION_PUBLIC_ASSIGN_CS, - TAO_UNION_PUBLIC_RESET_CS, - TAO_UNION_PUBLIC_ACCESS_CS, - - // Emitting code for private members of the union. - TAO_UNION_PRIVATE_CH, - - // Emitting code for CDR operators for types defined inside unions. - TAO_UNION_BRANCH_CDR_OP_CH, - TAO_UNION_BRANCH_CDR_OP_CI, - TAO_UNION_BRANCH_CDR_OP_CS, - - // Emitting code for typecodes. - TAO_TYPECODE_DECL, - TAO_TYPECODE_DEFN, - - // Always must be last. - TAO_UNKNOWN - }; - - enum LOOKUP_STRATEGY - { - // Various lookup strategies. - TAO_LINEAR_SEARCH, - TAO_DYNAMIC_HASH, - TAO_PERFECT_HASH, - TAO_BINARY_SEARCH, - TAO_ACTIVE_DEMUX, - TAO_USER_DEFINED - }; - - enum CG_SUB_STATE - { - // Sub states. - - // These are for the CDR operators. - TAO_CDR_INPUT, - TAO_CDR_OUTPUT, - TAO_CDR_SCOPE, - - // These are for typecode generation. - TAO_TC_DEFN_TYPECODE, // top level typecode - TAO_TC_DEFN_TYPECODE_NESTED, // nested tc - - TAO_TC_DEFN_ENCAPSULATION, // encapsulation - TAO_AMI_HANDLER_TC_DEFN_ENCAPSULATION, // encapsulation - - TAO_TC_DEFN_SCOPE, // scope - TAO_TC_DEFN_TC_SIZE, // tc size computation - TAO_TC_DEFN_ENCAP_LEN, // encap size computation - TAO_TC_DEFN_SCOPE_LEN, // scope size computation - - // Means the upcall has arguments. - TAO_USE_FULL_NAME, + // = TITLE + // TAO_CodeGen + // + // = DESCRIPTION + // Holds global parameters for the Back End and + // generates the C++ mapping. + // +public: + + // Define all the code generation states. + // The first letter C/S of the suffix stands for client/server-side + // The second letter H/I/S stands for header/inline/impl file. + // These are used to denote the state or the context of code + // generation we are in and serves to produce the right kind of + // visitor for us. + + enum CG_STATE + { + // Initial state. + TAO_INITIAL, + + // Rest of the state in alphabetical order of the types. + + // Emitting code for arguments of an operation. No distinction between + // headers, inlines, stubs. + TAO_ARGUMENT_ARGLIST_CH, // argument in op signature of + // ... client header + TAO_ARGUMENT_ARGLIST_SH, // argument in op signature of + // ... server header + TAO_ARGUMENT_INVOKE_ARG_LIST, + + TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CH, // ... client header + TAO_ARGUMENT_INTERCEPTORS_ARGLIST_CS, // ... client source + TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CH, // ... client header + TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_CS, // ... client source + TAO_ARGUMENT_INTERCEPTORS_PARAMLIST, // ... client source + TAO_ARGUMENT_INTERCEPTORS_RESULT, // ... client source + TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SH, // ... server header + TAO_ARGUMENT_INTERCEPTORS_ARGLIST_SS, // ... server source + TAO_ARGUMENT_INTERCEPTORS_INFO_ARGLIST_SS, // ... server source + TAO_ARGUMENT_ARGLIST_OTHERS, // ... in other cases + TAO_ARGUMENT_PRE_INVOKE_CS, // preprocessing of argument + // variable before passing to + // do_static_call (in stub) + TAO_ARGUMENT_INVOKE_CS, // passing argument variable to do_static_call + TAO_ARGUMENT_POST_INVOKE_CS, // postprocessing of argument + // variable after do_static_call + TAO_ARGUMENT_VARDECL_SS, // declaration of argument + // variable in skeleton (server) + TAO_ARGUMENT_MARSHAL_SS, // passing argument node to the + TAO_ARGUMENT_DEMARSHAL_SS, // demarshal and marshal + // operations + TAO_ARGUMENT_UPCALL_SS, // passing argument variable to upcall + TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument + // variable to upcall + + // emitting code for attributes. + TAO_ATTRIBUTE_CH, // in client header + TAO_ATTRIBUTE_CS, // in client stubs + TAO_ATTRIBUTE_SH, // in server header + TAO_ATTRIBUTE_IH, // in implementation header + TAO_ATTRIBUTE_SS, // in server skeletons + TAO_ATTRIBUTE_IS, // in implementation skeletons + TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SH, // in server header for collocated + TAO_ATTRIBUTE_THRU_POA_COLLOCATED_SS, // in server skeletons for + // collocated + TAO_ATTRIBUTE_DIRECT_COLLOCATED_SH, // in server header for collocated + TAO_ATTRIBUTE_DIRECT_COLLOCATED_SS, // in server skeletons for + // collocated + + TAO_ATTRIBUTE_BASE_PROXY_IMPL_CH, // Proxy Impl Related Attribute visitors. + + TAO_ATTRIBUTE_PROXY_IMPL_XH, + + TAO_ATTRIBUTE_REMOTE_PROXY_IMPL_CS, + TAO_ATTRIBUTE_THRU_POA_PROXY_IMPL_SS, + TAO_ATTRIBUTE_DIRECT_PROXY_IMPL_SS, + + TAO_ATTRIBUTE_SMART_PROXY_CH, // in client header + TAO_ATTRIBUTE_SMART_PROXY_CS, // in client source + TAO_ATTRIBUTE_INTERCEPTORS_CH, // in client header + TAO_ATTRIBUTE_INTERCEPTORS_CS, // in client source + TAO_ATTRIBUTE_INTERCEPTORS_SH, // in server header + TAO_ATTRIBUTE_INTERCEPTORS_SS, // in server source + + TAO_ATTRIBUTE_TIE_SH, + TAO_ATTRIBUTE_TIE_SI, + + // Emitting code for array defn. + TAO_ARRAY_CH, + TAO_ARRAY_CI, + TAO_ARRAY_CS, + TAO_ARRAY_ANY_OP_CH, + TAO_ARRAY_ANY_OP_CS, + TAO_ARRAY_CDR_OP_CH, + TAO_ARRAY_CDR_OP_CI, + TAO_ARRAY_CDR_OP_CS, + + // Emitting code for the constants. + TAO_CONSTANT_CH, // in client header + TAO_CONSTANT_CI, // XXXASG rm? + TAO_CONSTANT_CS, // in client stub + + // Emitting code for enums. + TAO_ENUM_CH, // in client header + TAO_ENUM_CS, // in client stubs + TAO_ENUM_ANY_OP_CH, + TAO_ENUM_ANY_OP_CS, + TAO_ENUM_CDR_OP_CH, + TAO_ENUM_CDR_OP_CI, + TAO_ENUM_CDR_OP_CS, + + // Emitting code for exceptions. + TAO_EXCEPTION_CH, + TAO_EXCEPTION_CTOR_CH, + TAO_EXCEPTION_CI, + TAO_EXCEPTION_CS, + TAO_EXCEPTION_CTOR_CS, + TAO_EXCEPTION_CTOR_ASSIGN_CS, + TAO_EXCEPTION_ANY_OP_CH, + TAO_EXCEPTION_ANY_OP_CS, + TAO_EXCEPTION_CDR_OP_CH, + TAO_EXCEPTION_CDR_OP_CI, + TAO_EXCEPTION_CDR_OP_CS, + + // Emitting fields i.e., struct members. + TAO_FIELD_CH, + TAO_FIELD_CI, + TAO_FIELD_CS, + TAO_FIELD_CDR_OP_CH, + TAO_FIELD_CDR_OP_CI, + TAO_FIELD_CDR_OP_CS, + TAO_FIELD_OBV_CH, + + // Emitting code for the interface. + TAO_INTERFACE_CH, + TAO_INTERFACE_CI, + TAO_INTERFACE_CS, + TAO_INTERFACE_SH, + TAO_INTERFACE_IH, + TAO_INTERFACE_SI, + TAO_INTERFACE_SS, + TAO_INTERFACE_IS, + TAO_INTERFACE_THRU_POA_COLLOCATED_SH, + TAO_INTERFACE_THRU_POA_COLLOCATED_SS, + TAO_INTERFACE_DIRECT_COLLOCATED_SH, + TAO_INTERFACE_DIRECT_COLLOCATED_SS, + TAO_INTERFACE_ANY_OP_CH, + TAO_INTERFACE_ANY_OP_CS, + TAO_INTERFACE_CDR_OP_CH, + TAO_INTERFACE_CDR_OP_CI, + TAO_INTERFACE_CDR_OP_CS, + TAO_INTERFACE_TIE_SH, + TAO_INTERFACE_TIE_SI, + TAO_INTERFACE_SMART_PROXY_CH, + TAO_INTERFACE_SMART_PROXY_CS, + TAO_INTERFACE_INTERCEPTORS_CH, + TAO_INTERFACE_INTERCEPTORS_CS, + TAO_INTERFACE_INTERCEPTORS_SH, + TAO_INTERFACE_INTERCEPTORS_SS, + TAO_INTERFACE_PROXY_BROKERS_CH, + TAO_INTERFACE_PROXY_BROKERS_CS, + TAO_INTERFACE_PROXY_BROKERS_SH, + TAO_INTERFACE_PROXY_BROKERS_SS, + TAO_INTERFACE_BASE_PROXY_BROKER_CH, + TAO_INTERFACE_BASE_PROXY_BROKER_CS, + TAO_INTERFACE_REMOTE_PROXY_BROKER_CH, + TAO_INTERFACE_REMOTE_PROXY_BROKER_CS, + TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SH, + TAO_INTERFACE_STRATEGIZED_PROXY_BROKER_SS, + TAO_INTERFACE_PROXY_IMPLS_CH, + TAO_INTERFACE_PROXY_IMPLS_CS, + + TAO_INTERFACE_PROXY_IMPLS_SH, + + TAO_INTERFACE_PROXY_IMPLS_SS, + TAO_INTERFACE_BASE_PROXY_IMPL_CH, + TAO_INTERFACE_BASE_PROXY_IMPL_CS, + TAO_INTERFACE_REMOTE_PROXY_IMPL_CH, + TAO_INTERFACE_REMOTE_PROXY_IMPL_CS, + TAO_INTERFACE_THRU_POA_PROXY_IMPL_SH, + TAO_INTERFACE_THRU_POA_PROXY_IMPL_SS, + TAO_INTERFACE_DIRECT_PROXY_IMPL_SH, + TAO_INTERFACE_DIRECT_PROXY_IMPL_SS, + + // Emitting code for the interface forward declaration. + TAO_INTERFACE_FWD_CH, + TAO_INTERFACE_FWD_CI, + TAO_INTERFACE_FWD_CS, + TAO_INTERFACE_FWD_CDR_OP_CH, + TAO_INTERFACE_FWD_CDR_OP_CI, + TAO_INTERFACE_FWD_CDR_OP_CS, + TAO_INTERFACE_FWD_ANY_OP_CH, + + // Emitting code for the valuetype. + TAO_VALUETYPE_CH, + TAO_VALUETYPE_CI, + TAO_VALUETYPE_CS, + TAO_VALUETYPE_SH, + TAO_VALUETYPE_IH, + TAO_VALUETYPE_SI, + TAO_VALUETYPE_SS, + TAO_VALUETYPE_IS, + TAO_VALUETYPE_OBV_CH, // OBV_ class + TAO_VALUETYPE_OBV_CI, + TAO_VALUETYPE_OBV_CS, + TAO_VALUETYPE_COLLOCATED_SH, + TAO_VALUETYPE_COLLOCATED_SS, + TAO_VALUETYPE_ANY_OP_CH, + TAO_VALUETYPE_ANY_OP_CS, + TAO_VALUETYPE_MARSHAL_CH, // the actual generation of CDR in header + TAO_VALUETYPE_MARSHAL_CS, // and the implementation, activated from: + TAO_VALUETYPE_CDR_OP_CH, + TAO_VALUETYPE_CDR_OP_CI, + TAO_VALUETYPE_CDR_OP_CS, + TAO_VALUETYPE_INIT_CH, // _init -related generation + TAO_VALUETYPE_INIT_CI, // + TAO_VALUETYPE_INIT_CS, // + TAO_VALUETYPE_INIT_ARGLIST_CH,// unfortunately there are no CI and CS + + // Emitting code for the valuetype forward declaration. + TAO_VALUETYPE_FWD_CH, + TAO_VALUETYPE_FWD_CI, + TAO_VALUETYPE_FWD_CS, + TAO_VALUETYPE_FWD_CDR_OP_CH, + TAO_VALUETYPE_FWD_CDR_OP_CI, + TAO_VALUETYPE_FWD_CDR_OP_CS, + + // Emitting code for the module, + TAO_MODULE_CH, + TAO_MODULE_CI, + TAO_MODULE_CS, + TAO_MODULE_SH, + TAO_MODULE_SI, + TAO_MODULE_IH, + TAO_MODULE_SS, + TAO_MODULE_IS, + TAO_MODULE_ANY_OP_CH, + TAO_MODULE_ANY_OP_CS, + TAO_MODULE_CDR_OP_CH, + TAO_MODULE_CDR_OP_CI, + TAO_MODULE_CDR_OP_CS, + TAO_MODULE_OBV_CH, // for OBV_ (cmp. POA_ namespace) + TAO_MODULE_OBV_CI, + TAO_MODULE_OBV_CS, + + // Emitting code for an operation. + TAO_OPERATION_CH, // in client header + TAO_OPERATION_CS, // in client stubs + TAO_OPERATION_SH, // in server header + TAO_OPERATION_IH, // in implementation header + TAO_OPERATION_SS, // in server skeletons + TAO_OPERATION_IS, // in server skeletons + TAO_OPERATION_THRU_POA_COLLOCATED_SH, // in collocated server header + TAO_OPERATION_THRU_POA_COLLOCATED_SS, // in collocated server skel + TAO_OPERATION_DIRECT_COLLOCATED_SH, // in collocated server header + TAO_OPERATION_DIRECT_COLLOCATED_SS, // in collocated server skel + + TAO_OPERATION_BASE_PROXY_IMPL_CH, // Proxy_Impl operation gen. + // in client header + TAO_OPERATION_PROXY_IMPL_XH, + TAO_OPERATION_REMOTE_PROXY_IMPL_CS, + TAO_OPERATION_THRU_POA_PROXY_IMPL_SS, + TAO_OPERATION_DIRECT_PROXY_IMPL_SS, + + TAO_OPERATION_SMART_PROXY_CH, // in client header + TAO_OPERATION_SMART_PROXY_CS, // in client stubs + TAO_OPERATION_INTERCEPTORS_CH, // in client header + TAO_OPERATION_INTERCEPTORS_CS, // in client source + TAO_OPERATION_INTERCEPTORS_SH, // in server header + TAO_OPERATION_INTERCEPTORS_SS, // in server source + + TAO_OPERATION_RETTYPE_CH, // return type in client header op + // signature + TAO_OPERATION_INTERCEPTORS_INFO_RETTYPE_CH, // return type in client header op + // signature for RequestInfo class + TAO_OPERATION_RETTYPE_SH, // return type in server header op + // signature + TAO_OPERATION_RETTYPE_IS, // return type in client header op + TAO_OPERATION_RETTYPE_OTHERS, // ... in other cases + + TAO_OPERATION_INVOKE_ARG_LIST, // Generate the signature needed to invoke + // the operation given. The signature generated + // consists of the name of the arguments, without + // any type + + TAO_OPERATION_ARGLIST_CH, // parameter list in op signature + // ... for client header + TAO_OPERATION_ARGLIST_SH, // ... for server header + TAO_OPERATION_INTERCEPTORS_ARGLIST_CH, // private member list list for request info + TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CH, // private member list list for request info + TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_CS, // arglist for request info obj instantiation + TAO_OPERATION_INTERCEPTORS_ARGLIST_CS, // private member list list for request info // ... for client source + TAO_OPERATION_INTERCEPTORS_PARAMLIST, // create the paramlist on demand + TAO_OPERATION_INTERCEPTORS_RESULT, // create the result on demand + TAO_OPERATION_INTERCEPTORS_EXCEPTLIST, // create the exceptionlist on demand + TAO_OPERATION_INTERCEPTORS_ARGLIST_SH, // private member list list for request info + TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SH, // private member list list for request info + TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS, // arglist for request info obj instantiation + TAO_OPERATION_INTERCEPTORS_ARGLIST_SS, // private member list list for request info // ... for server source + + // TAO_OPERATION_ARGLIST_PROXY_IMPL_CH, // Proxy impl arg list generation + // in client header + + TAO_OPERATION_ARGLIST_PROXY_IMPL_XH, // Proxy impl arg list generation + // in client/server header + TAO_OPERATION_ARGLIST_PROXY_IMPL_XS, + + TAO_OPERATION_ARGLIST_BASE_PROXY_IMPL_CH, + + TAO_OPERATION_ARGLIST_IH, // ... for implementation header + TAO_OPERATION_ARGLIST_IS, // ... for implementation header + TAO_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server + TAO_OPERATION_ARGLIST_OTHERS, // ... for all other cases + TAO_OPERATION_RETVAL_DECL_CS, // return value variable declaration + TAO_OPERATION_RETVAL_PRE_INVOKE_CS, // preprocessing for return value + // before sending over the wire + TAO_OPERATION_ARG_PRE_INVOKE_CS, // preprocessing of arguments + // before do_static_call + TAO_OPERATION_RETVAL_INVOKE_CS, // passing the return type + // variable to do_static_call + TAO_OPERATION_ARG_INVOKE_CS, // passing argument variable to do_static_call + // after do_static_call + TAO_OPERATION_ARG_POST_INVOKE_CS, // processing of arg after do_static_call + TAO_OPERATION_RETVAL_RETURN_CS, // returning the return type + // variable + TAO_OPERATION_EXCEPTLIST_CS, // generating the exception list + TAO_OPERATION_RETVAL_DECL_SS, // return type decl in skeleton + TAO_OPERATION_ARG_DECL_SS, // argument decl in skeleton + TAO_OPERATION_ARG_DEMARSHAL_SS, // and argument variables to the + TAO_OPERATION_RETVAL_MARSHAL_SS, // marshal and demarshal operations + TAO_OPERATION_ARG_MARSHAL_SS, + TAO_OPERATION_RETVAL_ASSIGN_SS, // assigning to return type + // variable + TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall + TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS, // variables to upcall for + // collocated op + TAO_OPERATION_ARG_POST_UPCALL_SS, // return and argument variables + TAO_OPERATION_INTERCEPTORS_ARG_INFO_CS, // Interceptor args + TAO_OPERATION_INTERCEPTORS_ARG_INFO_SS, // Interceptor args + TAO_OPERATION_RESULT_SS, // XXXASG rm? + TAO_OPERATION_TIE_SH, + TAO_OPERATION_TIE_SI, + + TAO_OBV_OPERATION_ARGLIST_CH, // parameter list in obv op signature + // ... for client header + TAO_OBV_OPERATION_ARGLIST_OBV_CH, // ... for OBV_ class + TAO_OBV_OPERATION_ARGLIST_SH, // ... for server header + TAO_OBV_OPERATION_ARGLIST_IH, // ... for implementation header + TAO_OBV_OPERATION_ARGLIST_IS, // ... for implementation header + TAO_OBV_OPERATION_ARGLIST_COLLOCATED_SH, // ... for collocated server + TAO_OBV_OPERATION_ARGLIST_OTHERS, // ... for all other cases + TAO_OBV_OPERATION_ARGLIST_IMPL_CH, // for implementations, e.g. exception holders + TAO_OBV_OPERATION_ARGLIST_IMPL_CS, // for implementations, e.g. exception holders + + // AMI next generation states + TAO_AMI_INTERFACE_CH, + TAO_AMI_SENDC_OPERATION_CH, + TAO_AMI_SENDC_OPERATION_CS, + TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CH, + TAO_AMI_HANDLER_REPLY_STUB_OPERATION_CS, + TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH, + TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS, + TAO_AMI_EXCEPTION_HOLDER_RAISE_OPERATION_CS, + + // AMH next state generation + TAO_INTERFACE_AMH_SH, + TAO_INTERFACE_AMH_SS, + TAO_OPERATION_AMH_SH, // added 12/11 + TAO_OPERATION_AMH_SS, + TAO_INTERFACE_AMH_RH_SH, // added 12/19 + TAO_INTERFACE_AMH_RH_SS, + TAO_OPERATION_AMH_RH_SH, + TAO_OPERATION_AMH_RH_SS, + + // Emitting code for root. + TAO_ROOT_CH, + TAO_ROOT_CI, + TAO_ROOT_CS, + TAO_ROOT_SH, + TAO_ROOT_SI, + TAO_ROOT_SS, + TAO_ROOT_TIE_SH, + TAO_ROOT_IH, + TAO_ROOT_IS, + TAO_ROOT_ANY_OP_CH, + TAO_ROOT_ANY_OP_CS, + TAO_ROOT_CDR_OP_CH, + TAO_ROOT_CDR_OP_CI, + TAO_ROOT_CDR_OP_CS, + + // Emitting sequences. + TAO_SEQUENCE_CH, + TAO_SEQUENCE_CI, + TAO_SEQUENCE_CS, + TAO_SEQUENCE_ANY_OP_CH, + TAO_SEQUENCE_ANY_OP_CS, + TAO_SEQUENCE_CDR_OP_CH, + TAO_SEQUENCE_CDR_OP_CI, + TAO_SEQUENCE_CDR_OP_CS, + + // Emitting code for sequence base type. + TAO_SEQUENCE_BASE_CH, + TAO_SEQUENCE_BASE_CI, + TAO_SEQUENCE_BASE_CS, + + // For special sequnce elements. + TAO_SEQELEM_RETTYPE_CH, + TAO_SEQELEM_RETTYPE_CI, + TAO_SEQELEM_RETTYPE_CS, + + // For sequence buffer types. + TAO_SEQUENCE_BUFFER_TYPE_CH, + TAO_SEQUENCE_BUFFER_TYPE_CI, + TAO_SEQUENCE_BUFFER_TYPE_CS, + + // Emitting code for struct and its members. + TAO_STRUCT_CH, + TAO_STRUCT_CI, + TAO_STRUCT_CS, + TAO_STRUCT_ANY_OP_CH, + TAO_STRUCT_ANY_OP_CS, + TAO_STRUCT_CDR_OP_CH, + TAO_STRUCT_CDR_OP_CI, + TAO_STRUCT_CDR_OP_CS, + + // Emitting code for typedefs. + TAO_TYPEDEF_CH, + TAO_TYPEDEF_CI, + TAO_TYPEDEF_CS, + TAO_TYPEDEF_ANY_OP_CH, + TAO_TYPEDEF_ANY_OP_CS, + TAO_TYPEDEF_CDR_OP_CH, + TAO_TYPEDEF_CDR_OP_CI, + TAO_TYPEDEF_CDR_OP_CS, + + // Emitting code for unions. + TAO_UNION_CH, + TAO_UNION_CI, + TAO_UNION_CS, + TAO_UNION_ANY_OP_CH, + TAO_UNION_ANY_OP_CS, + TAO_UNION_CDR_OP_CH, + TAO_UNION_CDR_OP_CI, + TAO_UNION_CDR_OP_CS, + + // Emitting code for the discriminant. + TAO_UNION_DISCTYPEDEFN_CH, + TAO_UNION_DISCTYPEDEFN_CI, + TAO_UNION_DISCTYPEDEFN_CS, + + // Emitting code for the public members of the union. + TAO_UNION_PUBLIC_CH, + TAO_UNION_PUBLIC_CI, + TAO_UNION_PUBLIC_CS, + TAO_UNION_PUBLIC_ASSIGN_CS, + TAO_UNION_PUBLIC_RESET_CS, + TAO_UNION_PUBLIC_ACCESS_CS, + + // Emitting code for private members of the union. + TAO_UNION_PRIVATE_CH, + + // Emitting code for CDR operators for types defined inside unions. + TAO_UNION_BRANCH_CDR_OP_CH, + TAO_UNION_BRANCH_CDR_OP_CI, + TAO_UNION_BRANCH_CDR_OP_CS, + + // Emitting code for typecodes. + TAO_TYPECODE_DECL, + TAO_TYPECODE_DEFN, + + // Always must be last. + TAO_UNKNOWN + }; + + enum LOOKUP_STRATEGY + { + // Various lookup strategies. + TAO_LINEAR_SEARCH, + TAO_DYNAMIC_HASH, + TAO_PERFECT_HASH, + TAO_BINARY_SEARCH, + TAO_ACTIVE_DEMUX, + TAO_USER_DEFINED + }; + + enum CG_SUB_STATE + { + // Sub states. + + // These are for the CDR operators. + TAO_CDR_INPUT, + TAO_CDR_OUTPUT, + TAO_CDR_SCOPE, + + // These are for typecode generation. + TAO_TC_DEFN_TYPECODE, // top level typecode + TAO_TC_DEFN_TYPECODE_NESTED, // nested tc + + TAO_TC_DEFN_ENCAPSULATION, // encapsulation + TAO_AMI_HANDLER_TC_DEFN_ENCAPSULATION, // encapsulation + + TAO_TC_DEFN_SCOPE, // scope + TAO_TC_DEFN_TC_SIZE, // tc size computation + TAO_TC_DEFN_ENCAP_LEN, // encap size computation + TAO_TC_DEFN_SCOPE_LEN, // scope size computation + + // Means the upcall has arguments. + TAO_USE_FULL_NAME, - // Means we are not generating the assignment operator. - TAO_UNION_COPY_CONSTRUCTOR, + // Means we are not generating the assignment operator. + TAO_UNION_COPY_CONSTRUCTOR, - // Generating the _var template parameter in sequence of arrays. - TAO_ARRAY_SEQ_CH_TEMPLATE_VAR, + // Generating the _var template parameter in sequence of arrays. + TAO_ARRAY_SEQ_CH_TEMPLATE_VAR, - // Used to denote either error or don't care. - TAO_SUB_STATE_UNKNOWN - }; + // Used to denote either error or don't care. + TAO_SUB_STATE_UNKNOWN + }; - TAO_CodeGen (void); - // Constructor + TAO_CodeGen (void); + // Constructor - ~TAO_CodeGen (void); - // Destructor + ~TAO_CodeGen (void); + // Destructor - be_visitor *make_visitor (be_visitor_context *); - // Factory that makes the right visitor based on the contex. This - // delegates the task to its factory data member. + be_visitor *make_visitor (be_visitor_context *); + // Factory that makes the right visitor based on the contex. This + // delegates the task to its factory data member. - int gen_cplusplus_mapping (void); - // Generate the C++ mapping for CORBA IDL. + int gen_cplusplus_mapping (void); + // Generate the C++ mapping for CORBA IDL. - int start_client_header (const char *fname); - // Set the client header stream. + int start_client_header (const char *fname); + // Set the client header stream. - int start_client_inline (const char *fname); - // Set the client inline stream. + int start_client_inline (const char *fname); + // Set the client inline stream. - int start_client_stubs (const char *fname); - // Set the client stub stream. + int start_client_stubs (const char *fname); + // Set the client stub stream. - int start_server_header (const char *fname); - // Set the server header stream. + int start_server_header (const char *fname); + // Set the server header stream. - int start_implementation_header (const char *fname); - // Set the implementation header stream. + int start_implementation_header (const char *fname); + // Set the implementation header stream. - int start_implementation_skeleton (const char *fname); - // Set the implementation skeleton stream. + int start_implementation_skeleton (const char *fname); + // Set the implementation skeleton stream. - int start_server_template_header (const char *fname); - // Set the server template header stream. + int start_server_template_header (const char *fname); + // Set the server template header stream. - int start_server_inline (const char *fname); - // Set the server inline stream. + int start_server_inline (const char *fname); + // Set the server inline stream. - int start_server_template_inline (const char *fname); - // Set the server template inline stream. + int start_server_template_inline (const char *fname); + // Set the server template inline stream. - int start_server_skeletons (const char *fname); - // Set the server skeletons stream. + int start_server_skeletons (const char *fname); + // Set the server skeletons stream. - int start_server_template_skeletons (const char *fname); - // Set the server template skeletons stream. + int start_server_template_skeletons (const char *fname); + // Set the server template skeletons stream. - int end_client_header (void); - // Generate code at the end such as the <<= and >>= operators alongwith the - // ending #endif statement. + int end_client_header (void); + // Generate code at the end such as the <<= and >>= operators alongwith the + // ending #endif statement. - int end_server_header (void); - // Put a last #endif in the server header. + int end_server_header (void); + // Put a last #endif in the server header. - int end_implementation_header (const char *fname); - // Put a last #endif in the server header. + int end_implementation_header (const char *fname); + // Put a last #endif in the server header. - int end_implementation_skeleton (const char *fname); - // Put a last #endif in the server header. + int end_implementation_skeleton (const char *fname); + // Put a last #endif in the server header. - int end_server_template_header (void); - // Put a last #endif in the server template header. + int end_server_template_header (void); + // Put a last #endif in the server template header. - int end_server_template_inline (void); - // Put a last #endif in the server template header. + int end_server_template_inline (void); + // Put a last #endif in the server template header. - int end_server_template_skeletons (void); - // Put a last #endif in the server skeletons. + int end_server_template_skeletons (void); + // Put a last #endif in the server skeletons. - int end_server_skeletons (void); - // Put a last #endif in the server skeletons. + int end_server_skeletons (void); + // Put a last #endif in the server skeletons. - TAO_OutStream *client_header (void); - // Get the client header stream. + TAO_OutStream *client_header (void); + // Get the client header stream. - TAO_OutStream *client_stubs (void); - // Get the client stubs stream. + TAO_OutStream *client_stubs (void); + // Get the client stubs stream. - TAO_OutStream *client_inline (void); - // Get the client inline stream. + TAO_OutStream *client_inline (void); + // Get the client inline stream. - TAO_OutStream *server_header (void); - // get the server header stream. + TAO_OutStream *server_header (void); + // get the server header stream. - TAO_OutStream *implementation_header (void); - // Get the implementation header stream. + TAO_OutStream *implementation_header (void); + // Get the implementation header stream. - TAO_OutStream *implementation_skeleton (void); - // Get the implementation skeleton stream. + TAO_OutStream *implementation_skeleton (void); + // Get the implementation skeleton stream. - TAO_OutStream *server_template_header (void); - // Get the server header template stream. + TAO_OutStream *server_template_header (void); + // Get the server header template stream. - TAO_OutStream *server_skeletons (void); - // Get the server skeletons stream. + TAO_OutStream *server_skeletons (void); + // Get the server skeletons stream. - TAO_OutStream *server_template_skeletons (void); - // Get the server template skeletons stream. + TAO_OutStream *server_template_skeletons (void); + // Get the server template skeletons stream. - TAO_OutStream *server_inline (void); - // Get the server inline stream. + TAO_OutStream *server_inline (void); + // Get the server inline stream. - TAO_OutStream *server_template_inline (void); - // Get the server template inline stream. + TAO_OutStream *server_template_inline (void); + // Get the server template inline stream. - void gperf_input_stream (TAO_OutStream *gperf_input); - // Set the gperf input file stream. + void gperf_input_stream (TAO_OutStream *gperf_input); + // Set the gperf input file stream. - TAO_OutStream *gperf_input_stream (void); - // Retrieve the gperf input stream being used. + TAO_OutStream *gperf_input_stream (void); + // Retrieve the gperf input stream being used. - void gperf_input_filename (char *filename); - // Set the gperf input file name. + void gperf_input_filename (char *filename); + // Set the gperf input file name. - char *gperf_input_filename (void); - // Retrieve the gperf input file name being used. - // Name of the temp file used to collect the input for gperf - // program. This is needed coz I do ACE_OS::open on this when I need - // ACE_HANDLE for the file instead FILE*. + char *gperf_input_filename (void); + // Retrieve the gperf input file name being used. + // Name of the temp file used to collect the input for gperf + // program. This is needed coz I do ACE_OS::open on this when I need + // ACE_HANDLE for the file instead FILE*. - void outstream (TAO_OutStream *os); - // Set current out stream. + void outstream (TAO_OutStream *os); + // Set current out stream. - TAO_OutStream *outstream (void); - // Retrieve current out stream being used. + TAO_OutStream *outstream (void); + // Retrieve current out stream being used. - void config_visitor_factory (void); - // Set the visitor factory object. In this respect, this behaves as the - // "strategy" pattern in which the TAO_CodeGen object is the context and the - // visitor_factory is the strategy object. + void config_visitor_factory (void); + // Set the visitor factory object. In this respect, this behaves as the + // "strategy" pattern in which the TAO_CodeGen object is the context and the + // visitor_factory is the strategy object. - void node (be_decl *n); - // Pass info. + void node (be_decl *n); + // Pass info. - be_decl *node (void); - // Retrieve passed info. + be_decl *node (void); + // Retrieve passed info. - const char *upcase (const char *str); - // Convert input string to all upcase. + const char *upcase (const char *str); + // Convert input string to all upcase. - void gen_ident_string (TAO_OutStream *stream) const; - // Pass along the #ident string, if any, from the IDL file. + void gen_ident_string (TAO_OutStream *stream) const; + // Pass along the #ident string, if any, from the IDL file. - private: - void gen_ifndef_string (const char *fname, - TAO_OutStream *stream, - const char *prefix, - const char *suffix); +private: + void gen_ifndef_string (const char *fname, + TAO_OutStream *stream, + const char *prefix, + const char *suffix); - void gen_standard_include (TAO_OutStream *stream, - const char *included_file); + void gen_standard_include (TAO_OutStream *stream, + const char *included_file); - private: - TAO_OutStream *client_header_; - // Client header stream. +private: + TAO_OutStream *client_header_; + // Client header stream. - TAO_OutStream *client_stubs_; - // Client stub file stream + TAO_OutStream *client_stubs_; + // Client stub file stream - TAO_OutStream *client_inline_; - // Client side inline definitions. + TAO_OutStream *client_inline_; + // Client side inline definitions. - TAO_OutStream *server_header_; - // Server header stream. + TAO_OutStream *server_header_; + // Server header stream. - TAO_OutStream *implementation_header_; - // Implementation header stream. + TAO_OutStream *implementation_header_; + // Implementation header stream. - TAO_OutStream *implementation_skeleton_; - // Implementation skeleton stream. + TAO_OutStream *implementation_skeleton_; + // Implementation skeleton stream. - TAO_OutStream *server_template_header_; - // Server header template stream. + TAO_OutStream *server_template_header_; + // Server header template stream. - TAO_OutStream *server_skeletons_; - // Server skeleton stream. + TAO_OutStream *server_skeletons_; + // Server skeleton stream. - TAO_OutStream *server_template_skeletons_; - // Server skeleton template stream. + TAO_OutStream *server_template_skeletons_; + // Server skeleton template stream. - TAO_OutStream *server_inline_; - // Server side inline file. + TAO_OutStream *server_inline_; + // Server side inline file. - TAO_OutStream *server_template_inline_; - // Server side template inline file. + TAO_OutStream *server_template_inline_; + // Server side template inline file. - TAO_OutStream *gperf_input_stream_; - // TAO_OutStream to collect the input for gperf program. + TAO_OutStream *gperf_input_stream_; + // TAO_OutStream to collect the input for gperf program. - char *gperf_input_filename_; - // Name of the temp file used to collect the input for gperf - // program. This is needed coz I do ACE_OS::open on this when I need - // ACE_HANDLE for the file instead FILE*. + char *gperf_input_filename_; + // Name of the temp file used to collect the input for gperf + // program. This is needed coz I do ACE_OS::open on this when I need + // ACE_HANDLE for the file instead FILE*. - TAO_OutStream *curr_os_; - // Currently used out stream. + TAO_OutStream *curr_os_; + // Currently used out stream. - be_decl *node_; - // Save current node in this. + be_decl *node_; + // Save current node in this. - TAO_Visitor_Factory *visitor_factory_; - // Visitor factory object. + TAO_Visitor_Factory *visitor_factory_; + // Visitor factory object. - LOOKUP_STRATEGY strategy_; - // The enumerated value indicating the lookup strategy. + LOOKUP_STRATEGY strategy_; + // The enumerated value indicating the lookup strategy. }; typedef ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX> TAO_CODEGEN; diff --git a/TAO/TAO_IDL/be_include/be_constant.h b/TAO/TAO_IDL/be_include/be_constant.h index 54bab938a62..f113e7c9a83 100644 --- a/TAO/TAO_IDL/be_include/be_constant.h +++ b/TAO/TAO_IDL/be_include/be_constant.h @@ -27,7 +27,6 @@ #include "ast_constant.h" #include "ast_expression.h" -class UTL_StrList; class be_visitor; class be_constant : public virtual AST_Constant, @@ -39,8 +38,7 @@ public: be_constant (AST_Expression::ExprType et, AST_Expression *v, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. const char *exprtype_to_string (void); diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index b32837fa52c..0dbc3082a03 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -49,8 +49,7 @@ public: // Default constructor. be_decl (AST_Decl::NodeType type, - UTL_ScopedName *n, - UTL_StrList *pragmas); + UTL_ScopedName *n); // Constructor that sets the node type. ~be_decl (void); diff --git a/TAO/TAO_IDL/be_include/be_enum.h b/TAO/TAO_IDL/be_include/be_enum.h index ebe256c0890..99f8893dde7 100644 --- a/TAO/TAO_IDL/be_include/be_enum.h +++ b/TAO/TAO_IDL/be_include/be_enum.h @@ -27,7 +27,6 @@ #include "be_type.h" #include "ast_enum.h" -class UTL_StrList; class be_visitor; class be_enum : public virtual AST_Enum, @@ -39,7 +38,6 @@ public: // Default constructor. be_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_enum_val.h b/TAO/TAO_IDL/be_include/be_enum_val.h index eac47f5de61..12d4947c3f2 100644 --- a/TAO/TAO_IDL/be_include/be_enum_val.h +++ b/TAO/TAO_IDL/be_include/be_enum_val.h @@ -26,7 +26,6 @@ #include "be_decl.h" #include "ast_enum_val.h" -class UTL_StrList; class be_visitor; class be_enum_val : public virtual AST_EnumVal, @@ -37,8 +36,7 @@ public: // Default constructor. be_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. // Visiting diff --git a/TAO/TAO_IDL/be_include/be_exception.h b/TAO/TAO_IDL/be_include/be_exception.h index e10e6c24f47..1221d3be876 100644 --- a/TAO/TAO_IDL/be_include/be_exception.h +++ b/TAO/TAO_IDL/be_include/be_exception.h @@ -7,7 +7,6 @@ #include "be_type.h" #include "ast_exception.h" -class UTL_StrList; class be_visitor; class be_exception : public virtual AST_Exception, @@ -20,7 +19,6 @@ public: // Default constructor. be_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_factory.h b/TAO/TAO_IDL/be_include/be_factory.h new file mode 100644 index 00000000000..a53e7f3d6b6 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_factory.h @@ -0,0 +1,60 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// be_factory.h +// +// = DESCRIPTION +// Extension of class AST_Factory that provides additional means for C++ +// mapping. +// +// = AUTHOR +// Copyright 1994-1995 by Sun Microsystems, Inc. +// and +// Boris Kolpackov <bosk@ipmce.ru> +// +// ============================================================================ + +#ifndef BE_FACTORY_H +#define BE_FACTORY_H + +#include "be_scope.h" +#include "be_decl.h" +#include "ast_factory.h" + +class AST_Type; +class UTL_StrList; +class be_visitor; +class be_argument; + +class be_factory : public virtual AST_Factory, + public virtual be_scope, + public virtual be_decl +{ +public: + be_factory (void); + // Default constructor. + + be_factory (UTL_ScopedName *n); + // Constructor + + ~be_factory (void); + // Destructor. + + virtual void destroy (void); + // Cleanup method. + + // Visiting. + virtual int accept (be_visitor *visitor); + + // Narrowing + DEF_NARROW_METHODS3 (be_factory, AST_Factory, be_scope, be_decl); + DEF_NARROW_FROM_DECL (be_factory); + DEF_NARROW_FROM_SCOPE (be_factory); +}; + +#endif diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h index 409897b07eb..33fbc73148a 100644 --- a/TAO/TAO_IDL/be_include/be_field.h +++ b/TAO/TAO_IDL/be_include/be_field.h @@ -25,7 +25,6 @@ #include "be_decl.h" #include "ast_field.h" -class UTL_StrList; class be_visitor; class be_field : public virtual AST_Field, @@ -37,7 +36,6 @@ public: be_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, Visibility vis = vis_NA); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h index 925bbdf151e..4b3f036d8b6 100644 --- a/TAO/TAO_IDL/be_include/be_generator.h +++ b/TAO/TAO_IDL/be_include/be_generator.h @@ -79,98 +79,81 @@ class TAO_IDL_BE_Export be_generator : public AST_Generator public: // Create a node representing a module which is the root of an AST made // up of BE nodes. - virtual AST_Root *create_root (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_Root *create_root (UTL_ScopedName *n); virtual AST_PredefinedType *create_predefined_type ( AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p + UTL_ScopedName *n ); virtual AST_Module *create_module (UTL_Scope *s, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual AST_Interface *create_interface (UTL_ScopedName *n, AST_Interface **ih, long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_InterfaceFwd *create_interface_fwd (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Interface *create_valuetype (UTL_ScopedName *n, AST_Interface **ih, - long nih, - UTL_StrList *p); + long nih); - virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n); virtual AST_Exception *create_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Structure *create_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Enum *create_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Operation *create_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Field *create_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, AST_Field::Visibility vis = AST_Field::vis_NA); virtual AST_Argument *create_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual AST_Attribute *create_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_Union *create_union(AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual AST_UnionLabel *create_union_label (AST_UnionLabel::UnionLabel ul, AST_Expression *lv); virtual AST_Constant *create_constant (AST_Expression::ExprType et, AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual AST_Expression *create_expr(UTL_ScopedName *n); @@ -199,8 +182,7 @@ public: virtual AST_Expression *create_expr(double d); virtual AST_EnumVal *create_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual AST_Array *create_array (UTL_ScopedName *n, unsigned long ndims, @@ -219,14 +201,14 @@ public: virtual AST_Typedef *create_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing a native - virtual AST_Native *create_native (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_Native *create_native (UTL_ScopedName *n); + // Create a node representing a OBV factory construct + virtual AST_Factory *create_factory (UTL_ScopedName *n); }; #endif // _BE_GENERATOR_BE_GENERATOR_HH diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index ccf54765ed8..4eca6d20f8c 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -63,7 +63,6 @@ public: long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor that sets its scoped name <n>, a list of inherited interfaces diff --git a/TAO/TAO_IDL/be_include/be_interface_fwd.h b/TAO/TAO_IDL/be_include/be_interface_fwd.h index 3652c7b6495..d99bae65eb4 100644 --- a/TAO/TAO_IDL/be_include/be_interface_fwd.h +++ b/TAO/TAO_IDL/be_include/be_interface_fwd.h @@ -27,7 +27,6 @@ #include "ast_interface_fwd.h" class AST_Interface; -class UTL_StrList; class be_visitor; class be_interface_fwd : public virtual AST_InterfaceFwd, @@ -43,8 +42,7 @@ public: // Default constructor. be_interface_fwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. virtual ~be_interface_fwd (void); diff --git a/TAO/TAO_IDL/be_include/be_interface_strategy.h b/TAO/TAO_IDL/be_include/be_interface_strategy.h index 4d135631fd6..b415accf388 100644 --- a/TAO/TAO_IDL/be_include/be_interface_strategy.h +++ b/TAO/TAO_IDL/be_include/be_interface_strategy.h @@ -40,7 +40,7 @@ public: }; be_interface_strategy (be_interface *node, - Strategy_Kind strategy_type); + Strategy_Kind strategy_type); virtual ~be_interface_strategy (); diff --git a/TAO/TAO_IDL/be_include/be_module.h b/TAO/TAO_IDL/be_include/be_module.h index cee142dc1de..77f71fc0df4 100644 --- a/TAO/TAO_IDL/be_include/be_module.h +++ b/TAO/TAO_IDL/be_include/be_module.h @@ -27,7 +27,6 @@ #include "be_decl.h" #include "ast_module.h" -class UTL_StrList; class be_visitor; class be_module : public virtual AST_Module, @@ -38,8 +37,7 @@ public: be_module (void); // Default constructor. - be_module (UTL_ScopedName *n, - UTL_StrList *p); + be_module (UTL_ScopedName *n); // Constructor. virtual void destroy (void); diff --git a/TAO/TAO_IDL/be_include/be_native.h b/TAO/TAO_IDL/be_include/be_native.h index 8056b20a17a..78d0602569e 100644 --- a/TAO/TAO_IDL/be_include/be_native.h +++ b/TAO/TAO_IDL/be_include/be_native.h @@ -24,7 +24,6 @@ #include "be_type.h" #include "ast_native.h" -class UTL_StrList; class be_visitor; // Representation of "native" IDL type added by the POA spec. @@ -36,8 +35,7 @@ public: be_native (void); // Default constructor. - be_native (UTL_ScopedName *n, - UTL_StrList *p); + be_native (UTL_ScopedName *n); // Constructor that initializes its scoped name. virtual ~be_native (void) {} diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index dbbbe8beb4b..1c87ed1eae0 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -28,7 +28,6 @@ #include "be_operation_strategy.h" class AST_Type; -class UTL_StrList; class be_visitor; class be_argument; @@ -43,7 +42,6 @@ public: be_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor diff --git a/TAO/TAO_IDL/be_include/be_predefined_type.h b/TAO/TAO_IDL/be_include/be_predefined_type.h index 704f212b38e..0860729e6f2 100644 --- a/TAO/TAO_IDL/be_include/be_predefined_type.h +++ b/TAO/TAO_IDL/be_include/be_predefined_type.h @@ -26,7 +26,6 @@ #include "be_type.h" #include "ast_predefined_type.h" -class UTL_StrList; class be_visitor; class be_predefined_type : public virtual AST_PredefinedType, @@ -37,8 +36,7 @@ public: // Default constructor. be_predefined_type (AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. // Visiting. diff --git a/TAO/TAO_IDL/be_include/be_root.h b/TAO/TAO_IDL/be_include/be_root.h index 3bcaacb4ca1..b8560d5a391 100644 --- a/TAO/TAO_IDL/be_include/be_root.h +++ b/TAO/TAO_IDL/be_include/be_root.h @@ -26,7 +26,6 @@ #include "be_scope.h" #include "ast_root.h" -class UTL_StrList; class be_visitor; class be_root : public virtual AST_Root, @@ -42,8 +41,7 @@ public: be_root (void); // Default constructor. - be_root (UTL_ScopedName *n, - UTL_StrList *p); + be_root (UTL_ScopedName *n); // Constructor that sets its scoped name <n>, and any pragmas <p>. // Scope management functions that override the AST scope management methods diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h index caef7cdfed1..abf916c0b56 100644 --- a/TAO/TAO_IDL/be_include/be_sequence.h +++ b/TAO/TAO_IDL/be_include/be_sequence.h @@ -48,6 +48,7 @@ public: MNG_STRING, MNG_WSTRING, MNG_OBJREF, + MNG_VALUE, MNG_PSEUDO }; diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h index 6b95da27dc6..aa950558a31 100644 --- a/TAO/TAO_IDL/be_include/be_structure.h +++ b/TAO/TAO_IDL/be_include/be_structure.h @@ -27,7 +27,6 @@ #include "be_type.h" #include "ast_structure.h" -class UTL_StrList; class be_visitor; class be_structure : public virtual AST_Structure, @@ -39,7 +38,6 @@ public: // Default constructor. be_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_type.h b/TAO/TAO_IDL/be_include/be_type.h index 65b878881a1..747dac1ba69 100644 --- a/TAO/TAO_IDL/be_include/be_type.h +++ b/TAO/TAO_IDL/be_include/be_type.h @@ -35,8 +35,7 @@ public: // Default constructor. be_type (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. virtual ~be_type (void); diff --git a/TAO/TAO_IDL/be_include/be_typedef.h b/TAO/TAO_IDL/be_include/be_typedef.h index e95b9da1c40..842d64ed3cd 100644 --- a/TAO/TAO_IDL/be_include/be_typedef.h +++ b/TAO/TAO_IDL/be_include/be_typedef.h @@ -25,7 +25,6 @@ #include "be_type.h" #include "ast_typedef.h" -class UTL_StrList; class be_visitor; class be_typedef : public virtual AST_Typedef, @@ -37,7 +36,6 @@ public: be_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool l, idl_bool a); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h index 5375b15b334..4463f06e849 100644 --- a/TAO/TAO_IDL/be_include/be_union.h +++ b/TAO/TAO_IDL/be_include/be_union.h @@ -27,7 +27,6 @@ #include "ast_union.h" class AST_ConcreteType; -class UTL_StrList; class be_visitor; class be_union : public virtual AST_Union, @@ -40,7 +39,6 @@ public: be_union(AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Constructor. diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h index b523873f7ad..fbe5d32cdb0 100644 --- a/TAO/TAO_IDL/be_include/be_union_branch.h +++ b/TAO/TAO_IDL/be_include/be_union_branch.h @@ -27,7 +27,6 @@ class UTL_LabelList; class UTL_Type; -class UTL_StrList; class be_visitor; class be_union_branch : public virtual AST_UnionBranch, @@ -39,8 +38,7 @@ public: be_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. int gen_label_value (TAO_OutStream *os, diff --git a/TAO/TAO_IDL/be_include/be_valuetype.h b/TAO/TAO_IDL/be_include/be_valuetype.h index 4fa1c966a27..1457eb94f9a 100644 --- a/TAO/TAO_IDL/be_include/be_valuetype.h +++ b/TAO/TAO_IDL/be_include/be_valuetype.h @@ -18,8 +18,6 @@ #ifndef TAO_BE_VALUETYPE_H #define TAO_BE_VALUETYPE_H -#ifdef IDL_HAS_VALUETYPE - #include "be_interface.h" class TAO_OutStream; @@ -40,7 +38,6 @@ public: be_valuetype (UTL_ScopedName *n, AST_Interface **ih, long nih, - UTL_StrList *p, idl_bool set_abstract = 0); // Constructor that sets its scoped name <n>, a list of inherited valuetypes // and supported interfaces <ih>, the number of inherited interfaces <nih>, @@ -49,8 +46,7 @@ public: ~be_valuetype (void); // Destructor. - virtual void redefine (AST_Interface *from, - UTL_StrList *p); + virtual void redefine (AST_Interface *from); idl_bool opt_accessor (void); // Should generate optimized form? @@ -69,6 +65,18 @@ public: char *full_name = 0); // Generate the _out implementation. + virtual int gen_helper_header (char *local_name = 0, + char *full_name = 0); + // Generate the helper functions definition. + + virtual int gen_helper_inline (char *local_name = 0, + char *full_name = 0); + // Generate the helper functions inline implementation. + + virtual int gen_helper_stubs (char *local_name = 0, + char *full_name = 0); + // Generate the helper functions implementation. + const char *full_obv_skel_name (void); // Retrieve the fully scoped skel class name. @@ -111,6 +119,4 @@ private: char *full_obv_skel_name_; }; -#endif /* IDL_HAS_VALUETYPE */ - #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_valuetype_fwd.h b/TAO/TAO_IDL/be_include/be_valuetype_fwd.h index e8844c377cb..433edc98b42 100644 --- a/TAO/TAO_IDL/be_include/be_valuetype_fwd.h +++ b/TAO/TAO_IDL/be_include/be_valuetype_fwd.h @@ -24,8 +24,6 @@ #ifndef BE_VALUETYPE_FWD_H #define BE_VALUETYPE_FWD_H -#ifdef IDL_HAS_VALUETYPE - #include "be_interface_fwd.h" class be_valuetype_fwd : public virtual be_interface_fwd @@ -40,8 +38,7 @@ public: // Default constructor. be_valuetype_fwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Constructor. virtual ~be_valuetype_fwd (void); @@ -49,20 +46,6 @@ public: virtual void set_abstract_valuetype (void); - virtual int gen_var_defn (char *local_name = 0); - // Generate the _var class definition. - - virtual int gen_var_impl (char *local_name = 0, - char *full_name = 0); - // Generate the implementation for the _var class. - - virtual int gen_out_defn (char *local_name = 0); - // Generate the _out class definition. - - virtual int gen_out_impl (char *local_name = 0, - char *full_name = 0); - // Generate the _out implementation. - // Visiting. virtual int accept (be_visitor* visitor); @@ -72,6 +55,4 @@ public: }; -#endif /* IDL_HAS_VALUETYPE */ - #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h index 249bee0d4c2..2434d5655b0 100644 --- a/TAO/TAO_IDL/be_include/be_visitor.h +++ b/TAO/TAO_IDL/be_include/be_visitor.h @@ -32,10 +32,9 @@ class be_predefined_type; class be_module; class be_interface; class be_interface_fwd; -#ifdef IDL_HAS_VALUETYPE - class be_valuetype; - class be_valuetype_fwd; -#endif /* IDL_HAS_VALUETYPE */ +class be_valuetype; +class be_valuetype_fwd; +class be_factory; class be_structure; class be_exception; class be_expression; @@ -95,13 +94,14 @@ public: virtual int visit_interface_fwd (be_interface_fwd *node); // visit interface_fwd -#ifdef IDL_HAS_VALUETYPE virtual int visit_valuetype (be_valuetype *node); // visit valuetype virtual int visit_valuetype_fwd (be_valuetype_fwd *node); // visit valuetype_fwd -#endif /* IDL_HAS_VALUETYPE */ + + virtual int visit_factory (be_factory *node); + // Visit a OBV factory construct. virtual int visit_structure (be_structure *node); // visit a structure diff --git a/TAO/TAO_IDL/be_include/be_visitor_scope.h b/TAO/TAO_IDL/be_include/be_visitor_scope.h index 82e244fabce..d7696f1e32b 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_scope.h +++ b/TAO/TAO_IDL/be_include/be_visitor_scope.h @@ -21,7 +21,7 @@ #ifndef TAO_BE_VISITOR_SCOPE_H #define TAO_BE_VISITOR_SCOPE_H -#include "be_visitor.h" +#include "idl_bool.h" #include "be_visitor_decl.h" class be_visitor_scope : public be_visitor_decl 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 1fe1880f3dd..523f903bc98 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 @@ -45,6 +45,8 @@ public: virtual int visit_predefined_type (be_predefined_type *node); virtual int visit_interface (be_interface *node); virtual int visit_interface_fwd (be_interface_fwd *node); + 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_enum (be_enum *node); virtual int visit_exception (be_exception *node); diff --git a/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h index 1a36b175013..b4be5b420c9 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/cdr_op_cs.h @@ -61,6 +61,12 @@ public: virtual int visit_interface_fwd (be_interface_fwd *node); // visit an interface forward node + virtual int visit_valuetype (be_valuetype *node); + // visit an interface + + virtual int visit_valuetype_fwd (be_valuetype_fwd *node); + // visit an interface forward node + virtual int visit_predefined_type (be_predefined_type *node); // visit a predefined type 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 c307db5fa6e..993a9894fff 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_sequence/elemtype.h @@ -48,6 +48,8 @@ public: virtual int visit_predefined_type (be_predefined_type *node); virtual int visit_interface (be_interface *node); virtual int visit_interface_fwd (be_interface_fwd *node); + 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_enum (be_enum *node); virtual int visit_exception (be_exception *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 dad8535cb5d..71bca6b32b2 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 @@ -51,6 +51,8 @@ public: virtual int visit_predefined_type (be_predefined_type *node); virtual int visit_interface (be_interface *node); virtual int visit_interface_fwd (be_interface_fwd *node); + 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_enum (be_enum *node); virtual int visit_exception (be_exception *node); @@ -60,11 +62,6 @@ public: virtual int visit_sequence (be_sequence *node); virtual int visit_typedef (be_typedef *node); -#if defined(IDL_HAS_VALUETYPE) - virtual int visit_valuetype (be_valuetype *node); - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); -#endif - protected: int visit_node (be_type *); // helper that does the common job @@ -95,6 +92,10 @@ public: virtual int visit_interface_fwd (be_interface_fwd *node); + virtual int visit_valuetype (be_valuetype *node); + + virtual int visit_valuetype_fwd (be_valuetype_fwd *node); + virtual int visit_predefined_type (be_predefined_type *node); private: be_sequence *beseq_; diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h index 79fa5d50880..e57228c98ff 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h @@ -23,10 +23,14 @@ #ifndef _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_ #define _BE_VISITOR_TYPECODE_TYPECODE_DEFN_H_ +#include "ace/CDR_Base.h" +#include "ace/Containers_T.h" #include "be_visitor_scope.h" const int TAO_BE_VISITOR_TYPECODE_DEFN_MAX_STACK_SIZE = 1024; +class AST_Structure; + class be_visitor_typecode_defn : public be_visitor_scope { // diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h index d40cbc2130d..fca936fb85d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype.h @@ -18,8 +18,6 @@ #ifndef TAO_BE_VISITOR_VALUETYPE_H #define TAO_BE_VISITOR_VALUETYPE_H -#ifdef IDL_HAS_VALUETYPE - #include "be_visitor_scope.h" #include "be_visitor_valuetype/valuetype.h" @@ -31,6 +29,7 @@ #include "be_visitor_valuetype/valuetype_cs.h" #include "be_visitor_valuetype/cdr_op_ch.h" #include "be_visitor_valuetype/cdr_op_ci.h" +#include "be_visitor_valuetype/cdr_op_cs.h" #include "be_visitor_valuetype/marshal_ch.h" #include "be_visitor_valuetype/marshal_cs.h" #include "be_visitor_valuetype/arglist.h" @@ -42,7 +41,10 @@ #include "be_visitor_valuetype/obv_module.h" #include "be_visitor_valuetype/ami_exception_holder_ch.h" #include "be_visitor_valuetype/ami_exception_holder_cs.h" - -#endif /* IDL_HAS_VALUETYPE */ +#include "be_visitor_valuetype/valuetype_init.h" +#include "be_visitor_valuetype/valuetype_init_ch.h" +#include "be_visitor_valuetype/valuetype_init_ci.h" +#include "be_visitor_valuetype/valuetype_init_cs.h" +#include "be_visitor_valuetype/valuetype_init_arglist_ch.h" #endif /* TAO_BE_VISITOR_VALUETYPE_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h index 78af6220e4f..5ff6cb5f5fb 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ch.h @@ -9,7 +9,7 @@ // TAO IDL // // = FILENAME -// cdr_op_ci.h +// valuetype_cdr_op_ch.h // // = DESCRIPTION // Concrete visitor for valuetypes. @@ -43,7 +43,6 @@ public: virtual int visit_valuetype (be_valuetype *node); // visit valuetype - }; #endif /* _BE_VISITOR_VALUETYPE_CDR_OP_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h index 68048d69098..a936aed771c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/cdr_op_ci.h @@ -9,14 +9,14 @@ // TAO IDL // // = FILENAME -// cdr_op_ci.h +// valuetype_cdr_op_ci.h // // = DESCRIPTION // Concrete visitor for valuetypes. // This one provides code generation for the CDR operators. // // = AUTHOR -// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> +// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> // // ============================================================================ @@ -43,7 +43,6 @@ public: virtual int visit_valuetype (be_valuetype *node); // visit valuetype - }; #endif /* _BE_VISITOR_VALUETYPE_CDR_OP_CI_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 745e5e73e0f..84196336afe 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype.h @@ -36,12 +36,15 @@ class be_visitor_valuetype : public be_visitor_scope // public: + be_visitor_valuetype (be_visitor_context *ctx); // constructor ~be_visitor_valuetype (void); // destructor +public: + virtual int visit_valuetype (be_valuetype *node); // visit the valuetype node @@ -83,9 +86,6 @@ public: // =helper methods for generation of fields - //int gen_field_i (be_field *node, idl_bool make_inline); - // field accessor and modifier implemantation - int gen_pd (be_valuetype *node); // private data fields for scope @@ -98,6 +98,43 @@ public: virtual int gen_init_impl (be_valuetype *node); // generate the _init implementation +protected: + + // There are three possible situations. + // (1) If there is no initializers but at least one operation. + // In this case we don't need to bother about factory. + // + // (2) There are no (operations or initializers) (i.e. only state + // members) then we need a concrete type-specific factory + // class whose create_for_unmarshal creates OBV_ class. + // + // (3) There is at least one operation and at least one initializer. + // In this case we need to generate abstract factory class. + // + // Here I reflect these situations. + + enum FactoryStyle + { + FS_UNKNOWN, + FS_NO_FACTORY, + FS_CONCRETE_FACTORY, + FS_ABSTRACT_FACTORY + }; + + static FactoryStyle determine_factory_style (be_valuetype* node); + // determine what kind of factory needed + + static idl_bool have_operation(be_valuetype* node); + // recurse down the inheritance tree to determine + // if valuetype has at least one operation/attribute. + + static idl_bool obv_need_ref_counter(be_valuetype* node); + // check is VT needs a RefCounter mix-in in OBV_ class + // suppose that we are deciding for this node + + static idl_bool obv_have_ref_counter(be_valuetype* node); + // recurse down the inheritance tree to see + // if node or one of its OBV_ base class already has RefCounter }; #endif /* _BE_VALUETYPE_VALUETYPE_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h new file mode 100644 index 00000000000..b507ccf5f2d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init.h @@ -0,0 +1,82 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init.h +// +// = DESCRIPTION +// Coomon visitor for the Valuetype node. +// This one provides code generation for valuetype factory construct. +// +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#ifndef _BE_VALUETYPE_VALUETYPE_INIT_H_ +#define _BE_VALUETYPE_VALUETYPE_INIT_H_ + + +class be_visitor_valuetype_init : public be_visitor_valuetype +{ + // + // = TITLE + // be_visitor_valuetype_init + // + // = DESCRIPTION + // This is a common visitor to generate valuetype factory constructs. + // + // + +public: + be_visitor_valuetype_init (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_init (void); + // destructor + +public: + + virtual int visit_attribute (be_attribute *node); + // visit attribute + + virtual int visit_constant (be_constant *node); + // visit a constant + + virtual int visit_enum (be_enum *node); + // visit an enum + + virtual int visit_operation (be_operation *node); + // visit operation + + virtual int visit_exception (be_exception *node); + // visit exception (not used) + + virtual int visit_structure (be_structure *node); + // visit a structure + + virtual int visit_union (be_union *node); + // visit a union + + virtual int visit_typedef (be_typedef *node); + // visit the typedef node + + virtual int visit_field (be_field *node); + // visit a field + + virtual int visit_factory (be_factory *node); + // visit a factory + + void begin_public (void); + void begin_private (void); +}; + +#endif /* _BE_VALUETYPE_VALUETYPE_INIT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h new file mode 100644 index 00000000000..35438202c9b --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_arglist_ch.h @@ -0,0 +1,53 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_arglist_ch.h +// +// = DESCRIPTION +// Visitor for generating code for OBV factory. This generates the +// operation signature. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// ============================================================================ + +#ifndef _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_ +#define _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_ + + +class be_visitor_valuetype_init_arglist_ch : public be_visitor_scope +{ + // + // = TITLE + // be_visitor_valuetype_init_arglist_ch + // + // = DESCRIPTION + // This is a visitor to generate factory argument list + // + // +public: + be_visitor_valuetype_init_arglist_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_init_arglist_ch (void); + // destructor + + virtual int visit_factory (be_factory *node); + // visit factory construct + + virtual int visit_argument (be_argument *node); + // visit each argument + + virtual int post_process (be_decl *); + // stuff to o/p after each element of the scope is handled +}; + +#endif /* _BE_VISITOR_VALUETYPE_INIT_ARGLIST_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h new file mode 100644 index 00000000000..d38e9ab8240 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ch.h @@ -0,0 +1,53 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_ch.h +// +// = DESCRIPTION +// Concrete visitor for the Valuetype node. +// This one provides code generation for valuetype factory +// in the (client) header. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CH_H_ +#define _BE_VALUETYPE_VALUETYPE_INIT_CH_H_ + + +class be_visitor_valuetype_init_ch : public be_visitor_valuetype_init +{ + // + // = TITLE + // be_visitor_valuetype_init_ch + // + // = DESCRIPTION + // This is a concrete visitor to generate valuetype factory in + // the client header + // + // +public: + be_visitor_valuetype_init_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_init_ch (void); + // destructor + + virtual int visit_valuetype (be_valuetype *node); + // entry point + + virtual int visit_factory (be_factory *node); + // visit a factory +}; + +#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h new file mode 100644 index 00000000000..dbb81438b8d --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_ci.h @@ -0,0 +1,52 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_ci.h +// +// = DESCRIPTION +// Concrete visitor for the Valuetype node. +// This one provides code generation for valuetype factory +// in the (client) inline. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CI_H_ +#define _BE_VALUETYPE_VALUETYPE_INIT_CI_H_ + + +class be_visitor_valuetype_init_ci : public be_visitor_valuetype_init +{ + // + // = TITLE + // be_visitor_valuetype_init_ci + // + // = DESCRIPTION + // This is a concrete visitor to generate valuetype factory in + // the client header + // + // +public: + be_visitor_valuetype_init_ci (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_init_ci (void); + // destructor + + virtual int visit_valuetype (be_valuetype *node); + + virtual int visit_factory (be_factory *node); + // visit a factory +}; + +#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h new file mode 100644 index 00000000000..aa7544f521c --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype/valuetype_init_cs.h @@ -0,0 +1,52 @@ +// +// $Id$ +// +/* -*- c++ -*- */ +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_init_cs.h +// +// = DESCRIPTION +// Concrete visitor for the Valuetype node. +// This one provides code generation for valuetype factory +// in the (client) source. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// +// +// ============================================================================ + +#ifndef _BE_VALUETYPE_VALUETYPE_INIT_CS_H_ +#define _BE_VALUETYPE_VALUETYPE_INIT_CS_H_ + + +class be_visitor_valuetype_init_cs : public be_visitor_valuetype_init +{ + // + // = TITLE + // be_visitor_valuetype_init_cs + // + // = DESCRIPTION + // This is a concrete visitor to generate valuetype factory in + // the client header + // + // +public: + be_visitor_valuetype_init_cs (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_init_cs (void); + // destructor + + virtual int visit_valuetype (be_valuetype *node); + + virtual int visit_factory (be_factory *node); + // visit a factory +}; + +#endif /* _BE_VALUETYPE_VALUETYPE_INIT_CS_H_ */ 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 435a992ae9d..ce88329fe5d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd.h @@ -23,15 +23,12 @@ #ifndef TAO_BE_VISITOR_VALUETYPE_FWD_H #define TAO_BE_VISITOR_VALUETYPE_FWD_H -#ifdef IDL_HAS_VALUETYPE - #include "be_visitor.h" #include "be_visitor_scope.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" #include "be_visitor_valuetype_fwd/cdr_op_ci.h" -#endif /* IDL_HAS_VALUETYPE */ - #endif /* TAO_BE_VISITOR_VALUETYPE_FWD_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h new file mode 100644 index 00000000000..a0a0401af93 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ch.h @@ -0,0 +1,52 @@ +/* -*- c++ -*- */ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// valuetype_fwd_cdr_op_ch.h +// +// = DESCRIPTION +// Concrete visitor for the valuetype_fwd class +// This one provides code generation for the CDR operators +// (actually just their declarations) for the valuetype forward +// declaration in the client inline. +// +// = AUTHOR +// Boris Kolpackov <bosk@ipmce.ru> +// based on code from Torsten Kuepper +// based on code from Aniruddha Gokhale & Carlos O'Ryan +// +// ============================================================================ + +#ifndef BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H +#define BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H + +class be_visitor_valuetype_fwd_cdr_op_ch : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_valuetype_fwd_cdr_op_ch + // + // = DESCRIPTION + // This is a concrete visitor for valuetype that generates the CDR + // operator forward declarations. + // + +public: + be_visitor_valuetype_fwd_cdr_op_ch (be_visitor_context *ctx); + // constructor + + ~be_visitor_valuetype_fwd_cdr_op_ch (void); + // destructor + + virtual int visit_valuetype_fwd (be_valuetype_fwd *node); + // visit valuetype +}; + +#endif /* BE_VISITOR_VALUETYPE_FWD_CDR_OP_CH_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ci.h b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ci.h index d0ff6d0c457..bf3159a0e7b 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ci.h +++ b/TAO/TAO_IDL/be_include/be_visitor_valuetype_fwd/cdr_op_ci.h @@ -9,7 +9,7 @@ // TAO IDL // // = FILENAME -// cdr_op_ci.h +// valuetype_fwd_cdr_op_ci.h // // = DESCRIPTION // Concrete visitor for the valuetype_fwd class @@ -18,7 +18,8 @@ // declaration in the client inline. // // = AUTHOR -// Torsten Kuepper +// Boris Kolpackov <bosk@ipmce.ru> +// based on code from Torsten Kuepper // based on code from Aniruddha Gokhale & Carlos O'Ryan // // ============================================================================ @@ -46,7 +47,6 @@ public: virtual int visit_valuetype_fwd (be_valuetype_fwd *node); // visit valuetype - }; #endif /* BE_VISITOR_VALUETYPE_FWD_CDR_OP_CI_H */ diff --git a/TAO/TAO_IDL/driver/drv_init.cpp b/TAO/TAO_IDL/driver/drv_init.cpp index 47decd3d200..5c845f7db5f 100644 --- a/TAO/TAO_IDL/driver/drv_init.cpp +++ b/TAO/TAO_IDL/driver/drv_init.cpp @@ -114,13 +114,15 @@ DRV_init (void) idl_global->set_local_escapes (local_escapes); idl_global->set_be (""); - idl_global->set_pragmas (0); idl_global->set_compile_flags (0); idl_global->set_read_from_stdin (I_FALSE); idl_global->set_include_file_names (0); idl_global->set_n_include_file_names (0); idl_global->set_parse_state (IDL_GlobalData::PS_NoState); + // Put an empty prefix on the stack for the global scope. + idl_global->pragma_prefixes ().push (ACE::strnew ("")); + // Initialize BE global data object. ACE_NEW (be_global, BE_GlobalData); diff --git a/TAO/TAO_IDL/fe/Makefile.am b/TAO/TAO_IDL/fe/Makefile.am index 686f4570439..f7074e41070 100644 --- a/TAO/TAO_IDL/fe/Makefile.am +++ b/TAO/TAO_IDL/fe/Makefile.am @@ -25,6 +25,7 @@ libfe_la_SOURCES = \ fe_lookup.cpp \ fe_private.cpp \ lex.yy.cpp \ + tmplinst.cpp \ y.tab.cpp diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp index 400dbe1b29f..295790ab91c 100644 --- a/TAO/TAO_IDL/fe/fe_declarator.cpp +++ b/TAO/TAO_IDL/fe/fe_declarator.cpp @@ -62,100 +62,101 @@ NOTE: SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. - */ - -/* - * fe_declarator.cc - Implementation of FE private declaration - * statement class - * - * The FE_Declarator class is used to hold together complex declarations - * until all the components are parsed and before they are composed into - * an AST_Type node. - */ +*/ #include "idl.h" #include "idl_extern.h" - #include "fe_private.h" ACE_RCSID(fe, fe_declarator, "$Id$") -/* - * Constructor(s) and destructor - */ - -FE_Declarator::FE_Declarator(UTL_ScopedName *n, DeclaratorType dt, - AST_Decl *cp) - : pd_complex_part(cp), - pd_name(n), - pd_decl_type(dt) +// Constructor(s) and destructor + +FE_Declarator::FE_Declarator (UTL_ScopedName *n, + DeclaratorType dt, + AST_Decl *cp) + : pd_complex_part (cp), + pd_name (n), + pd_decl_type (dt) { } -/* - * Private operations - */ - -/* - * Public operations - */ +// Public operations. // Compose the type of the complex declarator (if any) with the base -// type supplied in ct +// type supplied in ct. AST_Type * -FE_Declarator::compose(AST_Decl *d) +FE_Declarator::compose (AST_Decl *d) { - AST_Array *arr; - AST_Type *ct; - - ct = AST_Type::narrow_from_decl(d); - if (ct == NULL) { - idl_global->err()->not_a_type(d); - return NULL; - } - if (ct->node_type() == AST_Decl::NT_except) { - idl_global->err()->not_a_type(d); - return NULL; - } - if (pd_decl_type == FD_simple || pd_complex_part == NULL) { - return ct; - } - if (pd_complex_part->node_type() == AST_Decl::NT_array) { - arr = AST_Array::narrow_from_decl(pd_complex_part); - arr->set_base_type(ct); - - /* - * Add the new array to the types defined in the global scope - */ - idl_global->root()->fe_add_array(arr); - - return arr; - } - return NULL; // return through this statement should not happen + 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 + // not have a different prefix from the place of declaration. + if (!ct->is_defined ()) + { + char *current_prefix = 0; + idl_global->pragma_prefixes ().top (current_prefix); + + if (ACE_OS::strcmp (current_prefix, d->prefix ()) != 0) + { + idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT, + d); + + return 0; + } + } + + if (ct == 0) + { + idl_global->err ()->not_a_type (d); + return 0; + } + + if (ct->node_type () == AST_Decl::NT_except) + { + idl_global->err ()->not_a_type (d); + return 0; + } + + if (this->pd_decl_type == FD_simple || this->pd_complex_part == 0) + { + return ct; + } + + if (this->pd_complex_part->node_type () == AST_Decl::NT_array) + { + arr = AST_Array::narrow_from_decl (this->pd_complex_part); + arr->set_base_type (ct); + + // Add the new array to the types defined in the global scope + idl_global->root ()->fe_add_array (arr); + + return arr; + } + + // We shouldn't get here. + return 0; } -/* - * Redefinition of inherited virtual operations - */ - -/* - * Data accessors - */ +// Data accessors. AST_Decl * -FE_Declarator::complex_part() +FE_Declarator::complex_part (void) { - return pd_complex_part; + return this->pd_complex_part; } UTL_ScopedName * -FE_Declarator::name() +FE_Declarator::name (void) { - return pd_name; + return this->pd_name; } FE_Declarator::DeclaratorType -FE_Declarator::decl_type() +FE_Declarator::decl_type (void) { - return pd_decl_type; + return this->pd_decl_type; } diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index 0f63d775f22..f80c9d097e8 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -112,128 +112,112 @@ fe_populate_global_scope (AST_Module *m) pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_long, - create_scoped_name ("long"), - NULL + create_scoped_name ("long") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_ulong, - create_scoped_name ("unsigned long"), - NULL + create_scoped_name ("unsigned long") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_longlong, - create_scoped_name ("long long"), - NULL + create_scoped_name ("long long") ); m->fe_add_predefined_type(pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_ulonglong, - create_scoped_name ("unsigned long long"), - NULL + create_scoped_name ("unsigned long long") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_short, - create_scoped_name ("short"), - NULL + create_scoped_name ("short") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_ushort, - create_scoped_name ("unsigned short"), - NULL + create_scoped_name ("unsigned short") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_float, - create_scoped_name ("float"), - NULL + create_scoped_name ("float") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_double, - create_scoped_name("double"), - NULL + create_scoped_name("double") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_longdouble, - create_scoped_name ("long double"), - NULL + create_scoped_name ("long double") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_char, - create_scoped_name ("char"), - NULL + create_scoped_name ("char") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_wchar, - create_scoped_name ("wchar"), - NULL + create_scoped_name ("wchar") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_octet, - create_scoped_name ("octet"), - NULL + create_scoped_name ("octet") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_any, - create_scoped_name ("any"), - NULL + create_scoped_name ("any") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_boolean, - create_scoped_name ("boolean"), - NULL + create_scoped_name ("boolean") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_void, - create_scoped_name ("void"), - NULL + create_scoped_name ("void") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name("Object"), - NULL + create_scoped_name("Object") ); m->fe_add_predefined_type (pdt); @@ -242,200 +226,175 @@ fe_populate_global_scope (AST_Module *m) pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("attribute"), - NULL + create_scoped_name ("attribute") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("case"), - NULL + create_scoped_name ("case") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("const"), - NULL + create_scoped_name ("const") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("context"), - NULL + create_scoped_name ("context") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("default"), - NULL + create_scoped_name ("default") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("enum"), - NULL + create_scoped_name ("enum") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("exception"), - NULL + create_scoped_name ("exception") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("in"), - NULL + create_scoped_name ("in") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("out"), - NULL + create_scoped_name ("out") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("inout"), - NULL + create_scoped_name ("inout") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("interface"), - NULL + create_scoped_name ("interface") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("module"), - NULL + create_scoped_name ("module") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("oneway"), - NULL + create_scoped_name ("oneway") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("raises"), - NULL + create_scoped_name ("raises") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("readonly"), - NULL + create_scoped_name ("readonly") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("sequence"), - NULL + create_scoped_name ("sequence") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("string"), - NULL + create_scoped_name ("string") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("wstring"), - NULL + create_scoped_name ("wstring") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("struct"), - NULL + create_scoped_name ("struct") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("switch"), - NULL + create_scoped_name ("switch") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("typedef"), - NULL + create_scoped_name ("typedef") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("union"), - NULL + create_scoped_name ("union") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("unsigned"), - NULL + create_scoped_name ("unsigned") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("TRUE"), - NULL + create_scoped_name ("TRUE") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("FALSE"), - NULL + create_scoped_name ("FALSE") ); m->fe_add_predefined_type (pdt); @@ -445,64 +404,49 @@ fe_populate_global_scope (AST_Module *m) pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("abstract"), - NULL + create_scoped_name ("abstract") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("custom"), - NULL + create_scoped_name ("custom") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("init"), - NULL + create_scoped_name ("private") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("private"), - NULL + create_scoped_name ("public") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("public"), - NULL + create_scoped_name ("supports") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("supports"), - NULL + create_scoped_name ("truncatable") ); m->fe_add_predefined_type (pdt); pdt = idl_global->gen ()->create_predefined_type ( AST_PredefinedType::PT_pseudo, - create_scoped_name ("truncatable"), - NULL - ); - m->fe_add_predefined_type (pdt); - - pdt = - idl_global->gen ()->create_predefined_type ( - AST_PredefinedType::PT_pseudo, - create_scoped_name ("valuetype"), - NULL + create_scoped_name ("valuetype") ); m->fe_add_predefined_type (pdt); } @@ -617,7 +561,7 @@ FE_init_stage2 (void) } // Create a global root for the AST. Note that the AST root has no name. - r = idl_global->gen ()->create_root (create_scoped_name (""), 0); + r = idl_global->gen ()->create_root (create_scoped_name ("")); idl_global->set_root (r); if (r == 0) diff --git a/TAO/TAO_IDL/fe/fe_tmplinst.cpp b/TAO/TAO_IDL/fe/fe_tmplinst.cpp new file mode 100644 index 00000000000..838db3009e9 --- /dev/null +++ b/TAO/TAO_IDL/fe/fe_tmplinst.cpp @@ -0,0 +1,56 @@ +// $Id$ + +#include "ace/ACE.h" +#include "ace/Hash_Map_Manager_T.h" +#include "ace/Containers_T.h" + +class AST_Decl; +class AST_Field; + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Hash_Map_Entry<ACE_CString, int>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Equal_To<ACE_CString>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash<ACE_CString>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>; + +template class ACE_Node<AST_Decl *>; +template class ACE_Unbounded_Set<AST_Decl *>; +template class ACE_Unbounded_Set_Iterator<AST_Decl *>; + +template class ACE_Node<AST_Field *>; +template class ACE_Unbounded_Queue<AST_Field *>; +template class ACE_Unbounded_Queue_Iterator<AST_Field *>; + +template class ACE_Node<char *>; +template class ACE_Unbounded_Stack<char *>; +template class ACE_Unbounded_Stack_Iterator<char *>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, int> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Equal_To<ACE_CString> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash<ACE_CString> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> + +#pragma instantiate ACE_Node<AST_Decl *> +#pragma instantiate ACE_Unbounded_Set<AST_Decl *> +#pragma instantiate ACE_Unbounded_Set_Iterator<AST_Decl *> + +#pragma instantiate ACE_Node<AST_Decl *> +#pragma instantiate ACE_Unbounded_Queue<AST_Decl *> +#pragma instantiate ACE_Unbounded_Queue_Iterator<AST_Decl *> + +#pragma instantiate ACE_Node<char *> +#pragma instantiate ACE_Unbounded_Stack<char *> +#pragma instantiate ACE_Unbounded_Stack_Iterator<char *> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index b5770d82232..401045f22ee 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -72,14 +72,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "fe_private.h" #include "y.tab.h" -static char * idl_wstring_escape_reader(char *); -static ACE_CDR::WChar idl_wchar_escape_reader(char *); -static char idl_escape_reader(char *); -static double idl_atof(char *); -static long idl_atoi(char *, long); -static unsigned long idl_atoui(char *, long); -static void idl_parse_line_and_file(char *); -static void idl_store_pragma(char *); +static char * idl_wstring_escape_reader (char *); +static ACE_CDR::WChar idl_wchar_escape_reader (char *); +static char idl_escape_reader (char *); +static double idl_atof (char *); +static long idl_atoi (char *, long); +static unsigned long idl_atoui (char *, long); +static void idl_parse_line_and_file (char *); +static void idl_store_pragma (char *); +static char * idl_get_pragma_string (char *); +static idl_bool idl_valid_version (char *); +static AST_Decl * idl_find_node (char *); #if 0 /* defined (HPUX) */ // HPUX has yytext typed to unsigned char *. We make sure here that @@ -350,48 +353,74 @@ stripped_name(UTL_String *fn) return n; } -/* - * Parse a #line statement generated by the C preprocessor - */ +// Parse a #line statement generated by the C preprocessor static void -idl_parse_line_and_file(char *buf) +idl_parse_line_and_file (char *buf) { - char *r = buf; - char *h; - UTL_String *nm; + char *r = buf; + char *h = 0; + UTL_String *nm = 0; - /* Skip initial '#' */ + // Skip initial '#'. if (*r != '#') - return; + { + return; + } else - r++; + { + r++; + } - /* Check to see if we're running under the screwy Microsoft scheme */ - /* of putting #line num instead of #num. */ + // Check to see if we're running under the screwy Microsoft scheme + // of putting #line num instead of #num. if (ACE_OS::strncmp (r, "line", 4) == 0) - r += 5; + { + r += 5; + } - /* Find line number */ + // Find line number. while (isspace (*r)) - r++; + { + r++; + } + h = r; + for (; isdigit (*r); r++) - continue; + { + continue; + } + *r++ = 0; - idl_global->set_lineno(idl_atoui(h, 10)); + idl_global->set_lineno (idl_atoui (h, 10)); - /* Find file name, if present */ + // Find file name, if present. for (; *r != '"'; r++) - if (*r == '\n' || *r == '\0') - return; + { + if (*r == '\n' || *r == '\0') + { + return; + } + } h = ++r; + for (; *r != '"'; r++) - continue; + { + continue; + } + *r = 0; + UTL_String *tmp = 0; + if (*h == '\0') - idl_global->set_filename(new UTL_String("standard input")); + { + ACE_NEW (tmp, + UTL_String ("standard input")); + idl_global->set_filename (tmp); + return; + } else { long i; @@ -401,70 +430,183 @@ idl_parse_line_and_file(char *buf) for (i = 0, j = 0; h[j] != '\0'; i++, j++) { if (h[j] == '\\' && h[j + 1] == '\\') - j++; + { + j++; + } - h[i] = h[j]; + h[i] = h[j]; } + h[i] = '\0'; - idl_global->set_filename(new UTL_String(h)); - } - int in_main_file = I_FALSE; - if (idl_global->filename()->compare(idl_global->real_filename()) - || idl_global->filename()->compare(idl_global->main_filename())) - in_main_file = I_TRUE; - idl_global->set_in_main_file(in_main_file); - /* - * If it's an import file store the stripped name for the BE to use - */ - if (!(idl_global->in_main_file()) && idl_global->import()) { - nm = new UTL_String(stripped_name(idl_global->filename())); - idl_global->store_include_file_name(nm); - } + ACE_NEW (tmp, + UTL_String (h)); + idl_global->set_filename (tmp); + } + + UTL_String *fname = idl_global->filename (); + idl_bool in_main_file = I_FALSE; + idl_bool is_real_filename = fname->compare (idl_global->real_filename ()); + idl_bool is_main_filename = I_FALSE; + + if (!is_real_filename) + { + is_main_filename = fname->compare (idl_global->main_filename ()); + } + + if (is_real_filename || is_main_filename) + { + in_main_file = I_TRUE; + } + + idl_global->set_in_main_file (in_main_file); + + // If it's an import file store the stripped name for the BE to use + if (!(idl_global->in_main_file ()) && idl_global->import ()) + { + ACE_NEW (nm, + UTL_String (stripped_name (fname))); + + // This call also manages the #pragma prefix. + idl_global->store_include_file_name (nm); + } + else if (is_main_filename && idl_global->pragma_prefixes ().size () > 1) + { + // If we're here, we have come to the end of an included file, so we + // pop its prefix. + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } } -/* - * Store a #pragma line into the list of pragmas - */ +// Store a #pragma line into the list of pragmas static void -idl_store_pragma(char *buf) +idl_store_pragma (char *buf) { char *sp = buf + 1; - // Remove all the blanks between the '#' and the 'pragma' + + // Remove all the blanks between the '#' and the 'pragma'. if (*sp != 'p') { while (*sp != 'p') - ++sp; + { + ++sp; + } + char *tp = buf + 1; + while (*sp != '\n') { *tp = *sp; - ++tp; ++sp; + ++tp; + ++sp; } } - if (ACE_OS::strstr(buf + 8, "import") != 0) { - idl_global->set_import(I_TRUE); - return; - } - if (ACE_OS::strstr(buf + 8, "include") != 0) { - idl_global->set_import(I_FALSE); - return; - } - // Remove the final '\n' + if (ACE_OS::strstr (buf + 8, "import") != 0) + { + idl_global->set_import (I_TRUE); + return; + } + + if (ACE_OS::strstr (buf + 8, "include") != 0) + { + idl_global->set_import (I_FALSE); + return; + } + + // Remove the final '\n'. while (*sp != '\n') - ++sp; + { + ++sp; + } + *sp = '\0'; - if (ACE_OS::strstr(buf + 8, "ident") != 0) { - idl_global->ident_string(buf + 8); - return; - } - UTL_StrList *p = idl_global->pragmas(); - if (p == NULL) - idl_global->set_pragmas(new UTL_StrList(new UTL_String(buf), NULL)); - else { - p->nconc(new UTL_StrList(new UTL_String(buf), NULL)); - idl_global->set_pragmas(p); - } + + if (ACE_OS::strncmp (buf + 8, "prefix", 6) == 0) + { + char *new_prefix = idl_get_pragma_string (buf); + + if (new_prefix != 0) + { + unsigned long depth = idl_global->scopes ()->depth (); + + // At global scope, we always replace the prefix. For all + // other scopes, we replace only if there is a prefix already + // associated with that scope, otherwise we add the prefix. + if (depth == 1 || idl_global->scopes ()->top ()->has_prefix ()) + { + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + + if (depth > 1) + { + idl_global->scopes ()->top ()->has_prefix (1); + } + + idl_global->pragma_prefixes ().push (new_prefix); + } + } + else if (ACE_OS::strncmp (buf + 8, "version", 7) == 0) + { + char *tmp = buf + 16; + + while (*tmp == ' ') + { + ++tmp; + } + + char *number = ACE_OS::strchr (tmp, ' '); + + while (*number == ' ') + { + ++number; + } + + AST_Decl *d = idl_find_node (tmp); + + if (d == 0) + { + return; + } + + if (!idl_valid_version (number)) + { + idl_global->err ()->version_number_error (number); + return; + } + + d->version (ACE::strnew (number)); + } + else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0) + { + idl_global->ident_string (buf + 8); + } + else if (ACE_OS::strncmp (buf + 8, "id", 2) == 0) + { + char *tmp = buf + 11; + + while (*tmp == ' ') + { + ++tmp; + } + + AST_Decl *d = idl_find_node (tmp); + + if (d == 0) + { + return; + } + + char *new_id = idl_get_pragma_string (buf); + + if (new_id != 0) + { + d->repoID (new_id); + } + } } /* @@ -677,3 +819,111 @@ idl_wstring_escape_reader (char *str) { return str; } + +static char * +idl_get_pragma_string (char *pragma) +{ + // Get pointers to each end of the substring between the quotes. + const char *start = ACE_OS::strchr (pragma, '"') + 1; + const char *end = ACE_OS::strchr (start, '"'); + + if (end == 0) + { + idl_global->err ()->syntax_error ( + IDL_GlobalData::PS_PragmaPrefixSyntax + ); + + return 0; + } + + int len = end - start; + char *retval = 0; + + ACE_NEW_RETURN (retval, + char[len + 1], + 0); + + ACE_OS::strncpy (retval, + start, + len); + + retval[len] = '\0'; + return retval; +} + +static idl_bool +idl_valid_version (char *s) +{ + // Nothing preceding decimal point. + if (*s == '.') + { + return 0; + } + + char *minor = ACE_OS::strchr (s, '.'); + int i; + + if (minor == 0) + { + // No decimal point. + return 0; + } + + if (*(minor + 1) == '\0') + { + // Nothing following decimal point. + return 0; + } + + char *tmp = minor + 1; + + for (i = 0; tmp[i] != '\0'; ++i) + { + if (!isdigit (tmp[i])) + { + return 0; + } + } + + int len = minor - s; + + for (i = 0; i < len; ++i) + { + if (!isdigit (s[i])) + { + return 0; + } + } + + // Major and minor version numbers must be unsigned shorts. + if (ACE_OS::atoi (minor + 1) > ACE_UINT16_MAX + || ACE_OS::atoi (s) > ACE_UINT16_MAX) + { + return 0; + } + + return 1; +} + +static AST_Decl * +idl_find_node (char *s) +{ + UTL_ScopedName *node = idl_global->string_to_scoped_name (s); + AST_Decl *d = 0; + + if (node != 0) + { + d = idl_global->scopes ()->top_non_null ()->lookup_by_name (node, + I_TRUE); + } + + if (d == 0) + { + idl_global->err ()->lookup_error (node); + node->destroy (); + delete node; + node = 0; + } + + return d; +} diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index 0355ef6d522..a9e8a74d1e7 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -259,112 +259,102 @@ definitions definition : type_dcl { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | const_dcl { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | exception { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | interface_def { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | module { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | value_def { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | error { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); yyerrok; } ; module : IDL_MODULE { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen); } IDENTIFIER { - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($3), NULL); - AST_Module *m = NULL; - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_StrList *p = idl_global->pragmas(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier ($3), 0); + AST_Module *m = 0; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen); /* * Make a new module and add it to the enclosing scope */ - if (s != NULL) { - m = idl_global->gen ()->create_module (s, n, p); + if (s != 0) { + m = idl_global->gen ()->create_module (s, n); (void) s->fe_add_module (m); } /* * Push it on the stack */ - idl_global->scopes()->push(m); + idl_global->scopes ()->push (m); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen); } definitions { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen); /* * Finished with this module - pop it from the scope stack */ - UTL_Scope* s = idl_global->scopes()->top(); - AST_Module* m = AST_Module::narrow_from_scope (s); - if (m != 0) - { - UTL_StrList *p = m->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - } - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } ; @@ -376,27 +366,23 @@ interface_def interface : interface_header { - UTL_Scope *s = idl_global->scopes ()->top_non_null (); - AST_Interface *i = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas (); - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; /* * Make a new interface node and add it to its enclosing scope */ - if (s != NULL && $1 != NULL) { + if (s != 0 && $1 != 0) { i = idl_global->gen ()->create_interface ( $1->interface_name (), $1->inherits (), $1->n_inherits (), $1->inherits_flat (), $1->n_inherits_flat (), - p, $1->is_local (), $1->is_abstract () ); - AST_Interface::fwd_redefinition_helper (i,s,p); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the interface to its definition scope */ @@ -409,42 +395,30 @@ interface : } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } exports { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * 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); - if (m != NULL) - { - m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) - { - p = (UTL_StrList*) p->copy (); - } - idl_global->set_pragmas (p); - } - idl_global->scopes ()->pop(); + idl_global->scopes ()->pop (); } ; interface_decl: IDL_INTERFACE { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen); $$ = $3; } ; @@ -452,51 +426,44 @@ interface_decl: interface_header : interface_decl inheritance_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + 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 * list of all interfaces which this interface inherits from, * recursively */ - $$ = new FE_InterfaceHeader(new UTL_ScopedName($1, NULL), $2); + $$ = new FE_InterfaceHeader (new UTL_ScopedName ($1, 0), $2); } | IDL_LOCAL interface_decl inheritance_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + 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 * list of all interfaces which this interface inherits from, * recursively */ - $$ = new FE_Local_InterfaceHeader(new UTL_ScopedName($2, NULL), $3); + $$ = new FE_Local_InterfaceHeader (new UTL_ScopedName($2, 0), $3); } | IDL_ABSTRACT interface_decl inheritance_spec { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle abstract interface yet\n"; - /* (if not truncatable) */ -#if 0 - 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 - * list of all interfaces which this interface inherits from, - * recursively - */ - $$ = new FE_Abstract_InterfaceHeader(new UTL_ScopedName($2, NULL), $3); -#endif + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle abstract") + ACE_TEXT (" interfaces yet\n"))); } ; inheritance_spec : ':' { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen); } at_least_one_scoped_name { @@ -504,7 +471,7 @@ inheritance_spec } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; @@ -518,10 +485,13 @@ value_def valuetype : IDL_CUSTOM value_concrete_decl { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle custom yet\n"; - /* set custom (if not truncatable) */ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" custom yet\n"))); } | value_concrete_decl ; @@ -529,47 +499,42 @@ valuetype value_concrete_decl : value_header { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Interface *i = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; - if (s != NULL && $1 != NULL) { - i = idl_global->gen()->create_valuetype($1->interface_name(), - $1->inherits(), - $1->n_inherits(), - p); - AST_Interface::fwd_redefinition_helper (i,s,p); + if (s != 0 && $1 != 0) { + i = idl_global->gen ()->create_valuetype ($1->interface_name (), + $1->inherits (), + $1->n_inherits ()); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the valuetype to its definition scope */ - (void) s->fe_add_interface(i); + (void) s->fe_add_interface (i); } /* * Push it on the scope stack */ - idl_global->scopes()->push(i); + idl_global->scopes ()->push (i); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } value_elements { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * Done with this interface - pop it off the scopes stack */ - UTL_Scope* s = idl_global->scopes()->top(); + UTL_Scope* s = idl_global->scopes ()->top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } ; @@ -577,53 +542,48 @@ value_abs_decl : IDL_ABSTRACT value_header { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Interface *i = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; - if (s != NULL && $2 != NULL) { + if (s != 0 && $2 != 0) { if ($2->n_concrete() > 0) { - idl_global->err()->abstract_inheritance_error ($2->interface_name ()); + idl_global->err ()->abstract_inheritance_error ($2->interface_name ()); } - i = idl_global->gen()->create_valuetype($2->interface_name(), - $2->inherits(), - $2->n_inherits(), - p); + i = idl_global->gen()->create_valuetype ($2->interface_name (), + $2->inherits (), + $2->n_inherits ()); i->set_abstract_valuetype (); - AST_Interface::fwd_redefinition_helper (i,s,p); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the valuetype to its definition scope */ - (void) s->fe_add_interface(i); + (void) s->fe_add_interface (i); } /* * Push it on the scope stack */ - idl_global->scopes()->push(i); + idl_global->scopes ()->push (i); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } exports { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * Done with this interface - pop it off the scopes stack */ - UTL_Scope* s = idl_global->scopes()->top(); + UTL_Scope* s = idl_global->scopes ()->top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } ; @@ -634,18 +594,18 @@ value_header : inheritance_spec supports_spec { - $$ = new FE_obv_header (new UTL_ScopedName ($1, NULL), $3, $4); + $$ = new FE_obv_header (new UTL_ScopedName ($1, 0), $3, $4); } ; value_decl : IDL_VALUETYPE { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeIDSeen); $$ = $3; } ; @@ -653,11 +613,14 @@ value_decl opt_truncatable : IDL_TRUNCATABLE { - cerr << "warning in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "truncatable modifier not supported and is ignored\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("warning in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("truncatable modifier not supported ") + ACE_TEXT ("and is ignored\n"))); $$ = I_FALSE; - /* $$ = I_TRUE; */ } | /* EMPTY */ { @@ -669,11 +632,11 @@ supports_spec : IDL_SUPPORTS scoped_name { - $$ = new UTL_NameList($2, NULL); + $$ = new UTL_NameList ($2, 0); } | /* empty */ { - $$ = NULL; + $$ = 0; } ; @@ -681,42 +644,37 @@ value_forward_decl : IDL_ABSTRACT value_decl { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($2, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($2, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_valuetype_fwd(n, p); - // if ($1) + if (s != 0) { + f = idl_global->gen()->create_valuetype_fwd (n); f->set_abstract_valuetype (); - (void) s->fe_add_interface_fwd(f); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } | value_decl { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($1, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($1, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_valuetype_fwd(n, p); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_valuetype_fwd (n); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } ; @@ -724,9 +682,13 @@ value_forward_decl : value_box_decl : value_decl type_spec /* in this order %!?*/ { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle boxes yet\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" boxes yet\n"))); } ; @@ -739,6 +701,7 @@ value_element : state_member | export | init_decl + ';' ; state_member @@ -764,15 +727,15 @@ exports export : type_dcl { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | const_dcl { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen); } ';' { @@ -780,35 +743,35 @@ export } | exception { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | attribute { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | operation { - idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } | error { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); yyerrok; } ; @@ -816,7 +779,7 @@ export at_least_one_scoped_name : scoped_name scoped_names { - $$ = new UTL_NameList($1, $2); + $$ = new UTL_NameList ($1, $2); } ; @@ -824,164 +787,153 @@ scoped_names : scoped_names ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen); } scoped_name { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen); - if ($1 == NULL) - $$ = new UTL_NameList($4, NULL); + if ($1 == 0) + $$ = new UTL_NameList ($4, 0); else { - $1->nconc(new UTL_NameList($4, NULL)); + $1->nconc (new UTL_NameList ($4, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; scoped_name : id { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - $$ = new UTL_IdList($1, NULL); + $$ = new UTL_IdList($1, 0); } | IDL_SCOPE_DELIMITOR { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - $$ = new UTL_IdList(new Identifier($1), - new UTL_IdList($3, NULL)); + $$ = new UTL_IdList (new Identifier ($1), + new UTL_IdList ($3, 0)); } | scoped_name IDL_SCOPE_DELIMITOR { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - $1->nconc(new UTL_IdList($4, NULL)); + $1->nconc (new UTL_IdList ($4, 0)); $$ = $1; } ; id: IDENTIFIER { - $$ = new Identifier($1); + $$ = new Identifier ($1); } ; forward : interface_decl { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($1, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName($1, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 0, 0); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 0, 0); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } | IDL_LOCAL interface_decl { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($2, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($2, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 1, 0); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 1, 0); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } | IDL_ABSTRACT interface_decl { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($2, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($2, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 0, 1); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 0, 1); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } ; const_dcl : IDL_CONST { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen); } const_type { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen); } '=' { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen); } expression { - UTL_ScopedName *n = new UTL_ScopedName($5, NULL); - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Constant *c = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; + UTL_ScopedName *n = new UTL_ScopedName ($5, 0); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Constant *c = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_ConstExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen); /* * Create a node representing a constant declaration. Store * it in the enclosing scope */ - if ($9 != NULL && s != NULL) { - if ($9->coerce($3) == NULL) - idl_global->err()->coercion_error($9, $3); + if ($9 != 0 && s != 0) { + if ($9->coerce ($3) == 0) + idl_global->err ()->coercion_error ($9, $3); else { c = - idl_global->gen()->create_constant($3, $9, n, p); - (void) s->fe_add_constant(c); + idl_global->gen ()->create_constant ($3, $9, n); + (void) s->fe_add_constant (c); } } - idl_global->set_pragmas (p); } ; @@ -1002,31 +954,31 @@ const_type } | scoped_name { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - AST_PredefinedType *c = NULL; - AST_Typedef *t = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; + AST_PredefinedType *c = 0; + AST_Typedef *t = 0; /* * If the constant's type is a scoped name, it must resolve * to a scalar constant type */ - if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { + if (s != 0 && (d = s->lookup_by_name ($1, I_TRUE)) != 0) { /* * Look through typedefs */ - while (d->node_type() == AST_Decl::NT_typedef) { - t = AST_Typedef::narrow_from_decl(d); - if (t == NULL) + while (d->node_type () == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl (d); + if (t == 0) break; - d = t->base_type(); + d = t->base_type (); } - if (d == NULL) + if (d == 0) $$ = AST_Expression::EV_any; - else if (d->node_type() == AST_Decl::NT_pre_defined) { - c = AST_PredefinedType::narrow_from_decl(d); - if (c != NULL) { - $$ = idl_global->PredefinedTypeToExprType(c->pt()); + else if (d->node_type () == AST_Decl::NT_pre_defined) { + c = AST_PredefinedType::narrow_from_decl (d); + if (c != 0) { + $$ = idl_global->PredefinedTypeToExprType (c->pt ()); } else { $$ = AST_Expression::EV_any; } @@ -1048,7 +1000,9 @@ const_expr : or_expr ; or_expr : xor_expr | or_expr '|' xor_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_or, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_or, + $1, + $3); } ; @@ -1056,7 +1010,9 @@ xor_expr : and_expr | xor_expr '^' and_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_xor, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_xor, + $1, + $3); } ; @@ -1064,7 +1020,9 @@ and_expr : shift_expr | and_expr '&' shift_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_and, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_and, + $1, + $3); } ; @@ -1072,11 +1030,15 @@ shift_expr : add_expr | shift_expr IDL_LEFT_SHIFT add_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_left,$1,$3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_left, + $1, + $3); } | shift_expr IDL_RIGHT_SHIFT add_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_right,$1,$3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_right, + $1, + $3); } ; @@ -1084,11 +1046,15 @@ add_expr : mult_expr | add_expr '+' mult_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_add, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_add, + $1, + $3); } | add_expr '-' mult_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_minus,$1,$3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_minus, + $1, + $3); } ; @@ -1096,15 +1062,21 @@ mult_expr : unary_expr | mult_expr '*' unary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_mul, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_mul, + $1, + $3); } | mult_expr '/' unary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_div, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_div, + $1, + $3); } | mult_expr '%' unary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_mod, $1, $3); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_mod, + $1, + $3); } ; @@ -1112,21 +1084,21 @@ unary_expr : primary_expr | '+' primary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, - $2, - NULL); + $$ = idl_global->gen ()->create_expr (AST_Expression::EC_u_plus, + $2, + 0); } | '-' primary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, - $2, - NULL); + $$ = idl_global->gen()->create_expr (AST_Expression::EC_u_minus, + $2, + 0); } | '~' primary_expr { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, - $2, - NULL); + $$ = idl_global->gen()->create_expr (AST_Expression::EC_bit_neg, + $2, + 0); } ; @@ -1138,7 +1110,7 @@ primary_expr * but only when it is evaluated (such as when it is assigned * as a constant value). */ - UTL_Scope *s = idl_global->scopes()->top_non_null (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); AST_Decl *d = s->lookup_by_name ($1, 1); @@ -1171,42 +1143,42 @@ primary_expr literal : IDL_INTEGER_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_UINTEGER_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_STRING_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_WSTRING_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_CHARACTER_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_WCHAR_LITERAL { ACE_OutputCDR::from_wchar wc ($1); - $$ = idl_global->gen()->create_expr(wc); + $$ = idl_global->gen ()->create_expr (wc); } | IDL_FLOATING_PT_LITERAL { - $$ = idl_global->gen()->create_expr($1); + $$ = idl_global->gen ()->create_expr ($1); } | IDL_TRUETOK { - $$ = idl_global->gen()->create_expr((idl_bool) I_TRUE, - AST_Expression::EV_bool); + $$ = idl_global->gen ()->create_expr ((idl_bool) I_TRUE, + AST_Expression::EV_bool); } | IDL_FALSETOK { - $$ = idl_global->gen()->create_expr((idl_bool) I_FALSE, - AST_Expression::EV_bool); + $$ = idl_global->gen ()->create_expr ((idl_bool) I_FALSE, + AST_Expression::EV_bool); } ; @@ -1280,7 +1252,7 @@ positive_int_expr : type_dcl : IDL_TYPEDEF { - idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen); } type_declarator {$$ = 0;} | struct_type { $$ = 0;} @@ -1288,67 +1260,58 @@ type_dcl | enum_type { $$ = 0;} | IDL_NATIVE simple_declarator { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Native *node = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Native *node = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_NativeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen); /* * Create a node representing a Native and add it to its * enclosing scope */ - if (s != NULL) { - node = idl_global->gen()->create_native ($2->name (), p); + if (s != 0) { + node = idl_global->gen ()->create_native ($2->name ()); /* * Add it to its defining scope */ (void) s->fe_add_native (node); } - idl_global->set_pragmas (p); } ; type_declarator : type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen); } at_least_one_declarator { - UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); UTL_DecllistActiveIterator *l; - FE_Declarator *d = NULL; - AST_Typedef *t = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); + FE_Declarator *d = 0; + AST_Typedef *t = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_DeclaratorsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen); /* * Create a list of type renamings. Add them to the * enclosing scope */ - if (s != NULL && $1 != NULL && $3 != NULL) { - l = new UTL_DecllistActiveIterator($3); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) - continue; - AST_Type * tp = d->compose($1); - if (tp == NULL) - continue; - t = idl_global->gen()->create_typedef(tp, d->name(), p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_typedef(t); + if (s != 0 && $1 != 0 && $3 != 0) { + l = new UTL_DecllistActiveIterator ($3); + for (;!(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) + continue; + AST_Type * tp = d->compose ($1); + if (tp == 0) + continue; + t = idl_global->gen ()->create_typedef (tp, + d->name (), + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_typedef (t); } delete l; } - idl_global->set_pragmas (p); } ; @@ -1360,18 +1323,18 @@ type_spec simple_type_spec : base_type_spec { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | template_type_spec | scoped_name { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; - if (s != NULL) - d = s->lookup_by_name($1, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error($1); + if (s != 0) + d = s->lookup_by_name ($1, I_TRUE); + if (d == 0) + idl_global->err ()->lookup_error ($1); $$ = d; } ; @@ -1401,7 +1364,7 @@ constructed_type_spec at_least_one_declarator : declarator declarators { - $$ = new UTL_DeclList($1, $2); + $$ = new UTL_DeclList ($1, $2); } ; @@ -1409,22 +1372,22 @@ declarators : declarators ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } declarator { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); - if ($1 == NULL) - $$ = new UTL_DeclList($4, NULL); + if ($1 == 0) + $$ = new UTL_DeclList ($4, 0); else { - $1->nconc(new UTL_DeclList($4, NULL)); + $1->nconc (new UTL_DeclList ($4, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; @@ -1436,7 +1399,7 @@ declarator at_least_one_simple_declarator : simple_declarator simple_declarators { - $$ = new UTL_DeclList($1, $2); + $$ = new UTL_DeclList ($1, $2); } ; @@ -1444,39 +1407,40 @@ simple_declarators : simple_declarators ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } simple_declarator { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); - if ($1 == NULL) - $$ = new UTL_DeclList($4, NULL); + if ($1 == 0) + $$ = new UTL_DeclList ($4, 0); else { - $1->nconc(new UTL_DeclList($4, NULL)); + $1->nconc (new UTL_DeclList ($4, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; simple_declarator : id { - $$ = new FE_Declarator(new UTL_ScopedName($1, NULL), - FE_Declarator::FD_simple, NULL); + $$ = new FE_Declarator (new UTL_ScopedName ($1, 0), + FE_Declarator::FD_simple, 0); } ; complex_declarator : array_declarator { - $$ = new FE_Declarator(new UTL_ScopedName($1->local_name(), NULL), - FE_Declarator::FD_complex, - $1); + $$ = new FE_Declarator (new UTL_ScopedName ($1->local_name (), + 0), + FE_Declarator::FD_complex, + $1); } ; @@ -1533,9 +1497,13 @@ floating_pt_type fixed_type : IDL_FIXED { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle fixed types yet\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" fixed types yet\n"))); } ; @@ -1574,57 +1542,48 @@ any_type struct_type : IDL_STRUCT { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen); } id { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($3, NULL); - AST_Structure *d = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($3, 0); + AST_Structure *d = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_StructIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); /* * Create a node representing a struct declaration. Add it * to the enclosing scope */ - if (s != NULL) { - d = idl_global->gen()->create_structure(n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_structure(d); + if (s != 0) { + d = idl_global->gen ()->create_structure (n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_structure (d); } /* * Push the scope of the struct on the scopes stack */ - idl_global->scopes()->push(d); + idl_global->scopes ()->push (d); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen); } at_least_one_member { - idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen); /* * Done with this struct. Pop its scope off the scopes stack */ - $$ = - AST_Structure::narrow_from_scope( - idl_global->scopes()->top_non_null()); - UTL_StrList *p = $$->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + $$ = AST_Structure::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); + idl_global->scopes ()->pop (); } ; @@ -1646,53 +1605,55 @@ member : member_i: type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen); } at_least_one_declarator { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen); } ';' { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_DecllistActiveIterator *l = NULL; - FE_Declarator *d = NULL; - AST_Field *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_DecllistActiveIterator *l = 0; + FE_Declarator *d = 0; + AST_Field *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted); /* * Check for illegal recursive use of type */ - if ($1 != NULL && AST_illegal_recursive_type($1)) - idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, $1); + if ($1 != 0 && AST_illegal_recursive_type ($1)) + idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, + $1); /* * Create a node representing a struct or exception member * Add it to the enclosing scope */ - else if (s != NULL && $1 != NULL && $3 != NULL) { - l = new UTL_DecllistActiveIterator($3); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) + else if (s != 0 && $1 != 0 && $3 != 0) { + l = new UTL_DecllistActiveIterator ($3); + for (;!(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) continue; - AST_Type *tp = d->compose($1); - if (tp == NULL) + AST_Type *tp = d->compose ($1); + if (tp == 0) continue; /* $0 denotes Visibility, must be on yacc reduction stack */ - f = idl_global->gen()->create_field(tp, d->name(), p, $<vival>0); - (void) s->fe_add_field(f); + f = idl_global->gen ()->create_field (tp, + d->name (), + $<vival>0); + (void) s->fe_add_field (f); } delete l; } } | error { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state ()); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); yyerrok; } ; @@ -1700,82 +1661,72 @@ member_i: union_type : IDL_UNION { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen); } id { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen); } IDL_SWITCH { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen); } '(' { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen); } switch_type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen); } ')' { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($3, NULL); - AST_Union *u = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($3, 0); + AST_Union *u = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchCloseParSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen); /* * Create a node representing a union. Add it to its enclosing * scope */ - if ($9 != NULL && s != NULL) { - AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl($9); - if (tp == NULL) { - idl_global->err()->not_a_type($9); + if ($9 != 0 && s != 0) { + AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl ($9); + if (tp == 0) { + idl_global->err ()->not_a_type ($9); } else { - u = idl_global->gen()->create_union(tp, - n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_union(u); + u = idl_global->gen ()->create_union (tp, + n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_union (u); } } /* * Push the scope of the union on the scopes stack */ - idl_global->scopes()->push(u); + idl_global->scopes()->push (u); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen); } at_least_one_case_branch { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen); /* * Done with this union. Pop its scope from the scopes stack */ - $$ = - AST_Union::narrow_from_scope ( - idl_global->scopes()->top_non_null() - ); + $$ = AST_Union::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); if ($$ != 0) { - UTL_StrList *p = $$->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } } ; @@ -1783,30 +1734,36 @@ union_type : switch_type_spec : integer_type { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | char_type { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + /* wchars are not allowed */ + if ($1 == AST_Expression::EV_wchar) + { + idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); + } + + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | 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); + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | boolean_type { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | enum_type | scoped_name { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - AST_PredefinedType *p = NULL; - AST_Typedef *t = NULL; - long found = I_FALSE; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; + AST_PredefinedType *p = 0; + AST_Typedef *t = 0; + long found = I_FALSE; /* * The discriminator is a scoped name. Try to resolve to @@ -1814,17 +1771,17 @@ switch_type_spec : * typedef's to arrive at the base type at the end of the * chain */ - if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { + if (s != 0 && (d = s->lookup_by_name ($1, I_TRUE)) != 0) { while (!found) { - switch (d->node_type()) { + switch (d->node_type ()) { case AST_Decl::NT_enum: $$ = d; found = I_TRUE; break; case AST_Decl::NT_pre_defined: - p = AST_PredefinedType::narrow_from_decl(d); - if (p != NULL) { - switch (p->pt()) { + p = AST_PredefinedType::narrow_from_decl (d); + if (p != 0) { + switch (p->pt ()) { case AST_PredefinedType::PT_long: case AST_PredefinedType::PT_ulong: case AST_PredefinedType::PT_longlong: @@ -1832,43 +1789,43 @@ switch_type_spec : case AST_PredefinedType::PT_short: case AST_PredefinedType::PT_ushort: case AST_PredefinedType::PT_char: - case AST_PredefinedType::PT_wchar: case AST_PredefinedType::PT_boolean: $$ = p; found = I_TRUE; break; + case AST_PredefinedType::PT_wchar: case AST_PredefinedType::PT_octet: - // octets are not allowed + /* octets and wchars are not allowed */ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); - $$ = NULL; + $$ = 0; found = I_TRUE; break; default: - $$ = NULL; + $$ = 0; found = I_TRUE; break; } } else { - $$ = NULL; + $$ = 0; found = I_TRUE; } break; case AST_Decl::NT_typedef: - t = AST_Typedef::narrow_from_decl(d); - if (t != NULL) d = t->base_type(); + t = AST_Typedef::narrow_from_decl (d); + if (t != 0) d = t->base_type (); break; default: - $$ = NULL; + $$ = 0; found = I_TRUE; break; } } } else - $$ = NULL; + $$ = 0; - if ($$ == NULL) - idl_global->err()->lookup_error($1); + if ($$ == 0) + idl_global->err ()->lookup_error ($1); } ; @@ -1882,44 +1839,38 @@ case_branches case_branch : at_least_one_case_label { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen); } element_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen); } ';' { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_LabellistActiveIterator *l = NULL; - AST_UnionLabel *d = NULL; - AST_UnionBranch *b = NULL; - AST_Field *f = $3; - - ACE_UNUSED_ARG (l); - ACE_UNUSED_ARG (d); + 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); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted); /* * Create several nodes representing branches of a union. * Add them to the enclosing scope (the union scope) */ - if (s != NULL && $1 != NULL && $3 != NULL) { - b = idl_global->gen()->create_union_branch($1, - f->field_type(), - f->name(), - f->pragmas()); - (void) s->fe_add_union_branch(b); + if (s != 0 && $1 != 0 && $3 != 0) { + b = idl_global->gen ()->create_union_branch ($1, + f->field_type (), + f->name ()); + (void) s->fe_add_union_branch (b); } } | error { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } ';' { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); yyerrok; } ; @@ -1927,82 +1878,84 @@ case_branch : at_least_one_case_label : case_label case_labels { - $$ = new UTL_LabelList($1, $2); + $$ = new UTL_LabelList ($1, $2); } ; case_labels : case_labels case_label { - if ($1 == NULL) - $$ = new UTL_LabelList($2, NULL); + if ($1 == 0) + $$ = new UTL_LabelList ($2, 0); else { - $1->nconc(new UTL_LabelList($2, NULL)); + $1->nconc(new UTL_LabelList ($2, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; case_label : IDL_DEFAULT { - idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen); } ':' { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); - $$ = idl_global->gen()-> - create_union_label(AST_UnionLabel::UL_default, - NULL); + $$ = idl_global->gen ()->create_union_label ( + AST_UnionLabel::UL_default, + 0 + ); } | IDL_CASE { - idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen); } const_expr { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen); } ':' { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); - $$ = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, - $3); + $$ = idl_global->gen()->create_union_label ( + AST_UnionLabel::UL_label, + $3 + ); } ; element_spec : type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen); } declarator { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen); /* * Check for illegal recursive use of type */ - if ($1 != NULL && AST_illegal_recursive_type($1)) - idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, $1); + if ($1 != 0 && AST_illegal_recursive_type ($1)) + idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, $1); /* * Create a field in a union branch */ - else if ($1 == NULL || $3 == NULL) - $$ = NULL; + else if ($1 == 0 || $3 == 0) + $$ = 0; else { - AST_Type *tp = $3->compose($1); - if (tp == NULL) - $$ = NULL; + AST_Type *tp = $3->compose ($1); + if (tp == 0) + $$ = 0; else - $$ = idl_global->gen()->create_field(tp, - $3->name(), - idl_global->pragmas()); + $$ = idl_global->gen ()->create_field (tp, + $3->name()); } } ; @@ -2010,61 +1963,55 @@ element_spec : enum_type : IDL_ENUM { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen); } id { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($3, NULL); - AST_Enum *e = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName($3, 0); + AST_Enum *e = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_EnumIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen); /* * Create a node representing an enum and add it to its * enclosing scope */ - if (s != NULL) { - e = idl_global->gen()->create_enum(n, - p, - s->is_local (), - s->is_abstract ()); + 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); + (void) s->fe_add_enum (e); } /* * Push the enum scope on the scopes stack */ - idl_global->scopes()->push(e); + idl_global->scopes ()->push (e); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen); } at_least_one_enumerator { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen); } '}' { - UTL_StrList *p = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_EnumQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen); /* * Done with this enum. Pop its scope from the scopes stack */ - if (idl_global->scopes()->top() == NULL) - $$ = NULL; + if (idl_global->scopes ()->top () == 0) + $$ = 0; else { - $$ = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); - p = $$->pragmas (); - idl_global->scopes()->pop(); + $$ = AST_Enum::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); + idl_global->scopes ()->pop (); } - idl_global->set_pragmas (p); } ; @@ -2074,7 +2021,7 @@ enumerators : enumerators ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen); } enumerator | /* EMPTY */ @@ -2083,22 +2030,22 @@ enumerators enumerator : IDENTIFIER { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($1), NULL); - AST_EnumVal *e = NULL; - AST_Enum *c = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier ($1), 0); + AST_EnumVal *e = 0; + AST_Enum *c = 0; /* * Create a node representing one enumerator in an enum * Add it to the enclosing scope (the enum scope) */ - if (s != NULL && s->scope_node_type() == AST_Decl::NT_enum) { - c = AST_Enum::narrow_from_scope(s); - if (c != NULL) - e = idl_global->gen()->create_enum_val(c->next_enum_val(), n, p); - (void) s->fe_add_enum_val(e); + if (s != 0 && s->scope_node_type () == AST_Decl::NT_enum) { + c = AST_Enum::narrow_from_scope (s); + if (c != 0) + e = idl_global->gen ()->create_enum_val (c->next_enum_val (), + n); + (void) s->fe_add_enum_val (e); } } ; @@ -2107,77 +2054,80 @@ sequence_type_spec : seq_head ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen); } positive_int_expr { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen); } '>' { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); /* * Remove sequence marker from scopes stack */ - if (idl_global->scopes()->top() == NULL) - idl_global->scopes()->pop(); - UTL_Scope *s = idl_global->scopes()->top_non_null (); + if (idl_global->scopes ()->top() == 0) + idl_global->scopes ()->pop (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); /* * Create a node representing a sequence */ - if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); - $$ = NULL; - } else if ($1 == NULL) { - $$ = NULL; + if ($4 == 0 || $4->coerce(AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong); + $$ = 0; + } else if ($1 == 0) { + $$ = 0; } else { - AST_Type *tp = AST_Type::narrow_from_decl($1); - if (tp == NULL) + AST_Type *tp = AST_Type::narrow_from_decl ($1); + if (tp == 0) ; // Error will be caught in FE_Declarator. else { - $$ = idl_global->gen()->create_sequence($4, - tp, - s->is_local (), - s->is_abstract ()); + $$ = idl_global->gen ()->create_sequence ($4, + tp, + s->is_local (), + s->is_abstract ()); /* - * Add this AST_Sequence to the types defined in the global scope + * Add this AST_Sequence to types defined in the global scope. */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_sequence ( + AST_Sequence::narrow_from_decl ($$) + ); } } } | seq_head '>' { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); /* * Remove sequence marker from scopes stack */ - if (idl_global->scopes()->top() == NULL) - idl_global->scopes()->pop(); - UTL_Scope *s = idl_global->scopes()->top_non_null (); + if (idl_global->scopes ()->top () == 0) + idl_global->scopes ()->pop (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); /* * Create a node representing a sequence */ - if ($1 == NULL) - $$ = NULL; + if ($1 == 0) + $$ = 0; else { - AST_Type *tp = AST_Type::narrow_from_decl($1); - if (tp == NULL) + AST_Type *tp = AST_Type::narrow_from_decl ($1); + if (tp == 0) ; // Error will be caught in FE_Declarator. else { $$ = - idl_global->gen()->create_sequence( - idl_global->gen()->create_expr((unsigned long) 0), - tp, - s->is_local (), - s->is_abstract ()); + idl_global->gen ()->create_sequence ( + idl_global->gen ()->create_expr ((unsigned long) 0), + tp, + s->is_local (), + s->is_abstract () + ); /* - * Add this AST_Sequence to the types defined in the global scope + * Add this AST_Sequence to types defined in the global scope */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_sequence ( + AST_Sequence::narrow_from_decl ($$) + ); } } } @@ -2186,19 +2136,19 @@ sequence_type_spec seq_head: IDL_SEQUENCE { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen); /* * Push a sequence marker on scopes stack */ - idl_global->scopes()->push(NULL); + idl_global->scopes ()->push (0); } '<' { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen); } simple_type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen); $$ = $5; } ; @@ -2207,51 +2157,54 @@ string_type_spec : string_head '<' { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } positive_int_expr { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } '>' { - idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); /* * Create a node representing a string */ - if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); - $$ = NULL; + if ($4 == 0 || $4->coerce (AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong); + $$ = 0; } else { - $$ = idl_global->gen()->create_string($4); + $$ = idl_global->gen ()->create_string ($4); /* * Add this AST_String to the types defined in the global scope */ - (void) idl_global->root() - ->fe_add_string(AST_String::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl ($$) + ); } } | string_head { - idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); /* * Create a node representing a string */ $$ = - idl_global->gen()->create_string( - idl_global->gen()->create_expr((unsigned long) 0)); + idl_global->gen ()->create_string ( + idl_global->gen ()->create_expr ((unsigned long) 0) + ); /* * Add this AST_String to the types defined in the global scope */ - (void) idl_global->root() - ->fe_add_string(AST_String::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl ($$) + ); } ; string_head: IDL_STRING { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } ; @@ -2259,68 +2212,75 @@ wstring_type_spec : wstring_head '<' { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } positive_int_expr { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } '>' { - idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); /* * Create a node representing a string */ - if ($4 == NULL || $4->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error($4, AST_Expression::EV_ulong); - $$ = NULL; + if ($4 == 0 || $4->coerce(AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error ($4, AST_Expression::EV_ulong); + $$ = 0; } else { - $$ = idl_global->gen()->create_wstring($4); + $$ = idl_global->gen ()->create_wstring ($4); /* * Add this AST_String to the types defined in the global scope */ - (void) idl_global->root() - ->fe_add_string(AST_String::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl ($$) + ); } } | wstring_head { - idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); /* * Create a node representing a string */ $$ = - idl_global->gen()->create_wstring( - idl_global->gen()->create_expr((unsigned long) 0)); + idl_global->gen ()->create_wstring ( + idl_global->gen ()->create_expr ((unsigned long) 0) + ); /* * Add this AST_String to the types defined in the global scope */ - (void) idl_global->root() - ->fe_add_string(AST_String::narrow_from_decl($$)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl ($$) + ); } ; wstring_head: IDL_WSTRING { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } ; array_declarator : id { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen); } at_least_one_array_dim { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted); /* * Create a node representing an array */ - if ($3 != NULL) { - $$ = idl_global->gen()->create_array(new UTL_ScopedName($1, NULL), - $3->length(), $3, 0, 0); + if ($3 != 0) { + $$ = idl_global->gen ()->create_array (new UTL_ScopedName ($1, + 0), + $3->length (), + $3, + 0, + 0); } } ; @@ -2328,45 +2288,45 @@ array_declarator : at_least_one_array_dim : array_dim array_dims { - $$ = new UTL_ExprList($1, $2); + $$ = new UTL_ExprList ($1, $2); } ; array_dims : array_dims array_dim { - if ($1 == NULL) - $$ = new UTL_ExprList($2, NULL); + if ($1 == 0) + $$ = new UTL_ExprList ($2, 0); else { - $1->nconc(new UTL_ExprList($2, NULL)); + $1->nconc (new UTL_ExprList ($2, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; array_dim : '[' { - idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen); } positive_int_expr { - idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen); } ']' { - idl_global->set_parse_state(IDL_GlobalData::PS_DimQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen); /* * Array dimensions are expressions which must be coerced to * positive integers */ - if ($3 == NULL || $3->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error($3, AST_Expression::EV_ulong); - $$ = NULL; + if ($3 == 0 || $3->coerce (AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error ($3, AST_Expression::EV_ulong); + $$ = 0; } else $$ = $3; } @@ -2376,55 +2336,52 @@ attribute: opt_readonly IDL_ATTRIBUTE { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen); } param_type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen); } at_least_one_simple_declarator { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_DecllistActiveIterator *l = NULL; - AST_Attribute *a = NULL; - FE_Declarator *d = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_DecllistActiveIterator *l = 0; + AST_Attribute *a = 0; + FE_Declarator *d = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_AttrCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted); /* * Create nodes representing attributes and add them to the * enclosing scope */ - if (s != NULL && $4 != NULL && $6 != NULL) { - l = new UTL_DecllistActiveIterator($6); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) + if (s != 0 && $4 != 0 && $6 != 0) { + l = new UTL_DecllistActiveIterator ($6); + for (; !(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) continue; - AST_Type *tp = d->compose($4); - if (tp == NULL) + AST_Type *tp = d->compose ($4); + if (tp == 0) continue; - a = idl_global->gen()->create_attribute($1, - tp, - (UTL_IdList *) d->name()->copy (), - p, - s->is_local (), - s->is_abstract ()); + a = idl_global->gen ()->create_attribute ($1, + tp, + (UTL_IdList *) d->name()->copy (), + s->is_local (), + s->is_abstract ()); /* * Add one attribute to the enclosing scope */ - (void) s->fe_add_attribute(a); + (void) s->fe_add_attribute (a); } delete l; } - idl_global->set_pragmas (p); } ; opt_readonly : IDL_READONLY { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen); $$ = I_TRUE; } | /* EMPTY */ @@ -2436,54 +2393,45 @@ opt_readonly exception : IDL_EXCEPTION { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen); } id { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName($3, NULL); - AST_Exception *e = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName ($3, 0); + AST_Exception *e = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen); /* * Create a node representing an exception and add it to * the enclosing scope */ - if (s != NULL) { - e = idl_global->gen()->create_exception(n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_exception(e); + if (s != 0) { + e = idl_global->gen ()->create_exception (n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_exception (e); } /* * Push the exception scope on the scope stack */ - idl_global->scopes()->push(e); + idl_global->scopes()->push (e); } '{' { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen); } members { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen); } '}' { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen); /* * Done with this exception. Pop its scope from the scope stack */ - AST_Exception *ex = - AST_Exception::narrow_from_scope (idl_global->scopes ()->top_non_null ()); - UTL_StrList *p = ex->pragmas (); - idl_global->scopes()->pop(); - idl_global->set_pragmas (p); + idl_global->scopes ()->pop (); } ; @@ -2491,83 +2439,81 @@ operation : opt_op_attribute op_type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); } IDENTIFIER { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($4), NULL); - AST_Operation *o = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier ($4), 0); + AST_Operation *o = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_OpIDSeen); + 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 */ - if (s != NULL && $2 != NULL) { - AST_Type *tp = AST_Type::narrow_from_decl($2); - if (tp == NULL) { - idl_global->err()->not_a_type($2); - } else if (tp->node_type() == AST_Decl::NT_except) { - idl_global->err()->not_a_type($2); + if (s != 0 && $2 != 0) { + AST_Type *tp = AST_Type::narrow_from_decl ($2); + if (tp == 0) { + idl_global->err ()->not_a_type ($2); + } else if (tp->node_type () == AST_Decl::NT_except) { + idl_global->err ()->not_a_type ($2); } else { - o = idl_global->gen()->create_operation(tp, - $1, - n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_operation(o); + o = idl_global->gen ()->create_operation (tp, + $1, + n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_operation (o); } } /* * Push the operation scope onto the scopes stack */ - idl_global->scopes()->push(o); + idl_global->scopes()->push (o); } parameter_list { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted); } opt_raises { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted); } opt_context { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Operation *o = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Operation *o = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_OpCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted); /* * Add exceptions and context to the operation */ - if (s != NULL && s->scope_node_type() == AST_Decl::NT_op) { - o = AST_Operation::narrow_from_scope(s); + if (s != 0 && s->scope_node_type() == AST_Decl::NT_op) { + o = AST_Operation::narrow_from_scope (s); - if ($8 != NULL && o != NULL) - (void) o->fe_add_exceptions($8); - if ($10 != NULL) - (void) o->fe_add_context($10); + if ($8 != 0 && o != 0) + (void) o->fe_add_exceptions ($8); + if ($10 != 0) + (void) o->fe_add_context ($10); } /* * Done with this operation. Pop its scope from the scopes stack */ - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } ; opt_op_attribute : IDL_ONEWAY { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); $$ = AST_Operation::OP_oneway; } | IDL_IDEMPOTENT { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); $$ = AST_Operation::OP_idempotent; } | /* EMPTY */ @@ -2581,38 +2527,147 @@ op_type_spec | IDL_VOID { $$ = - idl_global->scopes()->bottom() - ->lookup_primitive_type(AST_Expression::EV_void); + idl_global->scopes ()->bottom ()->lookup_primitive_type ( + AST_Expression::EV_void + ); } ; init_decl - : IDL_FACTORY IDENTIFIER parameter_list + : IDL_FACTORY + { + //@@ PS_FactorySeen? + idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); + } + IDENTIFIER + { + + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + if (s->is_abstract ()) + { + //@@ Fire error + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("error in %s line %d:\n") + ACE_TEXT ("Abstract valuetype can't have a ") + ACE_TEXT ("factory construct.\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + } + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier ($3), 0); + + AST_Factory *factory = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); + + /* + * Create a node representing an factory construct + * and add it to its enclosing scope + */ + if (s != 0) + { + factory = idl_global->gen ()->create_factory (n); + (void) s->fe_add_factory (factory); + } + /* + * Push the operation scope onto the scopes stack + */ + idl_global->scopes ()->push (factory); + } + init_parameter_list + { + // TODO: replace parameter_list with rule that accepts only IN args + + idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted); + idl_global->scopes ()->pop (); + } + ; + +init_parameter_list + : '(' + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); + } + ')' + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); + } + | '(' + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); + } + at_least_one_in_parameter + ')' + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); + } + ; + +at_least_one_in_parameter : in_parameter in_parameters ; + +in_parameters + : in_parameters + ',' + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); + } + in_parameter + | /* EMPTY */ + ; + +in_parameter : + IDL_IN + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); + } + param_type_spec + { + idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); + } + declarator { - // TODO: replace parameter_list with rule that accepts only IN args - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle factory yet\n"; + + 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) + */ + if ($3 != 0 && $5 != 0 && s != 0) + { + AST_Type *tp = $5->compose ($3); + if (tp != 0) + { + a = idl_global->gen ()->create_argument ( + AST_Argument::dir_IN, + tp, + (UTL_IdList *) $5->name ()->copy () + ); + + (void) s->fe_add_argument (a); + } + } } ; parameter_list : '(' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } ')' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } | '(' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } at_least_one_parameter ')' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } ; @@ -2622,7 +2677,7 @@ parameters : parameters ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } parameter | /* EMPTY */ @@ -2631,36 +2686,43 @@ parameters parameter : direction { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); } param_type_spec { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); } declarator { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Argument *a = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Argument *a = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDeclSeen); + 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) */ - if ($3 != NULL && $5 != NULL && s != NULL) { - AST_Type *tp = $5->compose($3); - if (tp != NULL) { + if ($3 != 0 && $5 != 0 && s != 0) { + AST_Type *tp = $5->compose ($3); + if (tp != 0) { if (!s->is_local () && tp->is_local ()) { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Cannot use a local type as an argument of a remote interface operation\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Cannot use a local type as an ") + ACE_TEXT ("argument of a remote operation\n"))); } else { - a = idl_global->gen()->create_argument($1, tp, (UTL_IdList *) $5->name ()->copy (), p); - (void) s->fe_add_argument(a); + a = idl_global->gen ()->create_argument ( + $1, + tp, + (UTL_IdList *) $5->name ()->copy () + ); + (void) s->fe_add_argument (a); } } } @@ -2670,19 +2732,19 @@ parameter : param_type_spec : base_type_spec { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + $$ = idl_global->scopes ()->bottom ()->lookup_primitive_type ($1); } | string_type_spec | wstring_type_spec | scoped_name { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; - if (s != NULL) - d = s->lookup_by_name($1, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error($1); + if (s != 0) + d = s->lookup_by_name ($1, I_TRUE); + if (d == 0) + idl_global->err ()->lookup_error ($1); $$ = d; } ; @@ -2705,49 +2767,49 @@ direction opt_raises : IDL_RAISES { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen); } '(' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen); } at_least_one_scoped_name ')' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen); $$ = $5; } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; opt_context : IDL_CONTEXT { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen); } '(' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen); } at_least_one_string_literal ')' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen); $$ = $5; } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; at_least_one_string_literal : IDL_STRING_LITERAL string_literals { - $$ = new UTL_StrList($1, $2); + $$ = new UTL_StrList ($1, $2); } ; @@ -2755,20 +2817,20 @@ string_literals : string_literals ',' { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen); } IDL_STRING_LITERAL { - if ($1 == NULL) - $$ = new UTL_StrList($4, NULL); + if ($1 == 0) + $$ = new UTL_StrList ($4, 0); else { - $1->nconc(new UTL_StrList($4, NULL)); + $1->nconc (new UTL_StrList ($4, 0)); $$ = $1; } } | /* EMPTY */ { - $$ = NULL; + $$ = 0; } ; @@ -2779,7 +2841,7 @@ string_literals * ??? */ int -yywrap() +yywrap () { return 1; } @@ -2788,7 +2850,7 @@ yywrap() * Report an error situation discovered in a production */ void -yyerror(const char *msg) +yyerror (const char *msg) { ACE_ERROR ((LM_ERROR, "%s\n", diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index b1275e87b0c..15a6b7c1583 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -802,14 +802,17 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "fe_private.h" #include "y.tab.h" -static char * idl_wstring_escape_reader(char *); -static ACE_CDR::WChar idl_wchar_escape_reader(char *); -static char idl_escape_reader(char *); -static double idl_atof(char *); -static long idl_atoi(char *, long); -static unsigned long idl_atoui(char *, long); -static void idl_parse_line_and_file(char *); -static void idl_store_pragma(char *); +static char * idl_wstring_escape_reader (char *); +static ACE_CDR::WChar idl_wchar_escape_reader (char *); +static char idl_escape_reader (char *); +static double idl_atof (char *); +static long idl_atoi (char *, long); +static unsigned long idl_atoui (char *, long); +static void idl_parse_line_and_file (char *); +static void idl_store_pragma (char *); +static char * idl_get_pragma_string (char *); +static idl_bool idl_valid_version (char *); +static AST_Decl * idl_find_node (char *); #if 0 /* defined (HPUX) */ // HPUX has tao_yytext typed to unsigned char *. We make sure here that @@ -1518,137 +1521,136 @@ TAO_YY_RULE_SETUP TAO_YY_ECHO; break; case TAO_YY_STATE_EOF(INITIAL): - tao_yyterminate(); - - case TAO_YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int tao_yy_amount_of_matched_text = (int) (tao_yy_cp - tao_yytext_ptr) - 1; - - /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */ - *tao_yy_cp = tao_yy_hold_char; - TAO_YY_RESTORE_TAO_YY_MORE_OFFSET - - if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed tao_yyin at a new source and called - * tao_yylex(). If so, then we have to assure - * consistency between tao_yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars; - tao_yy_current_buffer->tao_yy_input_file = tao_yyin; - tao_yy_current_buffer->tao_yy_buffer_status = TAO_YY_BUFFER_NORMAL; - } - - /* Note that here we test for tao_yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since tao_yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( tao_yy_c_buf_p <= &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] ) - { /* This was really a NUL. */ - tao_yy_state_type tao_yy_next_state; - - tao_yy_c_buf_p = tao_yytext_ptr + tao_yy_amount_of_matched_text; - - tao_yy_current_state = tao_yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * tao_yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state ); - - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; - - if ( tao_yy_next_state ) - { - /* Consume the NUL. */ - tao_yy_cp = ++tao_yy_c_buf_p; - tao_yy_current_state = tao_yy_next_state; - goto tao_yy_match; - } - - else - { - tao_yy_cp = tao_yy_c_buf_p; - goto tao_yy_find_action; - } - } - - else switch ( tao_yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - tao_yy_did_buffer_switch_on_eof = 0; - - if ( tao_yywrap() ) - { - /* Note: because we've taken care in - * tao_yy_get_next_buffer() to have set up - * tao_yytext, we can now set up - * tao_yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * TAO_YY_NULL, it'll still work - another - * TAO_YY_NULL will get returned. - */ - tao_yy_c_buf_p = tao_yytext_ptr + TAO_YY_MORE_ADJ; - - tao_yy_act = TAO_YY_STATE_EOF(TAO_YY_START); - goto do_action; - } - - else - { - if ( ! tao_yy_did_buffer_switch_on_eof ) - TAO_YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - tao_yy_c_buf_p = - tao_yytext_ptr + tao_yy_amount_of_matched_text; - - tao_yy_current_state = tao_yy_get_previous_state(); - - tao_yy_cp = tao_yy_c_buf_p; - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; - goto tao_yy_match; - - case EOB_ACT_LAST_MATCH: - tao_yy_c_buf_p = - &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars]; - - tao_yy_current_state = tao_yy_get_previous_state(); - - tao_yy_cp = tao_yy_c_buf_p; - tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; - goto tao_yy_find_action; - } - break; - } - - default: - TAO_YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of tao_yylex */ - + tao_yyterminate(); + + case TAO_YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int tao_yy_amount_of_matched_text = (int) (tao_yy_cp - tao_yytext_ptr) - 1; + + /* Undo the effects of TAO_YY_DO_BEFORE_ACTION. */ + *tao_yy_cp = tao_yy_hold_char; + TAO_YY_RESTORE_TAO_YY_MORE_OFFSET + + if ( tao_yy_current_buffer->tao_yy_buffer_status == TAO_YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed tao_yyin at a new source and called + * tao_yylex(). If so, then we have to assure + * consistency between tao_yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + tao_yy_n_chars = tao_yy_current_buffer->tao_yy_n_chars; + tao_yy_current_buffer->tao_yy_input_file = tao_yyin; + tao_yy_current_buffer->tao_yy_buffer_status = TAO_YY_BUFFER_NORMAL; + } + + /* Note that here we test for tao_yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since tao_yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( tao_yy_c_buf_p <= &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] ) + { /* This was really a NUL. */ + tao_yy_state_type tao_yy_next_state; + + tao_yy_c_buf_p = tao_yytext_ptr + tao_yy_amount_of_matched_text; + + tao_yy_current_state = tao_yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * tao_yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + tao_yy_next_state = tao_yy_try_NUL_trans( tao_yy_current_state ); + + tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + + if ( tao_yy_next_state ) + { + /* Consume the NUL. */ + tao_yy_cp = ++tao_yy_c_buf_p; + tao_yy_current_state = tao_yy_next_state; + goto tao_yy_match; + } + + else + { + tao_yy_cp = tao_yy_c_buf_p; + goto tao_yy_find_action; + } + } + + else switch ( tao_yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + tao_yy_did_buffer_switch_on_eof = 0; + + if ( tao_yywrap() ) + { + /* Note: because we've taken care in + * tao_yy_get_next_buffer() to have set up + * tao_yytext, we can now set up + * tao_yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * TAO_YY_NULL, it'll still work - another + * TAO_YY_NULL will get returned. + */ + tao_yy_c_buf_p = tao_yytext_ptr + TAO_YY_MORE_ADJ; + + tao_yy_act = TAO_YY_STATE_EOF(TAO_YY_START); + goto do_action; + } + + else + { + if ( ! tao_yy_did_buffer_switch_on_eof ) + TAO_YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + tao_yy_c_buf_p = + tao_yytext_ptr + tao_yy_amount_of_matched_text; + + tao_yy_current_state = tao_yy_get_previous_state(); + + tao_yy_cp = tao_yy_c_buf_p; + tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + goto tao_yy_match; + + case EOB_ACT_LAST_MATCH: + tao_yy_c_buf_p = + &tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars]; + + tao_yy_current_state = tao_yy_get_previous_state(); + + tao_yy_cp = tao_yy_c_buf_p; + tao_yy_bp = tao_yytext_ptr + TAO_YY_MORE_ADJ; + goto tao_yy_find_action; + } + break; + } + + default: + TAO_YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of tao_yylex */ /* tao_yy_get_next_buffer - try to read in a new buffer * @@ -1714,79 +1716,78 @@ static int tao_yy_get_next_buffer() "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else - /* just a shorter name for the current buffer */ - TAO_YY_BUFFER_STATE b = tao_yy_current_buffer; + /* just a shorter name for the current buffer */ + TAO_YY_BUFFER_STATE b = tao_yy_current_buffer; - int tao_yy_c_buf_p_offset = - (int) (tao_yy_c_buf_p - b->tao_yy_ch_buf); + int tao_yy_c_buf_p_offset = + (int) (tao_yy_c_buf_p - b->tao_yy_ch_buf); - if ( b->tao_yy_is_our_buffer ) - { - int new_size = b->tao_yy_buf_size * 2; + if ( b->tao_yy_is_our_buffer ) + { + int new_size = b->tao_yy_buf_size * 2; - if ( new_size <= 0 ) - b->tao_yy_buf_size += b->tao_yy_buf_size / 8; - else - b->tao_yy_buf_size *= 2; + if ( new_size <= 0 ) + b->tao_yy_buf_size += b->tao_yy_buf_size / 8; + else + b->tao_yy_buf_size *= 2; - b->tao_yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - tao_yy_flex_realloc( (void *) b->tao_yy_ch_buf, - b->tao_yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->tao_yy_ch_buf = 0; + b->tao_yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + tao_yy_flex_realloc( (void *) b->tao_yy_ch_buf, + b->tao_yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->tao_yy_ch_buf = 0; - if ( ! b->tao_yy_ch_buf ) - TAO_YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + if ( ! b->tao_yy_ch_buf ) + TAO_YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - tao_yy_c_buf_p = &b->tao_yy_ch_buf[tao_yy_c_buf_p_offset]; + tao_yy_c_buf_p = &b->tao_yy_ch_buf[tao_yy_c_buf_p_offset]; - num_to_read = tao_yy_current_buffer->tao_yy_buf_size - - number_to_move - 1; + num_to_read = tao_yy_current_buffer->tao_yy_buf_size - + number_to_move - 1; #endif - } + } - if ( num_to_read > TAO_YY_READ_BUF_SIZE ) - num_to_read = TAO_YY_READ_BUF_SIZE; + if ( num_to_read > TAO_YY_READ_BUF_SIZE ) + num_to_read = TAO_YY_READ_BUF_SIZE; - /* Read in more data. */ - TAO_YY_INPUT( (&tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]), - tao_yy_n_chars, num_to_read ); + /* Read in more data. */ + TAO_YY_INPUT( (&tao_yy_current_buffer->tao_yy_ch_buf[number_to_move]), + tao_yy_n_chars, num_to_read ); - tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; - } + tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; + } - if ( tao_yy_n_chars == 0 ) - { - if ( number_to_move == TAO_YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - tao_yyrestart( tao_yyin ); - } + if ( tao_yy_n_chars == 0 ) + { + if ( number_to_move == TAO_YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + tao_yyrestart( tao_yyin ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - tao_yy_current_buffer->tao_yy_buffer_status = - TAO_YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + { + ret_val = EOB_ACT_LAST_MATCH; + tao_yy_current_buffer->tao_yy_buffer_status = + TAO_YY_BUFFER_EOF_PENDING; + } + } - tao_yy_n_chars += number_to_move; - tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] = TAO_YY_END_OF_BUFFER_CHAR; - tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] = TAO_YY_END_OF_BUFFER_CHAR; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - tao_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0]; + tao_yy_n_chars += number_to_move; + tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars] = TAO_YY_END_OF_BUFFER_CHAR; + tao_yy_current_buffer->tao_yy_ch_buf[tao_yy_n_chars + 1] = TAO_YY_END_OF_BUFFER_CHAR; - return ret_val; - } + tao_yytext_ptr = &tao_yy_current_buffer->tao_yy_ch_buf[0]; + return ret_val; + } /* tao_yy_get_previous_state - get the state just before the EOB char was reached */ @@ -1994,29 +1995,28 @@ void tao_yy_switch_to_buffer( TAO_YY_BUFFER_STATE new_buffer ) void tao_yy_switch_to_buffer( new_buffer ) TAO_YY_BUFFER_STATE new_buffer; #endif - { - if ( tao_yy_current_buffer == new_buffer ) - return; - - if ( tao_yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *tao_yy_c_buf_p = tao_yy_hold_char; - tao_yy_current_buffer->tao_yy_buf_pos = tao_yy_c_buf_p; - tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; - } - - tao_yy_current_buffer = new_buffer; - tao_yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (tao_yywrap()) processing, but the only time this flag - * is looked at is after tao_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - tao_yy_did_buffer_switch_on_eof = 1; - } - + { + if ( tao_yy_current_buffer == new_buffer ) + return; + + if ( tao_yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *tao_yy_c_buf_p = tao_yy_hold_char; + tao_yy_current_buffer->tao_yy_buf_pos = tao_yy_c_buf_p; + tao_yy_current_buffer->tao_yy_n_chars = tao_yy_n_chars; + } + + tao_yy_current_buffer = new_buffer; + tao_yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (tao_yywrap()) processing, but the only time this flag + * is looked at is after tao_yywrap() is called, so it's safe + * to go ahead and always set it. + */ + tao_yy_did_buffer_switch_on_eof = 1; + } #ifdef TAO_YY_USE_PROTOS void tao_yy_load_buffer_state( void ) @@ -2425,48 +2425,74 @@ stripped_name(UTL_String *fn) return n; } -/* - * Parse a #line statement generated by the C preprocessor - */ +// Parse a #line statement generated by the C preprocessor static void -idl_parse_line_and_file(char *buf) +idl_parse_line_and_file (char *buf) { - char *r = buf; - char *h; - UTL_String *nm; + char *r = buf; + char *h = 0; + UTL_String *nm = 0; - /* Skip initial '#' */ + // Skip initial '#'. if (*r != '#') - return; + { + return; + } else - r++; + { + r++; + } - /* Check to see if we're running under the screwy Microsoft scheme */ - /* of putting #line num instead of #num. */ + // Check to see if we're running under the screwy Microsoft scheme + // of putting #line num instead of #num. if (ACE_OS::strncmp (r, "line", 4) == 0) - r += 5; + { + r += 5; + } - /* Find line number */ + // Find line number. while (isspace (*r)) - r++; + { + r++; + } + h = r; + for (; isdigit (*r); r++) - continue; + { + continue; + } + *r++ = 0; - idl_global->set_lineno(idl_atoui(h, 10)); + idl_global->set_lineno (idl_atoui (h, 10)); - /* Find file name, if present */ + // Find file name, if present. for (; *r != '"'; r++) - if (*r == '\n' || *r == '\0') - return; + { + if (*r == '\n' || *r == '\0') + { + return; + } + } h = ++r; + for (; *r != '"'; r++) - continue; + { + continue; + } + *r = 0; + UTL_String *tmp = 0; + if (*h == '\0') - idl_global->set_filename(new UTL_String("standard input")); + { + ACE_NEW (tmp, + UTL_String ("standard input")); + idl_global->set_filename (tmp); + return; + } else { long i; @@ -2476,70 +2502,183 @@ idl_parse_line_and_file(char *buf) for (i = 0, j = 0; h[j] != '\0'; i++, j++) { if (h[j] == '\\' && h[j + 1] == '\\') - j++; + { + j++; + } - h[i] = h[j]; + h[i] = h[j]; } + h[i] = '\0'; - idl_global->set_filename(new UTL_String(h)); + ACE_NEW (tmp, + UTL_String (h)); + idl_global->set_filename (tmp); + } + + UTL_String *fname = idl_global->filename (); + idl_bool in_main_file = I_FALSE; + idl_bool is_real_filename = fname->compare (idl_global->real_filename ()); + idl_bool is_main_filename = I_FALSE; + + if (!is_real_filename) + { + is_main_filename = fname->compare (idl_global->main_filename ()); + } + + if (is_real_filename || is_main_filename) + { + in_main_file = I_TRUE; + } + + idl_global->set_in_main_file (in_main_file); + + // If it's an import file store the stripped name for the BE to use + if (!(idl_global->in_main_file ()) && idl_global->import ()) + { + ACE_NEW (nm, + UTL_String (stripped_name (fname))); + + // This call also manages the #pragma prefix. + idl_global->store_include_file_name (nm); + } + else if (is_main_filename && idl_global->pragma_prefixes ().size () > 1) + { + // If we're here, we have come to the end of an included file, so we + // pop its prefix. + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; } - int in_main_file = I_FALSE; - if (idl_global->filename()->compare(idl_global->real_filename()) - || idl_global->filename()->compare(idl_global->main_filename())) - in_main_file = I_TRUE; - idl_global->set_in_main_file(in_main_file); - /* - * If it's an import file store the stripped name for the BE to use - */ - if (!(idl_global->in_main_file()) && idl_global->import()) { - nm = new UTL_String(stripped_name(idl_global->filename())); - idl_global->store_include_file_name(nm); - } } -/* - * Store a #pragma line into the list of pragmas - */ +// Store a #pragma line into the list of pragmas static void -idl_store_pragma(char *buf) +idl_store_pragma (char *buf) { char *sp = buf + 1; - // Remove all the blanks between the '#' and the 'pragma' + + // Remove all the blanks between the '#' and the 'pragma'. if (*sp != 'p') { while (*sp != 'p') - ++sp; + { + ++sp; + } + char *tp = buf + 1; + while (*sp != '\n') { *tp = *sp; - ++tp; ++sp; + ++tp; + ++sp; } } - if (ACE_OS::strstr(buf + 8, "import") != 0) { - idl_global->set_import(I_TRUE); - return; - } - if (ACE_OS::strstr(buf + 8, "include") != 0) { - idl_global->set_import(I_FALSE); - return; - } - // Remove the final '\n' + if (ACE_OS::strstr (buf + 8, "import") != 0) + { + idl_global->set_import (I_TRUE); + return; + } + + if (ACE_OS::strstr (buf + 8, "include") != 0) + { + idl_global->set_import (I_FALSE); + return; + } + + // Remove the final '\n'. while (*sp != '\n') - ++sp; + { + ++sp; + } + *sp = '\0'; - if (ACE_OS::strstr(buf + 8, "ident") != 0) { - idl_global->ident_string(buf + 8); - return; - } - UTL_StrList *p = idl_global->pragmas(); - if (p == NULL) - idl_global->set_pragmas(new UTL_StrList(new UTL_String(buf), NULL)); - else { - p->nconc(new UTL_StrList(new UTL_String(buf), NULL)); - idl_global->set_pragmas(p); - } + + if (ACE_OS::strncmp (buf + 8, "prefix", 6) == 0) + { + char *new_prefix = idl_get_pragma_string (buf); + + if (new_prefix != 0) + { + unsigned long depth = idl_global->scopes ()->depth (); + + // At global scope, we always replace the prefix. For all + // other scopes, we replace only if there is a prefix already + // associated with that scope, otherwise we add the prefix. + if (depth == 1 || idl_global->scopes ()->top ()->has_prefix ()) + { + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + + if (depth > 1) + { + idl_global->scopes ()->top ()->has_prefix (1); + } + + idl_global->pragma_prefixes ().push (new_prefix); + } + } + else if (ACE_OS::strncmp (buf + 8, "version", 7) == 0) + { + char *tmp = buf + 16; + + while (*tmp == ' ') + { + ++tmp; + } + + char *number = ACE_OS::strchr (tmp, ' '); + + while (*number == ' ') + { + ++number; + } + + AST_Decl *d = idl_find_node (tmp); + + if (d == 0) + { + return; + } + + if (!idl_valid_version (number)) + { + idl_global->err ()->version_number_error (number); + return; + } + + d->version (ACE::strnew (number)); + } + else if (ACE_OS::strncmp (buf + 8, "ident", 5) == 0) + { + idl_global->ident_string (buf + 8); + } + else if (ACE_OS::strncmp (buf + 8, "id", 2) == 0) + { + char *tmp = buf + 11; + + while (*tmp == ' ') + { + ++tmp; + } + + AST_Decl *d = idl_find_node (tmp); + + if (d == 0) + { + return; + } + + char *new_id = idl_get_pragma_string (buf); + + if (new_id != 0) + { + d->repoID (new_id); + } + } } /* @@ -2752,3 +2891,111 @@ idl_wstring_escape_reader (char *str) { return str; } + +static char * +idl_get_pragma_string (char *pragma) +{ + // Get pointers to each end of the substring between the quotes. + const char *start = ACE_OS::strchr (pragma, '"') + 1; + const char *end = ACE_OS::strchr (start, '"'); + + if (end == 0) + { + idl_global->err ()->syntax_error ( + IDL_GlobalData::PS_PragmaPrefixSyntax + ); + + return 0; + } + + int len = end - start; + char *retval = 0; + + ACE_NEW_RETURN (retval, + char[len + 1], + 0); + + ACE_OS::strncpy (retval, + start, + len); + + retval[len] = '\0'; + return retval; +} + +static idl_bool +idl_valid_version (char *s) +{ + // Nothing preceding decimal point. + if (*s == '.') + { + return 0; + } + + char *minor = ACE_OS::strchr (s, '.'); + int i; + + if (minor == 0) + { + // No decimal point. + return 0; + } + + if (*(minor + 1) == '\0') + { + // Nothing following decimal point. + return 0; + } + + char *tmp = minor + 1; + + for (i = 0; tmp[i] != '\0'; ++i) + { + if (!isdigit (tmp[i])) + { + return 0; + } + } + + int len = minor - s; + + for (i = 0; i < len; ++i) + { + if (!isdigit (s[i])) + { + return 0; + } + } + + // Major and minor version numbers must be unsigned shorts. + if (ACE_OS::atoi (minor + 1) > ACE_UINT16_MAX + || ACE_OS::atoi (s) > ACE_UINT16_MAX) + { + return 0; + } + + return 1; +} + +static AST_Decl * +idl_find_node (char *s) +{ + UTL_ScopedName *node = idl_global->string_to_scoped_name (s); + AST_Decl *d = 0; + + if (node != 0) + { + d = idl_global->scopes ()->top_non_null ()->lookup_by_name (node, + I_TRUE); + } + + if (d == 0) + { + idl_global->err ()->lookup_error (node); + node->destroy (); + delete node; + node = 0; + } + + return d; +} diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp.diff b/TAO/TAO_IDL/fe/lex.yy.cpp.diff index b761ccc174b..8b1734507cf 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp.diff +++ b/TAO/TAO_IDL/fe/lex.yy.cpp.diff @@ -1,7 +1,4 @@ ---- lex.yy.cpp Mon Nov 12 18:56:44 2001 -+++ lex.yy.cpp.new Mon Nov 12 18:52:48 2001 -@@ -984,7 +984,7 @@ - +@@ -987,7 +987,7 @@ /* Code executed at the end of each rule. */ #ifndef TAO_YY_BREAK -#define TAO_YY_BREAK break; @@ -9,7 +6,7 @@ #endif #define TAO_YY_RULE_SETUP \ -@@ -996,7 +996,7 @@ +@@ -999,7 +999,7 @@ TAO_YY_DECL { register tao_yy_state_type tao_yy_current_state; @@ -17,8 +14,7 @@ + register char *tao_yy_cp = 0, *tao_yy_bp = 0; register int tao_yy_act; - -@@ -1432,42 +1432,42 @@ +@@ -1435,7 +1435,7 @@ idl_global->set_lineno(idl_global->lineno() + 1); idl_store_pragma(ace_tao_yytext); } @@ -26,14 +22,15 @@ + break; case 69: case 70: - TAO_YY_RULE_SETUP - {/* ignore file */ - idl_global->set_lineno(idl_global->lineno() + 1); - } + +@@ -1442,7 +1442,7 @@ +{/* ignore file */ + idl_global->set_lineno(idl_global->lineno() + 1); + } - TAO_YY_BREAK -+ break; - case 71: - case 72: ++ break; +case 71: +case 72: TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); @@ -42,6 +39,8 @@ + break; case 73: case 74: + +@@ -1455,7 +1455,7 @@ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); @@ -50,6 +49,8 @@ + break; case 75: case 76: + +@@ -1462,7 +1462,7 @@ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); @@ -58,6 +59,8 @@ + break; case 77: case 78: + +@@ -1469,7 +1469,7 @@ TAO_YY_RULE_SETUP { idl_parse_line_and_file(ace_tao_yytext); @@ -66,8 +69,8 @@ + break; case 79: case 80: - TAO_YY_RULE_SETUP -@@ -1475,14 +1475,14 @@ + +@@ -1478,14 +1478,14 @@ /* ignore cpp ident */ idl_global->set_lineno(idl_global->lineno() + 1); } @@ -75,6 +78,8 @@ + break; case 81: TAO_YY_RULE_SETUP + +@@ -1484,7 +1484,7 @@ { /* ignore comments */ idl_global->set_lineno(idl_global->lineno() + 1); @@ -83,8 +88,8 @@ + break; case 82: TAO_YY_RULE_SETUP - { -@@ -1499,25 +1499,25 @@ + +@@ -1502,25 +1502,25 @@ } } } @@ -104,6 +109,8 @@ + break; case 85: TAO_YY_RULE_SETUP + +@@ -1518,7 +1518,7 @@ return ace_tao_yytext [0]; - TAO_YY_BREAK + break; diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index 92237c1df6d..b4f8cfca595 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -141,10 +141,11 @@ short tao_yylhs[] = { -1, 183, 184, 14, 14, 182, 185, 11, 25, 26, 26, 186, 187, 47, 188, 189, 121, 66, 66, 190, 191, 192, 193, 77, 194, 196, 197, 198, 123, 62, 62, - 62, 12, 12, 114, 199, 195, 201, 195, 200, 204, - 203, 203, 205, 206, 202, 15, 15, 15, 15, 61, - 61, 61, 207, 208, 23, 23, 209, 210, 17, 17, - 18, 211, 19, 19, + 62, 12, 12, 199, 201, 114, 202, 200, 204, 200, + 203, 207, 206, 206, 208, 209, 205, 210, 195, 212, + 195, 211, 215, 214, 214, 216, 217, 213, 15, 15, + 15, 15, 61, 61, 61, 218, 219, 23, 23, 220, + 221, 17, 17, 18, 222, 19, 19, }; short tao_yylen[] = { 2, 1, 2, 0, 0, 3, 0, 3, 0, 3, 0, @@ -153,7 +154,7 @@ short tao_yylen[] = { 2, 2, 3, 3, 0, 3, 0, 1, 1, 1, 1, 2, 1, 0, 0, 0, 7, 0, 0, 0, 8, 4, 0, 3, 1, 0, 2, 0, 2, 1, 2, - 2, 0, 1, 1, 1, 0, 3, 0, 3, 2, + 2, 0, 1, 1, 2, 0, 3, 0, 3, 2, 0, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 2, 0, 4, 0, 1, 0, 3, 0, 4, 1, 1, 2, 2, 0, 0, 0, 0, @@ -177,10 +178,11 @@ short tao_yylen[] = { 2, 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, 3, 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, + 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, }; short tao_yydefred[] = { 3, 0, 0, 16, 97, 18, 29, 146, 201, 216, 249, @@ -207,367 +209,371 @@ short tao_yydefred[] = { 3, 0, 125, 129, 134, 260, 92, 0, 267, 272, 0, 3, 0, 0, 209, 0, 0, 208, 0, 82, 287, 299, 300, 0, 0, 72, 74, 76, 0, 70, 78, - 80, 0, 68, 66, 0, 61, 63, 64, 65, 85, + 80, 304, 68, 66, 0, 61, 63, 64, 0, 85, 265, 130, 131, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 173, 281, 277, 280, 204, 208, 0, 219, 258, 252, - 257, 0, 0, 0, 303, 317, 294, 318, 302, 0, - 316, 284, 0, 0, 0, 28, 0, 0, 0, 0, - 0, 46, 0, 135, 0, 0, 0, 0, 0, 0, - 0, 126, 127, 128, 261, 268, 273, 0, 0, 0, - 0, 0, 0, 0, 214, 211, 210, 0, 0, 0, - 207, 0, 50, 83, 0, 0, 73, 75, 77, 79, - 81, 0, 304, 69, 67, 0, 101, 111, 22, 174, + 257, 0, 0, 0, 303, 330, 294, 331, 302, 0, + 329, 284, 0, 0, 0, 28, 0, 0, 0, 0, + 0, 46, 65, 0, 135, 0, 0, 0, 0, 0, + 0, 0, 126, 127, 128, 261, 268, 273, 0, 0, + 0, 0, 0, 0, 0, 214, 211, 210, 0, 0, + 0, 207, 0, 50, 83, 0, 0, 73, 75, 77, + 79, 81, 305, 69, 67, 0, 101, 111, 22, 174, 282, 279, 205, 0, 0, 0, 229, 220, 0, 225, 226, 228, 227, 253, 255, 293, 295, 285, 0, 0, - 0, 215, 212, 0, 0, 0, 0, 306, 320, 321, - 322, 313, 0, 312, 283, 0, 221, 256, 296, 286, - 181, 0, 308, 0, 213, 0, 0, 0, 314, 310, - 222, 323, 297, 179, 0, 0, 0, 0, 0, 0, - 315, 311, 237, 244, 242, 234, 241, 223, 233, 324, - 327, 298, 180, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 238, 245, 243, 247, 235, 240, 224, 232, - 0, 328, 0, 0, 0, 325, 0, 246, 248, 236, - 334, 0, 0, 329, 332, 0, 333, + 215, 212, 0, 0, 0, 0, 0, 306, 283, 0, + 221, 256, 0, 296, 286, 181, 0, 0, 213, 0, + 0, 0, 0, 0, 308, 315, 0, 314, 222, 319, + 333, 334, 335, 326, 0, 325, 336, 297, 179, 0, + 310, 0, 0, 0, 321, 0, 0, 0, 0, 316, + 312, 237, 244, 242, 234, 241, 223, 233, 327, 323, + 337, 340, 298, 180, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 317, 313, 238, + 245, 243, 247, 235, 240, 224, 232, 328, 324, 0, + 341, 0, 0, 0, 338, 0, 246, 248, 236, 347, + 0, 0, 342, 345, 0, 346, }; short tao_yydgoto[] = { 1, - 326, 78, 79, 80, 81, 82, 83, 84, 358, 85, - 176, 287, 86, 87, 289, 204, 422, 452, 453, 164, - 189, 60, 403, 171, 273, 322, 416, 428, 177, 222, - 390, 398, 20, 21, 347, 205, 206, 207, 208, 209, - 210, 211, 212, 213, 214, 215, 274, 417, 437, 113, + 327, 78, 79, 80, 81, 82, 83, 84, 358, 85, + 176, 287, 86, 87, 289, 204, 433, 471, 472, 164, + 189, 60, 408, 171, 273, 323, 425, 441, 177, 222, + 385, 394, 20, 21, 347, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 274, 426, 454, 113, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 382, 233, 178, 179, 180, 234, 99, 22, 23, 100, + 404, 233, 178, 179, 180, 234, 99, 22, 23, 100, 235, 2, 25, 103, 236, 104, 237, 105, 28, 106, - 29, 107, 30, 108, 38, 40, 154, 221, 319, 31, + 29, 107, 30, 108, 38, 40, 154, 221, 320, 31, 32, 57, 187, 161, 238, 41, 134, 33, 34, 35, 36, 37, 58, 188, 162, 245, 129, 186, 283, 56, - 246, 247, 239, 249, 327, 301, 300, 293, 294, 295, - 240, 297, 241, 298, 284, 303, 140, 169, 39, 153, - 220, 318, 123, 42, 155, 320, 410, 43, 156, 275, - 224, 323, 331, 282, 277, 355, 386, 354, 44, 157, - 225, 328, 374, 396, 418, 407, 429, 419, 430, 427, - 445, 424, 426, 425, 443, 444, 45, 158, 280, 226, - 329, 281, 330, 375, 168, 266, 139, 190, 101, 172, - 267, 102, 173, 268, 223, 321, 371, 336, 377, 46, - 159, 227, 332, 335, 343, 376, 397, 409, 369, 383, - 370, 384, 394, 406, 392, 405, 408, 431, 432, 447, - 456, + 246, 247, 239, 249, 328, 301, 300, 293, 294, 295, + 240, 297, 241, 298, 284, 304, 140, 169, 39, 153, + 220, 319, 123, 42, 155, 321, 419, 43, 156, 275, + 224, 324, 332, 282, 277, 355, 380, 354, 44, 157, + 225, 329, 373, 390, 427, 413, 442, 428, 443, 440, + 464, 437, 439, 438, 462, 463, 45, 158, 280, 226, + 330, 281, 331, 374, 168, 266, 139, 190, 101, 172, + 267, 102, 173, 268, 223, 322, 370, 337, 376, 46, + 159, 227, 333, 336, 384, 375, 393, 418, 299, 378, + 369, 387, 397, 388, 398, 412, 436, 410, 435, 391, + 405, 392, 406, 416, 445, 414, 444, 417, 446, 447, + 466, 475, }; short tao_yysindex[] = { 0, - 0, 590, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -208, -197, -175, -224, 0, 0, 0, 0, 0, - 0, 26, 430, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 49, 566, -146, - -208, 448, -208, -208, -208, -208, 0, 0, 0, 26, - 0, 26, -186, -186, 0, -208, -5, 17, 0, 0, - -209, 0, -138, 0, 0, 0, 0, 0, 0, 0, + 0, 575, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -216, -200, -235, -229, 0, 0, 0, 0, 0, + 0, 37, 411, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 42, 536, -173, + -216, 437, -216, -216, -216, -216, 0, 0, 0, 37, + 0, 37, -215, -215, 0, -216, -16, 12, 0, 0, + -171, 0, -125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 59, 0, -177, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, - 77, 87, 99, 105, 108, 113, 115, 134, 0, 0, - 0, -177, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 73, 0, - 0, 0, 0, -221, 0, 0, -59, 0, 149, -208, - 0, 0, 0, -88, 0, 0, 0, 0, 0, 0, - 0, 0, -208, 117, -208, 125, -51, 126, 127, 0, - 0, 0, -177, 0, 0, 0, 0, 12, -208, -221, - 0, 12, 12, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 648, 617, 207, 357, + 0, 0, 0, 0, 0, 72, 0, -207, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, + 62, 80, 106, 108, 111, 113, 119, 121, 0, 0, + 0, -207, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, + 0, 0, 0, -220, 0, 0, -67, 0, 140, -216, + 0, 0, 0, -97, 0, 0, 0, 0, 0, 0, + 0, 0, -216, 83, -216, 87, -44, 100, 110, 0, + 0, 0, -207, 0, 0, 0, 0, 13, -216, -220, + 0, 13, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 631, 600, 212, 486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, - 31, 31, 12, -177, 0, 130, 162, 220, -131, 132, - 129, 0, 0, 0, 0, 0, -177, 0, 0, 198, - 0, 221, 173, 0, 226, 16, 0, 648, 0, 0, - 0, 0, 515, -16, 0, 0, 0, 145, 0, 0, - 0, 18, 0, 0, 146, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 235, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 227, 229, 238, 0, 590, + 31, 31, 13, -207, 0, 134, 166, 228, -96, 27, + 122, 0, 0, 0, 0, 0, -207, 0, 0, 207, + 0, 225, 180, 0, 232, 16, 0, 631, 0, 0, + 0, 0, 510, -8, 0, 0, 0, 150, 0, 0, + 0, 0, 0, 0, 152, 0, 0, 0, 224, 0, + 0, 0, 0, 0, 245, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 229, 234, 243, 0, 575, 0, 0, 0, 0, 0, 0, 381, 0, 0, 0, - 0, 0, 152, 223, 0, 0, 0, 0, 0, -177, - 0, 0, 251, 253, 264, 0, 265, 268, 288, 381, - 381, 0, -221, 0, 162, 220, -131, 132, 132, 129, - 129, 0, 0, 0, 0, 0, 0, 12, 204, -208, - 12, 173, 205, 0, 0, 0, 0, 157, 206, 289, - 0, 217, 0, 0, 89, 548, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -177, 0, 0, 0, 0, - 0, 0, 0, 292, -208, 85, 0, 0, -177, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 311, -74, - 261, 0, 0, 314, 16, 288, -208, 0, 0, 0, - 0, 0, 315, 0, 0, 300, 0, 0, 0, 0, - 0, 548, 0, 316, 0, 239, 70, 319, 0, 0, - 0, 0, 0, 0, -208, -74, -188, 324, 74, -208, + 0, 0, 162, 230, 0, 0, 0, 0, 0, -207, + 0, 0, 231, 249, 254, 0, 255, 266, 73, 381, + 381, 0, 0, -220, 0, 166, 228, -96, 27, 27, + 122, 122, 0, 0, 0, 0, 0, 0, 13, 217, + -216, 13, 180, 221, 0, 0, 0, 0, 554, 222, + 288, 0, 226, 0, 0, 95, 361, 0, 0, 0, + 0, 0, 0, 0, 0, -207, 0, 0, 0, 0, + 0, 0, 0, 294, -216, 92, 0, 0, -207, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 315, 264, + 0, 0, 317, 16, 319, -216, 0, 0, 0, 301, + 0, 0, 0, 0, 0, 0, 320, 77, 0, 247, + 327, -63, 90, 338, 0, 0, 330, 0, 0, 0, + 0, 0, 0, 0, 342, 0, 0, 0, 0, 361, + 0, 341, -68, 361, 0, 345, 353, 104, -216, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 308, 12, 313, 448, -94, 244, -188, - -221, 336, 0, 0, 0, 0, 0, 0, 0, 0, - 337, 0, 321, -208, 318, 0, 94, 0, 0, 0, - 0, 359, 360, 0, 0, 98, 0, + 0, 0, 0, 0, -216, 77, 343, 13, 339, 437, + -52, 276, -68, -216, -63, -220, 363, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, + 0, 346, -216, 352, 0, 109, 0, 0, 0, 0, + 372, 371, 0, 0, 112, 0, }; short tao_yyrindex[] = { 0, - 0, 407, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 416, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -1, -13, 0, 0, 0, 0, 0, 0, 0, + 0, 7, 29, 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, 11, - 0, 42, 3, -43, 0, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, + 0, 26, 56, -43, 0, 0, 0, 0, 0, 0, + 2, 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, 33, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -98, 0, - 54, 91, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 151, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -93, 0, + 74, 127, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, - 0, 0, 0, 287, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 0, 302, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 0, 0, 228, 277, 13, 0, + 176, 0, 0, 0, 0, 0, 253, 281, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -19, 0, 120, 470, 537, 464, 111, - 38, 0, 0, 0, 0, 0, 293, 0, 0, 0, - 0, 352, 0, 0, 0, 0, 0, 305, 0, 0, + 0, 0, 0, -19, 0, 135, 543, 350, 328, 51, + 38, 0, 0, 0, 0, 0, 305, 0, 0, 0, + 0, 374, 0, 0, 0, 0, 0, 309, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 290, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 306, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 118, 0, 0, 0, 0, 0, 0, 0, 160, + 0, 199, 0, 0, 0, 0, 0, 0, 0, 178, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 549, 539, 492, 148, 159, 61, - 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 0, 179, 0, 0, 0, 0, 0, 304, + 0, 0, 0, 0, 0, 548, 541, 336, 88, 125, + 61, 115, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 18, 0, 223, 0, 0, 0, 0, 0, + 313, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 398, 0, 0, 399, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -28, 0, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 377, 0, 0, 390, 0, + 0, 0, 0, 0, 0, 0, -27, 0, 0, 0, + 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -7, 382, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 401, 0, 0, 0, 404, 0, 387, 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, 393, 0, 0, -48, 378, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 379, 0, + 460, 0, 322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 497, 0, 329, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 398, 0, 0, 0, 0, + 0, 407, 0, 0, 0, 0, }; short tao_yygindex[] = { 0, - -21, 250, 0, 0, 0, -35, 35, 4, 0, 39, - 0, 0, 0, -34, -306, -22, 0, 0, 0, 30, - 0, 57, 0, 0, 0, 0, 0, 0, 107, 0, - 0, 0, 0, 449, 0, -189, 0, 208, 209, 210, - -76, -42, -26, 45, 0, -113, 143, 41, 0, 0, - -32, -31, -30, 433, 0, 434, 0, 0, -191, -29, - 0, 0, -254, -9, 0, 0, 0, 215, 216, -12, - 10, 254, 0, 0, 14, 0, 25, 0, 0, 0, + -21, 259, 0, 0, 0, -35, 14, 4, 0, 34, + 0, 0, 0, -34, -289, -22, 0, 0, 0, 8, + 0, -1, 0, 0, 0, 0, 0, 0, 98, 0, + 0, 0, 0, 436, 0, -192, 0, 201, 202, 200, + -23, -14, -20, 50, 0, -118, 158, 41, 0, 0, + -32, -31, -30, 444, 0, 445, 0, 0, -176, -29, + 0, 0, -239, -9, 0, 0, 0, 227, 239, -12, + 10, 277, 0, 0, 11, 0, 25, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 318, 0, 0, 0, 0, 0, 0, 0, + 0, 488, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 323, 0, -36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, - 0, 459, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 294, 0, -67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 282, 236, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 252, 202, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, + 0, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 110, 0, 0, 0, 0, 0, - 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, - 0, + 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, + 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, + 0, 0, }; -#define TAO_YYTABLESIZE 941 +#define TAO_YYTABLESIZE 924 short tao_yytable[] = { 49, 88, 77, 48, 110, 111, 18, 114, 115, 116, 119, - 326, 24, 305, 255, 55, 26, 112, 133, 133, 88, - 122, 133, 133, 133, 36, 133, 27, 133, 121, 368, - 124, 125, 126, 127, 87, 47, 17, 87, 133, 133, - 19, 291, 133, 131, 55, 59, 278, 86, 47, 278, - 86, 203, 135, 84, 200, 136, 201, 94, 218, 219, - 55, 58, 6, 182, 278, 350, 182, 413, 189, 95, - 203, 189, 186, 133, 133, 122, 158, 16, 122, 55, - 122, 182, 122, 59, 6, 399, 189, 186, 76, 189, - 186, 158, 414, 415, 158, 122, 122, 269, 123, 122, - 96, 123, 141, 123, 133, 123, 128, 109, 130, 55, - 120, 163, 269, 276, 75, 269, 87, 132, 123, 123, - 142, 36, 123, 137, 138, 55, 16, 167, 348, 86, - 122, 122, 143, 36, 274, 84, 145, 202, 124, 133, - 174, 124, 181, 124, 291, 124, 146, 217, 119, 274, - 411, 119, 274, 123, 123, 144, 216, 147, 124, 124, - 112, 122, 124, 148, 36, 265, 149, 88, 119, 119, - 263, 150, 119, 151, 261, 264, 262, 112, 112, 259, - 260, 112, 308, 309, 123, 120, 414, 415, 120, 449, - 18, 18, 152, 124, 124, 160, 121, 286, 288, 121, - 291, 36, 165, 119, 119, 120, 120, 351, 166, 120, - 290, 170, 112, 379, 380, 381, 121, 121, 310, 311, - 121, 17, 17, 183, 124, 19, 19, 50, 52, 53, - 54, 18, 344, 345, 119, 434, 312, 313, 314, 175, - 120, 120, 292, 326, 252, 253, 254, 182, 184, 185, - 250, 121, 121, 256, 88, 257, 55, 258, 269, 307, - 307, 307, 17, 272, 271, 278, 19, 292, 47, 296, - 302, 120, 279, 18, 299, 304, 333, 88, 88, 24, - 346, 334, 121, 26, 189, 186, 55, 47, 315, 158, - 316, 133, 133, 87, 27, 360, 361, 362, 363, 317, - 286, 288, 55, 206, 17, 359, 86, 181, 19, 337, - 269, 338, 84, 290, 191, 192, 193, 194, 195, 196, - 197, 76, 339, 340, 198, 199, 341, 342, 349, 353, - 364, 357, 365, 191, 192, 193, 194, 195, 196, 197, - 76, 366, 181, 198, 199, 367, 135, 274, 122, 122, - 372, 378, 27, 385, 387, 393, 286, 288, 395, 400, - 402, 401, 404, 420, 49, 421, 433, 391, 439, 290, - 435, 123, 123, 209, 209, 442, 450, 446, 448, 209, - 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 181, 209, 209, 209, 209, 49, 451, 454, - 423, 45, 457, 455, 88, 436, 1, 110, 163, 57, - 172, 124, 124, 47, 21, 56, 319, 186, 356, 62, - 63, 119, 119, 66, 67, 68, 69, 209, 254, 49, - 230, 181, 10, 309, 209, 209, 178, 330, 331, 251, + 255, 24, 26, 307, 55, 17, 112, 133, 133, 88, + 122, 133, 133, 133, 6, 133, 27, 133, 121, 36, + 124, 125, 126, 127, 87, 19, 47, 87, 133, 133, + 47, 86, 133, 131, 86, 186, 189, 368, 128, 189, + 130, 339, 203, 218, 219, 200, 291, 201, 278, 6, + 186, 278, 318, 186, 189, 94, 16, 189, 84, 261, + 203, 262, 16, 133, 133, 122, 278, 95, 122, 55, + 122, 350, 122, 120, 96, 75, 55, 59, 119, 76, + 135, 119, 158, 136, 59, 122, 122, 144, 123, 122, + 109, 123, 143, 123, 133, 123, 132, 158, 119, 119, + 158, 163, 119, 55, 58, 141, 87, 269, 123, 123, + 420, 145, 123, 86, 429, 120, 348, 167, 120, 36, + 122, 122, 269, 142, 133, 269, 137, 138, 202, 146, + 174, 36, 181, 119, 119, 120, 120, 217, 36, 120, + 84, 55, 124, 123, 123, 124, 216, 124, 265, 124, + 291, 122, 121, 263, 147, 121, 148, 88, 264, 149, + 274, 150, 124, 124, 119, 112, 124, 151, 55, 152, + 120, 120, 121, 121, 123, 274, 121, 422, 274, 160, + 18, 18, 112, 112, 165, 448, 112, 286, 288, 166, + 17, 17, 170, 351, 458, 175, 36, 124, 124, 182, + 290, 120, 423, 424, 259, 260, 182, 121, 121, 182, + 19, 19, 184, 468, 401, 402, 403, 112, 423, 424, + 183, 18, 185, 291, 182, 309, 310, 291, 124, 50, + 52, 17, 313, 314, 315, 451, 311, 312, 121, 252, + 253, 254, 53, 54, 88, 250, 55, 256, 186, 257, + 309, 19, 189, 344, 345, 258, 276, 269, 271, 47, + 272, 278, 279, 18, 296, 292, 302, 88, 88, 24, + 26, 346, 303, 17, 339, 305, 334, 47, 335, 338, + 316, 133, 133, 87, 27, 317, 360, 361, 362, 363, + 86, 286, 288, 19, 318, 158, 359, 339, 181, 320, + 320, 320, 340, 341, 290, 191, 192, 193, 194, 195, + 196, 197, 76, 292, 342, 198, 199, 84, 55, 343, + 269, 365, 357, 191, 192, 193, 194, 195, 196, 197, + 76, 349, 181, 198, 199, 353, 364, 206, 122, 122, + 366, 367, 371, 135, 377, 55, 379, 381, 383, 389, + 395, 119, 119, 49, 396, 117, 386, 400, 117, 399, + 411, 123, 123, 118, 286, 288, 118, 27, 286, 288, + 407, 409, 415, 274, 421, 117, 117, 290, 430, 117, + 115, 290, 431, 118, 118, 432, 452, 118, 120, 120, + 456, 450, 461, 467, 465, 45, 49, 115, 115, 434, + 469, 115, 473, 470, 474, 1, 476, 88, 453, 110, + 117, 117, 181, 163, 57, 124, 124, 56, 118, 118, + 21, 181, 172, 49, 332, 121, 121, 254, 186, 230, + 178, 311, 115, 115, 322, 343, 231, 344, 251, 51, + 181, 117, 372, 460, 209, 209, 306, 308, 307, 118, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, - 209, 209, 209, 231, 209, 209, 209, 209, 120, 120, - 441, 373, 51, 305, 352, 306, 76, 307, 438, 121, - 121, 117, 118, 55, 270, 276, 228, 324, 388, 440, - 412, 248, 0, 0, 301, 389, 0, 0, 209, 301, + 209, 209, 209, 115, 209, 209, 209, 209, 209, 209, + 352, 455, 117, 118, 209, 209, 209, 209, 209, 209, + 209, 209, 209, 209, 209, 209, 209, 270, 209, 209, + 209, 209, 55, 228, 382, 276, 457, 459, 209, 301, + 248, 325, 0, 449, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 301, 301, 0, 0, 0, 0, 0, + 301, 301, 209, 0, 0, 0, 288, 301, 0, 301, + 0, 0, 301, 301, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 0, 0, 0, 0, 0, 301, 301, + 0, 0, 301, 0, 288, 301, 0, 301, 0, 0, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, - 0, 117, 0, 0, 117, 301, 301, 0, 0, 0, - 113, 288, 0, 0, 301, 0, 0, 0, 0, 0, - 0, 117, 117, 0, 0, 117, 0, 113, 113, 118, - 0, 113, 118, 301, 0, 0, 0, 301, 301, 301, - 301, 301, 301, 301, 301, 301, 301, 301, 301, 118, - 118, 0, 0, 118, 301, 301, 117, 117, 0, 0, - 288, 301, 113, 301, 0, 0, 301, 301, 301, 301, - 301, 301, 301, 301, 301, 301, 301, 115, 0, 116, - 0, 0, 301, 301, 118, 118, 301, 117, 288, 114, - 0, 301, 0, 113, 115, 115, 116, 116, 115, 0, - 116, 0, 0, 0, 0, 0, 114, 114, 0, 0, - 114, 0, 0, 47, 301, 118, 0, 0, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 115, - 115, 116, 116, 72, 73, 74, 325, 47, 0, 0, - 0, 114, 61, 62, 63, 64, 65, 66, 67, 68, + 301, 116, 0, 113, 0, 0, 301, 301, 114, 0, + 301, 0, 288, 0, 0, 301, 0, 0, 116, 116, + 113, 113, 116, 0, 113, 114, 114, 0, 0, 114, + 0, 0, 0, 0, 0, 0, 0, 47, 301, 0, + 0, 0, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 116, 116, 113, 326, 47, 73, 74, + 114, 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 8, 9, 0, 10, 72, 73, 74, - 115, 0, 116, 0, 0, 0, 76, 0, 0, 0, - 0, 0, 114, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, - 76, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 8, 9, 47, 10, 72, 73, 74, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 8, 9, 0, 10, 72, 73, 74, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 76, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 239, 0, 0, 0, 76, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 47, 239, 239, 239, 239, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 0, 0, 0, - 0, 0, 73, 74, 0, 0, 0, 0, 0, 0, - 0, 285, 0, 0, 47, 0, 239, 0, 0, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 0, 0, 47, 0, 76, 73, 74, 61, 62, 63, + 0, 0, 0, 0, 116, 0, 113, 47, 0, 0, + 76, 114, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 8, 9, 0, 10, 72, 73, 74, + 76, 0, 0, 47, 0, 0, 0, 0, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 8, + 9, 75, 10, 72, 73, 74, 239, 0, 0, 0, + 76, 239, 239, 239, 239, 239, 239, 239, 239, 239, + 239, 239, 239, 239, 0, 239, 239, 239, 239, 0, + 0, 0, 47, 0, 0, 0, 76, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 0, 0, + 0, 0, 72, 73, 74, 0, 47, 0, 0, 239, + 0, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 0, 0, 0, 0, 0, 73, 74, 0, + 0, 0, 47, 0, 0, 76, 285, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 0, 0, 0, - 0, 0, 0, 73, 74, 3, 0, 4, 5, 6, - 7, 0, 0, 0, 0, 0, 0, 76, 0, 0, - 0, 0, 8, 9, 0, 10, 0, 0, 0, 11, - 0, 0, 229, 0, 4, 76, 0, 7, 0, 0, - 0, 0, 12, 13, 14, 15, 0, 0, 0, 8, - 9, 16, 10, 0, 0, 0, 11, 0, 0, 230, - 0, 231, 232, 229, 0, 4, 0, 0, 7, 12, - 0, 0, 0, 242, 243, 244, 0, 0, 0, 0, - 8, 9, 0, 10, 0, 0, 0, 11, 0, 0, - 230, 0, 231, 232, 0, 0, 0, 0, 0, 0, - 12, + 47, 0, 0, 73, 74, 356, 62, 63, 0, 76, + 66, 67, 68, 69, 0, 0, 0, 0, 0, 10, + 3, 0, 4, 5, 6, 7, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 76, 0, 8, 9, 0, + 10, 0, 0, 0, 11, 229, 0, 4, 0, 0, + 7, 0, 0, 76, 0, 0, 0, 12, 13, 14, + 15, 0, 8, 9, 0, 10, 16, 0, 0, 11, + 0, 0, 230, 0, 231, 232, 229, 0, 4, 0, + 0, 7, 12, 0, 0, 0, 242, 243, 244, 0, + 0, 0, 0, 8, 9, 0, 10, 0, 0, 0, + 11, 0, 0, 230, 0, 231, 232, 0, 0, 0, + 0, 0, 0, 12, }; short tao_yycheck[] = { 12, 23, 23, 12, 39, 39, 2, 39, 39, 39, 39, - 59, 2, 41, 203, 58, 2, 39, 37, 38, 42, - 42, 41, 42, 43, 123, 45, 2, 47, 41, 336, - 43, 44, 45, 46, 41, 257, 2, 44, 58, 59, - 2, 233, 62, 56, 58, 59, 41, 41, 257, 44, - 44, 40, 262, 41, 43, 265, 45, 59, 172, 173, - 58, 59, 260, 41, 59, 320, 44, 256, 41, 59, - 40, 44, 44, 93, 94, 38, 44, 302, 41, 123, - 43, 59, 45, 58, 260, 392, 59, 59, 310, 62, - 62, 59, 281, 282, 62, 58, 59, 44, 38, 62, - 59, 41, 44, 43, 124, 45, 50, 59, 52, 123, - 257, 134, 59, 91, 301, 62, 123, 123, 58, 59, - 62, 123, 62, 262, 263, 123, 302, 140, 318, 123, - 93, 94, 310, 123, 44, 123, 60, 126, 38, 123, - 153, 41, 155, 43, 336, 45, 60, 170, 38, 59, - 405, 41, 62, 93, 94, 99, 169, 59, 58, 59, - 41, 124, 62, 59, 123, 37, 59, 190, 58, 59, - 42, 59, 62, 59, 43, 47, 45, 58, 59, 311, - 312, 62, 259, 260, 124, 38, 281, 282, 41, 444, - 187, 188, 59, 93, 94, 123, 38, 233, 233, 41, - 392, 300, 262, 93, 94, 58, 59, 321, 60, 62, - 233, 300, 93, 288, 289, 290, 58, 59, 261, 262, - 62, 187, 188, 275, 124, 187, 188, 13, 14, 14, - 15, 228, 300, 301, 124, 425, 263, 264, 265, 123, - 93, 94, 125, 292, 200, 201, 202, 123, 123, 123, - 44, 93, 94, 124, 277, 94, 300, 38, 61, 288, - 289, 290, 228, 91, 44, 40, 228, 284, 257, 125, - 125, 124, 257, 270, 257, 41, 125, 300, 301, 270, - 303, 59, 124, 270, 257, 257, 300, 257, 62, 257, - 62, 311, 312, 300, 270, 328, 328, 328, 328, 62, - 336, 336, 300, 125, 270, 328, 300, 320, 270, 59, - 257, 59, 300, 336, 303, 304, 305, 306, 307, 308, - 309, 310, 59, 59, 313, 314, 59, 40, 125, 125, - 125, 328, 44, 303, 304, 305, 306, 307, 308, 309, - 310, 125, 355, 313, 314, 257, 262, 257, 311, 312, - 59, 41, 125, 93, 41, 41, 392, 392, 59, 44, - 291, 123, 44, 40, 377, 292, 59, 377, 125, 392, - 58, 311, 312, 256, 257, 40, 59, 41, 58, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 405, 276, 277, 278, 279, 410, 305, 41, - 410, 125, 305, 44, 427, 427, 0, 257, 431, 123, - 59, 311, 312, 257, 125, 123, 257, 41, 262, 263, - 264, 311, 312, 267, 268, 269, 270, 310, 125, 125, - 41, 444, 276, 41, 256, 257, 59, 59, 41, 190, + 203, 2, 2, 41, 58, 2, 39, 37, 38, 42, + 42, 41, 42, 43, 260, 45, 2, 47, 41, 123, + 43, 44, 45, 46, 41, 2, 257, 44, 58, 59, + 257, 41, 62, 56, 44, 44, 41, 337, 50, 44, + 52, 59, 40, 172, 173, 43, 233, 45, 41, 260, + 59, 44, 41, 62, 59, 59, 302, 62, 41, 43, + 40, 45, 302, 93, 94, 38, 59, 59, 41, 123, + 43, 321, 45, 257, 59, 301, 58, 59, 38, 310, + 262, 41, 44, 265, 58, 58, 59, 99, 38, 62, + 59, 41, 310, 43, 124, 45, 123, 59, 58, 59, + 62, 134, 62, 58, 59, 44, 123, 44, 58, 59, + 410, 60, 62, 123, 414, 38, 319, 140, 41, 123, + 93, 94, 59, 62, 123, 62, 262, 263, 126, 60, + 153, 123, 155, 93, 94, 58, 59, 170, 123, 62, + 123, 123, 38, 93, 94, 41, 169, 43, 37, 45, + 337, 124, 38, 42, 59, 41, 59, 190, 47, 59, + 44, 59, 58, 59, 124, 41, 62, 59, 123, 59, + 93, 94, 58, 59, 124, 59, 62, 256, 62, 123, + 187, 188, 58, 59, 262, 435, 62, 233, 233, 60, + 187, 188, 300, 322, 444, 123, 300, 93, 94, 123, + 233, 124, 281, 282, 311, 312, 41, 93, 94, 44, + 187, 188, 123, 463, 288, 289, 290, 93, 281, 282, + 275, 228, 123, 410, 59, 259, 260, 414, 124, 13, + 14, 228, 263, 264, 265, 438, 261, 262, 124, 200, + 201, 202, 14, 15, 277, 44, 300, 124, 257, 94, + 288, 228, 257, 300, 301, 38, 91, 61, 44, 257, + 91, 40, 257, 270, 125, 284, 125, 300, 301, 270, + 270, 304, 59, 270, 292, 41, 125, 257, 59, 59, + 62, 311, 312, 300, 270, 62, 329, 329, 329, 329, + 300, 337, 337, 270, 62, 257, 329, 59, 321, 288, + 289, 290, 59, 59, 337, 303, 304, 305, 306, 307, + 308, 309, 310, 125, 59, 313, 314, 300, 300, 257, + 257, 44, 329, 303, 304, 305, 306, 307, 308, 309, + 310, 125, 355, 313, 314, 125, 125, 125, 311, 312, + 125, 257, 59, 262, 40, 300, 93, 41, 40, 59, + 41, 311, 312, 376, 288, 38, 376, 41, 41, 123, + 41, 311, 312, 38, 410, 410, 41, 125, 414, 414, + 291, 44, 41, 257, 44, 58, 59, 410, 44, 62, + 41, 414, 40, 58, 59, 292, 58, 62, 311, 312, + 125, 59, 40, 58, 41, 125, 419, 58, 59, 419, + 59, 62, 41, 305, 44, 0, 305, 440, 440, 257, + 93, 94, 435, 446, 123, 311, 312, 123, 93, 94, + 125, 444, 59, 125, 257, 311, 312, 125, 41, 41, + 59, 41, 93, 94, 41, 59, 125, 41, 190, 14, + 463, 124, 355, 446, 256, 257, 256, 258, 257, 124, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 124, 276, 277, 278, 279, 256, 257, + 323, 441, 39, 39, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 221, 276, 277, + 278, 279, 15, 186, 374, 224, 443, 445, 310, 257, + 188, 276, -1, 436, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, -1, -1, -1, -1, -1, + 278, 279, 310, -1, -1, -1, 284, 257, -1, 287, + -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, -1, -1, -1, -1, -1, 278, 279, + -1, -1, 310, -1, 284, 257, -1, 287, -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 125, 276, 277, 278, 279, 311, 312, - 431, 355, 14, 256, 322, 257, 310, 258, 428, 311, - 312, 39, 39, 15, 221, 224, 186, 276, 375, 430, - 406, 188, -1, -1, 257, 376, -1, -1, 310, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - -1, 38, -1, -1, 41, 278, 279, -1, -1, -1, - 41, 284, -1, -1, 287, -1, -1, -1, -1, -1, - -1, 58, 59, -1, -1, 62, -1, 58, 59, 38, - -1, 62, 41, 257, -1, -1, -1, 310, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 58, - 59, -1, -1, 62, 278, 279, 93, 94, -1, -1, - 284, 257, 93, 287, -1, -1, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 41, -1, 41, - -1, -1, 278, 279, 93, 94, 310, 124, 284, 41, - -1, 287, -1, 124, 58, 59, 58, 59, 62, -1, - 62, -1, -1, -1, -1, -1, 58, 59, -1, -1, - 62, -1, -1, 257, 310, 124, -1, -1, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 93, - 94, 93, 94, 277, 278, 279, 256, 257, -1, -1, - -1, 93, 262, 263, 264, 265, 266, 267, 268, 269, + 272, 41, -1, 41, -1, -1, 278, 279, 41, -1, + 310, -1, 284, -1, -1, 287, -1, -1, 58, 59, + 58, 59, 62, -1, 62, 58, 59, -1, -1, 62, + -1, -1, -1, -1, -1, -1, -1, 257, 310, -1, + -1, -1, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 93, 94, 93, 256, 257, 278, 279, + 93, -1, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, -1, 276, 277, 278, 279, - 124, -1, 124, -1, -1, -1, 310, -1, -1, -1, - -1, -1, 124, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 257, -1, -1, -1, - 310, 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, -1, 276, 277, 278, 279, -1, -1, -1, - 301, -1, -1, -1, -1, -1, -1, -1, -1, 310, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 257, -1, -1, -1, 310, 262, 263, + -1, -1, -1, -1, 124, -1, 124, 257, -1, -1, + 310, 124, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, -1, 276, 277, 278, 279, + 310, -1, -1, 257, -1, -1, -1, -1, 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, -1, -1, -1, - -1, -1, 278, 279, -1, -1, -1, -1, -1, -1, - -1, 287, -1, -1, 257, -1, 310, -1, -1, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - -1, -1, 257, -1, 310, 278, 279, 262, 263, 264, + 274, 301, 276, 277, 278, 279, 257, -1, -1, -1, + 310, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, -1, 276, 277, 278, 279, -1, + -1, -1, 257, -1, -1, -1, 310, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, -1, -1, + -1, -1, 277, 278, 279, -1, 257, -1, -1, 310, + -1, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, -1, -1, -1, -1, -1, 278, 279, -1, + -1, -1, 257, -1, -1, 310, 287, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, -1, -1, -1, - -1, -1, -1, 278, 279, 256, -1, 258, 259, 260, - 261, -1, -1, -1, -1, -1, -1, 310, -1, -1, - -1, -1, 273, 274, -1, 276, -1, -1, -1, 280, - -1, -1, 256, -1, 258, 310, -1, 261, -1, -1, - -1, -1, 293, 294, 295, 296, -1, -1, -1, 273, - 274, 302, 276, -1, -1, -1, 280, -1, -1, 283, - -1, 285, 286, 256, -1, 258, -1, -1, 261, 293, - -1, -1, -1, 297, 298, 299, -1, -1, -1, -1, - 273, 274, -1, 276, -1, -1, -1, 280, -1, -1, - 283, -1, 285, 286, -1, -1, -1, -1, -1, -1, - 293, + 257, -1, -1, 278, 279, 262, 263, 264, -1, 310, + 267, 268, 269, 270, -1, -1, -1, -1, -1, 276, + 256, -1, 258, 259, 260, 261, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 310, -1, 273, 274, -1, + 276, -1, -1, -1, 280, 256, -1, 258, -1, -1, + 261, -1, -1, 310, -1, -1, -1, 293, 294, 295, + 296, -1, 273, 274, -1, 276, 302, -1, -1, 280, + -1, -1, 283, -1, 285, 286, 256, -1, 258, -1, + -1, 261, 293, -1, -1, -1, 297, 298, 299, -1, + -1, -1, -1, 273, 274, -1, 276, -1, -1, -1, + 280, -1, -1, 283, -1, 285, 286, -1, -1, -1, + -1, -1, -1, 293, }; #define TAO_YYFINAL 1 #ifndef TAO_YYDEBUG @@ -663,7 +669,7 @@ const char *tao_yyrule[] = { "value_elements :", "value_element : state_member", "value_element : export", -"value_element : init_decl", +"value_element : init_decl ';'", "$$24 :", "state_member : IDL_PUBLIC $$24 member_i", "$$25 :", @@ -902,18 +908,31 @@ const char *tao_yyrule[] = { "opt_op_attribute :", "op_type_spec : param_type_spec", "op_type_spec : IDL_VOID", -"init_decl : IDL_FACTORY IDENTIFIER parameter_list", "$$92 :", -"parameter_list : '(' $$92 ')'", "$$93 :", -"parameter_list : '(' $$93 at_least_one_parameter ')'", -"at_least_one_parameter : parameter parameters", +"init_decl : IDL_FACTORY $$92 IDENTIFIER $$93 init_parameter_list", "$$94 :", -"parameters : parameters ',' $$94 parameter", -"parameters :", +"init_parameter_list : '(' $$94 ')'", "$$95 :", +"init_parameter_list : '(' $$95 at_least_one_in_parameter ')'", +"at_least_one_in_parameter : in_parameter in_parameters", "$$96 :", -"parameter : direction $$95 param_type_spec $$96 declarator", +"in_parameters : in_parameters ',' $$96 in_parameter", +"in_parameters :", +"$$97 :", +"$$98 :", +"in_parameter : IDL_IN $$97 param_type_spec $$98 declarator", +"$$99 :", +"parameter_list : '(' $$99 ')'", +"$$100 :", +"parameter_list : '(' $$100 at_least_one_parameter ')'", +"at_least_one_parameter : parameter parameters", +"$$101 :", +"parameters : parameters ',' $$101 parameter", +"parameters :", +"$$102 :", +"$$103 :", +"parameter : direction $$102 param_type_spec $$103 declarator", "param_type_spec : base_type_spec", "param_type_spec : string_type_spec", "param_type_spec : wstring_type_spec", @@ -921,17 +940,17 @@ const char *tao_yyrule[] = { "direction : IDL_IN", "direction : IDL_OUT", "direction : IDL_INOUT", -"$$97 :", -"$$98 :", -"opt_raises : IDL_RAISES $$97 '(' $$98 at_least_one_scoped_name ')'", +"$$104 :", +"$$105 :", +"opt_raises : IDL_RAISES $$104 '(' $$105 at_least_one_scoped_name ')'", "opt_raises :", -"$$99 :", -"$$100 :", -"opt_context : IDL_CONTEXT $$99 '(' $$100 at_least_one_string_literal ')'", +"$$106 :", +"$$107 :", +"opt_context : IDL_CONTEXT $$106 '(' $$107 at_least_one_string_literal ')'", "opt_context :", "at_least_one_string_literal : IDL_STRING_LITERAL string_literals", -"$$101 :", -"string_literals : string_literals ',' $$101 IDL_STRING_LITERAL", +"$$108 :", +"string_literals : string_literals ',' $$108 IDL_STRING_LITERAL", "string_literals :", }; #endif @@ -961,7 +980,7 @@ TAO_YYSTYPE tao_yyvs[TAO_YYSTACKSIZE]; * ??? */ int -tao_yywrap() +tao_yywrap () { return 1; } @@ -970,7 +989,7 @@ tao_yywrap() * Report an error situation discovered in a production */ void -tao_yyerror(const char *msg) +tao_yyerror (const char *msg) { ACE_ERROR ((LM_ERROR, "%s\n", @@ -1282,153 +1301,139 @@ tao_yyreduce: { case 4: { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen); } break; case 5: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 6: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen); } break; case 7: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 8: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen); } break; case 9: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 10: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceDeclSeen); } break; case 11: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 12: { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleDeclSeen); } break; case 13: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 14: { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeDeclSeen); } break; case 15: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 16: { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } break; case 17: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; case 18: { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSeen); } break; case 19: { - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); - AST_Module *m = NULL; - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_StrList *p = idl_global->pragmas(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier (tao_yyvsp[0].strval), 0); + AST_Module *m = 0; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleIDSeen); /* * Make a new module and add it to the enclosing scope */ - if (s != NULL) { - m = idl_global->gen ()->create_module (s, n, p); + if (s != 0) { + m = idl_global->gen ()->create_module (s, n); (void) s->fe_add_module (m); } /* * Push it on the stack */ - idl_global->scopes()->push(m); + idl_global->scopes ()->push (m); } break; case 20: { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleSqSeen); } break; case 21: { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleBodySeen); } break; case 22: { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ModuleQsSeen); /* * Finished with this module - pop it from the scope stack */ - UTL_Scope* s = idl_global->scopes()->top(); - AST_Module* m = AST_Module::narrow_from_scope (s); - if (m != 0) - { - UTL_StrList *p = m->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - } - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } break; case 25: { - UTL_Scope *s = idl_global->scopes ()->top_non_null (); - AST_Interface *i = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas (); - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; /* * Make a new interface node and add it to its enclosing scope */ - if (s != NULL && tao_yyvsp[0].ihval != NULL) { + if (s != 0 && tao_yyvsp[0].ihval != 0) { i = idl_global->gen ()->create_interface ( tao_yyvsp[0].ihval->interface_name (), tao_yyvsp[0].ihval->inherits (), tao_yyvsp[0].ihval->n_inherits (), tao_yyvsp[0].ihval->inherits_flat (), tao_yyvsp[0].ihval->n_inherits_flat (), - p, tao_yyvsp[0].ihval->is_local (), tao_yyvsp[0].ihval->is_abstract () ); - AST_Interface::fwd_redefinition_helper (i,s,p); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the interface to its definition scope */ @@ -1442,91 +1447,72 @@ case 25: break; case 26: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } break; case 27: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } break; case 28: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * 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); - if (m != NULL) - { - m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) - { - p = (UTL_StrList*) p->copy (); - } - idl_global->set_pragmas (p); - } - idl_global->scopes ()->pop(); + idl_global->scopes ()->pop (); } break; case 29: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSeen); } break; case 30: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceIDSeen); tao_yyval.idval = tao_yyvsp[0].idval; } break; case 31: { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + 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 * list of all interfaces which this interface inherits from, * recursively */ - tao_yyval.ihval = new FE_InterfaceHeader(new UTL_ScopedName(tao_yyvsp[-1].idval, NULL), tao_yyvsp[0].nlval); + tao_yyval.ihval = new FE_InterfaceHeader (new UTL_ScopedName (tao_yyvsp[-1].idval, 0), tao_yyvsp[0].nlval); } break; case 32: { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + 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 * list of all interfaces which this interface inherits from, * recursively */ - tao_yyval.ihval = new FE_Local_InterfaceHeader(new UTL_ScopedName(tao_yyvsp[-1].idval, NULL), tao_yyvsp[0].nlval); + tao_yyval.ihval = new FE_Local_InterfaceHeader (new UTL_ScopedName(tao_yyvsp[-1].idval, 0), tao_yyvsp[0].nlval); } break; case 33: { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle abstract interface yet\n"; - /* (if not truncatable) */ -#if 0 - 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 - * list of all interfaces which this interface inherits from, - * recursively - */ - tao_yyval.ihval = new FE_Abstract_InterfaceHeader(new UTL_ScopedName(tao_yyvsp[-1].idval, NULL), tao_yyvsp[0].nlval); -#endif + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle abstract") + ACE_TEXT (" interfaces yet\n"))); } break; case 34: { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InheritColonSeen); } break; case 35: @@ -1536,142 +1522,138 @@ case 35: break; case 36: { - tao_yyval.nlval = NULL; + tao_yyval.nlval = 0; } break; case 41: { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle custom yet\n"; - /* set custom (if not truncatable) */ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" custom yet\n"))); } break; case 43: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Interface *i = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; - if (s != NULL && tao_yyvsp[0].vhval != NULL) { - i = idl_global->gen()->create_valuetype(tao_yyvsp[0].vhval->interface_name(), - tao_yyvsp[0].vhval->inherits(), - tao_yyvsp[0].vhval->n_inherits(), - p); - AST_Interface::fwd_redefinition_helper (i,s,p); + if (s != 0 && tao_yyvsp[0].vhval != 0) { + i = idl_global->gen ()->create_valuetype (tao_yyvsp[0].vhval->interface_name (), + tao_yyvsp[0].vhval->inherits (), + tao_yyvsp[0].vhval->n_inherits ()); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the valuetype to its definition scope */ - (void) s->fe_add_interface(i); + (void) s->fe_add_interface (i); } /* * Push it on the scope stack */ - idl_global->scopes()->push(i); + idl_global->scopes ()->push (i); } break; case 44: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } break; case 45: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } break; case 46: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * Done with this interface - pop it off the scopes stack */ - UTL_Scope* s = idl_global->scopes()->top(); + UTL_Scope* s = idl_global->scopes ()->top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } break; case 47: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Interface *i = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Interface *i = 0; - if (s != NULL && tao_yyvsp[0].vhval != NULL) { + if (s != 0 && tao_yyvsp[0].vhval != 0) { if (tao_yyvsp[0].vhval->n_concrete() > 0) { - idl_global->err()->abstract_inheritance_error (tao_yyvsp[0].vhval->interface_name ()); + idl_global->err ()->abstract_inheritance_error (tao_yyvsp[0].vhval->interface_name ()); } - i = idl_global->gen()->create_valuetype(tao_yyvsp[0].vhval->interface_name(), - tao_yyvsp[0].vhval->inherits(), - tao_yyvsp[0].vhval->n_inherits(), - p); + i = idl_global->gen()->create_valuetype (tao_yyvsp[0].vhval->interface_name (), + tao_yyvsp[0].vhval->inherits (), + tao_yyvsp[0].vhval->n_inherits ()); i->set_abstract_valuetype (); - AST_Interface::fwd_redefinition_helper (i,s,p); + AST_Interface::fwd_redefinition_helper (i, s); /* * Add the valuetype to its definition scope */ - (void) s->fe_add_interface(i); + (void) s->fe_add_interface (i); } /* * Push it on the scope stack */ - idl_global->scopes()->push(i); + idl_global->scopes ()->push (i); } break; case 48: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceSqSeen); } break; case 49: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceBodySeen); } break; case 50: { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_InterfaceQsSeen); /* * Done with this interface - pop it off the scopes stack */ - UTL_Scope* s = idl_global->scopes()->top(); + UTL_Scope* s = idl_global->scopes ()->top (); AST_Interface* m = AST_Interface::narrow_from_scope (s); m->inherited_name_clash (); - UTL_StrList *p = m->pragmas (); - if (p != 0) p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } break; case 51: { - tao_yyval.vhval = new FE_obv_header (new UTL_ScopedName (tao_yyvsp[-3].idval, NULL), tao_yyvsp[-1].nlval, tao_yyvsp[0].nlval); + tao_yyval.vhval = new FE_obv_header (new UTL_ScopedName (tao_yyvsp[-3].idval, 0), tao_yyvsp[-1].nlval, tao_yyvsp[0].nlval); } break; case 52: { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeSeen); } break; case 53: { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ValuetypeIDSeen); tao_yyval.idval = tao_yyvsp[0].idval; } break; case 54: { - cerr << "warning in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "truncatable modifier not supported and is ignored\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("warning in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("truncatable modifier not supported ") + ACE_TEXT ("and is ignored\n"))); tao_yyval.bval = I_FALSE; - /* $$ = I_TRUE; */ } break; case 55: @@ -1681,59 +1663,58 @@ case 55: break; case 56: { - tao_yyval.nlval = new UTL_NameList(tao_yyvsp[0].idlist, NULL); + tao_yyval.nlval = new UTL_NameList (tao_yyvsp[0].idlist, 0); } break; case 57: { - tao_yyval.nlval = NULL; + tao_yyval.nlval = 0; } break; case 58: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_valuetype_fwd(n, p); - /* if ($1)*/ + if (s != 0) { + f = idl_global->gen()->create_valuetype_fwd (n); f->set_abstract_valuetype (); - (void) s->fe_add_interface_fwd(f); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } break; case 59: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_valuetype_fwd(n, p); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_valuetype_fwd (n); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } break; case 60: { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle boxes yet\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" boxes yet\n"))); } break; case 66: @@ -1750,17 +1731,17 @@ case 68: break; case 72: { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeDeclSeen); } break; case 73: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 74: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstDeclSeen); } break; case 75: @@ -1770,212 +1751,201 @@ case 75: break; case 76: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptDeclSeen); } break; case 77: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 78: { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrDeclSeen); } break; case 79: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 80: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpDeclSeen); } break; case 81: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); } break; case 82: { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } break; case 83: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; case 84: { - tao_yyval.nlval = new UTL_NameList(tao_yyvsp[-1].idlist, tao_yyvsp[0].nlval); + tao_yyval.nlval = new UTL_NameList (tao_yyvsp[-1].idlist, tao_yyvsp[0].nlval); } break; case 85: { - idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SNListCommaSeen); } break; case 86: { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopedNameSeen); - if (tao_yyvsp[-3].nlval == NULL) - tao_yyval.nlval = new UTL_NameList(tao_yyvsp[0].idlist, NULL); + if (tao_yyvsp[-3].nlval == 0) + tao_yyval.nlval = new UTL_NameList (tao_yyvsp[0].idlist, 0); else { - tao_yyvsp[-3].nlval->nconc(new UTL_NameList(tao_yyvsp[0].idlist, NULL)); + tao_yyvsp[-3].nlval->nconc (new UTL_NameList (tao_yyvsp[0].idlist, 0)); tao_yyval.nlval = tao_yyvsp[-3].nlval; } } break; case 87: { - tao_yyval.nlval = NULL; + tao_yyval.nlval = 0; } break; case 88: { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - tao_yyval.idlist = new UTL_IdList(tao_yyvsp[0].idval, NULL); + tao_yyval.idlist = new UTL_IdList(tao_yyvsp[0].idval, 0); } break; case 89: { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } break; case 90: { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - tao_yyval.idlist = new UTL_IdList(new Identifier(tao_yyvsp[-2].strval), - new UTL_IdList(tao_yyvsp[0].idval, NULL)); + tao_yyval.idlist = new UTL_IdList (new Identifier (tao_yyvsp[-2].strval), + new UTL_IdList (tao_yyvsp[0].idval, 0)); } break; case 91: { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen); } break; case 92: { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SN_IDSeen); - tao_yyvsp[-3].idlist->nconc(new UTL_IdList(tao_yyvsp[0].idval, NULL)); + tao_yyvsp[-3].idlist->nconc (new UTL_IdList (tao_yyvsp[0].idval, 0)); tao_yyval.idlist = tao_yyvsp[-3].idlist; } break; case 93: { - tao_yyval.idval = new Identifier(tao_yyvsp[0].strval); + tao_yyval.idval = new Identifier (tao_yyvsp[0].strval); } break; case 94: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 0, 0); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 0, 0); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } break; case 95: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 1, 0); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 1, 0); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } break; case 96: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_InterfaceFwd *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_InterfaceFwd *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ForwardDeclSeen); + 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 */ - if (s != NULL) { - f = idl_global->gen()->create_interface_fwd(n, p, 0, 1); - (void) s->fe_add_interface_fwd(f); + if (s != 0) { + f = idl_global->gen ()->create_interface_fwd (n, 0, 1); + (void) s->fe_add_interface_fwd (f); } - idl_global->set_pragmas (p); } break; case 97: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstSeen); } break; case 98: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstTypeSeen); } break; case 99: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstIDSeen); } break; case 100: { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstAssignSeen); } break; case 101: { - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[-4].idval, NULL); - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Constant *c = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; - - ACE_UNUSED_ARG (v); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[-4].idval, 0); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Constant *c = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ConstExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ConstExprSeen); /* * Create a node representing a constant declaration. Store * it in the enclosing scope */ - if (tao_yyvsp[0].exval != NULL && s != NULL) { - if (tao_yyvsp[0].exval->coerce(tao_yyvsp[-6].etval) == NULL) - idl_global->err()->coercion_error(tao_yyvsp[0].exval, tao_yyvsp[-6].etval); + if (tao_yyvsp[0].exval != 0 && s != 0) { + if (tao_yyvsp[0].exval->coerce (tao_yyvsp[-6].etval) == 0) + idl_global->err ()->coercion_error (tao_yyvsp[0].exval, tao_yyvsp[-6].etval); else { c = - idl_global->gen()->create_constant(tao_yyvsp[-6].etval, tao_yyvsp[0].exval, n, p); - (void) s->fe_add_constant(c); + idl_global->gen ()->create_constant (tao_yyvsp[-6].etval, tao_yyvsp[0].exval, n); + (void) s->fe_add_constant (c); } } - idl_global->set_pragmas (p); } break; case 108: @@ -1990,31 +1960,31 @@ case 109: break; case 110: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - AST_PredefinedType *c = NULL; - AST_Typedef *t = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; + AST_PredefinedType *c = 0; + AST_Typedef *t = 0; /* * If the constant's type is a scoped name, it must resolve * to a scalar constant type */ - if (s != NULL && (d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE)) != NULL) { + if (s != 0 && (d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE)) != 0) { /* * Look through typedefs */ - while (d->node_type() == AST_Decl::NT_typedef) { - t = AST_Typedef::narrow_from_decl(d); - if (t == NULL) + while (d->node_type () == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl (d); + if (t == 0) break; - d = t->base_type(); + d = t->base_type (); } - if (d == NULL) + if (d == 0) tao_yyval.etval = AST_Expression::EV_any; - else if (d->node_type() == AST_Decl::NT_pre_defined) { - c = AST_PredefinedType::narrow_from_decl(d); - if (c != NULL) { - tao_yyval.etval = idl_global->PredefinedTypeToExprType(c->pt()); + else if (d->node_type () == AST_Decl::NT_pre_defined) { + c = AST_PredefinedType::narrow_from_decl (d); + if (c != 0) { + tao_yyval.etval = idl_global->PredefinedTypeToExprType (c->pt ()); } else { tao_yyval.etval = AST_Expression::EV_any; } @@ -2030,73 +2000,93 @@ case 110: break; case 114: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_or, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_or, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 116: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_xor, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_xor, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 118: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_and, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_and, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 120: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_left,tao_yyvsp[-2].exval,tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_left, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 121: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_right,tao_yyvsp[-2].exval,tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_right, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 123: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_add, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_add, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 124: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_minus,tao_yyvsp[-2].exval,tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_minus, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 126: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_mul, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_mul, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 127: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_div, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_div, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 128: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_mod, tao_yyvsp[-2].exval, tao_yyvsp[0].exval); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_mod, + tao_yyvsp[-2].exval, + tao_yyvsp[0].exval); } break; case 130: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, - tao_yyvsp[0].exval, - NULL); + tao_yyval.exval = idl_global->gen ()->create_expr (AST_Expression::EC_u_plus, + tao_yyvsp[0].exval, + 0); } break; case 131: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, - tao_yyvsp[0].exval, - NULL); + tao_yyval.exval = idl_global->gen()->create_expr (AST_Expression::EC_u_minus, + tao_yyvsp[0].exval, + 0); } break; case 132: { - tao_yyval.exval = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, - tao_yyvsp[0].exval, - NULL); + tao_yyval.exval = idl_global->gen()->create_expr (AST_Expression::EC_bit_neg, + tao_yyvsp[0].exval, + 0); } break; case 133: @@ -2106,7 +2096,7 @@ case 133: * but only when it is evaluated (such as when it is assigned * as a constant value). */ - UTL_Scope *s = idl_global->scopes()->top_non_null (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist, 1); @@ -2137,50 +2127,50 @@ case 135: break; case 136: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].ival); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].ival); } break; case 137: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].uival); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].uival); } break; case 138: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].sval); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].sval); } break; case 139: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].wsval); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].wsval); } break; case 140: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].cval); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].cval); } break; case 141: { ACE_OutputCDR::from_wchar wc (tao_yyvsp[0].wcval); - tao_yyval.exval = idl_global->gen()->create_expr(wc); + tao_yyval.exval = idl_global->gen ()->create_expr (wc); } break; case 142: { - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].dval); + tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].dval); } break; case 143: { - tao_yyval.exval = idl_global->gen()->create_expr((idl_bool) I_TRUE, - AST_Expression::EV_bool); + tao_yyval.exval = idl_global->gen ()->create_expr ((idl_bool) I_TRUE, + AST_Expression::EV_bool); } break; case 144: { - tao_yyval.exval = idl_global->gen()->create_expr((idl_bool) I_FALSE, - AST_Expression::EV_bool); + tao_yyval.exval = idl_global->gen ()->create_expr ((idl_bool) I_FALSE, + AST_Expression::EV_bool); } break; case 145: @@ -2250,7 +2240,7 @@ case 145: break; case 146: { - idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypedefSeen); } break; case 147: @@ -2267,150 +2257,142 @@ case 150: break; case 151: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Native *node = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Native *node = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_NativeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_NativeSeen); /* * Create a node representing a Native and add it to its * enclosing scope */ - if (s != NULL) { - node = idl_global->gen()->create_native (tao_yyvsp[0].deval->name (), p); + if (s != 0) { + node = idl_global->gen ()->create_native (tao_yyvsp[0].deval->name ()); /* * Add it to its defining scope */ (void) s->fe_add_native (node); } - idl_global->set_pragmas (p); } break; case 152: { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_TypeSpecSeen); } break; case 153: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); UTL_DecllistActiveIterator *l; - FE_Declarator *d = NULL; - AST_Typedef *t = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); - - ACE_UNUSED_ARG (v); + FE_Declarator *d = 0; + AST_Typedef *t = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_DeclaratorsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclaratorsSeen); /* * Create a list of type renamings. Add them to the * enclosing scope */ - if (s != NULL && tao_yyvsp[-2].dcval != NULL && tao_yyvsp[0].dlval != NULL) { - l = new UTL_DecllistActiveIterator(tao_yyvsp[0].dlval); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) - continue; - AST_Type * tp = d->compose(tao_yyvsp[-2].dcval); - if (tp == NULL) - continue; - t = idl_global->gen()->create_typedef(tp, d->name(), p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_typedef(t); + if (s != 0 && tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].dlval != 0) { + l = new UTL_DecllistActiveIterator (tao_yyvsp[0].dlval); + for (;!(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) + continue; + AST_Type * tp = d->compose (tao_yyvsp[-2].dcval); + if (tp == 0) + continue; + t = idl_global->gen ()->create_typedef (tp, + d->name (), + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_typedef (t); } delete l; } - idl_global->set_pragmas (p); } break; case 156: { - tao_yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(tao_yyvsp[0].etval); + tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; case 158: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; - if (s != NULL) - d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error(tao_yyvsp[0].idlist); + if (s != 0) + d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE); + if (d == 0) + idl_global->err ()->lookup_error (tao_yyvsp[0].idlist); tao_yyval.dcval = d; } break; case 172: { - tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[-1].deval, tao_yyvsp[0].dlval); + tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[-1].deval, tao_yyvsp[0].dlval); } break; case 173: { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } break; case 174: { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); - if (tao_yyvsp[-3].dlval == NULL) - tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[0].deval, NULL); + if (tao_yyvsp[-3].dlval == 0) + tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[0].deval, 0); else { - tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); + tao_yyvsp[-3].dlval->nconc (new UTL_DeclList (tao_yyvsp[0].deval, 0)); tao_yyval.dlval = tao_yyvsp[-3].dlval; } } break; case 175: { - tao_yyval.dlval = NULL; + tao_yyval.dlval = 0; } break; case 178: { - tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[-1].deval, tao_yyvsp[0].dlval); + tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[-1].deval, tao_yyvsp[0].dlval); } break; case 179: { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsCommaSeen); } break; case 180: { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DeclsDeclSeen); - if (tao_yyvsp[-3].dlval == NULL) - tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[0].deval, NULL); + if (tao_yyvsp[-3].dlval == 0) + tao_yyval.dlval = new UTL_DeclList (tao_yyvsp[0].deval, 0); else { - tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); + tao_yyvsp[-3].dlval->nconc (new UTL_DeclList (tao_yyvsp[0].deval, 0)); tao_yyval.dlval = tao_yyvsp[-3].dlval; } } break; case 181: { - tao_yyval.dlval = NULL; + tao_yyval.dlval = 0; } break; case 182: { - tao_yyval.deval = new FE_Declarator(new UTL_ScopedName(tao_yyvsp[0].idval, NULL), - FE_Declarator::FD_simple, NULL); + tao_yyval.deval = new FE_Declarator (new UTL_ScopedName (tao_yyvsp[0].idval, 0), + FE_Declarator::FD_simple, 0); } break; case 183: { - tao_yyval.deval = new FE_Declarator(new UTL_ScopedName(tao_yyvsp[0].dcval->local_name(), NULL), - FE_Declarator::FD_complex, - tao_yyvsp[0].dcval); + tao_yyval.deval = new FE_Declarator (new UTL_ScopedName (tao_yyvsp[0].dcval->local_name (), + 0), + FE_Declarator::FD_complex, + tao_yyvsp[0].dcval); } break; case 186: @@ -2460,9 +2442,13 @@ case 194: break; case 195: { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle fixed types yet\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Sorry, I (TAO_IDL) can't handle") + ACE_TEXT (" fixed types yet\n"))); } break; case 196: @@ -2492,61 +2478,52 @@ case 200: break; case 201: { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructSeen); } break; case 202: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_Structure *d = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_Structure *d = 0; - ACE_UNUSED_ARG (v); - - idl_global->set_parse_state(IDL_GlobalData::PS_StructIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructIDSeen); /* * Create a node representing a struct declaration. Add it * to the enclosing scope */ - if (s != NULL) { - d = idl_global->gen()->create_structure(n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_structure(d); + if (s != 0) { + d = idl_global->gen ()->create_structure (n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_structure (d); } /* * Push the scope of the struct on the scopes stack */ - idl_global->scopes()->push(d); + idl_global->scopes ()->push (d); } break; case 203: { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructSqSeen); } break; case 204: { - idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructBodySeen); } break; case 205: { - idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StructQsSeen); /* * 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()); - UTL_StrList *p = tao_yyval.dcval->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + tao_yyval.dcval = AST_Structure::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); + idl_global->scopes ()->pop (); } break; case 209: @@ -2557,44 +2534,46 @@ case 209: break; case 211: { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberTypeSeen); } break; case 212: { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsSeen); } break; case 213: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_DecllistActiveIterator *l = NULL; - FE_Declarator *d = NULL; - AST_Field *f = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_DecllistActiveIterator *l = 0; + FE_Declarator *d = 0; + AST_Field *f = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_MemberDeclsCompleted); /* * Check for illegal recursive use of type */ - if (tao_yyvsp[-4].dcval != NULL && AST_illegal_recursive_type(tao_yyvsp[-4].dcval)) - idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, tao_yyvsp[-4].dcval); + if (tao_yyvsp[-4].dcval != 0 && AST_illegal_recursive_type (tao_yyvsp[-4].dcval)) + idl_global->err ()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, + tao_yyvsp[-4].dcval); /* * Create a node representing a struct or exception member * Add it to the enclosing scope */ - else if (s != NULL && tao_yyvsp[-4].dcval != NULL && tao_yyvsp[-2].dlval != NULL) { - l = new UTL_DecllistActiveIterator(tao_yyvsp[-2].dlval); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) + else if (s != 0 && tao_yyvsp[-4].dcval != 0 && tao_yyvsp[-2].dlval != 0) { + l = new UTL_DecllistActiveIterator (tao_yyvsp[-2].dlval); + for (;!(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) continue; - AST_Type *tp = d->compose(tao_yyvsp[-4].dcval); - if (tp == NULL) + AST_Type *tp = d->compose (tao_yyvsp[-4].dcval); + if (tp == 0) continue; /* $0 denotes Visibility, must be on yacc reduction stack */ - f = idl_global->gen()->create_field(tp, d->name(), p, tao_yyvsp[-5].vival); - (void) s->fe_add_field(f); + f = idl_global->gen ()->create_field (tp, + d->name (), + tao_yyvsp[-5].vival); + (void) s->fe_add_field (f); } delete l; } @@ -2602,133 +2581,132 @@ case 213: break; case 214: { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state ()); } break; case 215: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; case 216: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionSeen); } break; case 217: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionIDSeen); } break; case 218: { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchSeen); } break; case 219: { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchOpenParSeen); } break; case 220: { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchTypeSeen); } break; case 221: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[-8].idval, NULL); - AST_Union *u = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[-8].idval, 0); + AST_Union *u = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchCloseParSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SwitchCloseParSeen); /* * Create a node representing a union. Add it to its enclosing * scope */ - if (tao_yyvsp[-2].dcval != NULL && s != NULL) { - AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl(tao_yyvsp[-2].dcval); - if (tp == NULL) { - idl_global->err()->not_a_type(tao_yyvsp[-2].dcval); + if (tao_yyvsp[-2].dcval != 0 && s != 0) { + AST_ConcreteType *tp = AST_ConcreteType::narrow_from_decl (tao_yyvsp[-2].dcval); + if (tp == 0) { + idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval); } else { - u = idl_global->gen()->create_union(tp, - n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_union(u); + u = idl_global->gen ()->create_union (tp, + n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_union (u); } } /* * Push the scope of the union on the scopes stack */ - idl_global->scopes()->push(u); + idl_global->scopes()->push (u); } break; case 222: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionSqSeen); } break; case 223: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionBodySeen); } break; case 224: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionQsSeen); /* * 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() - ); + tao_yyval.dcval = AST_Union::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); if (tao_yyval.dcval != 0) { - UTL_StrList *p = tao_yyval.dcval->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } } break; case 225: { - tao_yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(tao_yyvsp[0].etval); + tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; case 226: { - tao_yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(tao_yyvsp[0].etval); + /* wchars are not allowed */ + if (tao_yyvsp[0].etval == AST_Expression::EV_wchar) + { + 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 227: { - /* 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); + tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; case 228: { - tao_yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(tao_yyvsp[0].etval); + tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; case 230: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - AST_PredefinedType *p = NULL; - AST_Typedef *t = NULL; - long found = I_FALSE; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; + AST_PredefinedType *p = 0; + AST_Typedef *t = 0; + long found = I_FALSE; /* * The discriminator is a scoped name. Try to resolve to @@ -2736,17 +2714,17 @@ case 230: * typedef's to arrive at the base type at the end of the * chain */ - if (s != NULL && (d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE)) != NULL) { + if (s != 0 && (d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE)) != 0) { while (!found) { - switch (d->node_type()) { + switch (d->node_type ()) { case AST_Decl::NT_enum: tao_yyval.dcval = d; found = I_TRUE; break; case AST_Decl::NT_pre_defined: - p = AST_PredefinedType::narrow_from_decl(d); - if (p != NULL) { - switch (p->pt()) { + p = AST_PredefinedType::narrow_from_decl (d); + if (p != 0) { + switch (p->pt ()) { case AST_PredefinedType::PT_long: case AST_PredefinedType::PT_ulong: case AST_PredefinedType::PT_longlong: @@ -2754,572 +2732,572 @@ case 230: case AST_PredefinedType::PT_short: case AST_PredefinedType::PT_ushort: case AST_PredefinedType::PT_char: - case AST_PredefinedType::PT_wchar: case AST_PredefinedType::PT_boolean: tao_yyval.dcval = p; found = I_TRUE; break; + case AST_PredefinedType::PT_wchar: case AST_PredefinedType::PT_octet: - /* octets are not allowed*/ + /* octets and wchars are not allowed */ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); - tao_yyval.dcval = NULL; + tao_yyval.dcval = 0; found = I_TRUE; break; default: - tao_yyval.dcval = NULL; + tao_yyval.dcval = 0; found = I_TRUE; break; } } else { - tao_yyval.dcval = NULL; + tao_yyval.dcval = 0; found = I_TRUE; } break; case AST_Decl::NT_typedef: - t = AST_Typedef::narrow_from_decl(d); - if (t != NULL) d = t->base_type(); + t = AST_Typedef::narrow_from_decl (d); + if (t != 0) d = t->base_type (); break; default: - tao_yyval.dcval = NULL; + tao_yyval.dcval = 0; found = I_TRUE; break; } } } else - tao_yyval.dcval = NULL; + tao_yyval.dcval = 0; - if (tao_yyval.dcval == NULL) - idl_global->err()->lookup_error(tao_yyvsp[0].idlist); + if (tao_yyval.dcval == 0) + idl_global->err ()->lookup_error (tao_yyvsp[0].idlist); } break; case 234: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionLabelSeen); } break; case 235: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemSeen); } break; case 236: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_LabellistActiveIterator *l = NULL; - AST_UnionLabel *d = NULL; - AST_UnionBranch *b = NULL; - AST_Field *f = tao_yyvsp[-2].ffval; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_UnionBranch *b = 0; + AST_Field *f = tao_yyvsp[-2].ffval; - ACE_UNUSED_ARG (l); - ACE_UNUSED_ARG (d); - - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted); /* * Create several nodes representing branches of a union. * Add them to the enclosing scope (the union scope) */ - if (s != NULL && tao_yyvsp[-4].llval != NULL && tao_yyvsp[-2].ffval != NULL) { - b = idl_global->gen()->create_union_branch(tao_yyvsp[-4].llval, - f->field_type(), - f->name(), - f->pragmas()); - (void) s->fe_add_union_branch(b); + if (s != 0 && tao_yyvsp[-4].llval != 0 && tao_yyvsp[-2].ffval != 0) { + b = idl_global->gen ()->create_union_branch (tao_yyvsp[-4].llval, + f->field_type (), + f->name ()); + (void) s->fe_add_union_branch (b); } } break; case 237: { - idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->err()->syntax_error (idl_global->parse_state()); } break; case 238: { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state (IDL_GlobalData::PS_NoState); tao_yyerrok; } break; case 239: { - tao_yyval.llval = new UTL_LabelList(tao_yyvsp[-1].ulval, tao_yyvsp[0].llval); + tao_yyval.llval = new UTL_LabelList (tao_yyvsp[-1].ulval, tao_yyvsp[0].llval); } break; case 240: { - if (tao_yyvsp[-1].llval == NULL) - tao_yyval.llval = new UTL_LabelList(tao_yyvsp[0].ulval, NULL); + if (tao_yyvsp[-1].llval == 0) + tao_yyval.llval = new UTL_LabelList (tao_yyvsp[0].ulval, 0); else { - tao_yyvsp[-1].llval->nconc(new UTL_LabelList(tao_yyvsp[0].ulval, NULL)); + tao_yyvsp[-1].llval->nconc(new UTL_LabelList (tao_yyvsp[0].ulval, 0)); tao_yyval.llval = tao_yyvsp[-1].llval; } } break; case 241: { - tao_yyval.llval = NULL; + tao_yyval.llval = 0; } break; case 242: { - idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DefaultSeen); } break; case 243: { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); - tao_yyval.ulval = idl_global->gen()-> - create_union_label(AST_UnionLabel::UL_default, - NULL); + tao_yyval.ulval = idl_global->gen ()->create_union_label ( + AST_UnionLabel::UL_default, + 0 + ); } break; case 244: { - idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_CaseSeen); } break; case 245: { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelExprSeen); } break; case 246: { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_LabelColonSeen); - tao_yyval.ulval = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, - tao_yyvsp[-2].exval); + tao_yyval.ulval = idl_global->gen()->create_union_label ( + AST_UnionLabel::UL_label, + tao_yyvsp[-2].exval + ); } break; case 247: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemTypeSeen); } break; case 248: { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemDeclSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemDeclSeen); /* * Check for illegal recursive use of type */ - if (tao_yyvsp[-2].dcval != NULL && AST_illegal_recursive_type(tao_yyvsp[-2].dcval)) - idl_global->err()->error1(UTL_Error::EIDL_RECURSIVE_TYPE, tao_yyvsp[-2].dcval); + if (tao_yyvsp[-2].dcval != 0 && AST_illegal_recursive_type (tao_yyvsp[-2].dcval)) + idl_global->err()->error1 (UTL_Error::EIDL_RECURSIVE_TYPE, tao_yyvsp[-2].dcval); /* * Create a field in a union branch */ - else if (tao_yyvsp[-2].dcval == NULL || tao_yyvsp[0].deval == NULL) - tao_yyval.ffval = NULL; + else if (tao_yyvsp[-2].dcval == 0 || tao_yyvsp[0].deval == 0) + tao_yyval.ffval = 0; else { - AST_Type *tp = tao_yyvsp[0].deval->compose(tao_yyvsp[-2].dcval); - if (tp == NULL) - tao_yyval.ffval = NULL; + AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval); + if (tp == 0) + tao_yyval.ffval = 0; else - tao_yyval.ffval = idl_global->gen()->create_field(tp, - tao_yyvsp[0].deval->name(), - idl_global->pragmas()); + tao_yyval.ffval = idl_global->gen ()->create_field (tp, + tao_yyvsp[0].deval->name()); } } break; case 249: { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumSeen); } break; case 250: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_Enum *e = NULL; - AST_Decl *v = NULL; - UTL_StrList *p = idl_global->pragmas(); - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, 0); + AST_Enum *e = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_EnumIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen); /* * Create a node representing an enum and add it to its * enclosing scope */ - if (s != NULL) { - e = idl_global->gen()->create_enum(n, - p, - s->is_local (), - s->is_abstract ()); + 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); + (void) s->fe_add_enum (e); } /* * Push the enum scope on the scopes stack */ - idl_global->scopes()->push(e); + idl_global->scopes ()->push (e); } break; case 251: { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumSqSeen); } break; case 252: { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumBodySeen); } break; case 253: { - UTL_StrList *p = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_EnumQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumQsSeen); /* * Done with this enum. Pop its scope from the scopes stack */ - if (idl_global->scopes()->top() == NULL) - tao_yyval.dcval = NULL; + if (idl_global->scopes ()->top () == 0) + tao_yyval.dcval = 0; else { - tao_yyval.dcval = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); - p = tao_yyval.dcval->pragmas (); - idl_global->scopes()->pop(); + tao_yyval.dcval = AST_Enum::narrow_from_scope ( + idl_global->scopes ()->top_non_null () + ); + idl_global->scopes ()->pop (); } - idl_global->set_pragmas (p); } break; case 255: { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_EnumCommaSeen); } break; case 258: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); - AST_EnumVal *e = NULL; - AST_Enum *c = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0); + AST_EnumVal *e = 0; + AST_Enum *c = 0; /* * Create a node representing one enumerator in an enum * Add it to the enclosing scope (the enum scope) */ - if (s != NULL && s->scope_node_type() == AST_Decl::NT_enum) { - c = AST_Enum::narrow_from_scope(s); - if (c != NULL) - e = idl_global->gen()->create_enum_val(c->next_enum_val(), n, p); - (void) s->fe_add_enum_val(e); + if (s != 0 && s->scope_node_type () == AST_Decl::NT_enum) { + c = AST_Enum::narrow_from_scope (s); + if (c != 0) + e = idl_global->gen ()->create_enum_val (c->next_enum_val (), + n); + (void) s->fe_add_enum_val (e); } } break; case 259: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceCommaSeen); } break; case 260: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceExprSeen); } break; case 261: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); /* * Remove sequence marker from scopes stack */ - if (idl_global->scopes()->top() == NULL) - idl_global->scopes()->pop(); - UTL_Scope *s = idl_global->scopes()->top_non_null (); + if (idl_global->scopes ()->top() == 0) + idl_global->scopes ()->pop (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); /* * Create a node representing a sequence */ - if (tao_yyvsp[-2].exval == NULL || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error(tao_yyvsp[-2].exval, AST_Expression::EV_ulong); - tao_yyval.dcval = NULL; - } else if (tao_yyvsp[-5].dcval == NULL) { - tao_yyval.dcval = NULL; + if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong); + tao_yyval.dcval = 0; + } else if (tao_yyvsp[-5].dcval == 0) { + tao_yyval.dcval = 0; } else { - AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-5].dcval); - if (tp == NULL) + AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-5].dcval); + if (tp == 0) ; /* Error will be caught in FE_Declarator.*/ else { - tao_yyval.dcval = idl_global->gen()->create_sequence(tao_yyvsp[-2].exval, - tp, - s->is_local (), - s->is_abstract ()); + tao_yyval.dcval = idl_global->gen ()->create_sequence (tao_yyvsp[-2].exval, + tp, + s->is_local (), + s->is_abstract ()); /* - * Add this AST_Sequence to the types defined in the global scope + * Add this AST_Sequence to types defined in the global scope. */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); + (void) idl_global->root ()->fe_add_sequence ( + AST_Sequence::narrow_from_decl (tao_yyval.dcval) + ); } } } break; case 262: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceQsSeen); /* * Remove sequence marker from scopes stack */ - if (idl_global->scopes()->top() == NULL) - idl_global->scopes()->pop(); - UTL_Scope *s = idl_global->scopes()->top_non_null (); + if (idl_global->scopes ()->top () == 0) + idl_global->scopes ()->pop (); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); /* * Create a node representing a sequence */ - if (tao_yyvsp[-1].dcval == NULL) - tao_yyval.dcval = NULL; + if (tao_yyvsp[-1].dcval == 0) + tao_yyval.dcval = 0; else { - AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-1].dcval); - if (tp == NULL) + AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-1].dcval); + if (tp == 0) ; /* Error will be caught in FE_Declarator.*/ else { tao_yyval.dcval = - idl_global->gen()->create_sequence( - idl_global->gen()->create_expr((unsigned long) 0), - tp, - s->is_local (), - s->is_abstract ()); + idl_global->gen ()->create_sequence ( + idl_global->gen ()->create_expr ((unsigned long) 0), + tp, + s->is_local (), + s->is_abstract () + ); /* - * Add this AST_Sequence to the types defined in the global scope + * Add this AST_Sequence to types defined in the global scope */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); + (void) idl_global->root ()->fe_add_sequence ( + AST_Sequence::narrow_from_decl (tao_yyval.dcval) + ); } } } break; case 263: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSeen); /* * Push a sequence marker on scopes stack */ - idl_global->scopes()->push(NULL); + idl_global->scopes ()->push (0); } break; case 264: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceSqSeen); } break; case 265: { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_SequenceTypeSeen); tao_yyval.dcval = tao_yyvsp[0].dcval; } break; case 266: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } break; case 267: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } break; case 268: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); /* * Create a node representing a string */ - if (tao_yyvsp[-2].exval == NULL || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error(tao_yyvsp[-2].exval, AST_Expression::EV_ulong); - tao_yyval.dcval = NULL; + if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong); + tao_yyval.dcval = 0; } else { - tao_yyval.dcval = idl_global->gen()->create_string(tao_yyvsp[-2].exval); + tao_yyval.dcval = idl_global->gen ()->create_string (tao_yyvsp[-2].exval); /* * 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)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl (tao_yyval.dcval) + ); } } break; case 269: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); /* * Create a node representing a string */ tao_yyval.dcval = - idl_global->gen()->create_string( - idl_global->gen()->create_expr((unsigned long) 0)); + idl_global->gen ()->create_string ( + idl_global->gen ()->create_expr ((unsigned long) 0) + ); /* * 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)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl (tao_yyval.dcval) + ); } break; case 270: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } break; case 271: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSqSeen); } break; case 272: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringExprSeen); } break; case 273: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringQsSeen); /* * Create a node representing a string */ - if (tao_yyvsp[-2].exval == NULL || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error(tao_yyvsp[-2].exval, AST_Expression::EV_ulong); - tao_yyval.dcval = NULL; + if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong); + tao_yyval.dcval = 0; } else { - tao_yyval.dcval = idl_global->gen()->create_wstring(tao_yyvsp[-2].exval); + tao_yyval.dcval = idl_global->gen ()->create_wstring (tao_yyvsp[-2].exval); /* * 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)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl (tao_yyval.dcval) + ); } } break; case 274: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_StringCompleted); /* * Create a node representing a string */ tao_yyval.dcval = - idl_global->gen()->create_wstring( - idl_global->gen()->create_expr((unsigned long) 0)); + idl_global->gen ()->create_wstring ( + idl_global->gen ()->create_expr ((unsigned long) 0) + ); /* * 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)); + (void) idl_global->root ()->fe_add_string ( + AST_String::narrow_from_decl (tao_yyval.dcval) + ); } break; case 275: { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_StringSeen); } break; case 276: { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ArrayIDSeen); } break; case 277: { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_ArrayCompleted); /* * Create a node representing an array */ - if (tao_yyvsp[0].elval != NULL) { - tao_yyval.dcval = idl_global->gen()->create_array(new UTL_ScopedName(tao_yyvsp[-2].idval, NULL), - tao_yyvsp[0].elval->length(), tao_yyvsp[0].elval, 0, 0); + if (tao_yyvsp[0].elval != 0) { + tao_yyval.dcval = idl_global->gen ()->create_array (new UTL_ScopedName (tao_yyvsp[-2].idval, + 0), + tao_yyvsp[0].elval->length (), + tao_yyvsp[0].elval, + 0, + 0); } } break; case 278: { - tao_yyval.elval = new UTL_ExprList(tao_yyvsp[-1].exval, tao_yyvsp[0].elval); + tao_yyval.elval = new UTL_ExprList (tao_yyvsp[-1].exval, tao_yyvsp[0].elval); } break; case 279: { - if (tao_yyvsp[-1].elval == NULL) - tao_yyval.elval = new UTL_ExprList(tao_yyvsp[0].exval, NULL); + if (tao_yyvsp[-1].elval == 0) + tao_yyval.elval = new UTL_ExprList (tao_yyvsp[0].exval, 0); else { - tao_yyvsp[-1].elval->nconc(new UTL_ExprList(tao_yyvsp[0].exval, NULL)); + tao_yyvsp[-1].elval->nconc (new UTL_ExprList (tao_yyvsp[0].exval, 0)); tao_yyval.elval = tao_yyvsp[-1].elval; } } break; case 280: { - tao_yyval.elval = NULL; + tao_yyval.elval = 0; } break; case 281: { - idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimSqSeen); } break; case 282: { - idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimExprSeen); } break; case 283: { - idl_global->set_parse_state(IDL_GlobalData::PS_DimQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_DimQsSeen); /* * Array dimensions are expressions which must be coerced to * positive integers */ - if (tao_yyvsp[-2].exval == NULL || tao_yyvsp[-2].exval->coerce(AST_Expression::EV_ulong) == NULL) { - idl_global->err()->coercion_error(tao_yyvsp[-2].exval, AST_Expression::EV_ulong); - tao_yyval.exval = NULL; + if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0) { + idl_global->err ()->coercion_error (tao_yyvsp[-2].exval, AST_Expression::EV_ulong); + tao_yyval.exval = 0; } else tao_yyval.exval = tao_yyvsp[-2].exval; } break; case 284: { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrSeen); } break; case 285: { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrTypeSeen); } break; case 286: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_DecllistActiveIterator *l = NULL; - AST_Attribute *a = NULL; - FE_Declarator *d = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_DecllistActiveIterator *l = 0; + AST_Attribute *a = 0; + FE_Declarator *d = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_AttrCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrCompleted); /* * Create nodes representing attributes and add them to the * enclosing scope */ - if (s != NULL && tao_yyvsp[-2].dcval != NULL && tao_yyvsp[0].dlval != NULL) { - l = new UTL_DecllistActiveIterator(tao_yyvsp[0].dlval); - for (;!(l->is_done()); l->next()) { - d = l->item(); - if (d == NULL) + if (s != 0 && tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].dlval != 0) { + l = new UTL_DecllistActiveIterator (tao_yyvsp[0].dlval); + for (; !(l->is_done ()); l->next ()) { + d = l->item (); + if (d == 0) continue; - AST_Type *tp = d->compose(tao_yyvsp[-2].dcval); - if (tp == NULL) + AST_Type *tp = d->compose (tao_yyvsp[-2].dcval); + if (tp == 0) continue; - a = idl_global->gen()->create_attribute(tao_yyvsp[-5].bval, - tp, - (UTL_IdList *) d->name()->copy (), - p, - s->is_local (), - s->is_abstract ()); + a = idl_global->gen ()->create_attribute (tao_yyvsp[-5].bval, + tp, + (UTL_IdList *) d->name()->copy (), + s->is_local (), + s->is_abstract ()); /* * Add one attribute to the enclosing scope */ - (void) s->fe_add_attribute(a); + (void) s->fe_add_attribute (a); } delete l; } - idl_global->set_pragmas (p); } break; case 287: { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_AttrROSeen); tao_yyval.bval = I_TRUE; } break; @@ -3330,142 +3308,131 @@ case 288: break; case 289: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSeen); } break; case 290: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = new UTL_ScopedName(tao_yyvsp[0].idval, NULL); - AST_Exception *e = NULL; - UTL_StrList *p = idl_global->pragmas(); - AST_Decl *v = NULL; - - ACE_UNUSED_ARG (v); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = new UTL_ScopedName (tao_yyvsp[0].idval, 0); + AST_Exception *e = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptIDSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptIDSeen); /* * Create a node representing an exception and add it to * the enclosing scope */ - if (s != NULL) { - e = idl_global->gen()->create_exception(n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_exception(e); + if (s != 0) { + e = idl_global->gen ()->create_exception (n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_exception (e); } /* * Push the exception scope on the scope stack */ - idl_global->scopes()->push(e); + idl_global->scopes()->push (e); } break; case 291: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptSqSeen); } break; case 292: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptBodySeen); } break; case 293: { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_ExceptQsSeen); /* * Done with this exception. Pop its scope from the scope stack */ - AST_Exception *ex = - AST_Exception::narrow_from_scope (idl_global->scopes ()->top_non_null ()); - UTL_StrList *p = ex->pragmas (); - idl_global->scopes()->pop(); - idl_global->set_pragmas (p); + idl_global->scopes ()->pop (); } break; case 294: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); } break; case 295: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); - AST_Operation *o = NULL; - UTL_StrList *p = idl_global->pragmas(); + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0); + AST_Operation *o = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_OpIDSeen); + 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 */ - if (s != NULL && tao_yyvsp[-2].dcval != NULL) { - AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-2].dcval); - if (tp == NULL) { - idl_global->err()->not_a_type(tao_yyvsp[-2].dcval); - } else if (tp->node_type() == AST_Decl::NT_except) { - idl_global->err()->not_a_type(tao_yyvsp[-2].dcval); + if (s != 0 && tao_yyvsp[-2].dcval != 0) { + AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-2].dcval); + if (tp == 0) { + idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval); + } else if (tp->node_type () == AST_Decl::NT_except) { + idl_global->err ()->not_a_type (tao_yyvsp[-2].dcval); } else { - o = idl_global->gen()->create_operation(tp, - tao_yyvsp[-3].ofval, - n, - p, - s->is_local (), - s->is_abstract ()); - (void) s->fe_add_operation(o); + o = idl_global->gen ()->create_operation (tp, + tao_yyvsp[-3].ofval, + n, + s->is_local (), + s->is_abstract ()); + (void) s->fe_add_operation (o); } } /* * Push the operation scope onto the scopes stack */ - idl_global->scopes()->push(o); + idl_global->scopes()->push (o); } break; case 296: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted); } break; case 297: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseCompleted); } break; case 298: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Operation *o = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Operation *o = 0; - idl_global->set_parse_state(IDL_GlobalData::PS_OpCompleted); + idl_global->set_parse_state (IDL_GlobalData::PS_OpCompleted); /* * Add exceptions and context to the operation */ - if (s != NULL && s->scope_node_type() == AST_Decl::NT_op) { - o = AST_Operation::narrow_from_scope(s); + if (s != 0 && s->scope_node_type() == AST_Decl::NT_op) { + o = AST_Operation::narrow_from_scope (s); - if (tao_yyvsp[-2].nlval != NULL && o != NULL) - (void) o->fe_add_exceptions(tao_yyvsp[-2].nlval); - if (tao_yyvsp[0].slval != NULL) - (void) o->fe_add_context(tao_yyvsp[0].slval); + 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); } /* * Done with this operation. Pop its scope from the scopes stack */ - idl_global->scopes()->pop(); + idl_global->scopes ()->pop (); } break; case 299: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); tao_yyval.ofval = AST_Operation::OP_oneway; } break; case 300: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpAttrSeen); tao_yyval.ofval = AST_Operation::OP_idempotent; } break; @@ -3477,179 +3444,291 @@ break; case 303: { tao_yyval.dcval = - idl_global->scopes()->bottom() - ->lookup_primitive_type(AST_Expression::EV_void); + idl_global->scopes ()->bottom ()->lookup_primitive_type ( + AST_Expression::EV_void + ); } break; case 304: { - /* TODO: replace parameter_list with rule that accepts only IN args*/ - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Sorry, I (TAO_IDL) can't handle factory yet\n"; + /*@@ PS_FactorySeen?*/ + idl_global->set_parse_state (IDL_GlobalData::PS_OpTypeSeen); } break; case 305: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + if (s->is_abstract ()) + { + /*@@ Fire error*/ + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("error in %s line %d:\n") + ACE_TEXT ("Abstract valuetype can't have a ") + ACE_TEXT ("factory construct.\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + } + UTL_ScopedName *n = + new UTL_ScopedName (new Identifier (tao_yyvsp[0].strval), 0); + + AST_Factory *factory = 0; + idl_global->set_parse_state (IDL_GlobalData::PS_OpIDSeen); + + /* + * Create a node representing an factory construct + * and add it to its enclosing scope + */ + if (s != 0) + { + factory = idl_global->gen ()->create_factory (n); + (void) s->fe_add_factory (factory); + } + /* + * Push the operation scope onto the scopes stack + */ + idl_global->scopes ()->push (factory); } break; case 306: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + /* TODO: replace parameter_list with rule that accepts only IN args*/ + + idl_global->set_parse_state (IDL_GlobalData::PS_OpParsCompleted); + idl_global->scopes ()->pop (); } break; case 307: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; case 308: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 310: +case 309: +#line 2588 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); } break; -case 313: +case 310: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); } break; -case 314: +case 312: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); } break; case 315: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Argument *a = NULL; - UTL_StrList *p = idl_global->pragmas(); + idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); + } +break; +case 316: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); + } +break; +case 317: +{ - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDeclSeen); + 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) */ - if (tao_yyvsp[-2].dcval != NULL && tao_yyvsp[0].deval != NULL && s != NULL) { - AST_Type *tp = tao_yyvsp[0].deval->compose(tao_yyvsp[-2].dcval); - if (tp != NULL) { + if (tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].deval != 0 && s != 0) + { + AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval); + if (tp != 0) + { + a = idl_global->gen ()->create_argument ( + AST_Argument::dir_IN, + tp, + (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy () + ); + + (void) s->fe_add_argument (a); + } + } + } +break; +case 318: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); + } +break; +case 319: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); + } +break; +case 320: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpSqSeen); + } +break; +case 321: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpQsSeen); + } +break; +case 323: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpParCommaSeen); + } +break; +case 326: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpParDirSeen); + } +break; +case 327: +{ + idl_global->set_parse_state (IDL_GlobalData::PS_OpParTypeSeen); + } +break; +case 328: +{ + 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) + */ + if (tao_yyvsp[-2].dcval != 0 && tao_yyvsp[0].deval != 0 && s != 0) { + AST_Type *tp = tao_yyvsp[0].deval->compose (tao_yyvsp[-2].dcval); + if (tp != 0) { if (!s->is_local () && tp->is_local ()) { - cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; - cerr << "Cannot use a local type as an argument of a remote interface operation\n"; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("error in %s line %d\n"), + idl_global->filename ()->get_string (), + idl_global->lineno ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Cannot use a local type as an ") + ACE_TEXT ("argument of a remote operation\n"))); } else { - a = idl_global->gen()->create_argument(tao_yyvsp[-4].dival, tp, (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy (), p); - (void) s->fe_add_argument(a); + 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 316: +case 329: { - tao_yyval.dcval = idl_global->scopes()->bottom()->lookup_primitive_type(tao_yyvsp[0].etval); + tao_yyval.dcval = idl_global->scopes ()->bottom ()->lookup_primitive_type (tao_yyvsp[0].etval); } break; -case 319: +case 332: { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; + UTL_Scope *s = idl_global->scopes ()->top_non_null (); + AST_Decl *d = 0; - if (s != NULL) - d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error(tao_yyvsp[0].idlist); + if (s != 0) + d = s->lookup_by_name (tao_yyvsp[0].idlist, I_TRUE); + if (d == 0) + idl_global->err ()->lookup_error (tao_yyvsp[0].idlist); tao_yyval.dcval = d; } break; -case 320: +case 333: { tao_yyval.dival = AST_Argument::dir_IN; } break; -case 321: +case 334: { tao_yyval.dival = AST_Argument::dir_OUT; } break; -case 322: +case 335: { tao_yyval.dival = AST_Argument::dir_INOUT; } break; -case 323: +case 336: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSeen); } break; -case 324: +case 337: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseSqSeen); } break; -case 325: +case 338: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpRaiseQsSeen); tao_yyval.nlval = tao_yyvsp[-1].nlval; } break; -case 326: +case 339: { - tao_yyval.nlval = NULL; + tao_yyval.nlval = 0; } break; -case 327: +case 340: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSeen); } break; -case 328: +case 341: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextSqSeen); } break; -case 329: +case 342: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextQsSeen); tao_yyval.slval = tao_yyvsp[-1].slval; } break; -case 330: +case 343: { - tao_yyval.slval = NULL; + tao_yyval.slval = 0; } break; -case 331: +case 344: { - tao_yyval.slval = new UTL_StrList(tao_yyvsp[-1].sval, tao_yyvsp[0].slval); + tao_yyval.slval = new UTL_StrList (tao_yyvsp[-1].sval, tao_yyvsp[0].slval); } break; -case 332: +case 345: { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + idl_global->set_parse_state (IDL_GlobalData::PS_OpContextCommaSeen); } break; -case 333: +case 346: { - if (tao_yyvsp[-3].slval == NULL) - tao_yyval.slval = new UTL_StrList(tao_yyvsp[0].sval, NULL); + if (tao_yyvsp[-3].slval == 0) + tao_yyval.slval = new UTL_StrList (tao_yyvsp[0].sval, 0); else { - tao_yyvsp[-3].slval->nconc(new UTL_StrList(tao_yyvsp[0].sval, NULL)); + tao_yyvsp[-3].slval->nconc (new UTL_StrList (tao_yyvsp[0].sval, 0)); tao_yyval.slval = tao_yyvsp[-3].slval; } } break; -case 334: +case 347: { - tao_yyval.slval = NULL; + tao_yyval.slval = 0; } break; } diff --git a/TAO/TAO_IDL/fe/y.tab.cpp.diff b/TAO/TAO_IDL/fe/y.tab.cpp.diff index 1c8ab12a2ff..8f5fc2d65bc 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp.diff +++ b/TAO/TAO_IDL/fe/y.tab.cpp.diff @@ -1,6 +1,6 @@ ---- y.tab.cpp.orig Mon Nov 12 18:53:41 2001 -+++ y.tab.cpp Mon Nov 12 18:53:41 2001 -@@ -941,7 +941,7 @@ +--- y.tab.cpp Tue Dec 19 09:31:07 2000 ++++ y.tab.cpp.mod Tue Dec 19 09:28:09 2000 +@@ -960,7 +960,7 @@ #ifdef TAO_YYMAXDEPTH #define TAO_YYSTACKSIZE TAO_YYMAXDEPTH #else @@ -27,7 +27,7 @@ if (tao_yychar < 0) { if ((tao_yychar = tao_yylex()) < 0) tao_yychar = 0; -@@ -1201,11 +1201,10 @@ +@@ -1220,11 +1220,10 @@ goto tao_yynewerror; #endif diff --git a/TAO/TAO_IDL/include/ast.h b/TAO/TAO_IDL/include/ast.h index 9e5d14b1de3..501ff4a33c1 100644 --- a/TAO/TAO_IDL/include/ast.h +++ b/TAO/TAO_IDL/include/ast.h @@ -120,6 +120,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ast_string.h" // class AST_String #include "ast_typedef.h" // class AST_Typedef #include "ast_native.h" // class AST_Native +#include "ast_factory.h" // class AST_Factory #include "utl_list.h" // class UTL_List #include "utl_strlist.h" // class UTL_StrList diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h index 278e7740740..6671736d03e 100644 --- a/TAO/TAO_IDL/include/ast_argument.h +++ b/TAO/TAO_IDL/include/ast_argument.h @@ -91,10 +91,9 @@ public: // Constructor(s). AST_Argument (void); - AST_Argument (Direction direction, - AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + AST_Argument (Direction direction, + AST_Type *ft, + UTL_ScopedName *n); // Destructor. virtual ~AST_Argument (void); diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h index ec0cce6e1fb..e4cbc42b833 100644 --- a/TAO/TAO_IDL/include/ast_attribute.h +++ b/TAO/TAO_IDL/include/ast_attribute.h @@ -81,7 +81,6 @@ public: AST_Attribute (idl_bool readonly, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_concrete_type.h b/TAO/TAO_IDL/include/ast_concrete_type.h index 2cb530907c9..d431ffb3701 100644 --- a/TAO/TAO_IDL/include/ast_concrete_type.h +++ b/TAO/TAO_IDL/include/ast_concrete_type.h @@ -79,8 +79,7 @@ public: AST_ConcreteType (void); AST_ConcreteType (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Destructor. virtual ~AST_ConcreteType (void); diff --git a/TAO/TAO_IDL/include/ast_constant.h b/TAO/TAO_IDL/include/ast_constant.h index e22227efaa3..c64f45b21c4 100644 --- a/TAO/TAO_IDL/include/ast_constant.h +++ b/TAO/TAO_IDL/include/ast_constant.h @@ -87,14 +87,12 @@ public: AST_Constant (AST_Expression::ExprType et, AST_Decl::NodeType nt, - AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p); + AST_Expression *ev, + UTL_ScopedName *n); AST_Constant (AST_Expression::ExprType et, AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Destructor. virtual ~AST_Constant (void); diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h index 4ae43a782de..0de498285f0 100644 --- a/TAO/TAO_IDL/include/ast_decl.h +++ b/TAO/TAO_IDL/include/ast_decl.h @@ -145,6 +145,7 @@ public: , NT_native // Denotes a native type // dependent on the programming // language + , NT_factory // Denotes a OBV factory construct }; // Operations. @@ -152,9 +153,8 @@ public: // Constructor(s). AST_Decl (void); - AST_Decl (NodeType type, + AST_Decl (NodeType type, UTL_ScopedName *n, - UTL_StrList *pragmas, idl_bool anonymous = I_FALSE); virtual ~AST_Decl (void); @@ -202,10 +202,16 @@ public: // Return the stringified full name. const char *repoID (void); - // Retrieve the repository ID. + void repoID (char *value); + // Accessors for the repository ID. const char *prefix (void); - // Retrieve the repository ID prefix. + void prefix (char *value); + // Accessors for the repository ID prefix. + + const char *version (void); + void version (char *value); + // Accessors for the version member. idl_bool anonymous (void) const; // Are we an anonymous (no repo ID) type? @@ -223,12 +229,6 @@ public: void original_local_name (Identifier *); // Set. - void add_pragmas (UTL_StrList *p); - - UTL_StrList *pragmas (void); - - void pragmas (UTL_StrList *p); - idl_bool added (void); void set_added (idl_bool is_it); @@ -297,9 +297,6 @@ private: Identifier *pd_original_local_name; // _cxx_ removed if any. - UTL_StrList *pd_pragmas; - // Pragmas. - idl_bool pd_added; // Already added. @@ -309,14 +306,14 @@ private: char *prefix_; // The repository ID prefix. + char *version_; + // Set by #pragma version. + idl_bool anonymous_; // Are we an anonymous (no repo ID) type? // Operations - void compute_prefix (void); - // Computes the prefix for the repoID. - // Compute the full name of an AST node. void compute_full_name (UTL_ScopedName *n); }; diff --git a/TAO/TAO_IDL/include/ast_enum.h b/TAO/TAO_IDL/include/ast_enum.h index cb57a405f7f..39a5f81953d 100644 --- a/TAO/TAO_IDL/include/ast_enum.h +++ b/TAO/TAO_IDL/include/ast_enum.h @@ -85,7 +85,6 @@ public: // Constructor(s) AST_Enum (void); AST_Enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_enum_val.h b/TAO/TAO_IDL/include/ast_enum_val.h index 758216f87a9..3ce7175ee2d 100644 --- a/TAO/TAO_IDL/include/ast_enum_val.h +++ b/TAO/TAO_IDL/include/ast_enum_val.h @@ -79,9 +79,8 @@ public: // Constructor(s). AST_EnumVal (void); - AST_EnumVal (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p); + AST_EnumVal (unsigned long v, + UTL_ScopedName *n); // Destructor. virtual ~AST_EnumVal (void); diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h index 020296694cf..bce16beee09 100644 --- a/TAO/TAO_IDL/include/ast_exception.h +++ b/TAO/TAO_IDL/include/ast_exception.h @@ -82,7 +82,6 @@ public: AST_Exception (void); AST_Exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_factory.h b/TAO/TAO_IDL/include/ast_factory.h new file mode 100644 index 00000000000..6b624ee48b8 --- /dev/null +++ b/TAO/TAO_IDL/include/ast_factory.h @@ -0,0 +1,138 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ +/* + +COPYRIGHT + +Copyright 1992, 1993, 1994 Sun Microsystems, Inc. Printed in the United +States of America. All Rights Reserved. + +This product is protected by copyright and distributed under the following +license restricting its use. + +The Interface Definition Language Compiler Front End (CFE) is made +available for your use provided that you include this license and copyright +notice on all media and documentation and the software program in which +this product is incorporated in whole or part. You may copy and extend +functionality (but may not remove functionality) of the Interface +Definition Language CFE without charge, but you are not authorized to +license or distribute it to anyone else except as part of a product or +program developed by you or with the express written consent of Sun +Microsystems, Inc. ("Sun"). + +The names of Sun Microsystems, Inc. and any of its subsidiaries or +affiliates may not be used in advertising or publicity pertaining to +distribution of Interface Definition Language CFE as permitted herein. + +This license is effective until terminated by Sun for failure to comply +with this license. Upon termination, you shall destroy or return all code +and documentation for the Interface Definition Language CFE. + +INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED AS IS WITH NO WARRANTIES OF +ANY KIND INCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS +FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR ARISING FROM A COURSE OF +DEALING, USAGE OR TRADE PRACTICE. + +INTERFACE DEFINITION LANGUAGE CFE IS PROVIDED WITH NO SUPPORT AND WITHOUT +ANY OBLIGATION ON THE PART OF Sun OR ANY OF ITS SUBSIDIARIES OR AFFILIATES +TO ASSIST IN ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT. + +SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY WITH +RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY +INTERFACE DEFINITION LANGUAGE CFE OR ANY PART THEREOF. + +IN NO EVENT WILL SUN OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE FOR +ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL +DAMAGES, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +Use, duplication, or disclosure by the government is subject to +restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in +Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR +52.227-19. + +Sun, Sun Microsystems and the Sun logo are trademarks or registered +trademarks of Sun Microsystems, Inc. + +SunSoft, Inc. +2550 Garcia Avenue +Mountain View, California 94043 + +NOTE: + +SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are +trademarks or registered trademarks of Sun Microsystems, Inc. + +*/ + +#ifndef _AST_FACTORY_AST_FACTORY_HH +#define _AST_FACTORY_AST_FACTORY_HH + +// Representation of OBV factory construct declaration. + +#include "idl_fwd.h" +#include "idl_narrow.h" +#include "utl_list.h" +#include "ast_decl.h" +#include "utl_scope.h" +#include "utl_scoped_name.h" + +class TAO_IDL_FE_Export AST_Factory : public virtual AST_Decl, + public virtual UTL_Scope +{ +public: + + // Constructor(s). + AST_Factory (void); + + AST_Factory (UTL_ScopedName *n); + + // Destructor. + virtual ~AST_Factory (void); + + // Data Accessors. + + // Public operations. + + virtual int argument_count (void); + // Return the count of members. + + virtual int has_native (void); + // Any of the arguments or the return value is a <native> type. + // This is important because in that case no code should be + // generated for the stubs. + + // Narrowing. + DEF_NARROW_METHODS2(AST_Factory, AST_Decl, UTL_Scope); + DEF_NARROW_FROM_DECL(AST_Factory); + DEF_NARROW_FROM_SCOPE(AST_Factory); + + // AST Dumping. + virtual void dump (ostream &o); + + // Cleanup function. + virtual void destroy (void); + + // Visiting. + virtual int ast_accept (ast_visitor *visitor); + +private: + // Data. + + int argument_count_; + // Number of arguments. + + int has_native_; + // Is any argument of type native. + + // Operations. + + int compute_argument_attr (void); + // Count the number of arguments. + + // Scope Management Protocol. + + friend int tao_yyparse (void); + virtual AST_Argument *fe_add_argument (AST_Argument *a); +}; + +#endif // _AST_FACTORY_AST_FACTORY_HH diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h index 669c4636e13..9f618224d86 100644 --- a/TAO/TAO_IDL/include/ast_field.h +++ b/TAO/TAO_IDL/include/ast_field.h @@ -97,14 +97,12 @@ public: AST_Field (void); AST_Field (AST_Type *field_type, - UTL_ScopedName *n, - UTL_StrList *p, + UTL_ScopedName *n, Visibility vis = vis_NA); AST_Field (AST_Decl::NodeType nt, AST_Type *field_type, - UTL_ScopedName *n, - UTL_StrList *p, + UTL_ScopedName *n, Visibility vis = vis_NA); virtual ~AST_Field (void); diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h index a9fd8a7064a..957a55c1e65 100644 --- a/TAO/TAO_IDL/include/ast_generator.h +++ b/TAO/TAO_IDL/include/ast_generator.h @@ -77,18 +77,15 @@ public: // Create a node representing a predefined type. virtual AST_PredefinedType *create_predefined_type ( AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p + UTL_ScopedName *n ); // Create a node representing a module. virtual AST_Module *create_module (UTL_Scope *s, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Create a node representing a module which is the root of an AST. - virtual AST_Root *create_root (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_Root *create_root (UTL_ScopedName *n); // Create a node representing an interface. virtual AST_Interface *create_interface (UTL_ScopedName *n, @@ -96,41 +93,34 @@ public: long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing a forward declaration of an interface. virtual AST_InterfaceFwd *create_interface_fwd (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing an valuetype. virtual AST_Interface *create_valuetype (UTL_ScopedName *n, AST_Interface **ih, - long nih, - UTL_StrList *p); + long nih); // Create a node representing a forward declaration of an valuetype. - virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_InterfaceFwd *create_valuetype_fwd (UTL_ScopedName *n); // Create a node representing an exception. virtual AST_Exception *create_exception (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing a structure. virtual AST_Structure *create_structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing an enum. virtual AST_Enum *create_enum (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); @@ -138,7 +128,6 @@ public: virtual AST_Operation *create_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); @@ -146,46 +135,40 @@ public: // union. virtual AST_Field *create_field (AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, AST_Field::Visibility vis = AST_Field::vis_NA); // Create a node representing an argument to an operation. virtual AST_Argument *create_argument (AST_Argument::Direction d, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Create a node representing an attribute. virtual AST_Attribute *create_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing a union. virtual AST_Union *create_union (AST_ConcreteType *dt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing one branch in a union. virtual AST_UnionBranch *create_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Create a node representing a label on a union branch. - virtual AST_UnionLabel *create_union_label(AST_UnionLabel::UnionLabel ul, - AST_Expression *lv); + virtual AST_UnionLabel *create_union_label (AST_UnionLabel::UnionLabel ul, + AST_Expression *lv); // Create a node representing a constant virtual AST_Constant *create_constant (AST_Expression::ExprType et, AST_Expression *ev, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Create various kinds of nodes representing expressions. @@ -217,8 +200,7 @@ public: // Create a node representing an enumerator. virtual AST_EnumVal *create_enum_val (unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Create a node representing an array type. virtual AST_Array *create_array (UTL_ScopedName *n, @@ -242,13 +224,14 @@ public: // Create a node representing a type renaming (typedef). virtual AST_Typedef*create_typedef (AST_Type *bt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); // Create a node representing a native. - virtual AST_Native *create_native (UTL_ScopedName *n, - UTL_StrList *p); + virtual AST_Native *create_native (UTL_ScopedName *n); + + // Create a node representing an OBV factory construct. + virtual AST_Factory *create_factory (UTL_ScopedName *n); }; #endif // _AST_GENERATOR_AST_GENERATOR_HH diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h index 07c00af968c..a66c700762b 100644 --- a/TAO/TAO_IDL/include/ast_interface.h +++ b/TAO/TAO_IDL/include/ast_interface.h @@ -90,7 +90,6 @@ public: long nih, AST_Interface **ih_flat, long nih_flat, - UTL_StrList *p, idl_bool local, idl_bool abstract); @@ -98,11 +97,9 @@ public: // Data Accessors. static void fwd_redefinition_helper (AST_Interface *&i, - UTL_Scope *s, - UTL_StrList *p); + UTL_Scope *s); - virtual void redefine (AST_Interface *from, - UTL_StrList *p); + virtual void redefine (AST_Interface *from); AST_Interface **inherits (void); @@ -128,7 +125,7 @@ public: // Is this interface defined? This predicate returns FALSE when an // interface was forward declared but not defined yet, and TRUE in // all other cases. - idl_bool is_defined (void) + virtual idl_bool is_defined (void) { return (pd_n_inherits < 0) ? I_FALSE : I_TRUE; } @@ -204,6 +201,8 @@ private: virtual AST_Typedef *fe_add_typedef (AST_Typedef *t); virtual AST_Native *fe_add_native (AST_Native *n); + + virtual AST_Factory *fe_add_factory (AST_Factory *f); }; #endif // _AST_INTERFACE_AST_INTERFACE_HH diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h index 5234900a093..621e3a6988b 100644 --- a/TAO/TAO_IDL/include/ast_interface_fwd.h +++ b/TAO/TAO_IDL/include/ast_interface_fwd.h @@ -78,17 +78,17 @@ public: AST_InterfaceFwd (void); AST_InterfaceFwd (AST_Interface *dummy, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Destructor. virtual ~AST_InterfaceFwd (void); // Data Accessors. AST_Interface *full_definition (void); - void set_full_definition (AST_Interface *nfd); + virtual idl_bool is_defined (void); + virtual idl_bool is_local (void); virtual idl_bool is_valuetype (void); virtual idl_bool is_abstract_valuetype (void); diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h index e732b7259a8..6df56041b42 100644 --- a/TAO/TAO_IDL/include/ast_module.h +++ b/TAO/TAO_IDL/include/ast_module.h @@ -82,8 +82,7 @@ public: // Constructor(s) and destructor. AST_Module (void); - AST_Module (UTL_ScopedName *n, - UTL_StrList *p); + AST_Module (UTL_ScopedName *n); virtual ~AST_Module (void); diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h index 6ee42d69636..7627faf4354 100644 --- a/TAO/TAO_IDL/include/ast_native.h +++ b/TAO/TAO_IDL/include/ast_native.h @@ -16,8 +16,7 @@ public: AST_Native (void); // Default constructor. - AST_Native (UTL_ScopedName *n, - UTL_StrList *p); + AST_Native (UTL_ScopedName *n); // Constructor that initializes the scoped name. virtual ~AST_Native (void); diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h index 36e879022a4..627566d73e4 100644 --- a/TAO/TAO_IDL/include/ast_operation.h +++ b/TAO/TAO_IDL/include/ast_operation.h @@ -94,7 +94,6 @@ public: AST_Operation (AST_Type *return_type, Flags flags, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_predefined_type.h b/TAO/TAO_IDL/include/ast_predefined_type.h index 752ef67f3bc..e4ae7d28dec 100644 --- a/TAO/TAO_IDL/include/ast_predefined_type.h +++ b/TAO/TAO_IDL/include/ast_predefined_type.h @@ -101,9 +101,8 @@ public: // Constructor(s). AST_PredefinedType (void); - AST_PredefinedType (PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p); + AST_PredefinedType (PredefinedType t, + UTL_ScopedName *n); virtual ~AST_PredefinedType (void); diff --git a/TAO/TAO_IDL/include/ast_root.h b/TAO/TAO_IDL/include/ast_root.h index 6ced9d7a015..f4f92ae9323 100644 --- a/TAO/TAO_IDL/include/ast_root.h +++ b/TAO/TAO_IDL/include/ast_root.h @@ -77,8 +77,7 @@ public: // Constructor(s) and destructor. AST_Root (void); - AST_Root (UTL_ScopedName *n, - UTL_StrList *p); + AST_Root (UTL_ScopedName *n); virtual ~AST_Root (void); diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h index e2e070e0ced..1e87b078a5c 100644 --- a/TAO/TAO_IDL/include/ast_structure.h +++ b/TAO/TAO_IDL/include/ast_structure.h @@ -89,13 +89,11 @@ public: AST_Structure (void); AST_Structure (UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); AST_Structure (AST_Decl::NodeType nt, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_type.h b/TAO/TAO_IDL/include/ast_type.h index f6d76d7087b..66e2d1f72ba 100644 --- a/TAO/TAO_IDL/include/ast_type.h +++ b/TAO/TAO_IDL/include/ast_type.h @@ -86,8 +86,7 @@ public: AST_Type (void); AST_Type (AST_Decl::NodeType nt, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); // Destructor. virtual ~AST_Type (void); @@ -97,6 +96,10 @@ public: // Most types cannot be involved except structs and unions. // If the parameter is 0, we are trying to determine this for ourselves. + // To be overridden by the subclasses interface, struct, union, and + // the corresponding forward declaration classes. + virtual idl_bool is_defined (void); + // Accessors/mutators for the private members. idl_bool ifr_added (void); diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h index 3f3f619bbbc..428aa7bf994 100644 --- a/TAO/TAO_IDL/include/ast_typedef.h +++ b/TAO/TAO_IDL/include/ast_typedef.h @@ -80,7 +80,6 @@ public: AST_Typedef (AST_Type *base_type, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h index 8c198765119..1f3ba7da1c0 100644 --- a/TAO/TAO_IDL/include/ast_union.h +++ b/TAO/TAO_IDL/include/ast_union.h @@ -87,7 +87,6 @@ public: AST_Union (AST_ConcreteType *disc_type, UTL_ScopedName *n, - UTL_StrList *p, idl_bool local, idl_bool abstract); diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h index 2c51bf1512a..0ced0e3236e 100644 --- a/TAO/TAO_IDL/include/ast_union_branch.h +++ b/TAO/TAO_IDL/include/ast_union_branch.h @@ -80,8 +80,7 @@ public: AST_UnionBranch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p); + UTL_ScopedName *n); virtual ~AST_UnionBranch (void); diff --git a/TAO/TAO_IDL/include/ast_visitor.h b/TAO/TAO_IDL/include/ast_visitor.h index 09bc85b65a8..34632a4da60 100644 --- a/TAO/TAO_IDL/include/ast_visitor.h +++ b/TAO/TAO_IDL/include/ast_visitor.h @@ -30,11 +30,10 @@ class AST_Module; class AST_Interface; class AST_InterfaceFwd; -#if defined (IDL_HAS_VALUETYPE) // These classes don't exist now, but they may someday. // class AST_Valuetype; // class AST_ValuetypeFwd; -#endif /* IDL_HAS_VALUETYPE */ +class AST_Factory; class AST_Structure; class AST_Exception; @@ -104,6 +103,9 @@ public: virtual int visit_valuetype_fwd (AST_InterfaceFwd *node) = 0; // Visit valuetype_fwd + virtual int visit_factory (AST_Factory *node) = 0; + // Visit a OBV factory construct. + virtual int visit_structure (AST_Structure *node) = 0; // Visit a structure. diff --git a/TAO/TAO_IDL/include/fe_declarator.h b/TAO/TAO_IDL/include/fe_declarator.h index 39ea7e7e985..1c183bc21cf 100644 --- a/TAO/TAO_IDL/include/fe_declarator.h +++ b/TAO/TAO_IDL/include/fe_declarator.h @@ -62,52 +62,45 @@ NOTE: SunOS, SunSoft, Sun, Solaris, Sun Microsystems or the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. - */ +*/ #ifndef _FE_DECLARATOR_FE_DECLARATOR_HH #define _FE_DECLARATOR_FE_DECLARATOR_HH -// FE_Declarator.h -// -// FE internal class for storing interim declaration statements - -/* -** DEPENDENCIES: utl_scoped_name.hh, ast_decl.hh -** -** USE: Included from fe.hh -*/ - class FE_Declarator { public: - // Enum to denote types of declarators - enum DeclaratorType { - FD_simple // Simple declarator - , FD_complex // Complex declarator (complex_part field used) + // Enum to denote types of declarators. + enum DeclaratorType + { + FD_simple, // Simple declarator + FD_complex // Complex declarator (complex_part field used) }; - // Operations + // Operations. - // Constructor(s) - FE_Declarator(UTL_ScopedName *n, DeclaratorType dt, AST_Decl *cp); - virtual ~FE_Declarator() {} + // Constructor and destructor. + FE_Declarator (UTL_ScopedName *n, + DeclaratorType dt, + AST_Decl *cp); + virtual ~FE_Declarator (void) {} - // Data Accessors - AST_Decl *complex_part(); - UTL_ScopedName *name(); - DeclaratorType decl_type(); + // Data Accessors. + AST_Decl *complex_part (void); + UTL_ScopedName *name (void); + DeclaratorType decl_type (void); - // Other Operations + // Other Operations. // Compose an FE_Declarator into an AST_Type once all the needed information - // is available - AST_Type *compose(AST_Decl* tc); + // is available. + AST_Type *compose (AST_Decl* tc); private: - // Data - AST_Decl *pd_complex_part; // If a complex declarator - UTL_ScopedName *pd_name; // The name if complex - DeclaratorType pd_decl_type; // Whether complex or simple + // Data. + AST_Decl *pd_complex_part; // If a complex declarator + UTL_ScopedName *pd_name; // The name if complex + DeclaratorType pd_decl_type; // Whether complex or simple }; #endif // _FE_DECLARATOR_FE_DECLARATOR_HH diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index f13a61f56a2..d5daae2b367 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -69,6 +69,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "ace/SString.h" #include "ace/Hash_Map_Manager_T.h" +#include "ace/Containers_T.h" // idl_global.hh // @@ -267,11 +268,7 @@ public: virtual void set_local_escapes (const char *);// Set it virtual UTL_Indenter *indent (void); // Get indenter - virtual void set_indent (UTL_Indenter *); - // Set it - - virtual UTL_StrList *pragmas (void); // Get pragmas - virtual void set_pragmas (UTL_StrList *); // Set it + virtual void set_indent (UTL_Indenter *); // Set it virtual idl_bool read_from_stdin (void); // Reading from stdin? virtual void set_read_from_stdin (idl_bool); // Set it @@ -369,7 +366,13 @@ public: ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> & idl_keywords (void); // Accessor for the IDL keyword container. + + ACE_Unbounded_Stack<char *> & pragma_prefixes (void); + // Accessor for the pragma prefix container. + UTL_ScopedName *string_to_scoped_name (char *s);; + // Parses a string with double colons. + private: // Data UTL_ScopeStack *pd_scopes; // Store scopes stack @@ -390,7 +393,6 @@ private: const char *pd_be; // BE name to use char *pd_local_escapes; // Trapdoor argument UTL_Indenter *pd_indent; // Indent object - UTL_StrList *pd_pragmas; // List of pragmas // as its being built idl_bool pd_read_from_stdin; // Reading from stdin? UTL_String **pd_include_file_names;// Array of file names. @@ -439,6 +441,12 @@ private: ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> idl_keywords_; // Container for all the IDL keywords so local names can be checked. + + ACE_Unbounded_Stack<char *> pragma_prefixes_; + // Container for all the #pragma prefix declarations. + + long last_seen_index_; + // The index (not zero-based!) of the last seen included file. }; diff --git a/TAO/TAO_IDL/include/utl_decllist.h b/TAO/TAO_IDL/include/utl_decllist.h index 6387ed3220e..b7e804cb281 100644 --- a/TAO/TAO_IDL/include/utl_decllist.h +++ b/TAO/TAO_IDL/include/utl_decllist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, fe_declarator.hh diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h index 7d5877832d8..88eb7fe798e 100644 --- a/TAO/TAO_IDL/include/utl_err.h +++ b/TAO/TAO_IDL/include/utl_err.h @@ -120,6 +120,7 @@ public: EIDL_NONVOID_ONEWAY, // Non-void return type in oneway operation EIDL_NOT_A_TYPE, // Not a type EIDL_UNDERSCORE, // More than one leading underscore + EIDL_EMPTY_MODULE, // Empty modules not allowed in IDL. EIDL_BACK_END, // Back end error EIDL_OK // No error }; diff --git a/TAO/TAO_IDL/include/utl_exceptlist.h b/TAO/TAO_IDL/include/utl_exceptlist.h index b75d3e19504..f1e3f64905f 100644 --- a/TAO/TAO_IDL/include/utl_exceptlist.h +++ b/TAO/TAO_IDL/include/utl_exceptlist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, ast_exception.hh diff --git a/TAO/TAO_IDL/include/utl_exprlist.h b/TAO/TAO_IDL/include/utl_exprlist.h index 53ffaeb8f62..11e2aec397a 100644 --- a/TAO/TAO_IDL/include/utl_exprlist.h +++ b/TAO/TAO_IDL/include/utl_exprlist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: ast_expression.hh, utl_list.hh diff --git a/TAO/TAO_IDL/include/utl_idlist.h b/TAO/TAO_IDL/include/utl_idlist.h index 01de5961d7e..11113a51807 100644 --- a/TAO/TAO_IDL/include/utl_idlist.h +++ b/TAO/TAO_IDL/include/utl_idlist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, utl_identifier.hh diff --git a/TAO/TAO_IDL/include/utl_labellist.h b/TAO/TAO_IDL/include/utl_labellist.h index dfc4a39bdd6..5881cdb5013 100644 --- a/TAO/TAO_IDL/include/utl_labellist.h +++ b/TAO/TAO_IDL/include/utl_labellist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, ast_union_label.hh diff --git a/TAO/TAO_IDL/include/utl_list.h b/TAO/TAO_IDL/include/utl_list.h index 65119bbc443..b66cca0b739 100644 --- a/TAO/TAO_IDL/include/utl_list.h +++ b/TAO/TAO_IDL/include/utl_list.h @@ -82,12 +82,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. // Forward declare active iterator for UTL_List class UTL_ListActiveIterator; diff --git a/TAO/TAO_IDL/include/utl_namelist.h b/TAO/TAO_IDL/include/utl_namelist.h index ec750a0cad1..198b5c5c002 100644 --- a/TAO/TAO_IDL/include/utl_namelist.h +++ b/TAO/TAO_IDL/include/utl_namelist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, utl_scoped_name.hh diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index 6e123f14eed..6e0ccd1e73f 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -157,6 +157,8 @@ public: virtual AST_Native *add_native (AST_Native *n); + virtual AST_Factory *add_factory (AST_Factory *f); + // Call back end add_XXX functions for this scope. virtual AST_Decl *call_add (void); @@ -198,6 +200,10 @@ public: void add_to_scope (AST_Decl *e, AST_Decl *ex = 0); + // Accessors for the has_prefix_ member. + idl_bool has_prefix (void); + void has_prefix (idl_bool val); + // Cleanup function. virtual void destroy (void); @@ -275,6 +281,9 @@ private: long pd_name_referenced_allocated; // How many allocated? long pd_name_referenced_used; // How many used? + // Have we seen a #pragma prefix declaration in this scope? + idl_bool has_prefix_; + // Friend class UTL_ScopeActiveIterator defines active iterator for // UTL_Scope. Definition follows below. friend class UTL_ScopeActiveIterator; @@ -327,6 +336,8 @@ private: virtual AST_Array *fe_add_array (AST_Array *a); virtual AST_Native *fe_add_native (AST_Native *n); + + virtual AST_Factory *fe_add_factory (AST_Factory *f); }; // Active iterator for a UTL_Scope node diff --git a/TAO/TAO_IDL/include/utl_strlist.h b/TAO/TAO_IDL/include/utl_strlist.h index a15b7df9ad8..eb9ca3e4291 100644 --- a/TAO/TAO_IDL/include/utl_strlist.h +++ b/TAO/TAO_IDL/include/utl_strlist.h @@ -76,12 +76,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. /* ** DEPENDENCIES: utl_list.hh, utl_string.hh diff --git a/TAO/TAO_IDL/narrow/narrow.cpp b/TAO/TAO_IDL/narrow/narrow.cpp index cbcdb978305..7e075887881 100644 --- a/TAO/TAO_IDL/narrow/narrow.cpp +++ b/TAO/TAO_IDL/narrow/narrow.cpp @@ -75,29 +75,32 @@ ACE_RCSID(narrow, narrow, "$Id$") * Convert a UTL_Scope node into an AST_Decl node if possible */ AST_Decl * -ScopeAsDecl(UTL_Scope *s) +ScopeAsDecl (UTL_Scope *s) { - if (s == NULL) return NULL; - - switch (s->scope_node_type()) { - case AST_Decl::NT_module: - return AST_Module::narrow_from_scope(s); - case AST_Decl::NT_root: - return AST_Root::narrow_from_scope(s); - case AST_Decl::NT_interface: - return AST_Interface::narrow_from_scope(s); - case AST_Decl::NT_op: - return AST_Operation::narrow_from_scope(s); - case AST_Decl::NT_except: - return AST_Exception::narrow_from_scope(s); - case AST_Decl::NT_union: - return AST_Union::narrow_from_scope(s); - case AST_Decl::NT_struct: - return AST_Structure::narrow_from_scope(s); - case AST_Decl::NT_enum: - return AST_Enum::narrow_from_scope(s); - default: - return NULL; + if (s == 0) return 0; + + switch (s->scope_node_type ()) + { + case AST_Decl::NT_module: + return AST_Module::narrow_from_scope (s); + case AST_Decl::NT_root: + return AST_Root::narrow_from_scope (s); + case AST_Decl::NT_interface: + return AST_Interface::narrow_from_scope (s); + case AST_Decl::NT_op: + return AST_Operation::narrow_from_scope (s); + case AST_Decl::NT_factory: + return AST_Factory::narrow_from_scope (s); + case AST_Decl::NT_except: + return AST_Exception::narrow_from_scope (s); + case AST_Decl::NT_union: + return AST_Union::narrow_from_scope (s); + case AST_Decl::NT_struct: + return AST_Structure::narrow_from_scope (s); + case AST_Decl::NT_enum: + return AST_Enum::narrow_from_scope (s); + default: + return 0; } } @@ -105,37 +108,40 @@ ScopeAsDecl(UTL_Scope *s) * Convert an AST_Decl to a UTL_Scope if possible */ UTL_Scope * -DeclAsScope(AST_Decl *d) +DeclAsScope (AST_Decl *d) { - if (d == NULL) return NULL; - - switch (d->node_type()) { - case AST_Decl::NT_interface_fwd: - /* - * Resolve forward declared interface by looking at full_definition() - * field and iterating - */ - d = (AST_InterfaceFwd::narrow_from_decl(d))->full_definition(); - /* - * Fall through - */ - case AST_Decl::NT_interface: - return AST_Interface::narrow_from_decl(d); - case AST_Decl::NT_module: - return AST_Module::narrow_from_decl(d); - case AST_Decl::NT_root: - return AST_Root::narrow_from_decl(d); - case AST_Decl::NT_except: - return AST_Exception::narrow_from_decl(d); - case AST_Decl::NT_union: - return AST_Union::narrow_from_decl(d); - case AST_Decl::NT_struct: - return AST_Structure::narrow_from_decl(d); - case AST_Decl::NT_enum: - return AST_Enum::narrow_from_decl(d); - case AST_Decl::NT_op: - return AST_Operation::narrow_from_decl(d); - default: - return NULL; + if (d == 0) return 0; + + switch (d->node_type ()) + { + case AST_Decl::NT_interface_fwd: + /* + * Resolve forward declared interface by looking at full_definition() + * field and iterating + */ + d = (AST_InterfaceFwd::narrow_from_decl (d))->full_definition (); + /* + * Fall through + */ + case AST_Decl::NT_interface: + return AST_Interface::narrow_from_decl (d); + case AST_Decl::NT_module: + return AST_Module::narrow_from_decl (d); + case AST_Decl::NT_root: + return AST_Root::narrow_from_decl (d); + case AST_Decl::NT_except: + return AST_Exception::narrow_from_decl (d); + case AST_Decl::NT_union: + return AST_Union::narrow_from_decl (d); + case AST_Decl::NT_struct: + return AST_Structure::narrow_from_decl (d); + case AST_Decl::NT_enum: + return AST_Enum::narrow_from_decl (d); + case AST_Decl::NT_op: + return AST_Operation::narrow_from_decl (d); + case AST_Decl::NT_factory: + return AST_Factory::narrow_from_decl (d); + default: + return 0; } } diff --git a/TAO/TAO_IDL/util/utl_decllist.cpp b/TAO/TAO_IDL/util/utl_decllist.cpp index 2a810a6e5f8..030ef90946a 100644 --- a/TAO/TAO_IDL/util/utl_decllist.cpp +++ b/TAO/TAO_IDL/util/utl_decllist.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp index af6eb032966..01506844850 100644 --- a/TAO/TAO_IDL/util/utl_err.cpp +++ b/TAO/TAO_IDL/util/utl_err.cpp @@ -179,6 +179,8 @@ error_string (UTL_Error::ErrorCode c) return ACE_TEXT ("specified symbol is not a type: "); case UTL_Error::EIDL_UNDERSCORE: return ACE_TEXT ("identifier has more than one leading underscore: "); + case UTL_Error::EIDL_EMPTY_MODULE: + return ACE_TEXT ("module must contain at least one declaration: "); case UTL_Error::EIDL_BACK_END: return ACE_TEXT ("back end: "); } @@ -593,7 +595,8 @@ UTL_Error::error1 (UTL_Error::ErrorCode c, idl_global->lineno (), idl_global->filename ()); d->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -608,7 +611,8 @@ UTL_Error::error2 (UTL_Error::ErrorCode c, d1->name ()->dump (cerr); cerr << ", "; d2->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -626,7 +630,8 @@ UTL_Error::error3 (UTL_Error::ErrorCode c, d2->name ()->dump (cerr); cerr << ", "; d3->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -647,7 +652,8 @@ UTL_Error::warning1 (UTL_Error::ErrorCode c, idl_global->lineno (), idl_global->filename ()); d->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); } void @@ -661,7 +667,8 @@ UTL_Error::warning2 (UTL_Error::ErrorCode c, d1->name ()->dump (cerr); cerr << ", "; d2->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); } void @@ -678,7 +685,8 @@ UTL_Error::warning3 (UTL_Error::ErrorCode c, d2->name ()->dump (cerr); cerr << ", "; d3->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); } // Report a failed coercion attempt. @@ -759,7 +767,8 @@ UTL_Error::inheritance_fwd_error (UTL_ScopedName *n, n->dump (cerr); cerr << ACE_TEXT (" cannot inherit from forward declared interface "); f->local_name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -774,7 +783,8 @@ UTL_Error::inheritance_error (UTL_ScopedName *n, n->dump (cerr); cerr << ACE_TEXT (" attempts to inherit from "); d->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -800,7 +810,8 @@ UTL_Error::eval_error (AST_Expression *v) v->line (), v->file_name ()); v->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -817,7 +828,8 @@ UTL_Error::constant_expected (UTL_ScopedName *n, n->dump (cerr); cerr << ACE_TEXT (" bound to "); d->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -834,7 +846,8 @@ UTL_Error::enum_val_expected (AST_Union *u, u->file_name ()); cerr << " union " << u->local_name ()->get_string () << ", "; l->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -855,7 +868,8 @@ UTL_Error::enum_val_lookup_failure (AST_Union *u, cerr << " enum " << e->local_name ()->get_string () << ", "; cerr << " enumerator "; n->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -928,7 +942,8 @@ UTL_Error::ambiguous (UTL_Scope *s, d->name ()->dump (cerr); cerr << " vs. "; l->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -941,7 +956,8 @@ UTL_Error::fwd_decl_not_defined (AST_Interface *d) d->file_name()); cerr << "interface "; d->local_name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -957,7 +973,8 @@ UTL_Error::fwd_decl_lookup (AST_Interface *d, n->dump (cerr); cerr << ACE_TEXT (" in undefined forward declared interface "); d->local_name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -972,7 +989,8 @@ UTL_Error::redefinition_in_scope (AST_Decl *d, d->name ()->dump (cerr); cerr << ", "; s->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } @@ -987,7 +1005,8 @@ UTL_Error::not_a_type (AST_Decl *d) cerr << ACE_TEXT ("unknown symbol"); else d->name ()->dump (cerr); - cerr << "\n"; + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("\n"))); idl_global->set_err_count (idl_global->err_count () + 1); } diff --git a/TAO/TAO_IDL/util/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_exceptlist.cpp index e291f95a82e..8ad5d138ead 100644 --- a/TAO/TAO_IDL/util/utl_exceptlist.cpp +++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_exprlist.cpp index ad710e53ae2..0f3c5a3b2a8 100644 --- a/TAO/TAO_IDL/util/utl_exprlist.cpp +++ b/TAO/TAO_IDL/util/utl_exprlist.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index a86f3ec43d0..6b5454e08cb 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -69,7 +69,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "idl.h" #include "idl_extern.h" -#include "ace/OS.h" ACE_RCSID(util, utl_global, "$Id$") @@ -97,7 +96,6 @@ IDL_GlobalData::IDL_GlobalData (void) pd_be (0), pd_local_escapes (0), pd_indent (0), - pd_pragmas (0), pd_read_from_stdin (I_FALSE), pd_include_file_names (0), pd_n_include_file_names (0), @@ -112,7 +110,8 @@ IDL_GlobalData::IDL_GlobalData (void) ident_string_ (0), obv_support_ (I_FALSE), case_diff_error_ (I_TRUE), - idl_flags_ ("") + idl_flags_ (""), + last_seen_index_ (1) { // Path for the perfect hash generator(gperf) program. // Default is $ACE_ROOT/bin/gperf unless ACE_GPERF is defined. @@ -431,22 +430,6 @@ IDL_GlobalData::set_indent (UTL_Indenter *i) this->pd_indent = i; } -// Get or set list of pragmas being parsed -UTL_StrList * -IDL_GlobalData::pragmas (void) -{ - UTL_StrList *p = this->pd_pragmas; - - this->pd_pragmas = 0; - return p; -} - -void -IDL_GlobalData::set_pragmas (UTL_StrList *p) -{ - this->pd_pragmas = p; -} - // Get or set indicator whether we're reading from stdin. idl_bool IDL_GlobalData::read_from_stdin (void) @@ -460,37 +443,58 @@ IDL_GlobalData::set_read_from_stdin (idl_bool r) this->pd_read_from_stdin = r; } -// Have we seen this include file name before? +// Have we seen this #include file name before? long IDL_GlobalData::seen_include_file_before (UTL_String *n) { unsigned long i; - for (i = 0; i < this->pd_n_include_file_names; i++) - if (n->compare (this->pd_include_file_names[i])) - return I_TRUE; + for (i = 0; i < this->pd_n_include_file_names; ++i) + { + if (n->compare (this->pd_include_file_names[i])) + { + // We use the index value in the function below. We + // add 1 so a match on the first try will not return 0. + return (long) i + 1; + } + } + return I_FALSE; } -// Store a name of an #include file +// Store the name of an #include file. void IDL_GlobalData::store_include_file_name (UTL_String *n) { - UTL_String **o_include_file_names; - unsigned long o_n_alloced_file_names, i; + UTL_String **o_include_file_names; + unsigned long o_n_alloced_file_names; + unsigned long i; + long seen = this->seen_include_file_before (n); - /* - * Check if we need to store it at all or whether we've seen it already - */ - if (seen_include_file_before (n)) - return; - /* - * OK, need to store. Make sure there's space for one more string - */ + // Check if we need to store it at all or whether we've seen it already + if (seen) + { + if (seen != this->last_seen_index_) + { + // If it's not the same as the current filename, then we have + // just finished with some other included file, and its + // (possible empty) prefix must be popped. + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + + this->last_seen_index_ = seen; + return; + } + + // If it's a new filename, we need to push an empty prefix. + idl_global->pragma_prefixes ().push (ACE::strnew ("")); + + // OK, need to store. Make sure there's space for one more string if (this->pd_n_include_file_names == this->pd_n_alloced_file_names) { // Allocating more space. - if (this->pd_n_alloced_file_names == 0) { this->pd_n_alloced_file_names = INCREMENT; @@ -510,6 +514,7 @@ IDL_GlobalData::store_include_file_name (UTL_String *n) // Store it. this->pd_include_file_names[this->pd_n_include_file_names++] = n; + this->last_seen_index_ = this->pd_n_include_file_names; } void @@ -848,7 +853,15 @@ IDL_GlobalData::destroy (void) delete [] this->ident_string_; this->ident_string_ = 0; - // Should do pragmas here. + size_t size = this->pragma_prefixes ().size (); + char *trash = 0; + + for (size_t i = 0; i < size; ++i) + { + this->pragma_prefixes ().pop (trash); + delete [] trash; + trash = 0; + } } void @@ -869,26 +882,98 @@ IDL_GlobalData::idl_keywords (void) return this->idl_keywords_; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +ACE_Unbounded_Stack<char *> & +IDL_GlobalData::pragma_prefixes (void) +{ + return this->pragma_prefixes_; +} -template class ACE_Hash_Map_Entry<ACE_CString, int>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Equal_To<ACE_CString>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Hash<ACE_CString>; -template class ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>; +UTL_ScopedName * +IDL_GlobalData::string_to_scoped_name (char *s) +{ + char *start = s; + int len = 0; + UTL_ScopedName *retval = 0; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + char *end = ACE_OS::strstr (start, "::"); -#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, int> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Equal_To<ACE_CString> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash<ACE_CString> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> + while (end != 0) + { + len = end - start; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + if (len != 0) + { + char tmp[256]; + + ACE_OS::strncpy (tmp, + start, + len); + + tmp[len] = '\0'; + + Identifier *id = 0; + ACE_NEW_RETURN (id, + Identifier (tmp), + 0); + + if (retval == 0) + { + ACE_NEW_RETURN (retval, + UTL_ScopedName (id, + 0), + 0); + } + else + { + UTL_ScopedName *conc_name = 0; + ACE_NEW_RETURN (conc_name, + UTL_ScopedName (id, + 0), + 0); + + retval->nconc (conc_name); + } + } + + start = end + 2; + + end = ACE_OS::strstr (start, "::"); + } + + end = ACE_OS::strchr (start, ' '); + + len = end - start; + + char tmp[256]; + + ACE_OS::strncpy (tmp, + start, + len); + + tmp[len] = '\0'; + + Identifier *id = 0; + ACE_NEW_RETURN (id, + Identifier (tmp), + 0); + + if (retval == 0) + { + ACE_NEW_RETURN (retval, + UTL_ScopedName (id, + 0), + 0); + } + else + { + UTL_ScopedName *conc_name = 0; + ACE_NEW_RETURN (conc_name, + UTL_ScopedName (id, + 0), + 0); + + retval->nconc (conc_name); + } + + return retval; +} diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp index aa41928e408..04ed32ae32a 100644 --- a/TAO/TAO_IDL/util/utl_idlist.cpp +++ b/TAO/TAO_IDL/util/utl_idlist.cpp @@ -70,15 +70,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // NOTE: This list class only works correctly because we use single public // inheritance, as opposed to multiple inheritance or public virtual. -// It relies on a type-unsafe cast from UTL_List to subclasses, which -// will cease to operate correctly if you use either multiple or -// public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. +// It relies on a type-unsafe cast from UTL_List to subclasses, which +// will cease to operate correctly if you use either multiple or +// public virtual inheritance. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp index 8dfa1b4907f..ac155b68602 100644 --- a/TAO/TAO_IDL/util/utl_labellist.cpp +++ b/TAO/TAO_IDL/util/utl_labellist.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_list.cpp b/TAO/TAO_IDL/util/utl_list.cpp index 092c896c804..2c0f63e0de2 100644 --- a/TAO/TAO_IDL/util/utl_list.cpp +++ b/TAO/TAO_IDL/util/utl_list.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_namelist.cpp index d0f34fbf3f7..9f9869d32de 100644 --- a/TAO/TAO_IDL/util/utl_namelist.cpp +++ b/TAO/TAO_IDL/util/utl_namelist.cpp @@ -73,12 +73,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // It relies on a type-unsafe cast from UTL_List to subclasses, which // will cease to operate correctly if you use either multiple or // public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. #include "idl.h" #include "idl_extern.h" diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index b590f3f2416..1cded83d4cc 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -214,7 +214,8 @@ UTL_Scope::UTL_Scope (void) pd_referenced_used (0), pd_name_referenced (0), pd_name_referenced_allocated (0), - pd_name_referenced_used (0) + pd_name_referenced_used (0), + has_prefix_ (0) { } @@ -231,7 +232,8 @@ UTL_Scope::UTL_Scope (AST_Decl::NodeType nt) pd_referenced_used (0), pd_name_referenced (0), pd_name_referenced_allocated (0), - pd_name_referenced_used (0) + pd_name_referenced_used (0), + has_prefix_ (0) { } @@ -361,10 +363,6 @@ UTL_Scope::idl_keyword_clash (Identifier *e) // Public operations. -// Narrowing -IMPL_NARROW_METHODS0(UTL_Scope) -IMPL_NARROW_FROM_SCOPE(UTL_Scope) - // Scope Management Protocol. // // All members of the protocol defined in UTL_Scope simply return the node @@ -686,6 +684,19 @@ UTL_Scope::add_native (AST_Native *n) return n; } +AST_Factory * +UTL_Scope::add_factory (AST_Factory *f) +{ + //We don't invite any new types so there is nothing actually to add + if (f == 0) + { + return 0; + } + + f->set_added (I_TRUE); + return f; +} + // Protected Front End Scope Management Protocol. // // All members of the protocol defined in UTL_Scope simply return NULL @@ -825,6 +836,12 @@ UTL_Scope::fe_add_native (AST_Native *) return 0; } +AST_Factory * +UTL_Scope::fe_add_factory (AST_Factory *) +{ + return 0; +} + // This is the second pass of the front end // It calls the public add protocol on everything in scope. // It calls the add_xx functions of the most derived AST_Node. @@ -917,6 +934,10 @@ UTL_Scope::call_add (void) result = add_union_branch (AST_UnionBranch::narrow_from_decl (decl)); break; + case AST_Decl::NT_factory: + result = add_factory (AST_Factory::narrow_from_decl (decl)); + scope = AST_Factory::narrow_from_decl (decl); + break; default: return 0; } @@ -1660,7 +1681,10 @@ UTL_Scope::add_to_scope (AST_Decl *e, // The name of any scope except the unnamed scope formed by an operation // may not be redefined immediately within (and the root scope has no name). - if (nt != AST_Decl::NT_root && nt != AST_Decl::NT_op) + // As well as OBV factory construct. + if (nt != AST_Decl::NT_root + && nt != AST_Decl::NT_op + && nt != AST_Decl::NT_factory) { Identifier *parent_name = d->local_name (); @@ -1853,6 +1877,18 @@ UTL_Scope::referenced (AST_Decl *e, return I_FALSE; } +idl_bool +UTL_Scope::has_prefix (void) +{ + return this->has_prefix_; +} + +void +UTL_Scope::has_prefix (idl_bool val) +{ + this->has_prefix_ = val; +} + // Redefinition of inherited virtual operations. // AST Dumping. @@ -1944,6 +1980,10 @@ UTL_Scope::destroy (void) { } +// Narrowing. +IMPL_NARROW_METHODS0(UTL_Scope) +IMPL_NARROW_FROM_SCOPE(UTL_Scope) + // UTL_SCOPE_ACTIVE_ITERATOR // Constructor. @@ -1953,7 +1993,7 @@ UTL_ScopeActiveIterator::UTL_ScopeActiveIterator ( ) : iter_source (s), ik(i), - stage(i == UTL_Scope::IK_both ? UTL_Scope::IK_decls : i), + stage(i == UTL_Scope::IK_both ? UTL_Scope::IK_localtypes : i), il(0) { } @@ -2006,22 +2046,22 @@ UTL_ScopeActiveIterator::is_done (void) return I_FALSE; } - // Already done local types? - if (this->stage == UTL_Scope::IK_localtypes) + // Only want decls? + if (this->stage == UTL_Scope::IK_decls) { return I_TRUE; } - // Only want decls? - if (this->ik == UTL_Scope::IK_decls) + // Already done local types? + if (this->ik == UTL_Scope::IK_localtypes) { return I_TRUE; } // Switch to next stage. - this->stage = UTL_Scope::IK_localtypes; + this->stage = UTL_Scope::IK_decls; this->il = 0; - limit = this->iter_source->pd_locals_used; + limit = this->iter_source->pd_decls_used; } } diff --git a/TAO/TAO_IDL/util/utl_stack.cpp b/TAO/TAO_IDL/util/utl_stack.cpp index 11bd091ff2e..e96b087c469 100644 --- a/TAO/TAO_IDL/util/utl_stack.cpp +++ b/TAO/TAO_IDL/util/utl_stack.cpp @@ -104,45 +104,63 @@ UTL_ScopeStack::~UTL_ScopeStack() * Public operations */ -// Push an element on the stack +// Push an element on the stack. UTL_ScopeStack * -UTL_ScopeStack::push(UTL_Scope *el) +UTL_ScopeStack::push (UTL_Scope *el) { UTL_Scope **tmp; - long ostack_data_nalloced; - long i; + long ostack_data_nalloced; + long i; // Make sure there's space for one more - if (pd_stack_data_nalloced == pd_stack_top) { - ostack_data_nalloced = pd_stack_data_nalloced; - pd_stack_data_nalloced += INCREMENT; - tmp = new UTL_Scope *[pd_stack_data_nalloced]; + if (this->pd_stack_data_nalloced == this->pd_stack_top) + { + ostack_data_nalloced = this->pd_stack_data_nalloced; + this->pd_stack_data_nalloced += INCREMENT; + + ACE_NEW_RETURN (tmp, + UTL_Scope *[this->pd_stack_data_nalloced], + 0); - for (i = 0; i < ostack_data_nalloced; i++) - tmp[i] = pd_stack_data[i]; + for (i = 0; i < ostack_data_nalloced; ++i) + { + tmp[i] = this->pd_stack_data[i]; + } - delete []pd_stack_data; - pd_stack_data = tmp; - } + delete [] this->pd_stack_data; + this->pd_stack_data = tmp; + } - // Insert new scope - pd_stack_data[pd_stack_top++] = el; + // Insert new scope. + this->pd_stack_data[this->pd_stack_top++] = el; return this; } -// Pop an element from the stack +// Pop an element from the stack. void -UTL_ScopeStack::pop() +UTL_ScopeStack::pop (void) { - if (pd_stack_top <= 0) - return; - --pd_stack_top; + if (this->pd_stack_top <= 0) + { + return; + } + + // If our top scope has a #pragma prefix associated with it, + // it goes away with the scope. + if (this->top_non_null ()->has_prefix ()) + { + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + + --this->pd_stack_top; } // Return top element on stack UTL_Scope * -UTL_ScopeStack::top() +UTL_ScopeStack::top (void) { if (pd_stack_top <= 0) return NULL; @@ -151,7 +169,7 @@ UTL_ScopeStack::top() // Return bottom element on stack UTL_Scope * -UTL_ScopeStack::bottom() +UTL_ScopeStack::bottom (void) { if (pd_stack_top == 0) return NULL; @@ -160,21 +178,21 @@ UTL_ScopeStack::bottom() // Clear entire stack void -UTL_ScopeStack::clear() +UTL_ScopeStack::clear (void) { pd_stack_top = 0; } // How deep is the stack? unsigned long -UTL_ScopeStack::depth() +UTL_ScopeStack::depth (void) { return pd_stack_top; } // Return (top - 1) element on stack UTL_Scope * -UTL_ScopeStack::next_to_top() +UTL_ScopeStack::next_to_top (void) { UTL_Scope *tmp, *retval; @@ -190,7 +208,7 @@ UTL_ScopeStack::next_to_top() // Return topmost non-NULL element UTL_Scope * -UTL_ScopeStack::top_non_null() +UTL_ScopeStack::top_non_null (void) { long i; diff --git a/TAO/TAO_IDL/util/utl_strlist.cpp b/TAO/TAO_IDL/util/utl_strlist.cpp index 4e7a771d3fc..c7776e5cff3 100644 --- a/TAO/TAO_IDL/util/utl_strlist.cpp +++ b/TAO/TAO_IDL/util/utl_strlist.cpp @@ -70,15 +70,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // NOTE: This list class only works correctly because we use single public // inheritance, as opposed to multiple inheritance or public virtual. -// It relies on a type-unsafe cast from UTL_List to subclasses, which -// will cease to operate correctly if you use either multiple or -// public virtual inheritance. -// -// For portability reasons we have decided to provide both this and -// an implementation of the list classes in terms of templates. If -// your compiler supports templates, please use the files in the -// include/utl_tmpl and util/utl_tmpl directories instead of the -// files by the same names in the include and util directories. +// It relies on a type-unsafe cast from UTL_List to subclasses, which +// will cease to operate correctly if you use either multiple or +// public virtual inheritance. #include "idl.h" #include "idl_extern.h" |