diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-10 20:52:46 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-05-10 20:52:46 +0000 |
commit | 8106ea1d9086cb17eabe748f3ff9e2cf54dfe3b3 (patch) | |
tree | be85e81fc3d095096de97257ce22aab45e3d4a58 /TAO | |
parent | 73344b57d62f785899c966d7cf81c70029918ebe (diff) | |
download | ATCD-8106ea1d9086cb17eabe748f3ff9e2cf54dfe3b3.tar.gz |
ChangeLogTag:Wed May 10 15:44:23 2000 Nanbor Wang <nanbor@cs.wustl.edu>
Diffstat (limited to 'TAO')
58 files changed, 3959 insertions, 3789 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 27776c2c572..e2eeb736c3c 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,113 @@ +Wed May 10 15:44:23 2000 Nanbor Wang <nanbor@cs.wustl.edu> + + This batch of changes focus on propagating the "localness" up + and down of AST structures. For example, if one of the element + in a struct is local, then the whole struct is considered local. + IDL constructs finished in this stage are sequence, struct, + union, and exception. + + The code generation for local operations no longer uses special + internal states to differentiate local vs. remote operations. + This information is now embedded in the syntax tree. + + It's now illegal for a remote operation to have an argument of + local type. + + Known issues: Local arrays needs to be revisited to make sure we + generate the minimum code required. Also, an array of a local + type is also local. This is currently not 100% implemented. + + * docs/releasenotes/index.html: Updated the release info about + local interfaces. + + * TAO_IDL/fe/idl.yy: + * TAO_IDL/fe/y.tab.cpp: Modified the tree generation to propagate + localness info to operations, operations arguments, and + attributes. + + * TAO_IDL/include/ast_generator.h: + * TAO_IDL/ast/ast_generator.cpp: + * TAO_IDL/be_include/be_generator.h: + * TAO_IDL/be/be_generator.cpp: Modified the factory methods to + take in local and abstract info for Field, Operation, Attribute, + and Array. (Need more work on Array type.) Plus some cosmetic + changes. + + * TAO_IDL/include/ast_array.h: + * TAO_IDL/ast/ast_array.cpp: + * TAO_IDL/be_include/be_array.h: + * TAO_IDL/be/be_array.cpp: + * TAO_IDL/include/ast_attribute.h: + * TAO_IDL/ast/ast_attribute.cpp: + * TAO_IDL/be_include/be_attribute.h: + * TAO_IDL/be/be_attribute.cpp: + * TAO_IDL/include/ast_operation.h: + * TAO_IDL/ast/ast_operation.cpp: + * TAO_IDL/be_include/be_operation.h: + * TAO_IDL/be/be_operation.cpp: Modified constructors to pass in + local and abstract info. + + * TAO_IDL/ast/ast_typedef.cpp: + * TAO_IDL/be/be_typedef.cpp: Localness of typedef is determined by + both the enclosing scope and the type the typedef maps to. + + * TAO_IDL/be/be_union_branch.cpp: + * TAO_IDL/be/be_field.cpp: The default localness and abstractness + of a field (within a struct) or a branch (within a union) are + determined by the type of this field. Initialize them according + to the type info passed in. + + * TAO_IDL/be_include/be_exception.h: + * TAO_IDL/be/be_exception.cpp: + * TAO_IDL/be_include/be_structure.h: + * TAO_IDL/be/be_structure.cpp: + * TAO_IDL/be_include/be_union.h: + * TAO_IDL/be/be_union.cpp: + * TAO_IDL/include/ast_structure.h: + * TAO_IDL/ast/ast_structure.cpp: Moved methods <member_count>, + <compute_member_count> and their supporting data from backend + into their common baseclass ast_structure. Also moved the + <is_local> method from be_structure to ast_structure. It's + recursive semantics is required by all structure derived types. + + * TAO_IDL/be/be_visitor_interface/interface.cpp: + * TAO_IDL/be/be_visitor_operation/arglist.cpp: + * TAO_IDL/be/be_visitor_attribute/attribute.cpp: + * TAO_IDL/be/be_visitor_operation/operation_ch.cpp: + * TAO_IDL/be/be_visitor_operation/operation_cs.cpp: + * TAO_IDL/be/be_visitor_factory.cpp: Removed all *_LOCAL_* + states and changed to use the local information embedded in the + syntax tree. + + * TAO_IDL/be/be_visitor_ami_pre_proc.cpp: The contructor + signature for be_operation has changed. Changed to create all + AMI related opeations as remote interfaces. Some AMI interfaces + can probably be implemented as local interfaces and we might + want to work on that later on. + + * TAO_IDL/be/be_visitor_valuetype/valuetype.cpp: Like AMI + interfaces, all valuetype operations are considered to be remote + here. However, their code are generated by valuetype visitors + so the local information is not used there. + + * TAO_IDL/be/be_visitor_exception/any_op_ch.cpp: + * TAO_IDL/be/be_visitor_exception/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp: + * TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_structure/any_op_ch.cpp: + * TAO_IDL/be/be_visitor_structure/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp: + * TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp: + * TAO_IDL/be/be_visitor_union/any_op_ch.cpp: + * TAO_IDL/be/be_visitor_union/any_op_cs.cpp: + * TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_union/cdr_op_ci.cpp: + * TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp: Supressed visitors + for these constructed types from generating code for CDR, Any, + and Typecode if they are "local." + Wed May 10 11:59:35 2000 Carlos O'Ryan <coryan@uci.edu> * orbsvcs/orbsvcs/Makefile: diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp index aa0d1db6f08..9bded9937c8 100644 --- a/TAO/TAO_IDL/ast/ast_array.cpp +++ b/TAO/TAO_IDL/ast/ast_array.cpp @@ -74,8 +74,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. * arrays of AST_Interfaces??? */ -#include "idl.h" -#include "idl_extern.h" +#include "idl.h" +#include "idl_extern.h" ACE_RCSID(ast, ast_array, "$Id$") @@ -83,15 +83,20 @@ ACE_RCSID(ast, ast_array, "$Id$") * Constructor(s) and destructor */ AST_Array::AST_Array() - : pd_n_dims(0), - pd_dims(NULL), - pd_base_type(NULL) + : pd_n_dims(0), + pd_dims(NULL), + pd_base_type(NULL) { } -AST_Array::AST_Array(UTL_ScopedName *n, unsigned long nd, UTL_ExprList *ds) - : AST_Decl(AST_Decl::NT_array, n, NULL), - pd_n_dims(nd), pd_base_type(NULL) +AST_Array::AST_Array(UTL_ScopedName *n, + unsigned long nd, + UTL_ExprList *ds, + idl_bool local, + idl_bool abstract) + : AST_Decl(AST_Decl::NT_array, n, NULL), + COMMON_Base (local, abstract), + pd_n_dims(nd), pd_base_type(NULL) { pd_dims = compute_dims(ds, nd); } @@ -111,9 +116,9 @@ AST_Array::~AST_Array (void) AST_Expression ** AST_Array::compute_dims(UTL_ExprList *ds, unsigned long nds) { - AST_Expression **result; + AST_Expression **result; UTL_ExprlistActiveIterator *l; - unsigned long i; + unsigned long i; if (ds == NULL) return NULL; @@ -142,7 +147,7 @@ AST_Array::compute_dims(UTL_ExprList *ds, unsigned long nds) void AST_Array::dump(ostream &o) { - unsigned long i; + unsigned long i; pd_base_type->dump(o); o << " "; diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp index 82188f91b16..92d7185b044 100644 --- a/TAO/TAO_IDL/ast/ast_attribute.cpp +++ b/TAO/TAO_IDL/ast/ast_attribute.cpp @@ -53,8 +53,8 @@ Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks of Sun Microsystems, Inc. -SunSoft, Inc. -2550 Garcia Avenue +SunSoft, Inc. +2550 Garcia Avenue Mountain View, California 94043 NOTE: @@ -74,8 +74,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. * readonly. */ -#include "idl.h" -#include "idl_extern.h" +#include "idl.h" +#include "idl_extern.h" ACE_RCSID(ast, ast_attribute, "$Id$") @@ -83,17 +83,20 @@ ACE_RCSID(ast, ast_attribute, "$Id$") * Constructor(s) and destructor */ AST_Attribute::AST_Attribute() - : pd_readonly(I_TRUE) + : pd_readonly(I_TRUE) { } AST_Attribute::AST_Attribute(idl_bool ro, - AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) - : AST_Field(AST_Decl::NT_attr, ft, n, p), - AST_Decl(AST_Decl::NT_attr, n, p), - pd_readonly(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, abstract), + pd_readonly(ro) { } diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp index 498c91d06e8..9da6b271b66 100644 --- a/TAO/TAO_IDL/ast/ast_generator.cpp +++ b/TAO/TAO_IDL/ast/ast_generator.cpp @@ -98,8 +98,8 @@ ACE_RCSID(ast, ast_generator, "$Id$") */ AST_PredefinedType * AST_Generator::create_predefined_type(AST_PredefinedType::PredefinedType t, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n, + UTL_StrList *p) { return new AST_PredefinedType(t, n, p); } @@ -168,9 +168,9 @@ AST_Generator::create_interface_fwd(UTL_ScopedName *n, */ AST_Interface * AST_Generator::create_valuetype(UTL_ScopedName *, - AST_Interface ** /* ih */, - long /* nih */, - UTL_StrList *) + AST_Interface ** /* ih */, + long /* nih */, + UTL_StrList *) { // Valuetypes are represented as be_valuetype derived from be_interface, // which derives from AST_Interface. If you construct a backend which @@ -240,19 +240,23 @@ AST_Generator::create_enum(UTL_ScopedName *n, */ AST_Operation * AST_Generator::create_operation(AST_Type *rt, - AST_Operation::Flags fl, - UTL_ScopedName *n, - UTL_StrList *p) + AST_Operation::Flags fl, + UTL_ScopedName *n, + UTL_StrList *p, + idl_bool local, + idl_bool abstract) { - return new AST_Operation(rt, fl, n, p); + return new AST_Operation(rt, fl, n, p, local, abstract); } /* * Construct an AST_Field node (a field in a struct, union or exception) */ AST_Field * -AST_Generator::create_field(AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p, - AST_Field::Visibility vis) +AST_Generator::create_field(AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p, + AST_Field::Visibility vis) { return new AST_Field(ft, n, p, vis); } @@ -262,9 +266,9 @@ AST_Generator::create_field(AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p, */ AST_Argument * AST_Generator::create_argument(AST_Argument::Direction d, - AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p) { return new AST_Argument(d, ft, n, p); } @@ -274,11 +278,18 @@ AST_Generator::create_argument(AST_Argument::Direction d, */ AST_Attribute * AST_Generator::create_attribute(idl_bool ro, - AST_Type *ft, - UTL_ScopedName *n, - UTL_StrList *p) + AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p, + idl_bool local, + idl_bool abstract) { - return new AST_Attribute(ro, ft, n, p); + return new AST_Attribute(ro, + ft, + n, + p, + local, + abstract); } /* @@ -303,9 +314,9 @@ 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) + AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p) { return new AST_UnionBranch(ll, ft, n, p); } @@ -315,7 +326,7 @@ AST_Generator::create_union_branch(UTL_LabelList *ll, */ AST_UnionLabel * AST_Generator::create_union_label(AST_UnionLabel::UnionLabel ul, - AST_Expression *v) + AST_Expression *v) { return new AST_UnionLabel(ul, v); } @@ -325,9 +336,9 @@ 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) + AST_Expression *ev, + UTL_ScopedName *n, + UTL_StrList *p) { return new AST_Constant(et, ev, n, p); } @@ -345,7 +356,8 @@ AST_Generator::create_expr(UTL_ScopedName *n) * Construct an AST_Expression denoting a coercion */ AST_Expression * -AST_Generator::create_expr(AST_Expression *v, AST_Expression::ExprType t) +AST_Generator::create_expr(AST_Expression *v, + AST_Expression::ExprType t) { return new AST_Expression(v, t); } @@ -441,8 +453,8 @@ AST_Generator::create_expr(double d) */ AST_EnumVal * AST_Generator::create_enum_val(unsigned long v, - UTL_ScopedName *n, - UTL_StrList *p) + UTL_ScopedName *n, + UTL_StrList *p) { return new AST_EnumVal(v, n, p); } @@ -452,10 +464,16 @@ AST_Generator::create_enum_val(unsigned long v, */ AST_Array * AST_Generator::create_array(UTL_ScopedName *n, - unsigned long ndims, - UTL_ExprList *dims) + unsigned long ndims, + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract) { - return new AST_Array(n, ndims, dims); + return new AST_Array(n, + ndims, + dims, + local, + abstract); } /* diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp index 34906848d32..60f6d880e82 100644 --- a/TAO/TAO_IDL/ast/ast_operation.cpp +++ b/TAO/TAO_IDL/ast/ast_operation.cpp @@ -78,8 +78,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. * clause (implemented as an array of AST_Exceptions). */ -#include "idl.h" -#include "idl_extern.h" +#include "idl.h" +#include "idl_extern.h" ACE_RCSID(ast, ast_operation, "$Id$") @@ -94,12 +94,15 @@ AST_Operation::AST_Operation () { } -AST_Operation::AST_Operation (AST_Type *rt, - Flags fl, +AST_Operation::AST_Operation (AST_Type *rt, + Flags fl, UTL_ScopedName *n, - UTL_StrList *p) + UTL_StrList *p, + idl_bool local, + idl_bool abstract) : AST_Decl(AST_Decl::NT_op, n, p), UTL_Scope(AST_Decl::NT_op), + COMMON_Base (local, abstract), pd_return_type(rt), pd_flags(fl), pd_context(NULL), @@ -172,10 +175,10 @@ UTL_NameList * AST_Operation::fe_add_exceptions(UTL_NameList *t) { UTL_NamelistActiveIterator *nl_i; - UTL_ScopedName *nl_n; - UTL_Scope *fs = idl_global->scopes()->top(); - AST_Exception *fe; - AST_Decl *d; + UTL_ScopedName *nl_n; + UTL_Scope *fs = idl_global->scopes()->top(); + AST_Exception *fe; + AST_Decl *d; // Macro to avoid "warning: unused parameter" type warning. ACE_UNUSED_ARG (fs); @@ -264,9 +267,9 @@ AST_Operation::dump(ostream &o) UTL_ScopeActiveIterator *i; UTL_StrlistActiveIterator *si; UTL_ExceptlistActiveIterator *ei; - AST_Decl *d; - AST_Exception *e; - UTL_String *s; + AST_Decl *d; + AST_Exception *e; + UTL_String *s; if (pd_flags == OP_oneway) o << "oneway "; @@ -296,7 +299,7 @@ AST_Operation::dump(ostream &o) ei->next(); e->local_name()->dump(o); if (!(ei->is_done())) - o << ", "; + o << ", "; } delete ei; o << ")"; @@ -309,7 +312,7 @@ AST_Operation::dump(ostream &o) si->next(); o << s->get_string(); if (!(si->is_done())) - o << ", "; + o << ", "; } delete si; o << ")"; diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp index f8e3ac0979b..f46c517f362 100644 --- a/TAO/TAO_IDL/ast/ast_structure.cpp +++ b/TAO/TAO_IDL/ast/ast_structure.cpp @@ -72,8 +72,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. * structure's fields are managed in a scope). */ -#include "idl.h" -#include "idl_extern.h" +#include "idl.h" +#include "idl_extern.h" ACE_RCSID(ast, ast_structure, "$Id$") @@ -90,7 +90,9 @@ AST_Structure::AST_Structure (UTL_ScopedName *n, idl_bool abstract) : AST_Decl (AST_Decl::NT_struct, n, p), UTL_Scope (AST_Decl::NT_struct), - COMMON_Base (local, abstract) + COMMON_Base (local, abstract), + member_count_ (-1), + local_struct_ (-1) { } @@ -101,7 +103,9 @@ AST_Structure::AST_Structure (AST_Decl::NodeType nt, idl_bool abstract) : AST_Decl(nt, n, p), UTL_Scope(nt), - COMMON_Base (local, abstract) + COMMON_Base (local, abstract), + member_count_ (-1), + local_struct_ (-1) { } @@ -109,6 +113,78 @@ AST_Structure::~AST_Structure (void) { } +// compute total number of members +int +AST_Structure::compute_member_count (void) +{ + UTL_ScopeActiveIterator *si; // iterator + + this->member_count_ = 0; + + // if there are elements in this scope + if (this->nmembers () > 0) + { + // instantiate a scope iterator. + si = new UTL_ScopeActiveIterator (this, + UTL_Scope::IK_decls); + + while (!(si->is_done ())) + { + this->member_count_++; + si->next (); + } // end of while + + delete si; // free the iterator object + } + + return 0; +} + +// return the member count +int +AST_Structure::member_count (void) +{ + if (this->member_count_ == -1) + this->compute_member_count (); + + return this->member_count_; +} + +idl_bool +AST_Structure::is_local () +{ + if (this->local_struct_ == -1) + { + if (this->is_local_) + this->local_struct_ = this->is_local_; + else + { + this->local_struct_ = 0; + UTL_ScopeActiveIterator *si; // iterator + + if (this->nmembers () > 0) + { + // instantiate a scope iterator. + si = new UTL_ScopeActiveIterator (this, + UTL_Scope::IK_decls); + + while (!(si->is_done ())) + { + if (si->item ()->is_local ()) + { + this->local_struct_ = I_TRUE; + break; + } + si->next (); + } // end of while + + delete si; // free the iterator object + } + } + } + return this->local_struct_; +} + /* * Private operations */ diff --git a/TAO/TAO_IDL/ast/ast_typedef.cpp b/TAO/TAO_IDL/ast/ast_typedef.cpp index 46d70d57c4e..ca5528fe8a8 100644 --- a/TAO/TAO_IDL/ast/ast_typedef.cpp +++ b/TAO/TAO_IDL/ast/ast_typedef.cpp @@ -93,7 +93,7 @@ AST_Typedef::AST_Typedef (AST_Type *bt, idl_bool local, idl_bool abstract) : AST_Decl (AST_Decl::NT_typedef, n, p), - COMMON_Base (local, abstract), + COMMON_Base (bt->is_local () || local, abstract), pd_base_type(bt) { } diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp index 3d299062f36..7eb49d2fe58 100644 --- a/TAO/TAO_IDL/be/be_array.cpp +++ b/TAO/TAO_IDL/be/be_array.cpp @@ -33,9 +33,14 @@ be_array::be_array (void) { } -be_array::be_array (UTL_ScopedName *n, unsigned long ndims, UTL_ExprList *dims) - : AST_Array (n, ndims, dims), +be_array::be_array (UTL_ScopedName *n, + unsigned long ndims, + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract) + : AST_Array (n, ndims, dims, local, abstract), AST_Decl (AST_Decl::NT_array, n, NULL), + COMMON_Base (local, abstract), tao_name_ (0) { } diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp index f2a399b9f70..c14b4a2d366 100644 --- a/TAO/TAO_IDL/be/be_attribute.cpp +++ b/TAO/TAO_IDL/be/be_attribute.cpp @@ -19,9 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" ACE_RCSID(be, be_attribute, "$Id$") @@ -34,11 +34,16 @@ be_attribute::be_attribute (void) { } -be_attribute::be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p) - : AST_Attribute (ro, ft, n, p), +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), AST_Decl (AST_Decl::NT_attr, n, p), + COMMON_Base (local, abstract), get_strategy_ (new be_operation_default_strategy (0)), set_strategy_ (new be_operation_default_strategy (0)) { diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp index 7de0b3cdfe9..e4d1db32990 100644 --- a/TAO/TAO_IDL/be/be_exception.cpp +++ b/TAO/TAO_IDL/be/be_exception.cpp @@ -41,47 +41,11 @@ be_exception::be_exception (UTL_ScopedName *n, : AST_Decl (AST_Decl::NT_except, n, p), AST_Structure (AST_Decl::NT_except, n, p, local, abstract), UTL_Scope (AST_Decl::NT_except), - COMMON_Base (local, abstract), - member_count_ (-1) + COMMON_Base (local, abstract) { this->size_type (be_decl::VARIABLE); // always the case } -// compute total number of members -int -be_exception::compute_member_count (void) -{ - UTL_ScopeActiveIterator *si; // iterator - - this->member_count_ = 0; - - // if there are elements in this scope - if (this->nmembers () > 0) - { - // instantiate a scope iterator. - si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); - - while (!(si->is_done ())) - { - // get the next AST decl node - this->member_count_++; - si->next (); - } // end of while - delete si; // free the iterator object - } - return 0; -} - -// return the member count -int -be_exception::member_count (void) -{ - if (this->member_count_ == -1) - this->compute_member_count (); - - return this->member_count_; -} - // Are we or the parameter node involved in any recursion idl_bool be_exception::in_recursion (be_type *node) diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp index e0db61e127f..379bf29f363 100644 --- a/TAO/TAO_IDL/be/be_field.cpp +++ b/TAO/TAO_IDL/be/be_field.cpp @@ -34,7 +34,8 @@ 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) + AST_Decl (AST_Decl::NT_field, n, p), + 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 132b4b8828a..eb828868fcc 100644 --- a/TAO/TAO_IDL/be/be_generator.cpp +++ b/TAO/TAO_IDL/be/be_generator.cpp @@ -236,16 +236,17 @@ be_generator::create_interface_fwd (UTL_ScopedName *n, idl_bool local, idl_bool abstract) { - return (AST_InterfaceFwd *) new be_interface_fwd (this->create_interface (n, - 0, - -1, - 0, - 0, - p, - local, - abstract), - n, - p); + return + (AST_InterfaceFwd *) new be_interface_fwd (this->create_interface (n, + 0, + -1, + 0, + 0, + p, + local, + abstract), + n, + p); } /* @@ -329,17 +330,26 @@ AST_Operation * be_generator::create_operation(AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p) + UTL_StrList *p, + idl_bool local, + idl_bool abstract) { - return (AST_Operation *) new be_operation(rt, fl, n, p); + return (AST_Operation *) new be_operation(rt, + fl, + n, + p, + local, + abstract); } /* * Create a BE_Field node */ AST_Field * -be_generator::create_field(AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p, - AST_Field::Visibility vis) +be_generator::create_field(AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p, + AST_Field::Visibility vis) { return (AST_Field *) new be_field(ft, n, p, vis); } @@ -363,9 +373,16 @@ AST_Attribute * be_generator::create_attribute(idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p) + UTL_StrList *p, + idl_bool local, + idl_bool abstract) { - return (AST_Attribute *) new be_attribute(ro, ft, n, p); + return (AST_Attribute *) new be_attribute(ro, + ft, + n, + p, + local, + abstract); } /* @@ -537,9 +554,15 @@ be_generator::create_enum_val(unsigned long v, AST_Array * be_generator::create_array(UTL_ScopedName *n, unsigned long ndims, - UTL_ExprList *dims) + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract) { - return (AST_Array *) new be_array(n, ndims, dims); + return (AST_Array *) new be_array(n, + ndims, + dims, + local, + abstract); } /* diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp index 3020dc22673..9e1e3fef24f 100644 --- a/TAO/TAO_IDL/be/be_operation.cpp +++ b/TAO/TAO_IDL/be/be_operation.cpp @@ -19,9 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" ACE_RCSID(be, be_operation, "$Id$") @@ -35,11 +35,16 @@ be_operation::be_operation (void) { } -be_operation::be_operation (AST_Type *rt, AST_Operation::Flags fl, - UTL_ScopedName *n, UTL_StrList *p) - : AST_Operation (rt, fl, n, p), +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), UTL_Scope (AST_Decl::NT_op), + COMMON_Base (local, abstract), argument_count_ (-1), has_native_ (0), strategy_ (new be_operation_default_strategy (this)) @@ -69,15 +74,15 @@ be_operation::compute_argument_attr (void) { // instantiate a scope iterator. UTL_ScopeActiveIterator *si = - new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); + new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls); while (!(si->is_done ())) { // get the next AST decl node - AST_Decl *d = si->item (); + AST_Decl *d = si->item (); if (d->node_type () == AST_Decl::NT_argument) - { + { this->argument_count_++; be_argument *arg = be_argument::narrow_from_decl (d); be_type* type = @@ -99,7 +104,7 @@ be_operation::compute_argument_attr (void) } -int +int be_operation::void_return_type () { be_type* type = be_type::narrow_from_decl (this->return_type ()); @@ -199,7 +204,7 @@ TAO_CodeGen::CG_STATE be_operation::next_state (TAO_CodeGen::CG_STATE current_state, int is_extra_state) { - return this->strategy_->next_state (current_state, is_extra_state); + return this->strategy_->next_state (current_state, is_extra_state); } int diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp index ee43f3e90d6..4a21b786284 100644 --- a/TAO/TAO_IDL/be/be_structure.cpp +++ b/TAO/TAO_IDL/be/be_structure.cpp @@ -39,48 +39,10 @@ be_structure::be_structure (UTL_ScopedName *n, idl_bool abstract) : AST_Decl (AST_Decl::NT_struct, n, p), UTL_Scope (AST_Decl::NT_struct), - COMMON_Base (local, abstract), - member_count_ (-1) + COMMON_Base (local, abstract) { } -// compute total number of members -int -be_structure::compute_member_count (void) -{ - UTL_ScopeActiveIterator *si; // iterator - - this->member_count_ = 0; - - // if there are elements in this scope - if (this->nmembers () > 0) - { - // instantiate a scope iterator. - si = new UTL_ScopeActiveIterator (this, - UTL_Scope::IK_decls); - - while (!(si->is_done ())) - { - this->member_count_++; - si->next (); - } // end of while - - delete si; // free the iterator object - } - - return 0; -} - -// return the member count -int -be_structure::member_count (void) -{ - if (this->member_count_ == -1) - this->compute_member_count (); - - return this->member_count_; -} - // generate the _var definition for ourself int be_structure::gen_var_defn (char *) diff --git a/TAO/TAO_IDL/be/be_typedef.cpp b/TAO/TAO_IDL/be/be_typedef.cpp index 0f978f30de8..aaefcccf9c2 100644 --- a/TAO/TAO_IDL/be/be_typedef.cpp +++ b/TAO/TAO_IDL/be/be_typedef.cpp @@ -19,9 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" ACE_RCSID(be, be_typedef, "$Id$") @@ -35,7 +35,7 @@ be_typedef::be_typedef (AST_Type *bt, UTL_StrList *p, idl_bool local, idl_bool abstract) - : AST_Typedef (bt, n, p, local, abstract), + : AST_Typedef (bt, n, p, bt->is_local () || local, abstract), AST_Decl (AST_Decl::NT_typedef, n, p), COMMON_Base (local, abstract) { diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index 73a8a843105..e6a8cf60ab7 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -45,7 +45,6 @@ be_union::be_union (AST_ConcreteType *dt, AST_Decl (AST_Decl::NT_union, n, p), UTL_Scope (AST_Decl::NT_union), COMMON_Base (local, abstract), - member_count_ (-1), default_index_ (-2) { this->default_value_.computed_ = -2; @@ -54,31 +53,6 @@ be_union::be_union (AST_ConcreteType *dt, // compute total number of members int -be_union::compute_member_count (void) -{ - UTL_ScopeActiveIterator *si; // iterator - - this->member_count_ = 0; - - // if there are elements in this scope - if (this->nmembers () > 0) - { - // instantiate a scope iterator. - si = new UTL_ScopeActiveIterator (this, - UTL_Scope::IK_decls); - - while (!(si->is_done ())) - { - this->member_count_++; - si->next (); - } // end of while - delete si; // free the iterator object - } - return 0; -} - -// compute total number of members -int be_union::compute_default_index (void) { UTL_ScopeActiveIterator *si; // iterator @@ -122,16 +96,6 @@ be_union::compute_default_index (void) return 0; } -// return the member count -int -be_union::member_count (void) -{ - if (this->member_count_ == -1) - this->compute_member_count (); - - return this->member_count_; -} - // return the default_index int be_union::default_index (void) diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp index 620185d6920..1c45b78dda8 100644 --- a/TAO/TAO_IDL/be/be_union_branch.cpp +++ b/TAO/TAO_IDL/be/be_union_branch.cpp @@ -19,9 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" ACE_RCSID(be, be_union_branch, "$Id$") @@ -33,13 +33,14 @@ be_union_branch::be_union_branch (void) { } -be_union_branch::be_union_branch (UTL_LabelList *ll, +be_union_branch::be_union_branch (UTL_LabelList *ll, AST_Type *ft, - UTL_ScopedName *n, + UTL_ScopedName *n, UTL_StrList *p) : AST_UnionBranch (ll, ft, n, p), AST_Field (AST_Decl::NT_union_branch, ft, n, p), - AST_Decl (AST_Decl::NT_union_branch, n, p) + AST_Decl (AST_Decl::NT_union_branch, n, p), + COMMON_Base (ft->is_local (), ft->is_abstract ()) { } 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 0e41fc0f1d5..9d3b213d645 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -528,6 +528,8 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, 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); @@ -588,6 +590,8 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, be_operation * op = new be_operation (rt, AST_Operation::OP_noflags, op_name, + 0, + 0, 0); // Create the first argument, which is a Reply Handler @@ -720,6 +724,8 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, be_operation *operation = new be_operation (rt, AST_Operation::OP_noflags, op_name, + 0, + 0, 0); operation->set_name (op_name); @@ -839,15 +845,17 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, 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 (), 1, 0, I_FALSE), - 0)); + op_name->nconc (new UTL_ScopedName + (new Identifier + (new_op_name.rep (), 1, 0, I_FALSE), + 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); @@ -986,6 +994,8 @@ be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node) new be_operation (node->field_type (), AST_Operation::OP_noflags, get_name, + 0, + 0, 0); operation->set_name (get_name); operation->set_defined_in (node->defined_in ()); @@ -1024,6 +1034,8 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) be_operation *operation = new be_operation (rt, 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_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index c4ebeaef775..0edde660232 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -73,7 +73,9 @@ be_visitor_attribute::visit_attribute (be_attribute *node) be_operation *op = new be_operation (node->field_type (), AST_Operation::OP_noflags, node->name (), - 0); + 0, + node->is_local (), + node->is_abstract ()); op->set_name ((UTL_IdList *) node->name ()->copy ()); op->set_defined_in (node->defined_in ()); @@ -87,12 +89,6 @@ be_visitor_attribute::visit_attribute (be_attribute *node) // exactly the same code except different states. switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_H: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_H); - break; - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_S: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_S); - break; case TAO_CodeGen::TAO_ATTRIBUTE_CH: ctx.state (TAO_CodeGen::TAO_OPERATION_CH); break; @@ -208,7 +204,9 @@ be_visitor_attribute::visit_attribute (be_attribute *node) op = new be_operation (rt, AST_Operation::OP_noflags, node->name (), - 0); + 0, + node->is_local (), + node->is_abstract ()); op->set_name ((UTL_IdList *) node->name ()->copy ()); op->set_defined_in (node->defined_in ()); op->add_argument_to_scope (arg); @@ -225,15 +223,9 @@ be_visitor_attribute::visit_attribute (be_attribute *node) case TAO_CodeGen::TAO_ATTRIBUTE_CH: ctx.state (TAO_CodeGen::TAO_OPERATION_CH); break; - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_H: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_H); - break; case TAO_CodeGen::TAO_ATTRIBUTE_CS: ctx.state (TAO_CodeGen::TAO_OPERATION_CS); break; - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_S: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_S); - break; case TAO_CodeGen::TAO_ATTRIBUTE_SH: ctx.state (TAO_CodeGen::TAO_OPERATION_SH); break; diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp index 74fd57808b7..19ca3242e47 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_ch.cpp @@ -18,9 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" #include "be_visitor_exception.h" @@ -44,7 +44,9 @@ be_visitor_exception_any_op_ch::~be_visitor_exception_any_op_ch (void) int be_visitor_exception_any_op_ch::visit_exception (be_exception *node) { - if (node->cli_hdr_any_op_gen () || node->imported ()) + if (node->cli_hdr_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp index 0adeb3c242a..45c68895da9 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/any_op_cs.cpp @@ -45,7 +45,9 @@ be_visitor_exception_any_op_cs::~be_visitor_exception_any_op_cs (void) int be_visitor_exception_any_op_cs::visit_exception (be_exception *node) { - if (node->cli_stub_any_op_gen () || node->imported ()) + if (node->cli_stub_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp index 68e0d6f5c1a..0b1149ebfa9 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ch.cpp @@ -19,9 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" #include "be_visitor_exception.h" @@ -44,7 +44,9 @@ be_visitor_exception_cdr_op_ch::~be_visitor_exception_cdr_op_ch (void) int be_visitor_exception_cdr_op_ch::visit_exception (be_exception *node) { - if (node->cli_hdr_cdr_op_gen () || node->imported ()) + if (node->cli_hdr_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp index 2df15c83c41..c680b523c51 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_ci.cpp @@ -46,7 +46,9 @@ int be_visitor_exception_cdr_op_ci::visit_exception (be_exception *node) { // already generated and/or we are imported. Don't do anything. - if (node->cli_inline_cdr_op_gen () || node->imported ()) + if (node->cli_inline_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp index 22ddc620bcf..fe2f0d85230 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/cdr_op_cs.cpp @@ -39,7 +39,9 @@ be_visitor_exception_cdr_op_cs::~be_visitor_exception_cdr_op_cs (void) int be_visitor_exception_cdr_op_cs::visit_exception (be_exception *node) { - if (node->cli_stub_cdr_op_gen () || node->imported ()) + if (node->cli_stub_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; // set the substate as generating code for the types defined in our diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index f4e1adf042b..c47177253dd 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -143,15 +143,12 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_module_cdr_op (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: return new be_visitor_interface_ch (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CI: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: return new be_visitor_interface_ci (new_ctx); case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: return new be_visitor_interface_cs (new_ctx); case TAO_CodeGen::TAO_INTERFACE_SH: @@ -417,9 +414,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_decl (new_ctx); case TAO_CodeGen::TAO_ATTRIBUTE_CH: - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_H: case TAO_CodeGen::TAO_ATTRIBUTE_CS: - case TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_S: case TAO_CodeGen::TAO_ATTRIBUTE_SH: case TAO_CodeGen::TAO_ATTRIBUTE_IH: case TAO_CodeGen::TAO_ATTRIBUTE_SS: @@ -507,10 +502,8 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_UNION_ANY_OP_CS: return new be_visitor_union_any_op_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_CH: - case TAO_CodeGen::TAO_LOCAL_OPERATION_H: return new be_visitor_operation_ch (new_ctx); case TAO_CodeGen::TAO_OPERATION_CS: - case TAO_CodeGen::TAO_LOCAL_OPERATION_S: return new be_visitor_operation_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_SH: return new be_visitor_operation_sh (new_ctx); @@ -562,7 +555,6 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_operation_rettype_assign_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: - case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IS: diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp index 75e3a678f84..b1978a7c830 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp @@ -67,15 +67,9 @@ be_visitor_interface::visit_attribute (be_attribute *node) case TAO_CodeGen::TAO_INTERFACE_CH: ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_CH); break; - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: - ctx.state (TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_H); - break; case TAO_CodeGen::TAO_INTERFACE_CS: ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_CS); break; - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: - ctx.state (TAO_CodeGen::TAO_LOCAL_ATTRIBUTE_S); - break; case TAO_CodeGen::TAO_INTERFACE_SH: ctx.state (TAO_CodeGen::TAO_ATTRIBUTE_SH); break; @@ -169,11 +163,9 @@ be_visitor_interface::visit_constant (be_constant *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_CONSTANT_CH); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_CONSTANT_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: @@ -245,11 +237,9 @@ be_visitor_interface::visit_enum (be_enum *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_ENUM_CH); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_ENUM_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: @@ -331,15 +321,12 @@ be_visitor_interface::visit_exception (be_exception *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_EXCEPTION_CH); break; case TAO_CodeGen::TAO_INTERFACE_CI: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: ctx.state (TAO_CodeGen::TAO_EXCEPTION_CI); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_EXCEPTION_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: @@ -426,12 +413,6 @@ be_visitor_interface::visit_operation (be_operation *node) case TAO_CodeGen::TAO_INTERFACE_CS: ctx.state (TAO_CodeGen::TAO_OPERATION_CS); break; - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_H); - break; - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_S); - break; case TAO_CodeGen::TAO_INTERFACE_SH: ctx.state (TAO_CodeGen::TAO_OPERATION_SH); break; @@ -564,15 +545,12 @@ be_visitor_interface::visit_structure (be_structure *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_STRUCT_CH); break; case TAO_CodeGen::TAO_INTERFACE_CI: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: ctx.state (TAO_CodeGen::TAO_STRUCT_CI); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_STRUCT_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: @@ -653,15 +631,12 @@ be_visitor_interface::visit_union (be_union *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_UNION_CH); break; case TAO_CodeGen::TAO_INTERFACE_CI: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: ctx.state (TAO_CodeGen::TAO_UNION_CI); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_UNION_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: @@ -742,15 +717,12 @@ be_visitor_interface::visit_typedef (be_typedef *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_INTERFACE_CH: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_H: ctx.state (TAO_CodeGen::TAO_TYPEDEF_CH); break; case TAO_CodeGen::TAO_INTERFACE_CI: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_I: ctx.state (TAO_CodeGen::TAO_TYPEDEF_CI); break; case TAO_CodeGen::TAO_INTERFACE_CS: - case TAO_CodeGen::TAO_LOCAL_INTERFACE_S: ctx.state (TAO_CodeGen::TAO_TYPEDEF_CS); break; case TAO_CodeGen::TAO_INTERFACE_ANY_OP_CH: diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index 248841f6667..3e61eedc658 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -292,19 +292,13 @@ be_visitor_module::visit_interface (be_interface *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_MODULE_CH: - if (! node->is_local ()) - ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); - else - ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_H); + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); break; case TAO_CodeGen::TAO_MODULE_CI: ctx.state (TAO_CodeGen::TAO_INTERFACE_CI); break; case TAO_CodeGen::TAO_MODULE_CS: - if (! node->is_local ()) - ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); - else - ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_S); + ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); break; case TAO_CodeGen::TAO_MODULE_SH: ctx.state (TAO_CodeGen::TAO_INTERFACE_SH); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp index bc66c21e7cf..58f8e68eba5 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp @@ -71,7 +71,6 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: - case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: // last argument - is always CORBA::Environment @@ -104,14 +103,13 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: - *os << " = 0;\n\n"; - break; - // Fall thru. case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: - *os << ";\n\n"; + if (node->is_local ()) + *os << " = 0;\n\n"; + else + *os << ";\n\n"; break; case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: // each method is pure virtual in the server header @@ -167,7 +165,6 @@ be_visitor_operation_arglist::visit_argument (be_argument *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: - case TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H: ctx.state (TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH); break; case TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS: diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp index 1bfcf3a5f98..ab6e43918d2 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ch.cpp @@ -96,10 +96,7 @@ be_visitor_operation_ch::visit_operation (be_operation *node) // STEP 3: generate the argument list with the appropriate mapping. For these // we grab a visitor that generates the parameter listing ctx = *this->ctx_; - if (this->ctx_->state () == TAO_CodeGen::TAO_LOCAL_OPERATION_H) - ctx.state (TAO_CodeGen::TAO_LOCAL_OPERATION_ARGLIST_H); - else - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); visitor = tao_cg->make_visitor (&ctx); if (!visitor) { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp index 870767c23c6..69d4c2dfac9 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -64,7 +64,7 @@ be_visitor_operation_cs::visit_operation (be_operation *node) os = this->ctx_->stream (); this->ctx_->node (node); // save the node for future use - if (this->ctx_->state () == TAO_CodeGen::TAO_LOCAL_OPERATION_S) + if (node->is_local ()) return 0; os->indent (); // start with the current indentation level diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 9618d5d4fb6..0c8b7af6ac0 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -492,19 +492,13 @@ be_visitor_root::visit_interface (be_interface *node) switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_ROOT_CH: - if (! node->is_local ()) - ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); - else - ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_H); + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); break; case TAO_CodeGen::TAO_ROOT_CI: ctx.state (TAO_CodeGen::TAO_INTERFACE_CI); break; case TAO_CodeGen::TAO_ROOT_CS: - if (! node->is_local ()) - ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); - else - ctx.state (TAO_CodeGen::TAO_LOCAL_INTERFACE_S); + ctx.state (TAO_CodeGen::TAO_INTERFACE_CS); break; case TAO_CodeGen::TAO_ROOT_SH: ctx.state (TAO_CodeGen::TAO_INTERFACE_SH); diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp index 77311da083d..ca1eecdeb61 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_ch.cpp @@ -18,9 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" #include "be_visitor_structure.h" @@ -44,7 +44,9 @@ be_visitor_structure_any_op_ch::~be_visitor_structure_any_op_ch (void) int be_visitor_structure_any_op_ch::visit_structure (be_structure *node) { - if (node->cli_hdr_any_op_gen () || node->imported ()) + if (node->cli_hdr_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp index 88b6eaaa3c8..04dbfab0d22 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/any_op_cs.cpp @@ -45,7 +45,9 @@ be_visitor_structure_any_op_cs::~be_visitor_structure_any_op_cs (void) int be_visitor_structure_any_op_cs::visit_structure (be_structure *node) { - if (node->cli_stub_any_op_gen () || node->imported ()) + if (node->cli_stub_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp index 966a56f29a4..4aed27f26e2 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ch.cpp @@ -44,7 +44,9 @@ be_visitor_structure_cdr_op_ch::~be_visitor_structure_cdr_op_ch (void) int be_visitor_structure_cdr_op_ch::visit_structure (be_structure *node) { - if (node->cli_hdr_cdr_op_gen () || node->imported ()) + if (node->cli_hdr_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp index b3fc996b4cd..395750ef6a2 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_ci.cpp @@ -46,7 +46,9 @@ int be_visitor_structure_cdr_op_ci::visit_structure (be_structure *node) { // already generated and/or we are imported. Don't do anything. - if (node->cli_inline_cdr_op_gen () || node->imported ()) + if (node->cli_inline_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); @@ -133,7 +135,7 @@ be_visitor_structure_cdr_op_ci::post_process (be_decl *bd) { TAO_OutStream *os = this->ctx_->stream (); - if (!this->last_node (bd) + if (!this->last_node (bd) && bd->node_type () != AST_Decl::NT_enum_val) { switch (this->ctx_->sub_state ()) diff --git a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp index 6c7c0174899..db7f2e7cbc6 100644 --- a/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp @@ -39,7 +39,9 @@ be_visitor_structure_cdr_op_cs::~be_visitor_structure_cdr_op_cs (void) int be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node) { - if (node->cli_stub_cdr_op_gen () || node->imported ()) + if (node->cli_stub_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; // set the substate as generating code for the types defined in our scope diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp index b2ead4bea61..9075cb591a5 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_ch.cpp @@ -18,9 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" +#include "idl.h" +#include "idl_extern.h" +#include "be.h" #include "be_visitor_union.h" @@ -44,7 +44,9 @@ be_visitor_union_any_op_ch::~be_visitor_union_any_op_ch (void) int be_visitor_union_any_op_ch::visit_union (be_union *node) { - if (node->cli_hdr_any_op_gen () || node->imported ()) + if (node->cli_hdr_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp index 1ae318512d6..e8ad42ab833 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp @@ -45,7 +45,9 @@ be_visitor_union_any_op_cs::~be_visitor_union_any_op_cs (void) int be_visitor_union_any_op_cs::visit_union (be_union *node) { - if (node->cli_stub_any_op_gen () || node->imported ()) + if (node->cli_stub_any_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp index 0f883e1d480..95b1d63d3dd 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_ch.cpp @@ -44,7 +44,9 @@ be_visitor_union_cdr_op_ch::~be_visitor_union_cdr_op_ch (void) int be_visitor_union_cdr_op_ch::visit_union (be_union *node) { - if (node->cli_hdr_cdr_op_gen () || node->imported ()) + if (node->cli_hdr_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; TAO_OutStream *os = this->ctx_->stream (); 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 80e978244ad..314d324164e 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 @@ -45,7 +45,9 @@ int be_visitor_union_cdr_op_ci::visit_union (be_union *node) { // already generated and/or we are imported. Don't do anything. - if (node->cli_inline_cdr_op_gen () || node->imported ()) + if (node->cli_inline_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; // set the substate as generating code for the types defined in our scope diff --git a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp index f62a2206f04..507a62dd743 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp @@ -45,7 +45,9 @@ int be_visitor_union_cdr_op_cs::visit_union (be_union *node) { // already generated and/or we are imported. Don't do anything. - if (node->cli_stub_cdr_op_gen () || node->imported ()) + if (node->cli_stub_cdr_op_gen () || + node->imported () || + node->is_local ()) return 0; // set the substate as generating code for the types defined in our scope diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp index b5dee89d924..b4dec51679e 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp @@ -184,8 +184,12 @@ be_visitor_valuetype::visit_attribute (be_attribute *node) be_operation *op; // first the "get" operation - op = new be_operation (node->field_type (), AST_Operation::OP_noflags, - node->name (), 0); + op = new be_operation (node->field_type (), + AST_Operation::OP_noflags, + node->name (), + 0, + 0, + 0); op->set_name ((UTL_IdList *) node->name ()->copy ()); if (!op || this->visit_operation (op) == -1) { @@ -214,8 +218,12 @@ be_visitor_valuetype::visit_attribute (be_attribute *node) 0); arg->set_name ((UTL_IdList *) node->name ()->copy ()); // create the operation - op = new be_operation (rt, AST_Operation::OP_noflags, - node->name (), 0); + 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); diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h index fd9afcf42e7..a85bcb266df 100644 --- a/TAO/TAO_IDL/be_include/be_array.h +++ b/TAO/TAO_IDL/be_include/be_array.h @@ -41,7 +41,11 @@ public: be_array (void); // default constructor - be_array (UTL_ScopedName *n, unsigned long ndims, UTL_ExprList *dims); + be_array (UTL_ScopedName *n, + unsigned long ndims, + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract); // constructor ~be_array (void); diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h index 5112f115386..2ba4da31b0f 100644 --- a/TAO/TAO_IDL/be_include/be_attribute.h +++ b/TAO/TAO_IDL/be_include/be_attribute.h @@ -42,7 +42,12 @@ public: be_attribute (void); // default constructor - be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n, UTL_StrList *p); + be_attribute (idl_bool ro, + AST_Type *ft, + UTL_ScopedName *n, + UTL_StrList *p, + idl_bool local, + idl_bool abstract); // constructor // Visiting diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index 1526eb876f3..0924eaa3c6c 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -94,9 +94,6 @@ public: TAO_ATTRIBUTE_TIE_SH, TAO_ATTRIBUTE_TIE_SI, - TAO_LOCAL_ATTRIBUTE_H, - TAO_LOCAL_ATTRIBUTE_S, - // emitting code for array defn TAO_ARRAY_CH, TAO_ARRAY_CI, @@ -166,10 +163,6 @@ public: TAO_INTERFACE_SMART_PROXY_CH, TAO_INTERFACE_SMART_PROXY_CS, - TAO_LOCAL_INTERFACE_H, - TAO_LOCAL_INTERFACE_I, - TAO_LOCAL_INTERFACE_S, - // emitting code for the interface forward declaration TAO_INTERFACE_FWD_CH, TAO_INTERFACE_FWD_CI, @@ -293,11 +286,6 @@ public: TAO_OBV_OPERATION_ARGLIST_IMPL_CH, // for implementations, e.g. exception holders TAO_OBV_OPERATION_ARGLIST_IMPL_CS, // for implementations, e.g. exception holders - TAO_LOCAL_OPERATION_H, - TAO_LOCAL_OPERATION_I, - TAO_LOCAL_OPERATION_S, - TAO_LOCAL_OPERATION_ARGLIST_H, - // AMI next generation states TAO_AMI_INTERFACE_CH, TAO_AMI_SENDC_OPERATION_CH, diff --git a/TAO/TAO_IDL/be_include/be_exception.h b/TAO/TAO_IDL/be_include/be_exception.h index 158502bc9e4..0820e3fc65a 100644 --- a/TAO/TAO_IDL/be_include/be_exception.h +++ b/TAO/TAO_IDL/be_include/be_exception.h @@ -31,9 +31,6 @@ public: // =code generation - virtual int member_count (void); - // return the count of members - virtual idl_bool in_recursion (be_type *node = 0); // check if we or the parameter node is in recursion @@ -50,15 +47,6 @@ public: DEF_NARROW_METHODS3 (be_exception, AST_Exception, be_scope, be_type); DEF_NARROW_FROM_DECL (be_exception); DEF_NARROW_FROM_SCOPE (be_exception); - -private: - //=helper - - int compute_member_count (void); - // count the number of members - - int member_count_; - // number of members }; #endif // end of if !defined (...) diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h index f5153e5e75c..85b31a9f2b0 100644 --- a/TAO/TAO_IDL/be_include/be_generator.h +++ b/TAO/TAO_IDL/be_include/be_generator.h @@ -129,7 +129,9 @@ public: virtual AST_Operation *create_operation(AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p); + 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); @@ -141,7 +143,9 @@ public: virtual AST_Attribute *create_attribute(idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p); + UTL_StrList *p, + idl_bool local, + idl_bool abstract); virtual AST_Union *create_union(AST_ConcreteType *dt, UTL_ScopedName *n, UTL_StrList *p, @@ -179,7 +183,9 @@ public: UTL_StrList *p); virtual AST_Array *create_array(UTL_ScopedName *n, unsigned long ndims, - UTL_ExprList *dims); + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract); virtual AST_Sequence *create_sequence(AST_Expression *v, AST_Type *bt, idl_bool local, diff --git a/TAO/TAO_IDL/be_include/be_operation.h b/TAO/TAO_IDL/be_include/be_operation.h index fbfdb1156d3..72720a100b9 100644 --- a/TAO/TAO_IDL/be_include/be_operation.h +++ b/TAO/TAO_IDL/be_include/be_operation.h @@ -45,8 +45,12 @@ public: be_operation (void); // default constructor - be_operation (AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p); + be_operation (AST_Type *rt, + AST_Operation::Flags fl, + UTL_ScopedName *n, + UTL_StrList *p, + idl_bool local, + idl_bool abstract); // constructor ~be_operation (); @@ -70,7 +74,7 @@ public: virtual int accept (be_visitor *visitor); be_operation_strategy *set_strategy (be_operation_strategy *new_strategy); - + TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state, int is_extra_state = 0); // decide on the next state diff --git a/TAO/TAO_IDL/be_include/be_structure.h b/TAO/TAO_IDL/be_include/be_structure.h index 5268e563dc7..e0dcbf23eb7 100644 --- a/TAO/TAO_IDL/be_include/be_structure.h +++ b/TAO/TAO_IDL/be_include/be_structure.h @@ -63,16 +63,13 @@ public: char *full_name = 0); // generate the _out implementation - virtual int member_count (void); - // return the count of members - virtual idl_bool in_recursion (be_type *node = 0); // are we or the node represented by node involved in recursion - // Visiting virtual int accept (be_visitor *visitor); + // Visiting - // Narrowing + // Narrowing DEF_NARROW_METHODS3 (be_structure, AST_Structure, be_scope, be_type); DEF_NARROW_FROM_DECL (be_structure); DEF_NARROW_FROM_SCOPE (be_structure); @@ -80,16 +77,6 @@ public: protected: virtual int compute_size_type (void); // compute the size type if it is unknown - -private: - //=helper - - int compute_member_count (void); - // count the number of members - - int member_count_; - // number of members - }; #endif diff --git a/TAO/TAO_IDL/be_include/be_union.h b/TAO/TAO_IDL/be_include/be_union.h index 4fb780ecef0..81483ddbfcb 100644 --- a/TAO/TAO_IDL/be_include/be_union.h +++ b/TAO/TAO_IDL/be_include/be_union.h @@ -64,9 +64,6 @@ public: char *full_name = 0); // generate the _out implementation - virtual int member_count (void); - // return the count of members - virtual int default_index (void); // return the default index used @@ -115,18 +112,12 @@ protected: private: //=helper - int compute_member_count (void); - // count the number of members - int compute_default_index (void); // count the default index virtual int compute_default_value (void); // compute the implicit default value (if any) - int member_count_; - // number of members - int default_index_; // default label index (zero based indexing) diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index 73172941677..db73cdcb3f5 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -77,8 +77,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include <stdio.h> #if (defined(apollo) || defined(hpux)) && defined(__cplusplus) -extern "C" int yywrap(); -#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus) +extern "C" int yywrap(); +#endif // (defined(apollo) || defined(hpux)) && defined(__cplusplus) void yyerror (const char *); int yylex (void); @@ -95,77 +95,77 @@ extern int yyleng; */ %union { - AST_Decl *dcval; /* Decl value */ - UTL_StrList *slval; /* String list */ - UTL_NameList *nlval; /* Name list */ - UTL_ExprList *elval; /* Expression list */ - UTL_LabelList *llval; /* Label list */ - UTL_DeclList *dlval; /* Declaration list */ - FE_InterfaceHeader *ihval; /* Interface header */ - FE_obv_header *vhval; /* Valuetype header */ - AST_Expression *exval; /* Expression value */ - AST_UnionLabel *ulval; /* Union label */ - AST_Field *ffval; /* Field value */ - AST_Field::Visibility vival; /* N/A, pub or priv */ - AST_Expression::ExprType etval; /* Expression type */ - AST_Argument::Direction dival; /* Argument direction */ - AST_Operation::Flags ofval; /* Operation flags */ - FE_Declarator *deval; /* Declarator value */ - idl_bool bval; /* Boolean value */ - long ival; /* Long value */ - unsigned long uival; /* Unsigned long value */ - double dval; /* Double value */ - float fval; /* Float value */ - char cval; /* Char value */ - ACE_CDR::WChar wcval; /* WChar value */ - UTL_String *sval; /* String value */ - char *wsval; /* WString value */ - char *strval; /* char * value */ - Identifier *idval; /* Identifier */ - UTL_IdList *idlist; /* Identifier list */ + AST_Decl *dcval; /* Decl value */ + UTL_StrList *slval; /* String list */ + UTL_NameList *nlval; /* Name list */ + UTL_ExprList *elval; /* Expression list */ + UTL_LabelList *llval; /* Label list */ + UTL_DeclList *dlval; /* Declaration list */ + FE_InterfaceHeader *ihval; /* Interface header */ + FE_obv_header *vhval; /* Valuetype header */ + AST_Expression *exval; /* Expression value */ + AST_UnionLabel *ulval; /* Union label */ + AST_Field *ffval; /* Field value */ + AST_Field::Visibility vival; /* N/A, pub or priv */ + AST_Expression::ExprType etval; /* Expression type */ + AST_Argument::Direction dival; /* Argument direction */ + AST_Operation::Flags ofval; /* Operation flags */ + FE_Declarator *deval; /* Declarator value */ + idl_bool bval; /* Boolean value */ + long ival; /* Long value */ + unsigned long uival; /* Unsigned long value */ + double dval; /* Double value */ + float fval; /* Float value */ + char cval; /* Char value */ + ACE_CDR::WChar wcval; /* WChar value */ + UTL_String *sval; /* String value */ + char *wsval; /* WString value */ + char *strval; /* char * value */ + Identifier *idval; /* Identifier */ + UTL_IdList *idlist; /* Identifier list */ } /* * Token types: These are returned by the lexer */ -%token <strval> IDENTIFIER - -%token IDL_CONST -%token IDL_MODULE -%token IDL_INTERFACE -%token IDL_TYPEDEF -%token IDL_LONG -%token IDL_SHORT -%token IDL_UNSIGNED -%token IDL_DOUBLE -%token IDL_FLOAT -%token IDL_CHAR -%token IDL_WCHAR -%token IDL_OCTET -%token IDL_BOOLEAN -%token IDL_FIXED -%token IDL_ANY -%token IDL_STRUCT -%token IDL_UNION -%token IDL_SWITCH -%token IDL_ENUM -%token IDL_SEQUENCE -%token IDL_STRING -%token IDL_WSTRING -%token IDL_EXCEPTION -%token IDL_CASE -%token IDL_DEFAULT -%token IDL_READONLY -%token IDL_ATTRIBUTE -%token IDL_ONEWAY -%token IDL_IDEMPOTENT -%token IDL_VOID -%token IDL_IN -%token IDL_OUT -%token IDL_INOUT -%token IDL_RAISES -%token IDL_CONTEXT +%token <strval> IDENTIFIER + +%token IDL_CONST +%token IDL_MODULE +%token IDL_INTERFACE +%token IDL_TYPEDEF +%token IDL_LONG +%token IDL_SHORT +%token IDL_UNSIGNED +%token IDL_DOUBLE +%token IDL_FLOAT +%token IDL_CHAR +%token IDL_WCHAR +%token IDL_OCTET +%token IDL_BOOLEAN +%token IDL_FIXED +%token IDL_ANY +%token IDL_STRUCT +%token IDL_UNION +%token IDL_SWITCH +%token IDL_ENUM +%token IDL_SEQUENCE +%token IDL_STRING +%token IDL_WSTRING +%token IDL_EXCEPTION +%token IDL_CASE +%token IDL_DEFAULT +%token IDL_READONLY +%token IDL_ATTRIBUTE +%token IDL_ONEWAY +%token IDL_IDEMPOTENT +%token IDL_VOID +%token IDL_IN +%token IDL_OUT +%token IDL_INOUT +%token IDL_RAISES +%token IDL_CONTEXT %token IDL_NATIVE %token IDL_LOCAL /* OBV tokens see OMG ptc/98-10-04 3.2.4 */ @@ -178,69 +178,69 @@ extern int yyleng; %token IDL_TRUNCATABLE %token IDL_VALUETYPE -%token <ival> IDL_INTEGER_LITERAL +%token <ival> IDL_INTEGER_LITERAL %token <uival> IDL_UINTEGER_LITERAL -%token <sval> IDL_STRING_LITERAL -%token <cval> IDL_CHARACTER_LITERAL -%token <dval> IDL_FLOATING_PT_LITERAL -%token IDL_TRUETOK -%token IDL_FALSETOK - -%token <strval> IDL_SCOPE_DELIMITOR -%token IDL_LEFT_SHIFT -%token IDL_RIGHT_SHIFT -%token <wcval> IDL_WCHAR_LITERAL -%token <wsval> IDL_WSTRING_LITERAL +%token <sval> IDL_STRING_LITERAL +%token <cval> IDL_CHARACTER_LITERAL +%token <dval> IDL_FLOATING_PT_LITERAL +%token IDL_TRUETOK +%token IDL_FALSETOK + +%token <strval> IDL_SCOPE_DELIMITOR +%token IDL_LEFT_SHIFT +%token IDL_RIGHT_SHIFT +%token <wcval> IDL_WCHAR_LITERAL +%token <wsval> IDL_WSTRING_LITERAL /* * These are production names: */ -%type <dcval> type_spec simple_type_spec constructed_type_spec -%type <dcval> template_type_spec sequence_type_spec string_type_spec -%type <dcval> struct_type enum_type switch_type_spec union_type -%type <dcval> array_declarator op_type_spec seq_head wstring_type_spec +%type <dcval> type_spec simple_type_spec constructed_type_spec +%type <dcval> template_type_spec sequence_type_spec string_type_spec +%type <dcval> struct_type enum_type switch_type_spec union_type +%type <dcval> array_declarator op_type_spec seq_head wstring_type_spec %type <dcval> param_type_spec -%type <idlist> scoped_name -%type <slval> opt_context at_least_one_string_literal -%type <slval> string_literals +%type <idlist> scoped_name +%type <slval> opt_context at_least_one_string_literal +%type <slval> string_literals -%type <nlval> at_least_one_scoped_name scoped_names inheritance_spec -%type <nlval> opt_raises supports_spec +%type <nlval> at_least_one_scoped_name scoped_names inheritance_spec +%type <nlval> opt_raises supports_spec -%type <elval> at_least_one_array_dim array_dims +%type <elval> at_least_one_array_dim array_dims -%type <llval> at_least_one_case_label case_labels +%type <llval> at_least_one_case_label case_labels -%type <dlval> at_least_one_declarator declarators +%type <dlval> at_least_one_declarator declarators %type <dlval> at_least_one_simple_declarator simple_declarators -%type <ihval> interface_header +%type <ihval> interface_header %type <vhval> value_header -%type <exval> expression const_expr or_expr xor_expr and_expr shift_expr -%type <exval> add_expr mult_expr unary_expr primary_expr literal -%type <exval> positive_int_expr array_dim +%type <exval> expression const_expr or_expr xor_expr and_expr shift_expr +%type <exval> add_expr mult_expr unary_expr primary_expr literal +%type <exval> positive_int_expr array_dim -%type <ulval> case_label +%type <ulval> case_label -%type <ffval> element_spec +%type <ffval> element_spec -%type <etval> const_type integer_type char_type boolean_type -%type <etval> floating_pt_type any_type fixed_type signed_int -%type <etval> unsigned_int base_type_spec octet_type +%type <etval> const_type integer_type char_type boolean_type +%type <etval> floating_pt_type any_type fixed_type signed_int +%type <etval> unsigned_int base_type_spec octet_type -%type <dival> direction +%type <dival> direction -%type <ofval> opt_op_attribute +%type <ofval> opt_op_attribute -%type <deval> declarator simple_declarator complex_declarator +%type <deval> declarator simple_declarator complex_declarator -%type <bval> opt_readonly, opt_truncatable +%type <bval> opt_readonly, opt_truncatable -%type <idval> interface_decl value_decl id +%type <idval> interface_decl value_decl id %type <ival> type_dcl %% @@ -248,141 +248,141 @@ extern int yyleng; /* * Production starts here */ -start : definitions ; +start : definitions ; definitions - : definitions definition - | /* empty */ - ; + : definitions definition + | /* empty */ + ; definition - : type_dcl - { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); - } - ';' - { - 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_NoState); - } - | exception - { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); - } - ';' - { - 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_NoState); - } - | module - { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); - } - ';' - { - 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_NoState); - } - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; - -module : IDL_MODULE - { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); - } - IDENTIFIER - { - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($3, 1, 0, I_FALSE), NULL); - AST_Module *m = NULL; - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_StrList *p = idl_global->pragmas(); - - 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); - (void) s->fe_add_module (m); - } - /* - * Push it on the stack - */ - idl_global->scopes()->push(m); - } + : type_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } + ';' + { + 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_NoState); + } + | exception + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } + ';' + { + 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_NoState); + } + | module + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + } + ';' + { + 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_NoState); + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; + +module : IDL_MODULE + { + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + } + IDENTIFIER + { + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier($3, 1, 0, I_FALSE), NULL); + AST_Module *m = NULL; + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_StrList *p = idl_global->pragmas(); + + 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); + (void) s->fe_add_module (m); + } + /* + * Push it on the stack + */ + idl_global->scopes()->push(m); + } '{' - { - 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_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); - UTL_StrList *p = m->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); - } - ; + { + 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_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); + UTL_StrList *p = m->pragmas (); + if (p != 0) + p = (UTL_StrList*)p->copy (); + idl_global->set_pragmas (p); + idl_global->scopes()->pop(); + } + ; interface_def - : interface - | forward - ; + : interface + | forward + ; 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); - - /* - * Make a new interface node and add it to its enclosing scope - */ - if (s != NULL && $1 != NULL) { - i = idl_global->gen ()->create_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); + + /* + * Make a new interface node and add it to its enclosing scope + */ + if (s != NULL && $1 != NULL) { + i = idl_global->gen ()->create_interface ( $1->interface_name (), $1->inherits (), $1->n_inherits (), @@ -393,129 +393,129 @@ interface : $1->is_abstract () ); AST_Interface::fwd_redefinition_helper (i,s,p); - /* - * Add the interface to its definition scope - */ - (void) s->fe_add_interface (i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes ()->push (i); - } - '{' - { - 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_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); + /* + * Add the interface to its definition scope + */ + (void) s->fe_add_interface (i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes ()->push (i); + } + '{' + { + 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_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) + m->inherited_name_clash (); + UTL_StrList *p = m->pragmas (); + if (p != 0) { - p = (UTL_StrList*) p->copy (); + p = (UTL_StrList*) p->copy (); } - idl_global->set_pragmas (p); + 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); - } - id - { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); - $$ = $3; - } - ; + IDL_INTERFACE + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + $$ = $3; + } + ; interface_header : - interface_decl inheritance_spec - { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); - /* - * Create an AST representation of the information in the header - * part of an interface - this representation contains a computed - * list of all interfaces which this interface inherits from, - * recursively - */ - $$ = new FE_InterfaceHeader(new UTL_ScopedName($1, NULL), $2); - } + interface_decl inheritance_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + /* + * Create an AST representation of the information in the header + * part of an interface - this representation contains a computed + * list of all interfaces which this interface inherits from, + * recursively + */ + $$ = new FE_InterfaceHeader(new UTL_ScopedName($1, NULL), $2); + } | - IDL_LOCAL interface_decl inheritance_spec - { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); - /* - * Create an AST representation of the information in the header - * part of an interface - this representation contains a computed - * list of all interfaces which this interface inherits from, - * recursively - */ - $$ = new FE_Local_InterfaceHeader(new UTL_ScopedName($2, NULL), $3); - } + IDL_LOCAL interface_decl inheritance_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_InheritSpecSeen); + /* + * Create an AST representation of the information in the header + * part of an interface - this representation contains a computed + * list of all interfaces which this interface inherits from, + * recursively + */ + $$ = new FE_Local_InterfaceHeader(new UTL_ScopedName($2, NULL), $3); + } | - IDL_ABSTRACT interface_decl inheritance_spec - { + IDL_ABSTRACT interface_decl inheritance_spec + { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " 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); + 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 - } - ; + } + ; inheritance_spec - : ':' - { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); - } - at_least_one_scoped_name - { - $$ = $3; - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : ':' + { + idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + } + at_least_one_scoped_name + { + $$ = $3; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; value_def : valuetype | value_abs_decl | value_forward_decl | value_box_decl - ; + ; valuetype : IDL_CUSTOM value_concrete_decl { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle custom yet\n"; /* set custom (if not truncatable) */ } @@ -524,102 +524,102 @@ 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(); - - if (s != NULL && $1 != NULL) { - i = idl_global->gen()->create_valuetype($1->interface_name(), - $1->inherits(), - $1->n_inherits(), - p); + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Interface *i = NULL; + UTL_StrList *p = idl_global->pragmas(); + + 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); - /* - * Add the valuetype to its definition scope - */ - (void) s->fe_add_interface(i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes()->push(i); - } - '{' - { - 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_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); - 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(); + /* + * Add the valuetype to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); + } + '{' + { + 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_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); + 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(); } ; 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 = NULL; + UTL_StrList *p = idl_global->pragmas(); - if (s != NULL && $2 != NULL) { + if (s != NULL && $2 != NULL) { if ($2->n_concrete() > 0) { 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(), + p); i->set_abstract_valuetype (); AST_Interface::fwd_redefinition_helper (i,s,p); - /* - * Add the valuetype to its definition scope - */ - (void) s->fe_add_interface(i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes()->push(i); - } - '{' - { - 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_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); - 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(); + /* + * Add the valuetype to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); + } + '{' + { + 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_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); + 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(); } ; @@ -637,29 +637,29 @@ value_header : 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); - $$ = $3; + $$ = $3; } ; opt_truncatable : IDL_TRUNCATABLE - { + { cerr << "warning in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "truncatable modifier not supported and is ignored\n"; - $$ = I_FALSE; - /* $$ = I_TRUE; */ - } - | /* EMPTY */ - { - $$ = I_FALSE; - } - ; + $$ = I_FALSE; + /* $$ = I_TRUE; */ + } + | /* EMPTY */ + { + $$ = I_FALSE; + } + ; supports_spec : IDL_SUPPORTS @@ -677,51 +677,51 @@ 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(); - - 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); + 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(); + + 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) 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(); - - 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); - } + 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(); + + 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); + } idl_global->set_pragmas (p); - } - ; + } + ; value_box_decl : value_decl type_spec /* in this order %!?*/ { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle boxes yet\n"; } ; @@ -753,123 +753,123 @@ state_member ; exports - : exports export - | /* EMPTY */ - ; + : exports export + | /* EMPTY */ + ; export - : type_dcl - { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); - } - ';' - { - 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_NoState); - } - | exception - { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); - } - ';' - { - 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_NoState); - } - | operation - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - } - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; + : type_dcl + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + } + ';' + { + 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_NoState); + } + | exception + { + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + } + ';' + { + 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_NoState); + } + | operation + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; at_least_one_scoped_name : - scoped_name scoped_names - { - $$ = new UTL_NameList($1, $2); - } - ; + scoped_name scoped_names + { + $$ = new UTL_NameList($1, $2); + } + ; scoped_names - : scoped_names - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); - } - scoped_name - { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); - - if ($1 == NULL) - $$ = new UTL_NameList($4, NULL); - else { - $1->nconc(new UTL_NameList($4, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : scoped_names + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + } + scoped_name + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopedNameSeen); + + if ($1 == NULL) + $$ = new UTL_NameList($4, NULL); + else { + $1->nconc(new UTL_NameList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; scoped_name - : id - { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); - - $$ = new UTL_IdList($1, NULL); - } - | IDL_SCOPE_DELIMITOR - { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); - } - id - { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); - - $$ = new UTL_IdList(new Identifier($1, 1, 0, I_FALSE), - new UTL_IdList($3, NULL)); - } - | scoped_name - IDL_SCOPE_DELIMITOR - { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); - } - id - { - idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); - - $1->nconc(new UTL_IdList($4, NULL)); - $$ = $1; - } - ; + : id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $$ = new UTL_IdList($1, NULL); + } + | IDL_SCOPE_DELIMITOR + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $$ = new UTL_IdList(new Identifier($1, 1, 0, I_FALSE), + new UTL_IdList($3, NULL)); + } + | scoped_name + IDL_SCOPE_DELIMITOR + { + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + } + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); + + $1->nconc(new UTL_IdList($4, NULL)); + $$ = $1; + } + ; id: IDENTIFIER { @@ -878,704 +878,704 @@ id: IDENTIFIER ; 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(); - - 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); - } + 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(); + + 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); + } 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(); - - 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); - } + 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(); + + 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); + } 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(); - - 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); - } + 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(); + + 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); + } idl_global->set_pragmas (p); - } - ; + } + ; const_dcl : - IDL_CONST - { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); - } - const_type - { - 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_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; - - ACE_UNUSED_ARG (v); - - 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); - else { - c = - idl_global->gen()->create_constant($3, $9, n, p); - (void) s->fe_add_constant(c); - } - } + IDL_CONST + { + idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + } + const_type + { + 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_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; + + ACE_UNUSED_ARG (v); + + 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); + else { + c = + idl_global->gen()->create_constant($3, $9, n, p); + (void) s->fe_add_constant(c); + } + } idl_global->set_pragmas (p); - } - ; + } + ; const_type - : integer_type - | char_type - | octet_type - | boolean_type - | floating_pt_type - | fixed_type - | string_type_spec - { - $$ = AST_Expression::EV_string; - } - | wstring_type_spec - { - $$ = AST_Expression::EV_wstring; - } - | scoped_name - { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - AST_PredefinedType *c = NULL; - AST_Typedef *t = NULL; - - /* - * 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) { - /* - * Look through typedefs - */ - while (d->node_type() == AST_Decl::NT_typedef) { - t = AST_Typedef::narrow_from_decl(d); - if (t == NULL) - break; - d = t->base_type(); - } - if (d == NULL) - $$ = 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 { - $$ = AST_Expression::EV_any; - } - } else if (d->node_type () == AST_Decl::NT_string) { + : integer_type + | char_type + | octet_type + | boolean_type + | floating_pt_type + | fixed_type + | string_type_spec + { + $$ = AST_Expression::EV_string; + } + | wstring_type_spec + { + $$ = AST_Expression::EV_wstring; + } + | scoped_name + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + AST_PredefinedType *c = NULL; + AST_Typedef *t = NULL; + + /* + * 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) { + /* + * Look through typedefs + */ + while (d->node_type() == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl(d); + if (t == NULL) + break; + d = t->base_type(); + } + if (d == NULL) + $$ = 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 { + $$ = AST_Expression::EV_any; + } + } else if (d->node_type () == AST_Decl::NT_string) { $$ = AST_Expression::EV_string; } else if (d->node_type () == AST_Decl::NT_wstring) { - $$ = AST_Expression::EV_wstring; + $$ = AST_Expression::EV_wstring; } else - $$ = AST_Expression::EV_any; - } else - $$ = AST_Expression::EV_any; - } - ; + $$ = AST_Expression::EV_any; + } else + $$ = AST_Expression::EV_any; + } + ; -expression : const_expr ; +expression : const_expr ; const_expr : or_expr ; or_expr : xor_expr - | or_expr '|' xor_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_or, $1, $3); - } - ; + | or_expr '|' xor_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_or, $1, $3); + } + ; xor_expr - : and_expr - | xor_expr '^' and_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_xor, $1, $3); - } - ; + : and_expr + | xor_expr '^' and_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_xor, $1, $3); + } + ; and_expr - : shift_expr - | and_expr '&' shift_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_and, $1, $3); - } - ; + : shift_expr + | and_expr '&' shift_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_and, $1, $3); + } + ; shift_expr - : add_expr - | shift_expr IDL_LEFT_SHIFT add_expr - { - $$ = 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); - } - ; + : add_expr + | shift_expr IDL_LEFT_SHIFT add_expr + { + $$ = 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); + } + ; add_expr - : mult_expr - | add_expr '+' mult_expr - { - $$ = 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); - } - ; + : mult_expr + | add_expr '+' mult_expr + { + $$ = 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); + } + ; mult_expr - : unary_expr - | mult_expr '*' unary_expr - { - $$ = 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); - } - | mult_expr '%' unary_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_mod, $1, $3); - } - ; + : unary_expr + | mult_expr '*' unary_expr + { + $$ = 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); + } + | mult_expr '%' unary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_mod, $1, $3); + } + ; unary_expr - : primary_expr - | '+' primary_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, - $2, - NULL); - } - | '-' primary_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, - $2, - NULL); - } - | '~' primary_expr - { - $$ = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, - $2, - NULL); - } - ; + : primary_expr + | '+' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_plus, + $2, + NULL); + } + | '-' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_u_minus, + $2, + NULL); + } + | '~' primary_expr + { + $$ = idl_global->gen()->create_expr(AST_Expression::EC_bit_neg, + $2, + NULL); + } + ; primary_expr - : scoped_name - { - /* - * An expression which is a scoped name is not resolved now, - * but only when it is evaluated (such as when it is assigned - * as a constant value) - */ - $$ = idl_global->gen()->create_expr($1); - } - | literal - | '(' const_expr ')' - { - $$ = $2; - } - ; + : scoped_name + { + /* + * An expression which is a scoped name is not resolved now, + * but only when it is evaluated (such as when it is assigned + * as a constant value) + */ + $$ = idl_global->gen()->create_expr($1); + } + | literal + | '(' const_expr ')' + { + $$ = $2; + } + ; literal - : IDL_INTEGER_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_UINTEGER_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_STRING_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_WSTRING_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_CHARACTER_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_WCHAR_LITERAL - { - ACE_OutputCDR::from_wchar wc ($1); - $$ = idl_global->gen()->create_expr(wc); - } - | IDL_FLOATING_PT_LITERAL - { - $$ = idl_global->gen()->create_expr($1); - } - | IDL_TRUETOK - { - $$ = 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_INTEGER_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_UINTEGER_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_STRING_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_WSTRING_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_CHARACTER_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_WCHAR_LITERAL + { + ACE_OutputCDR::from_wchar wc ($1); + $$ = idl_global->gen()->create_expr(wc); + } + | IDL_FLOATING_PT_LITERAL + { + $$ = idl_global->gen()->create_expr($1); + } + | IDL_TRUETOK + { + $$ = 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); + } + ; positive_int_expr : - const_expr - { - $1->evaluate(AST_Expression::EK_const); - $$ = idl_global->gen()->create_expr($1, AST_Expression::EV_ulong); - } - ; + const_expr + { + $1->evaluate(AST_Expression::EK_const); + $$ = idl_global->gen()->create_expr($1, AST_Expression::EV_ulong); + } + ; type_dcl - : IDL_TYPEDEF - { - idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); - } - type_declarator {$$ = 0;} - | struct_type { $$ = 0;} - | union_type { $$ = 0;} - | enum_type { $$ = 0;} + : IDL_TYPEDEF + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + } + type_declarator {$$ = 0;} + | struct_type { $$ = 0;} + | union_type { $$ = 0;} + | 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(); + 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); - 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); - /* - * Add it to its defining scope - */ - (void) s->fe_add_native (node); - } + 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); + /* + * 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); - } - at_least_one_declarator - { - 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(); + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + } + at_least_one_declarator + { + 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); - 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; + 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, + continue; + t = idl_global->gen()->create_typedef(tp, d->name(), p, s->is_local (), s->is_abstract ()); - (void) s->fe_add_typedef(t); - } - delete l; - } + (void) s->fe_add_typedef(t); + } + delete l; + } idl_global->set_pragmas (p); - } - ; + } + ; type_spec - : simple_type_spec - | constructed_type_spec - ; + : simple_type_spec + | constructed_type_spec + ; simple_type_spec - : base_type_spec - { - $$ = 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; - - if (s != NULL) - d = s->lookup_by_name($1, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error($1); - $$ = d; - } - ; + : base_type_spec + { + $$ = 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; + + if (s != NULL) + d = s->lookup_by_name($1, I_TRUE); + if (d == NULL) + idl_global->err()->lookup_error($1); + $$ = d; + } + ; base_type_spec - : integer_type - | floating_pt_type - | char_type - | boolean_type - | octet_type - | fixed_type - | any_type - ; + : integer_type + | floating_pt_type + | char_type + | boolean_type + | octet_type + | fixed_type + | any_type + ; template_type_spec - : sequence_type_spec - | string_type_spec - | wstring_type_spec - ; + : sequence_type_spec + | string_type_spec + | wstring_type_spec + ; constructed_type_spec - : struct_type - | union_type - | enum_type - ; + : struct_type + | union_type + | enum_type + ; at_least_one_declarator : - declarator declarators - { - $$ = new UTL_DeclList($1, $2); - } - ; + declarator declarators + { + $$ = new UTL_DeclList($1, $2); + } + ; declarators - : declarators - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); - } - declarator - { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); - - if ($1 == NULL) - $$ = new UTL_DeclList($4, NULL); - else { - $1->nconc(new UTL_DeclList($4, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : declarators + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + } + declarator + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + + if ($1 == NULL) + $$ = new UTL_DeclList($4, NULL); + else { + $1->nconc(new UTL_DeclList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; declarator - : simple_declarator - | complex_declarator - ; + : simple_declarator + | complex_declarator + ; at_least_one_simple_declarator : - simple_declarator simple_declarators - { - $$ = new UTL_DeclList($1, $2); - } - ; + simple_declarator simple_declarators + { + $$ = new UTL_DeclList($1, $2); + } + ; simple_declarators - : simple_declarators - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); - } - simple_declarator - { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); - - if ($1 == NULL) - $$ = new UTL_DeclList($4, NULL); - else { - $1->nconc(new UTL_DeclList($4, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : simple_declarators + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + } + simple_declarator + { + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsDeclSeen); + + if ($1 == NULL) + $$ = new UTL_DeclList($4, NULL); + else { + $1->nconc(new UTL_DeclList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; simple_declarator : - id - { - $$ = new FE_Declarator(new UTL_ScopedName($1, NULL), - FE_Declarator::FD_simple, NULL); - } - ; + id + { + $$ = new FE_Declarator(new UTL_ScopedName($1, NULL), + FE_Declarator::FD_simple, NULL); + } + ; complex_declarator : - array_declarator - { - $$ = new FE_Declarator(new UTL_ScopedName($1->local_name(), NULL), - FE_Declarator::FD_complex, - $1); - } - ; + array_declarator + { + $$ = new FE_Declarator(new UTL_ScopedName($1->local_name(), NULL), + FE_Declarator::FD_complex, + $1); + } + ; integer_type - : signed_int - | unsigned_int - ; + : signed_int + | unsigned_int + ; signed_int - : IDL_LONG - { - $$ = AST_Expression::EV_long; - } - | IDL_LONG IDL_LONG - { - $$ = AST_Expression::EV_longlong; - } - | IDL_SHORT - { - $$ = AST_Expression::EV_short; - } - ; + : IDL_LONG + { + $$ = AST_Expression::EV_long; + } + | IDL_LONG IDL_LONG + { + $$ = AST_Expression::EV_longlong; + } + | IDL_SHORT + { + $$ = AST_Expression::EV_short; + } + ; unsigned_int - : IDL_UNSIGNED IDL_LONG - { - $$ = AST_Expression::EV_ulong; - } - | IDL_UNSIGNED IDL_LONG IDL_LONG - { - $$ = AST_Expression::EV_ulonglong; - } - | IDL_UNSIGNED IDL_SHORT - { - $$ = AST_Expression::EV_ushort; - } - ; + : IDL_UNSIGNED IDL_LONG + { + $$ = AST_Expression::EV_ulong; + } + | IDL_UNSIGNED IDL_LONG IDL_LONG + { + $$ = AST_Expression::EV_ulonglong; + } + | IDL_UNSIGNED IDL_SHORT + { + $$ = AST_Expression::EV_ushort; + } + ; floating_pt_type - : IDL_DOUBLE - { - $$ = AST_Expression::EV_double; - } - | IDL_FLOAT - { - $$ = AST_Expression::EV_float; - } - | IDL_LONG IDL_DOUBLE - { - $$ = AST_Expression::EV_longdouble; - } - ; + : IDL_DOUBLE + { + $$ = AST_Expression::EV_double; + } + | IDL_FLOAT + { + $$ = AST_Expression::EV_float; + } + | IDL_LONG IDL_DOUBLE + { + $$ = AST_Expression::EV_longdouble; + } + ; fixed_type - : IDL_FIXED - { + : IDL_FIXED + { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle fixed types yet\n"; - } - ; + } + ; char_type - : IDL_CHAR - { - $$ = AST_Expression::EV_char; - } - | IDL_WCHAR - { - $$ = AST_Expression::EV_wchar; + : IDL_CHAR + { + $$ = AST_Expression::EV_char; } - ; + | IDL_WCHAR + { + $$ = AST_Expression::EV_wchar; + } + ; octet_type - : IDL_OCTET - { + : IDL_OCTET + { $$ = AST_Expression::EV_octet; - } - ; + } + ; boolean_type - : IDL_BOOLEAN - { - $$ = AST_Expression::EV_bool; + : IDL_BOOLEAN + { + $$ = AST_Expression::EV_bool; } - ; + ; any_type - : IDL_ANY - { - $$ = AST_Expression::EV_any; - } - ; + : IDL_ANY + { + $$ = AST_Expression::EV_any; + } + ; struct_type : - IDL_STRUCT - { - 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; + IDL_STRUCT + { + 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); - 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, + 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); - } - /* - * Push the scope of the struct on the scopes stack - */ - idl_global->scopes()->push(d); - } - '{' - { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); - } - at_least_one_member - { - idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); - } - '}' - { - idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); - /* - * Done with this struct. Pop its scope off the scopes stack - */ + (void) s->fe_add_structure(d); + } + /* + * Push the scope of the struct on the scopes stack + */ + idl_global->scopes()->push(d); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + } + at_least_one_member + { + idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + } + '}' + { + 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); + 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(); - } - ; + } + ; at_least_one_member - : member members - | /* EMPTY */ - { - idl_global->err()->syntax_error(idl_global->parse_state()); - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; + : member members + | /* EMPTY */ + { + idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; members - : members member - | /* EMPTY */ - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; + : members member + | /* EMPTY */ + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; member : { @@ -1586,1113 +1586,1132 @@ member : ; member_i: - type_spec - { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); - } - at_least_one_declarator - { - 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(); - - 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); - /* - * 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) - continue; - AST_Type *tp = d->compose($1); - if (tp == NULL) - continue; + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + } + at_least_one_declarator + { + 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(); + + 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); + /* + * 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) + continue; + AST_Type *tp = d->compose($1); + if (tp == NULL) + 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); - } - delete l; - } - } - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; + f = idl_global->gen()->create_field(tp, d->name(), p, $<vival>0); + (void) s->fe_add_field(f); + } + delete l; + } + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; union_type : - IDL_UNION - { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); - } - id - { - 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_SwitchOpenParSeen); - } - switch_type_spec - { - 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(); + IDL_UNION + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + } + id + { + 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_SwitchOpenParSeen); + } + switch_type_spec + { + 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(); ACE_UNUSED_ARG (v); - 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); + 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); } else { - u = idl_global->gen()->create_union(tp, + u = idl_global->gen()->create_union(tp, n, p, 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->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_UnionQsSeen); - /* - * Done with this union. Pop its scope from the scopes stack - */ - $$ = - AST_Union::narrow_from_scope ( + (void) s->fe_add_union(u); + } + } + /* + * Push the scope of the union on the scopes stack + */ + idl_global->scopes()->push(u); + } + '{' + { + 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_UnionQsSeen); + /* + * Done with this union. Pop its scope from the scopes stack + */ + $$ = + 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(); + UTL_StrList *p = $$->pragmas (); + if (p != 0) + p = (UTL_StrList*)p->copy (); + idl_global->set_pragmas (p); + idl_global->scopes()->pop(); } - } - ; + } + ; switch_type_spec : - integer_type - { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); - } - | char_type - { - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); - } - | octet_type - { + integer_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | char_type + { + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | octet_type + { // octets are not allowed idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); - $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); - } - | boolean_type - { - $$ = 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; - - /* - * The discriminator is a scoped name. Try to resolve to - * one of the scalar types or to an enum. Thread through - * typedef's to arrive at the base type at the end of the - * chain - */ - if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { - while (!found) { - 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()) { - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_char: - case AST_PredefinedType::PT_wchar: - case AST_PredefinedType::PT_boolean: - $$ = p; - found = I_TRUE; - break; - case AST_PredefinedType::PT_octet: + $$ = idl_global->scopes()->bottom()->lookup_primitive_type($1); + } + | boolean_type + { + $$ = 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; + + /* + * The discriminator is a scoped name. Try to resolve to + * one of the scalar types or to an enum. Thread through + * typedef's to arrive at the base type at the end of the + * chain + */ + if (s != NULL && (d = s->lookup_by_name($1, I_TRUE)) != NULL) { + while (!found) { + 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()) { + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_char: + case AST_PredefinedType::PT_wchar: + case AST_PredefinedType::PT_boolean: + $$ = p; + found = I_TRUE; + break; + case AST_PredefinedType::PT_octet: // octets are not allowed idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); $$ = NULL; - found = I_TRUE; - break; - default: - $$ = NULL; - found = I_TRUE; - break; - } - } else + found = I_TRUE; + break; + default: + $$ = NULL; + found = I_TRUE; + break; + } + } else { - $$ = NULL; - found = I_TRUE; + $$ = NULL; + found = I_TRUE; } - break; - case AST_Decl::NT_typedef: - t = AST_Typedef::narrow_from_decl(d); - if (t != NULL) d = t->base_type(); - break; - default: - $$ = NULL; - found = I_TRUE; - break; - } - } - } else - $$ = NULL; - - if ($$ == NULL) - idl_global->err()->lookup_error($1); - } - ; + break; + case AST_Decl::NT_typedef: + t = AST_Typedef::narrow_from_decl(d); + if (t != NULL) d = t->base_type(); + break; + default: + $$ = NULL; + found = I_TRUE; + break; + } + } + } else + $$ = NULL; + + if ($$ == NULL) + idl_global->err()->lookup_error($1); + } + ; at_least_one_case_branch : case_branch case_branches ; case_branches - : case_branches case_branch - | /* empty */ - ; + : case_branches case_branch + | /* empty */ + ; case_branch : - at_least_one_case_label - { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); - } - element_spec - { - 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; + at_least_one_case_label + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + } + element_spec + { + 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); - 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); - } - } - | error - { - idl_global->err()->syntax_error(idl_global->parse_state()); - } - ';' - - { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - yyerrok; - } - ; + 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); + } + } + | error + { + idl_global->err()->syntax_error(idl_global->parse_state()); + } + ';' + + { + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + yyerrok; + } + ; at_least_one_case_label : - case_label case_labels - { - $$ = new UTL_LabelList($1, $2); - } - ; + case_label case_labels + { + $$ = new UTL_LabelList($1, $2); + } + ; case_labels - : case_labels case_label - { - if ($1 == NULL) - $$ = new UTL_LabelList($2, NULL); - else { - $1->nconc(new UTL_LabelList($2, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : case_labels case_label + { + if ($1 == NULL) + $$ = new UTL_LabelList($2, NULL); + else { + $1->nconc(new UTL_LabelList($2, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; case_label - : IDL_DEFAULT - { - idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); - } - ':' - { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); - - $$ = idl_global->gen()-> - create_union_label(AST_UnionLabel::UL_default, - NULL); - } - | IDL_CASE - { - 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_LabelColonSeen); - - $$ = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, - $3); - } - ; + : IDL_DEFAULT + { + idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + } + ':' + { + idl_global->set_parse_state(IDL_GlobalData::PS_LabelColonSeen); + + $$ = idl_global->gen()-> + create_union_label(AST_UnionLabel::UL_default, + NULL); + } + | IDL_CASE + { + 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_LabelColonSeen); + + $$ = idl_global->gen()->create_union_label(AST_UnionLabel::UL_label, + $3); + } + ; element_spec : - type_spec - { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); - } - declarator - { - 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); - /* - * Create a field in a union branch - */ - else if ($1 == NULL || $3 == NULL) - $$ = NULL; - else { - AST_Type *tp = $3->compose($1); - if (tp == NULL) - $$ = NULL; - else - $$ = idl_global->gen()->create_field(tp, - $3->name(), - idl_global->pragmas()); - } - } - ; + type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + } + declarator + { + 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); + /* + * Create a field in a union branch + */ + else if ($1 == NULL || $3 == NULL) + $$ = NULL; + else { + AST_Type *tp = $3->compose($1); + if (tp == NULL) + $$ = NULL; + else + $$ = idl_global->gen()->create_field(tp, + $3->name(), + idl_global->pragmas()); + } + } + ; enum_type : - IDL_ENUM - { - 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(); + IDL_ENUM + { + 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(); ACE_UNUSED_ARG (v); - 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, + 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 ()); - /* - * Add it to its defining scope - */ - (void) s->fe_add_enum(e); - } - /* - * Push the enum scope on the scopes stack - */ - idl_global->scopes()->push(e); - } - '{' - { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); - } - at_least_one_enumerator - { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); - } - '}' - { + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum(e); + } + /* + * Push the enum scope on the scopes stack + */ + idl_global->scopes()->push(e); + } + '{' + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + } + at_least_one_enumerator + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + } + '}' + { UTL_StrList *p = 0; - 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; - else { - $$ = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); + 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; + else { + $$ = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); p = $$->pragmas (); - idl_global->scopes()->pop(); - } + idl_global->scopes()->pop(); + } idl_global->set_pragmas (p); - } - ; + } + ; at_least_one_enumerator : enumerator enumerators ; enumerators - : enumerators - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + : enumerators + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); } - enumerator - | /* EMPTY */ - ; + enumerator + | /* EMPTY */ + ; enumerator : - IDENTIFIER - { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($1, 1, 0, I_FALSE), NULL); - AST_EnumVal *e = NULL; - AST_Enum *c = NULL; - UTL_StrList *p = idl_global->pragmas(); - - /* - * 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); - } - } - ; + IDENTIFIER + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_ScopedName *n = + new UTL_ScopedName(new Identifier($1, 1, 0, I_FALSE), NULL); + AST_EnumVal *e = NULL; + AST_Enum *c = NULL; + UTL_StrList *p = idl_global->pragmas(); + + /* + * 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); + } + } + ; sequence_type_spec : seq_head - ',' - { - 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_SequenceQsSeen); - /* - * Remove sequence marker from scopes stack - */ - if (idl_global->scopes()->top() == NULL) - idl_global->scopes()->pop(); + ',' + { + 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_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 (); - /* - * 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; - } else { - AST_Type *tp = AST_Type::narrow_from_decl($1); - if (tp == NULL) - ; // Error will be caught in FE_Declarator. - else { - $$ = idl_global->gen()->create_sequence($4, + /* + * 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; + } else { + AST_Type *tp = AST_Type::narrow_from_decl($1); + if (tp == NULL) + ; // Error will be caught in FE_Declarator. + else { + $$ = 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 - */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); - } - } - } - | seq_head - '>' - { - 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(); + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + } + } + } + | seq_head + '>' + { + 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 (); - /* - * Create a node representing a sequence - */ - if ($1 == NULL) - $$ = NULL; - else { - AST_Type *tp = AST_Type::narrow_from_decl($1); - if (tp == NULL) - ; // Error will be caught in FE_Declarator. + /* + * Create a node representing a sequence + */ + if ($1 == NULL) + $$ = NULL; + else { + AST_Type *tp = AST_Type::narrow_from_decl($1); + if (tp == NULL) + ; // Error will be caught in FE_Declarator. else { - $$ = - idl_global->gen()->create_sequence( - idl_global->gen()->create_expr((unsigned long) 0), - tp, + $$ = + 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 - */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); - } - } - } - ; + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl($$)); + } + } + } + ; seq_head: - IDL_SEQUENCE - { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); - /* - * Push a sequence marker on scopes stack - */ - idl_global->scopes()->push(NULL); - } - '<' - { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); - } - simple_type_spec - { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); - $$ = $5; - } - ; + IDL_SEQUENCE + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + /* + * Push a sequence marker on scopes stack + */ + idl_global->scopes()->push(NULL); + } + '<' + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + } + simple_type_spec + { + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + $$ = $5; + } + ; string_type_spec - : string_head - '<' - { - 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_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; - } else { - $$ = 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($$)); - } - } - | string_head - { - 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)); - /* - * Add this AST_String to the types defined in the global scope - */ - (void) idl_global->root() + : string_head + '<' + { + 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_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; + } else { + $$ = 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($$)); + } + } + | string_head + { + 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)); + /* + * Add this AST_String to the types defined in the global scope + */ + (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_STRING + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); } - ; + ; wstring_type_spec - : wstring_head - '<' - { - 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_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; - } else { - $$ = 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($$)); - } - } - | wstring_head - { - 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)); - /* - * Add this AST_String to the types defined in the global scope - */ - (void) idl_global->root() + : wstring_head + '<' + { + 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_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; + } else { + $$ = 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($$)); + } + } + | wstring_head + { + 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)); + /* + * Add this AST_String to the types defined in the global scope + */ + (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_WSTRING + { + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); } - ; + ; array_declarator : - id - { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); - } - at_least_one_array_dim - { - 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); - } - } - ; + id + { + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + } + at_least_one_array_dim + { + 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); + } + } + ; at_least_one_array_dim : - array_dim array_dims - { - $$ = new UTL_ExprList($1, $2); - } - ; + array_dim array_dims + { + $$ = new UTL_ExprList($1, $2); + } + ; array_dims - : array_dims array_dim - { - if ($1 == NULL) - $$ = new UTL_ExprList($2, NULL); - else { - $1->nconc(new UTL_ExprList($2, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : array_dims array_dim + { + if ($1 == NULL) + $$ = new UTL_ExprList($2, NULL); + else { + $1->nconc(new UTL_ExprList($2, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; array_dim : - '[' - { - 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_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; - } else - $$ = $3; - } - ; + '[' + { + 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_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; + } else + $$ = $3; + } + ; attribute: - opt_readonly - IDL_ATTRIBUTE - { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); - } - param_type_spec - { - 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(); - - 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) - continue; - AST_Type *tp = d->compose($4); - if (tp == NULL) - continue; - a = idl_global->gen()->create_attribute($1, tp, (UTL_IdList *) d->name()->copy (), p); - /* - * Add one attribute to the enclosing scope - */ - (void) s->fe_add_attribute(a); - } - delete l; - } + opt_readonly + IDL_ATTRIBUTE + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + } + param_type_spec + { + 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(); + + 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) + continue; + AST_Type *tp = d->compose($4); + if (tp == NULL) + continue; + a = idl_global->gen()->create_attribute($1, + tp, + (UTL_IdList *) d->name()->copy (), + p, + s->is_local (), + s->is_abstract ()); + /* + * Add one attribute to the enclosing scope + */ + (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); - $$ = I_TRUE; - } - | /* EMPTY */ - { - $$ = I_FALSE; - } - ; + : IDL_READONLY + { + idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + $$ = I_TRUE; + } + | /* EMPTY */ + { + $$ = I_FALSE; + } + ; exception : - IDL_EXCEPTION - { - 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; + IDL_EXCEPTION + { + 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); - 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, + 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); - } - /* - * Push the exception scope on the scope stack - */ - idl_global->scopes()->push(e); - } - '{' - { - 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_ExceptQsSeen); - /* - * Done with this exception. Pop its scope from the scope stack - */ + (void) s->fe_add_exception(e); + } + /* + * Push the exception scope on the scope stack + */ + idl_global->scopes()->push(e); + } + '{' + { + 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_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->scopes()->pop(); idl_global->set_pragmas (p); - } - ; + } + ; operation : - opt_op_attribute - op_type_spec - { - 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, 1, 0, I_FALSE), NULL); - AST_Operation *o = NULL; - UTL_StrList *p = idl_global->pragmas(); - - 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); + opt_op_attribute + op_type_spec + { + 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, 1, 0, I_FALSE), NULL); + AST_Operation *o = NULL; + UTL_StrList *p = idl_global->pragmas(); + + 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); } else { - o = idl_global->gen()->create_operation(tp, $1, n, p); - (void) s->fe_add_operation(o); - } - } - /* - * Push the operation scope onto the scopes stack - */ - idl_global->scopes()->push(o); - } - parameter_list - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); - } - opt_raises - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); - } - opt_context - { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Operation *o = NULL; - - 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 ($8 != NULL && o != NULL) - (void) o->fe_add_exceptions($8); - if ($10 != NULL) - (void) o->fe_add_context($10); - } - /* - * Done with this operation. Pop its scope from the scopes stack - */ - idl_global->scopes()->pop(); - } - ; + o = idl_global->gen()->create_operation(tp, + $1, + n, + p, + 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); + } + parameter_list + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + } + opt_raises + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + } + opt_context + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Operation *o = NULL; + + 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 ($8 != NULL && o != NULL) + (void) o->fe_add_exceptions($8); + if ($10 != NULL) + (void) o->fe_add_context($10); + } + /* + * Done with this operation. Pop its scope from the scopes stack + */ + idl_global->scopes()->pop(); + } + ; opt_op_attribute - : IDL_ONEWAY - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); - $$ = AST_Operation::OP_oneway; - } - | IDL_IDEMPOTENT - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); - $$ = AST_Operation::OP_idempotent; - } - | /* EMPTY */ - { - $$ = AST_Operation::OP_noflags; - } - ; + : IDL_ONEWAY + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + $$ = AST_Operation::OP_oneway; + } + | IDL_IDEMPOTENT + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + $$ = AST_Operation::OP_idempotent; + } + | /* EMPTY */ + { + $$ = AST_Operation::OP_noflags; + } + ; op_type_spec - : param_type_spec - | IDL_VOID - { - $$ = - idl_global->scopes()->bottom() - ->lookup_primitive_type(AST_Expression::EV_void); - } - ; + : param_type_spec + | IDL_VOID + { + $$ = + idl_global->scopes()->bottom() + ->lookup_primitive_type(AST_Expression::EV_void); + } + ; init_decl : IDL_INIT { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle init yet\n"; } ; 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); + at_least_one_parameter + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); } - ; + ; at_least_one_parameter : parameter parameters ; parameters - : parameters - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + : parameters + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); } - parameter - | /* EMPTY */ - ; + parameter + | /* EMPTY */ + ; parameter : - direction - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); - } - param_type_spec - { - 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(); - - 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) { - a = idl_global->gen()->create_argument($1, tp, (UTL_IdList *) $5->name ()->copy (), p); - (void) s->fe_add_argument(a); - } - } - } - ; + direction + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + } + param_type_spec + { + 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(); + + 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 (!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"; + } + else + { + a = idl_global->gen()->create_argument($1, tp, (UTL_IdList *) $5->name ()->copy (), p); + (void) s->fe_add_argument(a); + } + } + } + } + ; 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 + | wstring_type_spec | scoped_name - { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - AST_Decl *d = NULL; - - if (s != NULL) - d = s->lookup_by_name($1, I_TRUE); - if (d == NULL) - idl_global->err()->lookup_error($1); - $$ = d; - } - ; + { + UTL_Scope *s = idl_global->scopes()->top_non_null(); + AST_Decl *d = NULL; + + if (s != NULL) + d = s->lookup_by_name($1, I_TRUE); + if (d == NULL) + idl_global->err()->lookup_error($1); + $$ = d; + } + ; direction - : IDL_IN - { - $$ = AST_Argument::dir_IN; - } - | IDL_OUT - { - $$ = AST_Argument::dir_OUT; - } - | IDL_INOUT - { - $$ = AST_Argument::dir_INOUT; - } - ; + : IDL_IN + { + $$ = AST_Argument::dir_IN; + } + | IDL_OUT + { + $$ = AST_Argument::dir_OUT; + } + | IDL_INOUT + { + $$ = AST_Argument::dir_INOUT; + } + ; opt_raises - : IDL_RAISES - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); - } - '(' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); - } - at_least_one_scoped_name - ')' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); - $$ = $5; - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : IDL_RAISES + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + } + '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + } + at_least_one_scoped_name + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + $$ = $5; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; opt_context - : IDL_CONTEXT - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); - } - '(' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); - } - at_least_one_string_literal - ')' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); - $$ = $5; - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : IDL_CONTEXT + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + } + '(' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + } + at_least_one_string_literal + ')' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + $$ = $5; + } + | /* EMPTY */ + { + $$ = NULL; + } + ; at_least_one_string_literal : - IDL_STRING_LITERAL string_literals - { - $$ = new UTL_StrList($1, $2); - } - ; + IDL_STRING_LITERAL string_literals + { + $$ = new UTL_StrList($1, $2); + } + ; string_literals - : string_literals - ',' - { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); - } - IDL_STRING_LITERAL - { - if ($1 == NULL) - $$ = new UTL_StrList($4, NULL); - else { - $1->nconc(new UTL_StrList($4, NULL)); - $$ = $1; - } - } - | /* EMPTY */ - { - $$ = NULL; - } - ; + : string_literals + ',' + { + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + } + IDL_STRING_LITERAL + { + if ($1 == NULL) + $$ = new UTL_StrList($4, NULL); + else { + $1->nconc(new UTL_StrList($4, NULL)); + $$ = $1; + } + } + | /* EMPTY */ + { + $$ = NULL; + } + ; %% /* programs */ diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index 9c4afa55c31..11a8e03c8c4 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -10,8 +10,8 @@ char tao_yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90 \n\ #include <stdio.h> #if (defined(apollo) || defined(hpux)) && defined(__cplusplus) -extern "C" int tao_yywrap(); -#endif /* (defined(apollo) || defined(hpux)) && defined(__cplusplus)*/ +extern "C" int tao_yywrap(); +#endif /* (defined(apollo) || defined(hpux)) && defined(__cplusplus)*/ void tao_yyerror (const char *); int tao_yylex (void); @@ -23,34 +23,34 @@ extern int tao_yyleng; #define TAO_YYDEBUG 1 #line 97 "fe/idl.tao_yy" typedef union { - AST_Decl *dcval; /* Decl value */ - UTL_StrList *slval; /* String list */ - UTL_NameList *nlval; /* Name list */ - UTL_ExprList *elval; /* Expression list */ - UTL_LabelList *llval; /* Label list */ - UTL_DeclList *dlval; /* Declaration list */ - FE_InterfaceHeader *ihval; /* Interface header */ - FE_obv_header *vhval; /* Valuetype header */ - AST_Expression *exval; /* Expression value */ - AST_UnionLabel *ulval; /* Union label */ - AST_Field *ffval; /* Field value */ - AST_Field::Visibility vival; /* N/A, pub or priv */ - AST_Expression::ExprType etval; /* Expression type */ - AST_Argument::Direction dival; /* Argument direction */ - AST_Operation::Flags ofval; /* Operation flags */ - FE_Declarator *deval; /* Declarator value */ - idl_bool bval; /* Boolean value */ - long ival; /* Long value */ - unsigned long uival; /* Unsigned long value */ - double dval; /* Double value */ - float fval; /* Float value */ - char cval; /* Char value */ - ACE_CDR::WChar wcval; /* WChar value */ - UTL_String *sval; /* String value */ - char *wsval; /* WString value */ - char *strval; /* char * value */ - Identifier *idval; /* Identifier */ - UTL_IdList *idlist; /* Identifier list */ + AST_Decl *dcval; /* Decl value */ + UTL_StrList *slval; /* String list */ + UTL_NameList *nlval; /* Name list */ + UTL_ExprList *elval; /* Expression list */ + UTL_LabelList *llval; /* Label list */ + UTL_DeclList *dlval; /* Declaration list */ + FE_InterfaceHeader *ihval; /* Interface header */ + FE_obv_header *vhval; /* Valuetype header */ + AST_Expression *exval; /* Expression value */ + AST_UnionLabel *ulval; /* Union label */ + AST_Field *ffval; /* Field value */ + AST_Field::Visibility vival; /* N/A, pub or priv */ + AST_Expression::ExprType etval; /* Expression type */ + AST_Argument::Direction dival; /* Argument direction */ + AST_Operation::Flags ofval; /* Operation flags */ + FE_Declarator *deval; /* Declarator value */ + idl_bool bval; /* Boolean value */ + long ival; /* Long value */ + unsigned long uival; /* Unsigned long value */ + double dval; /* Double value */ + float fval; /* Float value */ + char cval; /* Char value */ + ACE_CDR::WChar wcval; /* WChar value */ + UTL_String *sval; /* String value */ + char *wsval; /* WString value */ + char *strval; /* char * value */ + Identifier *idval; /* Identifier */ + UTL_IdList *idlist; /* Identifier list */ } TAO_YYSTYPE; #line 55 "y.tab.cpp" #define IDENTIFIER 257 @@ -965,7 +965,7 @@ TAO_YYSTYPE tao_yylval; #define tao_yystacksize TAO_YYSTACKSIZE short tao_yyss[TAO_YYSTACKSIZE]; TAO_YYSTYPE tao_yyvs[TAO_YYSTACKSIZE]; -#line 2698 "fe/idl.tao_yy" +#line 2717 "fe/idl.tao_yy" /* programs */ /* @@ -1295,159 +1295,159 @@ tao_yyreduce: case 4: #line 260 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); } break; case 5: #line 264 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 6: #line 268 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); } break; case 7: #line 272 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 8: #line 276 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); } break; case 9: #line 280 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 10: #line 284 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceDeclSeen); } break; case 11: #line 288 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 12: #line 292 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleDeclSeen); } break; case 13: #line 296 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 14: #line 300 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeDeclSeen); } break; case 15: #line 304 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 16: #line 308 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 17: #line 312 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 18: #line 319 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSeen); + } break; case 19: #line 323 "fe/idl.tao_yy" { - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), 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, 1, 0, I_FALSE), NULL); + AST_Module *m = NULL; + UTL_Scope *s = idl_global->scopes()->top_non_null(); + UTL_StrList *p = idl_global->pragmas(); - 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); - (void) s->fe_add_module (m); - } - /* - * Push it on the stack - */ - idl_global->scopes()->push(m); - } + 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); + (void) s->fe_add_module (m); + } + /* + * Push it on the stack + */ + idl_global->scopes()->push(m); + } break; case 20: #line 344 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleSqSeen); + } break; case 21: #line 348 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_ModuleBodySeen); + } break; case 22: #line 352 "fe/idl.tao_yy" { - 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); - UTL_StrList *p = m->pragmas (); - if (p != 0) - p = (UTL_StrList*)p->copy (); - idl_global->set_pragmas (p); - idl_global->scopes()->pop(); - } + 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); + UTL_StrList *p = m->pragmas (); + if (p != 0) + p = (UTL_StrList*)p->copy (); + idl_global->set_pragmas (p); + idl_global->scopes()->pop(); + } break; case 25: #line 374 "fe/idl.tao_yy" { - 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 = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas (); + ACE_UNUSED_ARG (v); - /* - * Make a new interface node and add it to its enclosing scope - */ - if (s != NULL && tao_yyvsp[0].ihval != NULL) { - i = idl_global->gen ()->create_interface ( + /* + * Make a new interface node and add it to its enclosing scope + */ + if (s != NULL && tao_yyvsp[0].ihval != NULL) { + i = idl_global->gen ()->create_interface ( tao_yyvsp[0].ihval->interface_name (), tao_yyvsp[0].ihval->inherits (), tao_yyvsp[0].ihval->n_inherits (), @@ -1458,132 +1458,132 @@ case 25: tao_yyvsp[0].ihval->is_abstract () ); AST_Interface::fwd_redefinition_helper (i,s,p); - /* - * Add the interface to its definition scope - */ - (void) s->fe_add_interface (i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes ()->push (i); + /* + * Add the interface to its definition scope + */ + (void) s->fe_add_interface (i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes ()->push (i); } break; case 26: #line 407 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + } break; case 27: #line 411 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + } break; case 28: #line 415 "fe/idl.tao_yy" { - 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); + 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) + m->inherited_name_clash (); + UTL_StrList *p = m->pragmas (); + if (p != 0) { - p = (UTL_StrList*) p->copy (); + p = (UTL_StrList*) p->copy (); } - idl_global->set_pragmas (p); + idl_global->set_pragmas (p); } - idl_global->scopes ()->pop(); - } + idl_global->scopes ()->pop(); + } break; case 29: #line 438 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSeen); + } break; case 30: #line 442 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); - tao_yyval.idval = tao_yyvsp[0].idval; - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceIDSeen); + tao_yyval.idval = tao_yyvsp[0].idval; + } break; case 31: #line 450 "fe/idl.tao_yy" { - 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); - } + 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); + } break; case 32: #line 462 "fe/idl.tao_yy" { - 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); - } + 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); + } break; case 33: #line 474 "fe/idl.tao_yy" { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " 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); + 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 - } + } break; case 34: #line 494 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_InheritColonSeen); } break; case 35: #line 498 "fe/idl.tao_yy" { - tao_yyval.nlval = tao_yyvsp[0].nlval; - } + tao_yyval.nlval = tao_yyvsp[0].nlval; + } break; case 36: #line 502 "fe/idl.tao_yy" { - tao_yyval.nlval = NULL; - } + tao_yyval.nlval = NULL; + } break; case 41: #line 516 "fe/idl.tao_yy" { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle custom yet\n"; /* set custom (if not truncatable) */ } @@ -1591,111 +1591,111 @@ break; case 43: #line 527 "fe/idl.tao_yy" { - 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 = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); + 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); - /* - * Add the valuetype to its definition scope - */ - (void) s->fe_add_interface(i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes()->push(i); + /* + * Add the valuetype to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); } break; case 44: #line 549 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + } break; case 45: #line 553 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + } break; case 46: #line 557 "fe/idl.tao_yy" { - 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); - 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->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); + 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(); } break; case 47: #line 575 "fe/idl.tao_yy" { - 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 = NULL; + UTL_StrList *p = idl_global->pragmas(); - if (s != NULL && tao_yyvsp[0].vhval != NULL) { + if (s != NULL && tao_yyvsp[0].vhval != NULL) { if (tao_yyvsp[0].vhval->n_concrete() > 0) { 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(), + p); i->set_abstract_valuetype (); AST_Interface::fwd_redefinition_helper (i,s,p); - /* - * Add the valuetype to its definition scope - */ - (void) s->fe_add_interface(i); - } - /* - * Push it on the scope stack - */ - idl_global->scopes()->push(i); + /* + * Add the valuetype to its definition scope + */ + (void) s->fe_add_interface(i); + } + /* + * Push it on the scope stack + */ + idl_global->scopes()->push(i); } break; case 48: #line 603 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceSqSeen); + } break; case 49: #line 607 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_InterfaceBodySeen); + } break; case 50: #line 611 "fe/idl.tao_yy" { - 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); - 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->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); + 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(); } break; case 51: @@ -1707,31 +1707,31 @@ break; case 52: #line 639 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeSeen); } break; case 53: #line 643 "fe/idl.tao_yy" { idl_global->set_parse_state(IDL_GlobalData::PS_ValuetypeIDSeen); - tao_yyval.idval = tao_yyvsp[0].idval; + tao_yyval.idval = tao_yyvsp[0].idval; } break; case 54: #line 651 "fe/idl.tao_yy" { cerr << "warning in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "truncatable modifier not supported and is ignored\n"; - tao_yyval.bval = I_FALSE; - /* $$ = I_TRUE; */ - } + tao_yyval.bval = I_FALSE; + /* $$ = I_TRUE; */ + } break; case 55: #line 659 "fe/idl.tao_yy" { - tao_yyval.bval = I_FALSE; - } + tao_yyval.bval = I_FALSE; + } break; case 56: #line 667 "fe/idl.tao_yy" @@ -1748,50 +1748,50 @@ break; case 58: #line 679 "fe/idl.tao_yy" { - 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, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); + 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)*/ 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: #line 700 "fe/idl.tao_yy" { - 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, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); - } + 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); + } idl_global->set_pragmas (p); - } + } break; case 60: #line 722 "fe/idl.tao_yy" { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle boxes yet\n"; } break; @@ -1812,144 +1812,144 @@ break; case 72: #line 762 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_TypeDeclSeen); } break; case 73: #line 766 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 74: #line 770 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstDeclSeen); } break; case 75: #line 774 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 76: #line 778 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptDeclSeen); } break; case 77: #line 782 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 78: #line 786 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_AttrDeclSeen); } break; case 79: #line 790 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 80: #line 794 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpDeclSeen); } break; case 81: #line 798 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); } break; case 82: #line 802 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 83: #line 806 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 84: #line 814 "fe/idl.tao_yy" { - 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: #line 822 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SNListCommaSeen); } break; case 86: #line 826 "fe/idl.tao_yy" { - 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); - else { - tao_yyvsp[-3].nlval->nconc(new UTL_NameList(tao_yyvsp[0].idlist, NULL)); - tao_yyval.nlval = tao_yyvsp[-3].nlval; - } - } + if (tao_yyvsp[-3].nlval == NULL) + tao_yyval.nlval = new UTL_NameList(tao_yyvsp[0].idlist, NULL); + else { + tao_yyvsp[-3].nlval->nconc(new UTL_NameList(tao_yyvsp[0].idlist, NULL)); + tao_yyval.nlval = tao_yyvsp[-3].nlval; + } + } break; case 87: #line 837 "fe/idl.tao_yy" { - tao_yyval.nlval = NULL; - } + tao_yyval.nlval = NULL; + } break; case 88: #line 844 "fe/idl.tao_yy" { - 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, NULL); + } break; case 89: #line 850 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); } break; case 90: #line 854 "fe/idl.tao_yy" { - 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, 1, 0, I_FALSE), - new UTL_IdList(tao_yyvsp[0].idval, NULL)); - } + tao_yyval.idlist = new UTL_IdList(new Identifier(tao_yyvsp[-2].strval, 1, 0, I_FALSE), + new UTL_IdList(tao_yyvsp[0].idval, NULL)); + } break; case 91: #line 862 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ScopeDelimSeen); } break; case 92: #line 866 "fe/idl.tao_yy" { - 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_yyval.idlist = tao_yyvsp[-3].idlist; - } + tao_yyvsp[-3].idlist->nconc(new UTL_IdList(tao_yyvsp[0].idval, NULL)); + tao_yyval.idlist = tao_yyvsp[-3].idlist; + } break; case 93: #line 875 "fe/idl.tao_yy" @@ -1960,338 +1960,338 @@ break; case 94: #line 882 "fe/idl.tao_yy" { - 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, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); - } + 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); + } idl_global->set_pragmas (p); - } + } break; case 95: #line 901 "fe/idl.tao_yy" { - 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, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); - } + 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); + } idl_global->set_pragmas (p); - } + } break; case 96: #line 920 "fe/idl.tao_yy" { - 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, NULL); + AST_InterfaceFwd *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); - } + 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); + } idl_global->set_pragmas (p); - } + } break; case 97: #line 941 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstSeen); } break; case 98: #line 945 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstTypeSeen); } break; case 99: #line 949 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstIDSeen); } break; case 100: #line 953 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ConstAssignSeen); } break; case 101: #line 957 "fe/idl.tao_yy" { - 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; + 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); + ACE_UNUSED_ARG (v); - 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); - 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->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); + 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->set_pragmas (p); - } + } break; case 108: #line 992 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_string; - } + tao_yyval.etval = AST_Expression::EV_string; + } break; case 109: #line 996 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_wstring; + tao_yyval.etval = AST_Expression::EV_wstring; } break; case 110: #line 1000 "fe/idl.tao_yy" { - 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 = NULL; + AST_PredefinedType *c = NULL; + AST_Typedef *t = NULL; - /* - * 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) { - /* - * Look through typedefs - */ - while (d->node_type() == AST_Decl::NT_typedef) { - t = AST_Typedef::narrow_from_decl(d); - if (t == NULL) - break; - d = t->base_type(); - } - if (d == NULL) - 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 { - tao_yyval.etval = AST_Expression::EV_any; - } - } else if (d->node_type () == AST_Decl::NT_string) { + /* + * 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) { + /* + * Look through typedefs + */ + while (d->node_type() == AST_Decl::NT_typedef) { + t = AST_Typedef::narrow_from_decl(d); + if (t == NULL) + break; + d = t->base_type(); + } + if (d == NULL) + 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 { + tao_yyval.etval = AST_Expression::EV_any; + } + } else if (d->node_type () == AST_Decl::NT_string) { tao_yyval.etval = AST_Expression::EV_string; } else if (d->node_type () == AST_Decl::NT_wstring) { - tao_yyval.etval = AST_Expression::EV_wstring; + tao_yyval.etval = AST_Expression::EV_wstring; } else - tao_yyval.etval = AST_Expression::EV_any; - } else - tao_yyval.etval = AST_Expression::EV_any; - } + tao_yyval.etval = AST_Expression::EV_any; + } else + tao_yyval.etval = AST_Expression::EV_any; + } break; case 114: #line 1046 "fe/idl.tao_yy" { - 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: #line 1054 "fe/idl.tao_yy" { - 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: #line 1062 "fe/idl.tao_yy" { - 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: #line 1070 "fe/idl.tao_yy" { - 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: #line 1074 "fe/idl.tao_yy" { - 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: #line 1082 "fe/idl.tao_yy" { - 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: #line 1086 "fe/idl.tao_yy" { - 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: #line 1094 "fe/idl.tao_yy" { - 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: #line 1098 "fe/idl.tao_yy" { - 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: #line 1102 "fe/idl.tao_yy" { - 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: #line 1110 "fe/idl.tao_yy" { - 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, + NULL); + } break; case 131: #line 1116 "fe/idl.tao_yy" { - 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, + NULL); + } break; case 132: #line 1122 "fe/idl.tao_yy" { - 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, + NULL); + } break; case 133: #line 1131 "fe/idl.tao_yy" { - /* - * An expression which is a scoped name is not resolved now, - * but only when it is evaluated (such as when it is assigned - * as a constant value) - */ - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].idlist); - } + /* + * An expression which is a scoped name is not resolved now, + * but only when it is evaluated (such as when it is assigned + * as a constant value) + */ + tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].idlist); + } break; case 135: #line 1141 "fe/idl.tao_yy" { - tao_yyval.exval = tao_yyvsp[-1].exval; - } + tao_yyval.exval = tao_yyvsp[-1].exval; + } break; case 136: #line 1148 "fe/idl.tao_yy" { - 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: #line 1152 "fe/idl.tao_yy" { - 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: #line 1156 "fe/idl.tao_yy" { - 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: #line 1160 "fe/idl.tao_yy" { - 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: #line 1164 "fe/idl.tao_yy" { - 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: #line 1168 "fe/idl.tao_yy" { - ACE_OutputCDR::from_wchar wc (tao_yyvsp[0].wcval); - tao_yyval.exval = idl_global->gen()->create_expr(wc); - } + ACE_OutputCDR::from_wchar wc (tao_yyvsp[0].wcval); + tao_yyval.exval = idl_global->gen()->create_expr(wc); + } break; case 142: #line 1173 "fe/idl.tao_yy" { - 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: #line 1177 "fe/idl.tao_yy" { - 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: #line 1182 "fe/idl.tao_yy" { - 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: #line 1190 "fe/idl.tao_yy" { - tao_yyvsp[0].exval->evaluate(AST_Expression::EK_const); - tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].exval, AST_Expression::EV_ulong); - } + tao_yyvsp[0].exval->evaluate(AST_Expression::EK_const); + tao_yyval.exval = idl_global->gen()->create_expr(tao_yyvsp[0].exval, AST_Expression::EV_ulong); + } break; case 146: #line 1198 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_TypedefSeen); + } break; case 147: #line 1201 "fe/idl.tao_yy" @@ -2312,355 +2312,355 @@ break; case 151: #line 1206 "fe/idl.tao_yy" { - 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 = NULL; + AST_Decl *v = NULL; + UTL_StrList *p = idl_global->pragmas(); ACE_UNUSED_ARG (v); - 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); - /* - * Add it to its defining scope - */ - (void) s->fe_add_native (node); - } + 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); + /* + * Add it to its defining scope + */ + (void) s->fe_add_native (node); + } idl_global->set_pragmas (p); - } + } break; case 152: #line 1232 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_TypeSpecSeen); } break; case 153: #line 1236 "fe/idl.tao_yy" { - 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(); + 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); - 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; + 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, + continue; + t = idl_global->gen()->create_typedef(tp, d->name(), p, s->is_local (), s->is_abstract ()); - (void) s->fe_add_typedef(t); - } - delete l; - } + (void) s->fe_add_typedef(t); + } + delete l; + } idl_global->set_pragmas (p); - } + } break; case 156: #line 1278 "fe/idl.tao_yy" { - 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: #line 1283 "fe/idl.tao_yy" { - 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 = NULL; - 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); - tao_yyval.dcval = d; - } + 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); + tao_yyval.dcval = d; + } break; case 172: #line 1319 "fe/idl.tao_yy" { - 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: #line 1327 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); } break; case 174: #line 1331 "fe/idl.tao_yy" { - 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); - else { - tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); - tao_yyval.dlval = tao_yyvsp[-3].dlval; - } - } + if (tao_yyvsp[-3].dlval == NULL) + tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[0].deval, NULL); + else { + tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); + tao_yyval.dlval = tao_yyvsp[-3].dlval; + } + } break; case 175: #line 1342 "fe/idl.tao_yy" { - tao_yyval.dlval = NULL; - } + tao_yyval.dlval = NULL; + } break; case 178: #line 1354 "fe/idl.tao_yy" { - 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: #line 1362 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_DeclsCommaSeen); } break; case 180: #line 1366 "fe/idl.tao_yy" { - 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); - else { - tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); - tao_yyval.dlval = tao_yyvsp[-3].dlval; - } - } + if (tao_yyvsp[-3].dlval == NULL) + tao_yyval.dlval = new UTL_DeclList(tao_yyvsp[0].deval, NULL); + else { + tao_yyvsp[-3].dlval->nconc(new UTL_DeclList(tao_yyvsp[0].deval, NULL)); + tao_yyval.dlval = tao_yyvsp[-3].dlval; + } + } break; case 181: #line 1377 "fe/idl.tao_yy" { - tao_yyval.dlval = NULL; - } + tao_yyval.dlval = NULL; + } break; case 182: #line 1384 "fe/idl.tao_yy" { - 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, NULL), + FE_Declarator::FD_simple, NULL); + } break; case 183: #line 1392 "fe/idl.tao_yy" { - 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(), NULL), + FE_Declarator::FD_complex, + tao_yyvsp[0].dcval); + } break; case 186: #line 1406 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_long; - } + tao_yyval.etval = AST_Expression::EV_long; + } break; case 187: #line 1410 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_longlong; + tao_yyval.etval = AST_Expression::EV_longlong; } break; case 188: #line 1414 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_short; - } + tao_yyval.etval = AST_Expression::EV_short; + } break; case 189: #line 1421 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_ulong; - } + tao_yyval.etval = AST_Expression::EV_ulong; + } break; case 190: #line 1425 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_ulonglong; + tao_yyval.etval = AST_Expression::EV_ulonglong; } break; case 191: #line 1429 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_ushort; - } + tao_yyval.etval = AST_Expression::EV_ushort; + } break; case 192: #line 1436 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_double; - } + tao_yyval.etval = AST_Expression::EV_double; + } break; case 193: #line 1440 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_float; - } + tao_yyval.etval = AST_Expression::EV_float; + } break; case 194: #line 1444 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_longdouble; + tao_yyval.etval = AST_Expression::EV_longdouble; } break; case 195: #line 1451 "fe/idl.tao_yy" { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle fixed types yet\n"; - } + } break; case 196: #line 1460 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_char; - } + tao_yyval.etval = AST_Expression::EV_char; + } break; case 197: #line 1464 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_wchar; + tao_yyval.etval = AST_Expression::EV_wchar; } break; case 198: #line 1471 "fe/idl.tao_yy" { tao_yyval.etval = AST_Expression::EV_octet; - } + } break; case 199: #line 1478 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_bool; + tao_yyval.etval = AST_Expression::EV_bool; } break; case 200: #line 1485 "fe/idl.tao_yy" { - tao_yyval.etval = AST_Expression::EV_any; - } + tao_yyval.etval = AST_Expression::EV_any; + } break; case 201: #line 1492 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StructSeen); } break; case 202: #line 1496 "fe/idl.tao_yy" { - 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, NULL); + AST_Structure *d = NULL; + UTL_StrList *p = idl_global->pragmas(); + AST_Decl *v = NULL; ACE_UNUSED_ARG (v); - 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, + 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); - } - /* - * Push the scope of the struct on the scopes stack - */ - idl_global->scopes()->push(d); - } + (void) s->fe_add_structure(d); + } + /* + * Push the scope of the struct on the scopes stack + */ + idl_global->scopes()->push(d); + } break; case 203: #line 1523 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StructSqSeen); } break; case 204: #line 1527 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StructBodySeen); } break; case 205: #line 1531 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StructQsSeen); - /* - * Done with this struct. Pop its scope off the scopes stack - */ + 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); + 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(); - } + } break; case 207: #line 1550 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->err()->syntax_error(idl_global->parse_state()); + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 208: #line 1556 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 209: #line 1560 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 212: #line 1570 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 213: #line 1574 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 214: #line 1581 "fe/idl.tao_yy" @@ -2672,1191 +2672,1210 @@ break; case 216: #line 1590 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_MemberTypeSeen); } break; case 217: #line 1594 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_MemberDeclsSeen); } break; case 218: #line 1598 "fe/idl.tao_yy" { - 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 = NULL; + FE_Declarator *d = NULL; + AST_Field *f = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); - /* - * 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) - continue; - AST_Type *tp = d->compose(tao_yyvsp[-4].dcval); - if (tp == NULL) - continue; + 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); + /* + * 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) + continue; + AST_Type *tp = d->compose(tao_yyvsp[-4].dcval); + if (tp == NULL) + 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); - } - delete l; - } - } + f = idl_global->gen()->create_field(tp, d->name(), p, tao_yyvsp[-5].vival); + (void) s->fe_add_field(f); + } + delete l; + } + } break; case 219: #line 1632 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 220: #line 1636 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 221: #line 1644 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSeen); } break; case 222: #line 1648 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionIDSeen); } break; case 223: #line 1652 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchSeen); } break; case 224: #line 1656 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchOpenParSeen); } break; case 225: #line 1660 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SwitchTypeSeen); } break; case 226: #line 1664 "fe/idl.tao_yy" { - 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(); + 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); - 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); + 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); } else { - u = idl_global->gen()->create_union(tp, + u = idl_global->gen()->create_union(tp, n, p, 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); - } + (void) s->fe_add_union(u); + } + } + /* + * Push the scope of the union on the scopes stack + */ + idl_global->scopes()->push(u); + } break; case 227: #line 1697 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionSqSeen); } break; case 228: #line 1701 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionBodySeen); } break; case 229: #line 1705 "fe/idl.tao_yy" { - 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->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() ); 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(); + UTL_StrList *p = tao_yyval.dcval->pragmas (); + if (p != 0) + p = (UTL_StrList*)p->copy (); + idl_global->set_pragmas (p); + idl_global->scopes()->pop(); } - } + } break; case 230: #line 1727 "fe/idl.tao_yy" { - 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 231: #line 1731 "fe/idl.tao_yy" { - 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 232: #line 1735 "fe/idl.tao_yy" { /* 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 233: #line 1741 "fe/idl.tao_yy" { - 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 235: #line 1746 "fe/idl.tao_yy" { - 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 = NULL; + AST_PredefinedType *p = NULL; + AST_Typedef *t = NULL; + long found = I_FALSE; - /* - * The discriminator is a scoped name. Try to resolve to - * one of the scalar types or to an enum. Thread through - * typedef's to arrive at the base type at the end of the - * chain - */ - if (s != NULL && (d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE)) != NULL) { - while (!found) { - 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()) { - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - 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_octet: + /* + * The discriminator is a scoped name. Try to resolve to + * one of the scalar types or to an enum. Thread through + * typedef's to arrive at the base type at the end of the + * chain + */ + if (s != NULL && (d = s->lookup_by_name(tao_yyvsp[0].idlist, I_TRUE)) != NULL) { + while (!found) { + 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()) { + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + 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_octet: /* octets are not allowed*/ idl_global->err ()->error0 (UTL_Error::EIDL_DISC_TYPE); tao_yyval.dcval = NULL; - found = I_TRUE; - break; - default: - tao_yyval.dcval = NULL; - found = I_TRUE; - break; - } - } else + found = I_TRUE; + break; + default: + tao_yyval.dcval = NULL; + found = I_TRUE; + break; + } + } else { - tao_yyval.dcval = NULL; - found = I_TRUE; + tao_yyval.dcval = NULL; + found = I_TRUE; } - break; - case AST_Decl::NT_typedef: - t = AST_Typedef::narrow_from_decl(d); - if (t != NULL) d = t->base_type(); - break; - default: - tao_yyval.dcval = NULL; - found = I_TRUE; - break; - } - } - } else - tao_yyval.dcval = NULL; + break; + case AST_Decl::NT_typedef: + t = AST_Typedef::narrow_from_decl(d); + if (t != NULL) d = t->base_type(); + break; + default: + tao_yyval.dcval = NULL; + found = I_TRUE; + break; + } + } + } else + tao_yyval.dcval = NULL; - if (tao_yyval.dcval == NULL) - idl_global->err()->lookup_error(tao_yyvsp[0].idlist); - } + if (tao_yyval.dcval == NULL) + idl_global->err()->lookup_error(tao_yyvsp[0].idlist); + } break; case 239: #line 1825 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionLabelSeen); } break; case 240: #line 1829 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemSeen); } break; case 241: #line 1833 "fe/idl.tao_yy" { - 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(); + UTL_LabellistActiveIterator *l = NULL; + AST_UnionLabel *d = NULL; + AST_UnionBranch *b = NULL; + AST_Field *f = tao_yyvsp[-2].ffval; ACE_UNUSED_ARG (l); ACE_UNUSED_ARG (d); - 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); - } - } + 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); + } + } break; case 242: #line 1857 "fe/idl.tao_yy" { - idl_global->err()->syntax_error(idl_global->parse_state()); - } + idl_global->err()->syntax_error(idl_global->parse_state()); + } break; case 243: #line 1862 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_NoState); - tao_yyerrok; - } + idl_global->set_parse_state(IDL_GlobalData::PS_NoState); + tao_yyerrok; + } break; case 244: #line 1870 "fe/idl.tao_yy" { - 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 245: #line 1877 "fe/idl.tao_yy" { - if (tao_yyvsp[-1].llval == NULL) - tao_yyval.llval = new UTL_LabelList(tao_yyvsp[0].ulval, NULL); - else { - tao_yyvsp[-1].llval->nconc(new UTL_LabelList(tao_yyvsp[0].ulval, NULL)); - tao_yyval.llval = tao_yyvsp[-1].llval; - } - } + if (tao_yyvsp[-1].llval == NULL) + tao_yyval.llval = new UTL_LabelList(tao_yyvsp[0].ulval, NULL); + else { + tao_yyvsp[-1].llval->nconc(new UTL_LabelList(tao_yyvsp[0].ulval, NULL)); + tao_yyval.llval = tao_yyvsp[-1].llval; + } + } break; case 246: #line 1886 "fe/idl.tao_yy" { - tao_yyval.llval = NULL; - } + tao_yyval.llval = NULL; + } break; case 247: #line 1893 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_DefaultSeen); } break; case 248: #line 1897 "fe/idl.tao_yy" { - 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, + NULL); + } break; case 249: #line 1905 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_CaseSeen); } break; case 250: #line 1909 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_LabelExprSeen); } break; case 251: #line 1913 "fe/idl.tao_yy" { - 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 252: #line 1923 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_UnionElemTypeSeen); } break; case 253: #line 1927 "fe/idl.tao_yy" { - 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); - /* - * Create a field in a union branch - */ - else if (tao_yyvsp[-2].dcval == NULL || tao_yyvsp[0].deval == NULL) - tao_yyval.ffval = NULL; - else { - AST_Type *tp = tao_yyvsp[0].deval->compose(tao_yyvsp[-2].dcval); - if (tp == NULL) - tao_yyval.ffval = NULL; - else - tao_yyval.ffval = idl_global->gen()->create_field(tp, - tao_yyvsp[0].deval->name(), - idl_global->pragmas()); - } - } + 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); + /* + * Create a field in a union branch + */ + else if (tao_yyvsp[-2].dcval == NULL || tao_yyvsp[0].deval == NULL) + tao_yyval.ffval = NULL; + else { + AST_Type *tp = tao_yyvsp[0].deval->compose(tao_yyvsp[-2].dcval); + if (tp == NULL) + tao_yyval.ffval = NULL; + else + tao_yyval.ffval = idl_global->gen()->create_field(tp, + tao_yyvsp[0].deval->name(), + idl_global->pragmas()); + } + } break; case 254: #line 1953 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSeen); } break; case 255: #line 1957 "fe/idl.tao_yy" { - 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(); + 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); - 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, + 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 ()); - /* - * Add it to its defining scope - */ - (void) s->fe_add_enum(e); - } - /* - * Push the enum scope on the scopes stack - */ - idl_global->scopes()->push(e); - } + /* + * Add it to its defining scope + */ + (void) s->fe_add_enum(e); + } + /* + * Push the enum scope on the scopes stack + */ + idl_global->scopes()->push(e); + } break; case 256: #line 1987 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_EnumSqSeen); } break; case 257: #line 1991 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); + idl_global->set_parse_state(IDL_GlobalData::PS_EnumBodySeen); } break; case 258: #line 1995 "fe/idl.tao_yy" { UTL_StrList *p = 0; - 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; - else { - tao_yyval.dcval = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); + 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; + else { + tao_yyval.dcval = AST_Enum::narrow_from_scope(idl_global->scopes()->top_non_null()); p = tao_yyval.dcval->pragmas (); - idl_global->scopes()->pop(); - } + idl_global->scopes()->pop(); + } idl_global->set_pragmas (p); - } + } break; case 260: #line 2017 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_EnumCommaSeen); } break; case 263: #line 2026 "fe/idl.tao_yy" { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), 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, 1, 0, I_FALSE), NULL); + AST_EnumVal *e = NULL; + AST_Enum *c = NULL; + UTL_StrList *p = idl_global->pragmas(); - /* - * 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); - } - } + /* + * 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); + } + } break; case 264: #line 2050 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceCommaSeen); } break; case 265: #line 2054 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceExprSeen); } break; case 266: #line 2058 "fe/idl.tao_yy" { - 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(); + 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 (); - /* - * 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; - } else { - AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-5].dcval); - if (tp == NULL) - ; /* Error will be caught in FE_Declarator.*/ - else { - tao_yyval.dcval = idl_global->gen()->create_sequence(tao_yyvsp[-2].exval, + /* + * 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; + } else { + AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-5].dcval); + if (tp == NULL) + ; /* 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 ()); - /* - * Add this AST_Sequence to the types defined in the global scope - */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); - } - } - } + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); + } + } + } break; case 267: #line 2093 "fe/idl.tao_yy" { - 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(); + 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 (); - /* - * Create a node representing a sequence - */ - if (tao_yyvsp[-1].dcval == NULL) - tao_yyval.dcval = NULL; - else { - AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-1].dcval); - if (tp == NULL) - ; /* Error will be caught in FE_Declarator.*/ + /* + * Create a node representing a sequence + */ + if (tao_yyvsp[-1].dcval == NULL) + tao_yyval.dcval = NULL; + else { + AST_Type *tp = AST_Type::narrow_from_decl(tao_yyvsp[-1].dcval); + if (tp == NULL) + ; /* 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, + tao_yyval.dcval = + 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 - */ - (void) idl_global->root() - ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); - } - } - } + /* + * Add this AST_Sequence to the types defined in the global scope + */ + (void) idl_global->root() + ->fe_add_sequence(AST_Sequence::narrow_from_decl(tao_yyval.dcval)); + } + } + } break; case 268: #line 2129 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); - /* - * Push a sequence marker on scopes stack - */ - idl_global->scopes()->push(NULL); - } + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSeen); + /* + * Push a sequence marker on scopes stack + */ + idl_global->scopes()->push(NULL); + } break; case 269: #line 2137 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceSqSeen); } break; case 270: #line 2141 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); - tao_yyval.dcval = tao_yyvsp[0].dcval; + idl_global->set_parse_state(IDL_GlobalData::PS_SequenceTypeSeen); + tao_yyval.dcval = tao_yyvsp[0].dcval; } break; case 271: #line 2150 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); } break; case 272: #line 2154 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); } break; case 273: #line 2158 "fe/idl.tao_yy" { - 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; - } else { - 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)); - } - } + 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; + } else { + 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)); + } + } break; case 274: #line 2176 "fe/idl.tao_yy" { - 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)); - /* - * Add this AST_String to the types defined in the global scope - */ - (void) idl_global->root() + 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)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() ->fe_add_string(AST_String::narrow_from_decl(tao_yyval.dcval)); - } + } break; case 275: #line 2194 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); } break; case 276: #line 2202 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringSqSeen); } break; case 277: #line 2206 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringExprSeen); } break; case 278: #line 2210 "fe/idl.tao_yy" { - 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; - } else { - 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)); - } - } + 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; + } else { + 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)); + } + } break; case 279: #line 2228 "fe/idl.tao_yy" { - 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)); - /* - * Add this AST_String to the types defined in the global scope - */ - (void) idl_global->root() + 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)); + /* + * Add this AST_String to the types defined in the global scope + */ + (void) idl_global->root() ->fe_add_string(AST_String::narrow_from_decl(tao_yyval.dcval)); - } + } break; case 280: #line 2246 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_StringSeen); } break; case 281: #line 2253 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ArrayIDSeen); } break; case 282: #line 2257 "fe/idl.tao_yy" { - 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); - } - } + 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); + } + } break; case 283: #line 2271 "fe/idl.tao_yy" { - 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 284: #line 2278 "fe/idl.tao_yy" { - if (tao_yyvsp[-1].elval == NULL) - tao_yyval.elval = new UTL_ExprList(tao_yyvsp[0].exval, NULL); - else { - tao_yyvsp[-1].elval->nconc(new UTL_ExprList(tao_yyvsp[0].exval, NULL)); - tao_yyval.elval = tao_yyvsp[-1].elval; - } - } + if (tao_yyvsp[-1].elval == NULL) + tao_yyval.elval = new UTL_ExprList(tao_yyvsp[0].exval, NULL); + else { + tao_yyvsp[-1].elval->nconc(new UTL_ExprList(tao_yyvsp[0].exval, NULL)); + tao_yyval.elval = tao_yyvsp[-1].elval; + } + } break; case 285: #line 2287 "fe/idl.tao_yy" { - tao_yyval.elval = NULL; - } + tao_yyval.elval = NULL; + } break; case 286: #line 2294 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_DimSqSeen); } break; case 287: #line 2298 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_DimExprSeen); } break; case 288: #line 2302 "fe/idl.tao_yy" { - 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; - } else - tao_yyval.exval = tao_yyvsp[-2].exval; - } + 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; + } else + tao_yyval.exval = tao_yyvsp[-2].exval; + } break; case 289: #line 2319 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_AttrSeen); } break; case 290: #line 2323 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_AttrTypeSeen); } break; case 291: #line 2327 "fe/idl.tao_yy" { - 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 = NULL; + AST_Attribute *a = NULL; + FE_Declarator *d = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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) - continue; - AST_Type *tp = d->compose(tao_yyvsp[-2].dcval); - if (tp == NULL) - continue; - a = idl_global->gen()->create_attribute(tao_yyvsp[-5].bval, tp, (UTL_IdList *) d->name()->copy (), p); - /* - * Add one attribute to the enclosing scope - */ - (void) s->fe_add_attribute(a); - } - delete l; - } + 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) + continue; + AST_Type *tp = d->compose(tao_yyvsp[-2].dcval); + if (tp == NULL) + continue; + a = idl_global->gen()->create_attribute(tao_yyvsp[-5].bval, + tp, + (UTL_IdList *) d->name()->copy (), + p, + s->is_local (), + s->is_abstract ()); + /* + * Add one attribute to the enclosing scope + */ + (void) s->fe_add_attribute(a); + } + delete l; + } idl_global->set_pragmas (p); - } + } break; case 292: -#line 2362 "fe/idl.tao_yy" +#line 2367 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); - tao_yyval.bval = I_TRUE; - } + idl_global->set_parse_state(IDL_GlobalData::PS_AttrROSeen); + tao_yyval.bval = I_TRUE; + } break; case 293: -#line 2367 "fe/idl.tao_yy" +#line 2372 "fe/idl.tao_yy" { - tao_yyval.bval = I_FALSE; - } + tao_yyval.bval = I_FALSE; + } break; case 294: -#line 2374 "fe/idl.tao_yy" +#line 2379 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); - } + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSeen); + } break; case 295: -#line 2378 "fe/idl.tao_yy" +#line 2383 "fe/idl.tao_yy" { - 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; + 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); - 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, + 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); - } - /* - * Push the exception scope on the scope stack - */ - idl_global->scopes()->push(e); - } + (void) s->fe_add_exception(e); + } + /* + * Push the exception scope on the scope stack + */ + idl_global->scopes()->push(e); + } break; case 296: -#line 2405 "fe/idl.tao_yy" +#line 2410 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptSqSeen); } break; case 297: -#line 2409 "fe/idl.tao_yy" +#line 2414 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); + idl_global->set_parse_state(IDL_GlobalData::PS_ExceptBodySeen); } break; case 298: -#line 2413 "fe/idl.tao_yy" +#line 2418 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_ExceptQsSeen); - /* - * Done with this exception. Pop its scope from the scope stack - */ + 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->scopes()->pop(); idl_global->set_pragmas (p); - } + } break; case 299: -#line 2429 "fe/idl.tao_yy" +#line 2434 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpTypeSeen); } break; case 300: -#line 2433 "fe/idl.tao_yy" +#line 2438 "fe/idl.tao_yy" { - UTL_Scope *s = idl_global->scopes()->top_non_null(); - UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), 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, 1, 0, I_FALSE), NULL); + AST_Operation *o = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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); + 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); } else { - o = idl_global->gen()->create_operation(tp, tao_yyvsp[-3].ofval, n, p); - (void) s->fe_add_operation(o); - } - } - /* - * Push the operation scope onto the scopes stack - */ - idl_global->scopes()->push(o); - } + 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); + } + } + /* + * Push the operation scope onto the scopes stack + */ + idl_global->scopes()->push(o); + } break; case 301: -#line 2462 "fe/idl.tao_yy" +#line 2472 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); + idl_global->set_parse_state(IDL_GlobalData::PS_OpParsCompleted); } break; case 302: -#line 2466 "fe/idl.tao_yy" +#line 2476 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseCompleted); } break; case 303: -#line 2470 "fe/idl.tao_yy" +#line 2480 "fe/idl.tao_yy" { - 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 = NULL; - 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); + 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 (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); - } - /* - * Done with this operation. Pop its scope from the scopes stack - */ - idl_global->scopes()->pop(); - } + 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); + } + /* + * Done with this operation. Pop its scope from the scopes stack + */ + idl_global->scopes()->pop(); + } break; case 304: -#line 2495 "fe/idl.tao_yy" +#line 2505 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); - tao_yyval.ofval = AST_Operation::OP_oneway; - } + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + tao_yyval.ofval = AST_Operation::OP_oneway; + } break; case 305: -#line 2500 "fe/idl.tao_yy" +#line 2510 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); - tao_yyval.ofval = AST_Operation::OP_idempotent; - } + idl_global->set_parse_state(IDL_GlobalData::PS_OpAttrSeen); + tao_yyval.ofval = AST_Operation::OP_idempotent; + } break; case 306: -#line 2505 "fe/idl.tao_yy" +#line 2515 "fe/idl.tao_yy" { - tao_yyval.ofval = AST_Operation::OP_noflags; - } + tao_yyval.ofval = AST_Operation::OP_noflags; + } break; case 308: -#line 2513 "fe/idl.tao_yy" +#line 2523 "fe/idl.tao_yy" { - tao_yyval.dcval = - idl_global->scopes()->bottom() - ->lookup_primitive_type(AST_Expression::EV_void); - } + tao_yyval.dcval = + idl_global->scopes()->bottom() + ->lookup_primitive_type(AST_Expression::EV_void); + } break; case 309: -#line 2522 "fe/idl.tao_yy" +#line 2532 "fe/idl.tao_yy" { cerr << "error in " << idl_global->filename()->get_string() - << " line " << idl_global->lineno() << ":\n" ; + << " line " << idl_global->lineno() << ":\n" ; cerr << "Sorry, I (TAO_IDL) can't handle init yet\n"; } break; case 310: -#line 2532 "fe/idl.tao_yy" +#line 2542 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); } break; case 311: -#line 2536 "fe/idl.tao_yy" +#line 2546 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); } break; case 312: -#line 2540 "fe/idl.tao_yy" +#line 2550 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpSqSeen); } break; case 313: -#line 2545 "fe/idl.tao_yy" +#line 2555 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpQsSeen); } break; case 315: -#line 2555 "fe/idl.tao_yy" +#line 2565 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpParCommaSeen); } break; case 318: -#line 2564 "fe/idl.tao_yy" +#line 2574 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpParDirSeen); } break; case 319: -#line 2568 "fe/idl.tao_yy" +#line 2578 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpParTypeSeen); } break; case 320: -#line 2572 "fe/idl.tao_yy" +#line 2582 "fe/idl.tao_yy" { - 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 = NULL; + UTL_StrList *p = idl_global->pragmas(); - 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) { - 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); - } - } - } + 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 (!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"; + } + 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); + } + } + } + } break; case 321: -#line 2594 "fe/idl.tao_yy" +#line 2613 "fe/idl.tao_yy" { - 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 324: -#line 2600 "fe/idl.tao_yy" +#line 2619 "fe/idl.tao_yy" { - 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 = NULL; - 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); - tao_yyval.dcval = d; - } + 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); + tao_yyval.dcval = d; + } break; case 325: -#line 2614 "fe/idl.tao_yy" +#line 2633 "fe/idl.tao_yy" { - tao_yyval.dival = AST_Argument::dir_IN; - } + tao_yyval.dival = AST_Argument::dir_IN; + } break; case 326: -#line 2618 "fe/idl.tao_yy" +#line 2637 "fe/idl.tao_yy" { - tao_yyval.dival = AST_Argument::dir_OUT; - } + tao_yyval.dival = AST_Argument::dir_OUT; + } break; case 327: -#line 2622 "fe/idl.tao_yy" +#line 2641 "fe/idl.tao_yy" { - tao_yyval.dival = AST_Argument::dir_INOUT; - } + tao_yyval.dival = AST_Argument::dir_INOUT; + } break; case 328: -#line 2629 "fe/idl.tao_yy" +#line 2648 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSeen); } break; case 329: -#line 2633 "fe/idl.tao_yy" +#line 2652 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseSqSeen); } break; case 330: -#line 2638 "fe/idl.tao_yy" +#line 2657 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); - tao_yyval.nlval = tao_yyvsp[-1].nlval; - } + idl_global->set_parse_state(IDL_GlobalData::PS_OpRaiseQsSeen); + tao_yyval.nlval = tao_yyvsp[-1].nlval; + } break; case 331: -#line 2643 "fe/idl.tao_yy" +#line 2662 "fe/idl.tao_yy" { - tao_yyval.nlval = NULL; - } + tao_yyval.nlval = NULL; + } break; case 332: -#line 2650 "fe/idl.tao_yy" +#line 2669 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSeen); } break; case 333: -#line 2654 "fe/idl.tao_yy" +#line 2673 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextSqSeen); } break; case 334: -#line 2659 "fe/idl.tao_yy" +#line 2678 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); - tao_yyval.slval = tao_yyvsp[-1].slval; - } + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextQsSeen); + tao_yyval.slval = tao_yyvsp[-1].slval; + } break; case 335: -#line 2664 "fe/idl.tao_yy" +#line 2683 "fe/idl.tao_yy" { - tao_yyval.slval = NULL; - } + tao_yyval.slval = NULL; + } break; case 336: -#line 2671 "fe/idl.tao_yy" +#line 2690 "fe/idl.tao_yy" { - 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 337: -#line 2679 "fe/idl.tao_yy" +#line 2698 "fe/idl.tao_yy" { - idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); + idl_global->set_parse_state(IDL_GlobalData::PS_OpContextCommaSeen); } break; case 338: -#line 2683 "fe/idl.tao_yy" +#line 2702 "fe/idl.tao_yy" { - if (tao_yyvsp[-3].slval == NULL) - tao_yyval.slval = new UTL_StrList(tao_yyvsp[0].sval, NULL); - else { - tao_yyvsp[-3].slval->nconc(new UTL_StrList(tao_yyvsp[0].sval, NULL)); - tao_yyval.slval = tao_yyvsp[-3].slval; - } - } + if (tao_yyvsp[-3].slval == NULL) + tao_yyval.slval = new UTL_StrList(tao_yyvsp[0].sval, NULL); + else { + tao_yyvsp[-3].slval->nconc(new UTL_StrList(tao_yyvsp[0].sval, NULL)); + tao_yyval.slval = tao_yyvsp[-3].slval; + } + } break; case 339: -#line 2692 "fe/idl.tao_yy" +#line 2711 "fe/idl.tao_yy" { - tao_yyval.slval = NULL; - } + tao_yyval.slval = NULL; + } break; -#line 3859 "y.tab.cpp" +#line 3878 "y.tab.cpp" } tao_yyssp -= tao_yym; tao_yystate = *tao_yyssp; diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h index 18754248901..eb5121f67eb 100644 --- a/TAO/TAO_IDL/include/ast_array.h +++ b/TAO/TAO_IDL/include/ast_array.h @@ -84,9 +84,11 @@ public: // Constructor(s) AST_Array (); - AST_Array (UTL_ScopedName *n, - unsigned long ndims, - UTL_ExprList *dims); + AST_Array (UTL_ScopedName *n, + unsigned long ndims, + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract); virtual ~AST_Array (void); diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h index 2e13fd08aff..691237d0618 100644 --- a/TAO/TAO_IDL/include/ast_attribute.h +++ b/TAO/TAO_IDL/include/ast_attribute.h @@ -88,7 +88,9 @@ public: AST_Attribute (idl_bool readonly, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p); + UTL_StrList *p, + idl_bool local, + idl_bool abstract); virtual ~AST_Attribute (void); diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h index 51f1dcefe2e..cc23de8bdba 100644 --- a/TAO/TAO_IDL/include/ast_generator.h +++ b/TAO/TAO_IDL/include/ast_generator.h @@ -152,7 +152,9 @@ public: virtual AST_Operation *create_operation(AST_Type *rt, AST_Operation::Flags fl, UTL_ScopedName *n, - UTL_StrList *p); + UTL_StrList *p, + idl_bool local, + idl_bool abstract); // Create a node representing a field in a structure, exception or // union @@ -171,7 +173,9 @@ public: virtual AST_Attribute *create_attribute(idl_bool ro, AST_Type *ft, UTL_ScopedName *n, - UTL_StrList *p); + UTL_StrList *p, + idl_bool local, + idl_bool abstract); // Create a node representing a union virtual AST_Union *create_union(AST_ConcreteType *dt, @@ -221,7 +225,9 @@ public: // Create a node representing an array type virtual AST_Array *create_array(UTL_ScopedName *n, unsigned long ndims, - UTL_ExprList *dims); + UTL_ExprList *dims, + idl_bool local, + idl_bool abstract); // Create a node representing a sequence type virtual AST_Sequence *create_sequence(AST_Expression *v, diff --git a/TAO/TAO_IDL/include/ast_operation.h b/TAO/TAO_IDL/include/ast_operation.h index 6fe7f305b48..45828a4e030 100644 --- a/TAO/TAO_IDL/include/ast_operation.h +++ b/TAO/TAO_IDL/include/ast_operation.h @@ -101,7 +101,9 @@ public: AST_Operation (AST_Type *return_type, Flags flags, UTL_ScopedName *n, - UTL_StrList *p); + UTL_StrList *p, + idl_bool local, + idl_bool abstract); virtual ~AST_Operation (void); diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h index 6e2af1639ac..1416c9f93ba 100644 --- a/TAO/TAO_IDL/include/ast_structure.h +++ b/TAO/TAO_IDL/include/ast_structure.h @@ -111,6 +111,12 @@ public: DEF_NARROW_FROM_DECL(AST_Structure); DEF_NARROW_FROM_SCOPE(AST_Structure); + virtual int member_count (void); + // return the count of members + + virtual idl_bool is_local (void); + // Overwrite the is_local method. + // AST Dumping virtual void dump(ostream &o); @@ -123,6 +129,17 @@ private: virtual AST_Field *fe_add_field(AST_Field *f); virtual AST_Enum *fe_add_enum(AST_Enum *e); virtual AST_EnumVal *fe_add_enum_val(AST_EnumVal *v); + + //=helper + + int compute_member_count (void); + // count the number of members + + int member_count_; + // number of members + + idl_bool local_struct_; + // We also need to determine whether we contain any local type. }; #endif // _AST_STRUCTURE_AST_STRUCTURE_HH diff --git a/TAO/docs/releasenotes/index.html b/TAO/docs/releasenotes/index.html index b02f02087a7..f53073427a7 100644 --- a/TAO/docs/releasenotes/index.html +++ b/TAO/docs/releasenotes/index.html @@ -1900,12 +1900,9 @@ local objects.</p> <p>Future Work (aka. known problems):</p> <ul> <li>Supposedly, any constructed types that contains local types - become local automatically. TAO_IDL currently doesn't perform - this automatic conversion very well when a contructed type is - defined outside of a local interface.</li> - <li>TAO_IDL needs to support more comprehensive semantic check on - conflicts of using local types as operation arguments of a - regular (remote) interface.</li> + become local automatically. TAO_IDL currently doesn't handle + the array type very well if one is defined outside the scope of + a local interface.</li> <li>Need to test local object support more systematically and comprehensively. (Does TAO throw a MARSHAL exception when trying to marshal a local type?) |