diff -rc src/tool/omniidl2/omniORB2_be/o2be.h newsrc/tool/omniidl2/omniORB2_be/o2be.h *** src/tool/omniidl2/omniORB2_be/o2be.h Thu Jan 7 09:32:17 1999 --- newsrc/tool/omniidl2/omniORB2_be/o2be.h Tue Feb 9 11:06:01 1999 *************** *** 27,32 **** --- 27,36 ---- /* $Log: o2be.h,v $ + Revision 1.19 1999/02/09 09:43:40 djr + Fixed bug where a union helper class was not being declared before + being declared as a friend. + Revision 1.18 1999/01/07 09:32:16 djr Changes to support new version of TypeCode and Any. Code for TypeCode and Any are now generated in a separate *************** *** 556,561 **** --- 560,567 ---- void produce_typecode_skel(std::fstream& s); + void produce_decls_at_global_scope_in_hdr(std::fstream& s); + void set_have_produced_typecode_skel() { pd_have_produced_typecode_skel = I_TRUE; } idl_bool have_produced_typecode_skel() *************** *** 1057,1062 **** --- 1063,1070 ---- void produce_hdr(std::fstream& s); void produce_skel(std::fstream& s); void produce_dynskel(std::fstream& s); + + void produce_decls_at_global_scope_in_hdr(std::fstream& s); void produce_binary_operators_in_hdr(std::fstream& s); void produce_binary_operators_in_dynskel(std::fstream& s); diff -rc src/tool/omniidl2/omniORB2_be/o2be_exception.cc newsrc/tool/omniidl2/omniORB2_be/o2be_exception.cc *** src/tool/omniidl2/omniORB2_be/o2be_exception.cc Thu Jan 7 09:47:17 1999 --- newsrc/tool/omniidl2/omniORB2_be/o2be_exception.cc Tue Feb 9 11:17:30 1999 *************** *** 93,250 **** IND(s); s << "class " << uqname() << " : public CORBA::UserException {\n"; IND(s); s << "public:\n\n"; INC_INDENT_LEVEL(); - { - UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); - while (!i.is_done()) - { - AST_Decl *d = i.item(); - AST_Decl *decl = AST_Field::narrow_from_decl(d)->field_type(); - AST_Decl *tdecl = decl; - while (tdecl->node_type() == AST_Decl::NT_typedef) - tdecl = o2be_typedef::narrow_from_decl(tdecl)->base_type(); - IND(s); - switch (tdecl->node_type()) - { - case AST_Decl::NT_string: - { - if (decl->node_type() == AST_Decl::NT_string) - s << o2be_string::fieldMemberTypeName(); - else - s << o2be_typedef::narrow_from_decl(decl)->fieldMemberType_fqname(this); - s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - break; - } - case AST_Decl::NT_interface: - { - if (decl->node_type() == AST_Decl::NT_interface) - s << o2be_interface::narrow_from_decl(decl)->fieldMemberType_fqname(this); - else - s << o2be_typedef::narrow_from_decl(decl)->fieldMemberType_fqname(this); - s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - break; - } - case AST_Decl::NT_pre_defined: - { - if (AST_PredefinedType::narrow_from_decl(tdecl)->pt() - == AST_PredefinedType::PT_TypeCode) - { - s << o2be_predefined_type::TypeCodeMemberName(); - } - else - { - s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); - } - s << " " << o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - break; - } - case AST_Decl::NT_array: - { - if (decl->node_type() == AST_Decl::NT_array) { - // Check if this is an anonymous array type, if so - // generate the supporting typedef. - if (decl->has_ancestor(this)) { - char* fname = o2be_field::narrow_from_decl(d)->uqname(); - char * tmpname = new char [strlen(fname) + 2]; - strcpy(tmpname,"_"); - strcat(tmpname,fname); - o2be_array::narrow_from_decl(decl)->produce_typedef_in_union(s,tmpname,this); - } - o2be_array::narrow_from_decl(decl)->produce_struct_member_decl(s,d,this); - } - else { - s << o2be_typedef::narrow_from_decl(decl)->unambiguous_name(this); - s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - } - break; - } - case AST_Decl::NT_sequence: - { - if (decl->node_type() == AST_Decl::NT_sequence) { - s << o2be_sequence::narrow_from_decl(decl)->seq_template_name(this) - << " " - << o2be_field::narrow_from_decl(d)->uqname() - << ";\n"; - } - else { - s << o2be_typedef::narrow_from_decl(decl)->unambiguous_name(this); - s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - } - break; - } - default: - s << o2be_name::narrow_and_produce_unambiguous_name(decl,this) - << " " << o2be_field::narrow_from_decl(d)->uqname() << ";\n"; - } ! i.next(); } } - IND(s); s << "\n"; - IND(s); s << uqname() << "() {};\n"; - IND(s); s << uqname() << "(const " << uqname() << " &);\n"; { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); ! idl_bool first = I_TRUE; ! while (!i.is_done()) ! { ! if (first) { ! IND(s); s << uqname() << "("; ! first = I_FALSE; ! } ! AST_Decl *d = i.item(); ! AST_Decl *decl = AST_Field::narrow_from_decl(d)->field_type(); ! o2be_operation::argMapping mapping; ! o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( ! decl, ! o2be_operation::wIN,mapping); ! s << ((mapping.is_const) ? "const ":""); ! switch (ntype) { ! case o2be_operation::tObjref: ! s << o2be_interface::narrow_from_decl(decl)->unambiguous_objref_name(this); ! break; ! case o2be_operation::tString: ! s << "char* "; break; ! case o2be_operation::tTypeCode: ! s << "CORBA::TypeCode_ptr "; break; ! case o2be_operation::tArrayFixed: ! case o2be_operation::tArrayVariable: ! // Check if this is an anonymous array type, if so ! // use the supporting typedef for the array ! if (decl->node_type() == AST_Decl::NT_array && ! decl->has_ancestor(this)) { ! s << "_0RL_" << o2be_field::narrow_from_decl(d)->uqname(); } else { s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); } break; ! case o2be_operation::tSequence: if (decl->node_type() == AST_Decl::NT_sequence) { ! s << o2be_sequence::narrow_from_decl(decl)->seq_template_name(this); } else { ! s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); } break; - default: - s << o2be_name::narrow_and_produce_unambiguous_name(decl,this) - << ((mapping.is_arrayslice) ? "_slice":"") - << " " - << ((mapping.is_pointer) ? "*":"") - << ((mapping.is_reference) ? "&":""); - break; } ! s << " _" << o2be_field::narrow_from_decl(d)->uqname(); ! i.next(); ! s << ((!i.is_done()) ? ", " : ""); } if (!first) { s << ");\n"; }; --- 93,297 ---- IND(s); s << "class " << uqname() << " : public CORBA::UserException {\n"; IND(s); s << "public:\n\n"; INC_INDENT_LEVEL(); ! { // Declare any constructed types defined in this scope. ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); ! ! while( !i.is_done() ) { ! AST_Decl* d = i.item(); ! i.next(); ! if( d->node_type() != AST_Decl::NT_field ) continue; ! ! AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); ! if( !decl->has_ancestor(this) ) continue; ! ! switch( decl->node_type() ) { ! case AST_Decl::NT_enum: ! if( !o2be_enum::narrow_from_decl(decl)->get_hdr_produced_in_field() ) { ! o2be_enum::narrow_from_decl(decl)->set_hdr_produced_in_field(); ! o2be_enum::narrow_from_decl(decl)->produce_hdr(s); ! } ! break; ! case AST_Decl::NT_struct: ! if( !o2be_structure::narrow_from_decl(decl) ! ->get_hdr_produced_in_field() ) { ! o2be_structure::narrow_from_decl(decl)->set_hdr_produced_in_field(); ! o2be_structure::narrow_from_decl(decl)->produce_hdr(s); ! } ! break; ! case AST_Decl::NT_union: ! if( !o2be_union::narrow_from_decl(decl) ! ->get_hdr_produced_in_field() ) { ! o2be_union::narrow_from_decl(decl)->set_hdr_produced_in_field(); ! o2be_union::narrow_from_decl(decl)->produce_hdr(s); ! } ! break; ! default: ! break; } + } } { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); ! while( !i.is_done() ) { ! AST_Decl* d = i.item(); ! i.next(); ! if( d->node_type() != AST_Decl::NT_field ) continue; ! AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); ! AST_Decl* tdecl = decl; ! while (tdecl->node_type() == AST_Decl::NT_typedef) ! tdecl = o2be_typedef::narrow_from_decl(tdecl)->base_type(); ! ! IND(s); ! switch( tdecl->node_type() ) { ! case AST_Decl::NT_string: ! { ! if (decl->node_type() == AST_Decl::NT_string) ! s << o2be_string::fieldMemberTypeName(); ! else ! s << o2be_typedef::narrow_from_decl(decl) ! ->fieldMemberType_fqname(this); ! s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; break; ! } ! case AST_Decl::NT_interface: ! { ! if (decl->node_type() == AST_Decl::NT_interface) ! s << o2be_interface::narrow_from_decl(decl) ! ->fieldMemberType_fqname(this); ! else ! s << o2be_typedef::narrow_from_decl(decl) ! ->fieldMemberType_fqname(this); ! s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; break; ! } ! case AST_Decl::NT_pre_defined: ! { ! if (AST_PredefinedType::narrow_from_decl(tdecl)->pt() ! == AST_PredefinedType::PT_TypeCode) { ! s << o2be_predefined_type::TypeCodeMemberName(); } else { s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); + } + s << " " << o2be_field::narrow_from_decl(d)->uqname() << ";\n"; + break; + } + case AST_Decl::NT_array: + { + if (decl->node_type() == AST_Decl::NT_array) { + // Check if this is an anonymous array type, if so + // generate the supporting typedef. + if (decl->has_ancestor(this)) { + char* fname = o2be_field::narrow_from_decl(d)->uqname(); + char * tmpname = new char [strlen(fname) + 2]; + strcpy(tmpname,"_"); + strcat(tmpname,fname); + o2be_array::narrow_from_decl(decl)->produce_typedef_in_union(s,tmpname,this); } + o2be_array::narrow_from_decl(decl)->produce_struct_member_decl(s,d,this); + } + else { + s << o2be_typedef::narrow_from_decl(decl)->unambiguous_name(this); + s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; + } break; ! } ! case AST_Decl::NT_sequence: ! { if (decl->node_type() == AST_Decl::NT_sequence) { ! s << o2be_sequence::narrow_from_decl(decl)->seq_template_name(this) ! << " " ! << o2be_field::narrow_from_decl(d)->uqname() ! << ";\n"; } else { ! s << o2be_typedef::narrow_from_decl(decl)->unambiguous_name(this); ! s <<" "<< o2be_field::narrow_from_decl(d)->uqname() << ";\n"; } break; } ! default: ! s << o2be_name::narrow_and_produce_unambiguous_name(decl,this) ! << " " << o2be_field::narrow_from_decl(d)->uqname() << ";\n"; ! } ! } ! } ! ! IND(s); s << "\n"; ! IND(s); s << uqname() << "() {};\n"; ! IND(s); s << uqname() << "(const " << uqname() << " &);\n"; ! { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); ! idl_bool first = I_TRUE; ! ! while( !i.is_done() ) { ! if (first) { ! IND(s); s << uqname() << "("; ! first = I_FALSE; ! } ! AST_Decl* d = i.item(); ! i.next(); ! ! if( d->node_type() != AST_Decl::NT_field ) continue; ! ! AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); ! o2be_operation::argMapping mapping; ! o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( ! decl, ! o2be_operation::wIN,mapping); ! ! s << ((mapping.is_const) ? "const ":""); ! ! switch (ntype) { ! case o2be_operation::tObjref: ! s << o2be_interface::narrow_from_decl(decl) ! ->unambiguous_objref_name(this); ! break; ! case o2be_operation::tString: ! s << "char* "; ! break; ! case o2be_operation::tTypeCode: ! s << "CORBA::TypeCode_ptr "; ! break; ! case o2be_operation::tArrayFixed: ! case o2be_operation::tArrayVariable: ! // Check if this is an anonymous array type, if so ! // use the supporting typedef for the array ! if (decl->node_type() == AST_Decl::NT_array && ! decl->has_ancestor(this)) ! { ! s << "_0RL_" << o2be_field::narrow_from_decl(d)->uqname(); ! } ! else ! { ! s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); ! } ! break; ! case o2be_operation::tSequence: ! if (decl->node_type() == AST_Decl::NT_sequence) { ! s << o2be_sequence::narrow_from_decl(decl)->seq_template_name(this); ! } ! else { ! s << o2be_name::narrow_and_produce_unambiguous_name(decl,this); ! } ! break; ! default: ! s << o2be_name::narrow_and_produce_unambiguous_name(decl,this) ! << ((mapping.is_arrayslice) ? "_slice":"") ! << " " ! << ((mapping.is_pointer) ? "*":"") ! << ((mapping.is_reference) ? "&":""); ! break; } + s << " _" << o2be_field::narrow_from_decl(d)->uqname(); + s << ((!i.is_done()) ? ", " : ""); + } if (!first) { s << ");\n"; }; *************** *** 270,288 **** void o2be_exception::produce_skel(std::fstream &s) { IND(s); s << fqname() << "::" << uqname() << "(const " << fqname() << " &_s)\n"; IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { ! o2be_field *d = o2be_field::narrow_from_decl(i.item()); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(d->field_type(), o2be_operation::wIN,mapping); switch (ntype) { case o2be_operation::tArrayFixed: --- 317,379 ---- void o2be_exception::produce_skel(std::fstream &s) { + { // Declare any constructed types defined in this scope. + UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); + + while( !i.is_done() ) { + AST_Decl* d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + + AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); + if( !decl->has_ancestor(this) ) continue; + + switch( decl->node_type() ) { + case AST_Decl::NT_enum: + if( !o2be_enum::narrow_from_decl(decl) + ->get_skel_produced_in_field() ) { + o2be_enum::narrow_from_decl(decl)->set_skel_produced_in_field(); + o2be_enum::narrow_from_decl(decl)->produce_skel(s); + } + break; + case AST_Decl::NT_struct: + if( !o2be_structure::narrow_from_decl(decl) + ->get_skel_produced_in_field() ) { + o2be_structure::narrow_from_decl(decl)->set_skel_produced_in_field(); + o2be_structure::narrow_from_decl(decl)->produce_skel(s); + } + break; + case AST_Decl::NT_union: + if( !o2be_union::narrow_from_decl(decl) + ->get_skel_produced_in_field() ) { + o2be_union::narrow_from_decl(decl)->set_skel_produced_in_field(); + o2be_union::narrow_from_decl(decl)->produce_skel(s); + } + break; + default: + break; + } + } + } + IND(s); s << fqname() << "::" << uqname() << "(const " << fqname() << " &_s)\n"; IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl* di = i.item(); ! i.next(); ! if( di->node_type() != AST_Decl::NT_field ) continue; ! ! o2be_field* d = o2be_field::narrow_from_decl(di); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(d->field_type(), o2be_operation::wIN,mapping); + switch (ntype) { case o2be_operation::tArrayFixed: *************** *** 338,351 **** IND(s); s << d->uqname() << " = _s." << d->uqname() << ";\n"; break; } - i.next(); } } DEC_INDENT_LEVEL(); IND(s); s << "}\n\n"; { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); idl_bool first = I_TRUE; while (!i.is_done()) { --- 429,441 ---- IND(s); s << d->uqname() << " = _s." << d->uqname() << ";\n"; break; } } } DEC_INDENT_LEVEL(); IND(s); s << "}\n\n"; { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); idl_bool first = I_TRUE; while (!i.is_done()) { *************** *** 353,360 **** IND(s); s << fqname() << "::" << uqname() << "("; first = I_FALSE; } ! AST_Decl *d = i.item(); ! AST_Decl *decl = AST_Field::narrow_from_decl(d)->field_type(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( decl, --- 443,454 ---- IND(s); s << fqname() << "::" << uqname() << "("; first = I_FALSE; } ! ! AST_Decl* d = i.item(); ! i.next(); ! if( d->node_type() != AST_Decl::NT_field ) continue; ! ! AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( decl, *************** *** 403,409 **** break; } s << " _" << o2be_field::narrow_from_decl(d)->uqname(); - i.next(); s << ((!i.is_done()) ? ", " : ""); } if (!first) { --- 497,502 ---- *************** *** 411,420 **** IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator ii(this,UTL_Scope::IK_decls); while (!ii.is_done()) { ! o2be_field *dd = o2be_field::narrow_from_decl(ii.item()); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(dd->field_type(), --- 504,517 ---- IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator ii(this, UTL_Scope::IK_decls); while (!ii.is_done()) { ! AST_Decl* iid = ii.item(); ! ii.next(); ! if( iid->node_type() != AST_Decl::NT_field ) continue; ! ! o2be_field* dd = o2be_field::narrow_from_decl(iid); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(dd->field_type(), *************** *** 474,480 **** IND(s); s << dd->uqname() << " = _" << dd->uqname() << ";\n"; break; } - ii.next(); } } DEC_INDENT_LEVEL(); --- 571,576 ---- *************** *** 483,496 **** } IND(s); s << fqname() << " & " << fqname() ! << "::operator=(const " << fqname() << " &_s)\n"; IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { ! o2be_field *d = o2be_field::narrow_from_decl(i.item()); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(d->field_type(), --- 579,596 ---- } IND(s); s << fqname() << " & " << fqname() ! << "::operator=(const " << fqname() << "& _s)\n"; IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl* id = i.item(); ! i.next(); ! if( id->node_type() != AST_Decl::NT_field ) continue; ! ! o2be_field *d = o2be_field::narrow_from_decl(id); o2be_operation::argMapping mapping; o2be_operation::argType ntype; ntype = o2be_operation::ast2ArgMapping(d->field_type(), *************** *** 550,556 **** IND(s); s << d->uqname() << " = _s." << d->uqname() << ";\n"; break; } - i.next(); } } IND(s); s << "return *this;\n"; --- 650,655 ---- *************** *** 563,572 **** INC_INDENT_LEVEL(); IND(s); s << "size_t _msgsize = _initialoffset;\n"; { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl *d = i.item(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), --- 662,674 ---- INC_INDENT_LEVEL(); IND(s); s << "size_t _msgsize = _initialoffset;\n"; { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl* d = i.item(); ! i.next(); ! if( d->node_type() != AST_Decl::NT_field ) continue; ! o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), *************** *** 586,592 **** o2be_field::narrow_from_decl(d)->uqname(), ntype, mapping); - i.next(); } } IND(s); s << "return _msgsize;\n"; --- 688,693 ---- *************** *** 598,607 **** IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl *d = i.item(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), --- 699,711 ---- IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { ! AST_Decl* d = i.item(); ! i.next(); ! if( d->node_type() != AST_Decl::NT_field ) continue; ! o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), *************** *** 620,626 **** o2be_field::narrow_from_decl(d)->uqname(), ntype, mapping); - i.next(); } } DEC_INDENT_LEVEL(); --- 724,729 ---- *************** *** 631,640 **** IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), --- 734,746 ---- IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), *************** *** 653,659 **** o2be_field::narrow_from_decl(d)->uqname(), ntype, mapping); - i.next(); } } DEC_INDENT_LEVEL(); --- 759,764 ---- *************** *** 664,673 **** IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), --- 769,781 ---- IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), *************** *** 686,692 **** o2be_field::narrow_from_decl(d)->uqname(), ntype, mapping); - i.next(); } } DEC_INDENT_LEVEL(); --- 794,799 ---- *************** *** 697,706 **** IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), --- 804,816 ---- IND(s); s << "{\n"; INC_INDENT_LEVEL(); { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + o2be_operation::argMapping mapping; o2be_operation::argType ntype = o2be_operation::ast2ArgMapping( AST_Field::narrow_from_decl(d)->field_type(), *************** *** 720,726 **** ntype, mapping, I_TRUE); - i.next(); } } DEC_INDENT_LEVEL(); --- 830,835 ---- *************** *** 731,736 **** --- 840,885 ---- void o2be_exception::produce_dynskel(std::fstream &s) { + { // Declare any constructed types defined in this scope. + UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); + + while( !i.is_done() ) { + AST_Decl* d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + + AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); + if( !decl->has_ancestor(this) ) continue; + + switch( decl->node_type() ) { + case AST_Decl::NT_enum: + if( !o2be_enum::narrow_from_decl(decl) + ->get_dynskel_produced_in_field() ) { + o2be_enum::narrow_from_decl(decl)->set_dynskel_produced_in_field(); + o2be_enum::narrow_from_decl(decl)->produce_dynskel(s); + } + break; + case AST_Decl::NT_struct: + if( !o2be_structure::narrow_from_decl(decl) + ->get_dynskel_produced_in_field() ) { + o2be_structure::narrow_from_decl(decl) + ->set_dynskel_produced_in_field(); + o2be_structure::narrow_from_decl(decl)->produce_dynskel(s); + } + break; + case AST_Decl::NT_union: + if( !o2be_union::narrow_from_decl(decl) + ->get_dynskel_produced_in_field() ) { + o2be_union::narrow_from_decl(decl)->set_dynskel_produced_in_field(); + o2be_union::narrow_from_decl(decl)->produce_dynskel(s); + } + break; + default: + break; + } + } + } + // Produce code for types any and TypeCode this->produce_typecode_skel(s); *************** *** 771,776 **** --- 920,970 ---- void o2be_exception::produce_binary_operators_in_hdr(std::fstream &s) { + { // Declare any constructed types defined in this scope. + UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); + + while( !i.is_done() ) { + AST_Decl* d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + + AST_Decl *decl = AST_Field::narrow_from_decl(d)->field_type(); + if( !decl->has_ancestor(this) ) continue; + + switch( decl->node_type() ) { + case AST_Decl::NT_enum: + if( !o2be_enum::narrow_from_decl(decl) + ->get_binary_operators_hdr_produced_in_field() ) { + o2be_enum::narrow_from_decl(decl) + ->set_binary_operators_hdr_produced_in_field(); + o2be_enum::narrow_from_decl(decl) + ->produce_binary_operators_in_hdr(s); + } + break; + case AST_Decl::NT_struct: + if( !o2be_structure::narrow_from_decl(decl) + ->get_binary_operators_hdr_produced_in_field() ) { + o2be_structure::narrow_from_decl(decl) + ->set_binary_operators_hdr_produced_in_field(); + o2be_structure::narrow_from_decl(decl) + ->produce_binary_operators_in_hdr(s); + } + break; + case AST_Decl::NT_union: + if( !o2be_union::narrow_from_decl(decl) + ->get_binary_operators_hdr_produced_in_field() ) { + o2be_union::narrow_from_decl(decl) + ->set_binary_operators_hdr_produced_in_field(); + o2be_union::narrow_from_decl(decl) + ->produce_binary_operators_in_hdr(s); + } + break; + default: + break; + } + } + } + if (idl_global->compile_flags() & IDL_CF_ANY) { // any insertion and extraction operators IND(s); s << "void operator<<=(CORBA::Any& _a, const " *************** *** 786,801 **** void o2be_exception::produce_binary_operators_in_dynskel(std::fstream &s) { ////////////////////////////////////////////////////////////////////// //////////////////////// tcDescriptor generation ///////////////////// ////////////////////////////////////////////////////////////////////// // Ensure we have buildDesc support for all the members. { ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl *d = i.item(); ! if( d->node_type() == AST_Decl::NT_field ) { AST_Decl* ft = o2be_field::narrow_from_decl(d)->field_type(); o2be_buildDesc::produce_decls(s, ft); --- 980,1040 ---- void o2be_exception::produce_binary_operators_in_dynskel(std::fstream &s) { + { // Declare any constructed types defined in this scope. + UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); + + while( !i.is_done() ) { + AST_Decl* d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + + AST_Decl *decl = AST_Field::narrow_from_decl(d)->field_type(); + if( !decl->has_ancestor(this) ) continue; + + switch( decl->node_type() ) { + case AST_Decl::NT_enum: + if( !o2be_enum::narrow_from_decl(decl) + ->get_binary_operators_skel_produced_in_field() ) { + o2be_enum::narrow_from_decl(decl) + ->set_binary_operators_skel_produced_in_field(); + o2be_enum::narrow_from_decl(decl) + ->produce_binary_operators_in_dynskel(s); + } + break; + case AST_Decl::NT_struct: + if( !o2be_structure::narrow_from_decl(decl) + ->get_binary_operators_skel_produced_in_field() ) { + o2be_structure::narrow_from_decl(decl) + ->set_binary_operators_skel_produced_in_field(); + o2be_structure::narrow_from_decl(decl) + ->produce_binary_operators_in_dynskel(s); + } + break; + case AST_Decl::NT_union: + if( !o2be_union::narrow_from_decl(decl) + ->get_binary_operators_skel_produced_in_field() ) { + o2be_union::narrow_from_decl(decl) + ->set_binary_operators_skel_produced_in_field(); + o2be_union::narrow_from_decl(decl) + ->produce_binary_operators_in_dynskel(s); + } + break; + default: + break; + } + } + } + ////////////////////////////////////////////////////////////////////// //////////////////////// tcDescriptor generation ///////////////////// ////////////////////////////////////////////////////////////////////// // Ensure we have buildDesc support for all the members. { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl *d = i.item(); ! if( d->node_type() == AST_Decl::NT_field ) { AST_Decl* ft = o2be_field::narrow_from_decl(d)->field_type(); o2be_buildDesc::produce_decls(s, ft); *************** *** 816,822 **** { unsigned long currentIndex = 0; ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); --- 1055,1061 ---- { unsigned long currentIndex = 0; ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while (!i.is_done()) { AST_Decl *d = i.item(); *************** *** 945,950 **** --- 1184,1190 ---- IND(s); s << "}\n\n"; } + void o2be_exception::produce_typecode_skel(std::fstream &s) { *************** *** 956,962 **** if (memberCount > 0) { { // Ensure we have the typecodes of the members ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl* d = i.item(); i.next(); --- 1196,1202 ---- if (memberCount > 0) { { // Ensure we have the typecodes of the members ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl* d = i.item(); i.next(); *************** *** 973,979 **** INC_INDENT_LEVEL(); { // Produce entries in PR_structMember for struct members ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl *d = i.item(); i.next(); --- 1213,1219 ---- INC_INDENT_LEVEL(); { // Produce entries in PR_structMember for struct members ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while( !i.is_done() ) { AST_Decl *d = i.item(); i.next(); *************** *** 999,1004 **** --- 1239,1275 ---- if (memberCount > 0) s << "_0RL_structmember_" << _idname() << ", "; else s << "(CORBA::PR_structMember*) 0, "; s << memberCount << ");\n\n"; + } + + + void + o2be_exception::produce_decls_at_global_scope_in_hdr(std::fstream& s) + { + { // Declare any constructed types defined in this scope. + UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); + + while( !i.is_done() ) { + AST_Decl* d = i.item(); + i.next(); + if( d->node_type() != AST_Decl::NT_field ) continue; + + AST_Decl* decl = AST_Field::narrow_from_decl(d)->field_type(); + if( !decl->has_ancestor(this) ) continue; + + switch( decl->node_type() ) { + case AST_Decl::NT_struct: + o2be_structure::narrow_from_decl(decl) + ->produce_decls_at_global_scope_in_hdr(s); + break; + case AST_Decl::NT_union: + o2be_union::narrow_from_decl(decl) + ->produce_decls_at_global_scope_in_hdr(s); + break; + default: + break; + } + } + } } diff -rc src/tool/omniidl2/omniORB2_be/o2be_interface.cc newsrc/tool/omniidl2/omniORB2_be/o2be_interface.cc *** src/tool/omniidl2/omniORB2_be/o2be_interface.cc Thu Jan 7 09:47:07 1999 --- newsrc/tool/omniidl2/omniORB2_be/o2be_interface.cc Tue Feb 9 11:11:34 1999 *************** *** 27,32 **** --- 27,36 ---- /* $Log: o2be_interface.cc,v $ + Revision 1.27 1999/02/09 09:40:35 djr + produce_decls_at_global_scope_in_hdr() now propagates properly + through (nested) interfaces to structure and union types. + Revision 1.26 1999/01/07 09:47:04 djr Changes to support new TypeCode/Any implementation, which is now placed in a new file ...DynSK.cc (by default). *************** *** 2693,2699 **** void ! o2be_interface::produce_binary_operators_in_hdr(std::fstream &s) { { UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); --- 2697,2737 ---- void ! o2be_interface::produce_decls_at_global_scope_in_hdr(std::fstream& s) ! { ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); ! ! while( !i.is_done() ) { ! AST_Decl* d = i.item(); ! ! switch( d->node_type() ) { ! case AST_Decl::NT_union: ! o2be_union::narrow_from_decl(d) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! case AST_Decl::NT_struct: ! o2be_structure::narrow_from_decl(d) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! case AST_Decl::NT_except: ! o2be_exception::narrow_from_decl(d) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! case AST_Decl::NT_interface: ! o2be_interface::narrow_from_decl(d) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! default: ! break; ! } ! ! i.next(); ! } ! } ! ! ! void ! o2be_interface::produce_binary_operators_in_hdr(std::fstream& s) { { UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); *************** *** 2742,2748 **** } void ! o2be_interface::produce_binary_operators_in_dynskel(std::fstream &s) { { UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); --- 2780,2786 ---- } void ! o2be_interface::produce_binary_operators_in_dynskel(std::fstream& s) { { UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); diff -rc src/tool/omniidl2/omniORB2_be/o2be_module.cc newsrc/tool/omniidl2/omniORB2_be/o2be_module.cc *** src/tool/omniidl2/omniORB2_be/o2be_module.cc Thu Jan 7 09:45:59 1999 --- newsrc/tool/omniidl2/omniORB2_be/o2be_module.cc Tue Feb 9 11:08:57 1999 *************** *** 26,31 **** --- 26,35 ---- /* $Log: o2be_module.cc,v $ + Revision 1.12 1999/02/09 09:44:59 djr + Fixed bug where a union helper class was not being declared before + being declared as a friend. + Revision 1.11 1999/01/07 09:45:58 djr Changes for new output file ...DynSK.cc *************** *** 256,283 **** { if( !(in_main_file()) ) return; ! UTL_ScopeActiveIterator i(this,UTL_Scope::IK_decls); ! AST_Decl* decl; while( !i.is_done() ) { ! decl = i.item(); i.next(); if ((decl->in_main_file())) { switch(decl->node_type()) { case AST_Decl::NT_module: ! o2be_module:: ! narrow_from_decl(decl)->produce_decls_at_global_scope_in_hdr(s); break; case AST_Decl::NT_union: ! o2be_union:: ! narrow_from_decl(decl)->produce_decls_at_global_scope_in_hdr(s); break; case AST_Decl::NT_struct: ! o2be_structure:: ! narrow_from_decl(decl)->produce_decls_at_global_scope_in_hdr(s); break; default: break; --- 260,294 ---- { if( !(in_main_file()) ) return; ! UTL_ScopeActiveIterator i(this, UTL_Scope::IK_decls); while( !i.is_done() ) { ! AST_Decl* decl = i.item(); i.next(); if ((decl->in_main_file())) { switch(decl->node_type()) { case AST_Decl::NT_module: ! o2be_module::narrow_from_decl(decl) ! ->produce_decls_at_global_scope_in_hdr(s); break; case AST_Decl::NT_union: ! o2be_union::narrow_from_decl(decl) ! ->produce_decls_at_global_scope_in_hdr(s); break; case AST_Decl::NT_struct: ! o2be_structure::narrow_from_decl(decl) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! case AST_Decl::NT_except: ! o2be_exception::narrow_from_decl(decl) ! ->produce_decls_at_global_scope_in_hdr(s); ! break; ! case AST_Decl::NT_interface: ! o2be_interface::narrow_from_decl(decl) ! ->produce_decls_at_global_scope_in_hdr(s); break; default: break;