diff options
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r-- | TAO/TAO_IDL/be/be_decl.cpp | 20 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp | 1 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp | 16 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_eventtype_fwd.cpp | 1 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp | 24 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp | 16 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp | 7 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp | 24 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_decl.h | 4 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/idl.yy | 25 | ||||
-rw-r--r-- | TAO/TAO_IDL/fe/y.tab.cpp | 73 | ||||
-rw-r--r-- | TAO/TAO_IDL/util/utl_scope.cpp | 3 |
17 files changed, 182 insertions, 50 deletions
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index 9ab1742ec1f..00fbf97a237 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -89,7 +89,8 @@ be_decl::be_decl (void) srv_outarg_tmpl_class_gen_ (I_FALSE), srv_outarg_pragma_inst_gen_ (I_FALSE), srv_retarg_tmpl_class_gen_ (I_FALSE), - srv_retarg_pragma_inst_gen_ (I_FALSE) + srv_retarg_pragma_inst_gen_ (I_FALSE), + ccm_pre_proc_gen_ (I_FALSE) { } @@ -136,7 +137,8 @@ be_decl::be_decl (AST_Decl::NodeType type, srv_outarg_tmpl_class_gen_ (I_FALSE), srv_outarg_pragma_inst_gen_ (I_FALSE), srv_retarg_tmpl_class_gen_ (I_FALSE), - srv_retarg_pragma_inst_gen_ (I_FALSE) + srv_retarg_pragma_inst_gen_ (I_FALSE), + ccm_pre_proc_gen_ (I_FALSE) { } @@ -561,6 +563,12 @@ be_decl::srv_inline_gen (void) return this->srv_inline_gen_; } +idl_bool +be_decl::ccm_pre_proc_gen (void) +{ + return this->ccm_pre_proc_gen_; +} + // Set the flag indicating that code generation is done. void be_decl::cli_hdr_gen (idl_bool val) @@ -785,6 +793,14 @@ be_decl::srv_inline_gen (idl_bool val) this->srv_inline_gen_ = val; } +void +be_decl::ccm_pre_proc_gen (idl_bool val) +{ + this->ccm_pre_proc_gen_ = val; +} + +//========================================== + int be_decl::accept (be_visitor *visitor) { diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp index b36616ef865..a397590dde8 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp @@ -258,6 +258,7 @@ be_visitor_array_cdr_op_cs::visit_predefined_type (be_predefined_type *node) { case AST_PredefinedType::PT_pseudo: case AST_PredefinedType::PT_object: + case AST_PredefinedType::PT_value: case AST_PredefinedType::PT_any: // Let the helper handle this. return this->visit_node (node); diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp index 6a9959a5e23..666e3e0b896 100644 --- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp @@ -21,6 +21,7 @@ #include "be_typedef.h" #include "be_component.h" #include "be_eventtype.h" +#include "be_eventtype_fwd.h" #include "be_home.h" #include "be_extern.h" #include "ast_generator.h" @@ -250,6 +251,11 @@ be_visitor_ccm_pre_proc::visit_home (be_home *node) int be_visitor_ccm_pre_proc::visit_eventtype (be_eventtype *node) { + if (node->ccm_pre_proc_gen ()) + { + return 0; + } + if (this->create_event_consumer (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -259,9 +265,19 @@ be_visitor_ccm_pre_proc::visit_eventtype (be_eventtype *node) -1); } + node->ccm_pre_proc_gen (I_TRUE); return 0; } +int +be_visitor_ccm_pre_proc::visit_eventtype_fwd (be_eventtype_fwd *node) +{ + be_eventtype *fd = + be_eventtype::narrow_from_decl (node->full_definition ()); + + return this->visit_eventtype (fd); +} + // **************************************************************** int diff --git a/TAO/TAO_IDL/be/be_visitor_eventtype_fwd.cpp b/TAO/TAO_IDL/be/be_visitor_eventtype_fwd.cpp index 87ec46a6ac1..b68da9d5a75 100644 --- a/TAO/TAO_IDL/be/be_visitor_eventtype_fwd.cpp +++ b/TAO/TAO_IDL/be/be_visitor_eventtype_fwd.cpp @@ -23,6 +23,7 @@ #include "be_visitor_eventtype_fwd.h" #include "be_visitor_valuetype_fwd.h" #include "be_visitor_context.h" +#include "be_helper.h" #include "be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp" #include "be_visitor_eventtype_fwd/any_op_ch.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp b/TAO/TAO_IDL/be/be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp index c2f2954be89..7f0d8c8d21c 100644 --- a/TAO/TAO_IDL/be/be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_eventtype_fwd/eventtype_fwd_ch.cpp @@ -36,6 +36,30 @@ be_visitor_eventtype_fwd_ch::~be_visitor_eventtype_fwd_ch (void) int be_visitor_eventtype_fwd_ch::visit_eventtype_fwd (be_eventtype_fwd *node) { + if (node->cli_hdr_gen () || node->imported ()) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + // All we do in this is generate a forward declaration of the + // corresponding consumer interface class. + *os << be_nl << be_nl << "class " << node->local_name () << "Consumer;"; + + // Generate the ifdefined macro for the _ptr type. + os->gen_ifdef_macro (node->flat_name (), "Consumer_ptr"); + + // Generate the _ptr typedef. + *os << be_nl << be_nl + << "typedef " << node->local_name () << "Consumer *" << node->local_name () + << "Consumer_ptr;"; + + os->gen_endif (); + be_visitor_context ctx (*this->ctx_); be_visitor_valuetype_fwd_ch visitor (&ctx); return visitor.visit_valuetype_fwd (node); diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp index 1631fe636ee..8c3669fb306 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -360,6 +360,10 @@ be_visitor_field_ch::visit_predefined_type (be_predefined_type *node) { *os << bt->name () << "_var"; } + else if (node->pt () == AST_PredefinedType::PT_value) + { + *os << bt->name () << " *"; + } else if (node->pt () == AST_PredefinedType::PT_pseudo) { // This was a typedefed array. diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp index 40b3c54e310..4c02f8a5598 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp @@ -76,6 +76,10 @@ be_visitor_sequence_buffer_type::visit_predefined_type (be_predefined_type *node { *os << node->name () << "_ptr"; } + else if (pt == AST_PredefinedType::PT_value) + { + *os << node->name () << " *"; + } else { *os << node->name (); diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp index 27628f760b1..664e9a660f5 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_cs.cpp @@ -549,16 +549,22 @@ be_visitor_union_branch_cdr_op_cs::visit_predefined_type (be_predefined_type *no } else if (pt == AST_PredefinedType::PT_pseudo) { - *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl; - - //@@TODO - case for ValueBase. - - *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl + *os << "CORBA::TypeCode_var _tao_union_tmp;" << be_nl + << "result = strm >> _tao_union_tmp.out ();" << be_nl << be_nl << "if (result)" << be_idt_nl << "{" << be_idt_nl << "_tao_union." << f->local_name () << " (_tao_union_tmp.in ());"; } + else if (pt == AST_PredefinedType::PT_value) + { + *os << "CORBA::ValueBase * _tao_union_tmp;" << be_nl + << "result = strm >> _tao_union_tmp;" << be_nl << be_nl + << "if (result)" << be_idt_nl + << "{" << be_idt_nl + << "_tao_union." << f->local_name () << " (_tao_union_tmp);"; + + } else if (pt == AST_PredefinedType::PT_char) { *os << "CORBA::Char _tao_union_tmp;" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp index 1040193d8c8..f6e11c113bb 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp @@ -359,6 +359,11 @@ be_visitor_union_branch_private_ch::visit_predefined_type ( *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name () << "_;"; } + else if (node->pt () == AST_PredefinedType::PT_value) + { + *os << bt->nested_type_name (bu, " *") << " " << ub->local_name () + << "_;"; + } else if (node->pt () == AST_PredefinedType::PT_any) { // Cannot have an object inside of a union. In addition, an Any is a diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp index e37fbea8564..90397ea1bf9 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp @@ -425,6 +425,13 @@ be_visitor_union_branch_public_ch::visit_predefined_type (be_predefined_type *no *os << bt->nested_type_name (bu, "_ptr") << " " << ub->local_name () << " (void) const;"; break; + case AST_PredefinedType::PT_value: + *os << be_nl << be_nl + << "void " << ub->local_name () << " (" + << bt->nested_type_name (bu, " *") << ");" << be_nl; + *os << bt->nested_type_name (bu, " *") << " " << ub->local_name () + << " (void) const;"; + break; case AST_PredefinedType::PT_any: *os << be_nl << be_nl << "void " << ub->local_name () << " (const " diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp index 77b30a7eec9..5b45fd9505d 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp @@ -701,6 +701,11 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( << bt->name () << "_ptr"; } + else if (pt == AST_PredefinedType::PT_value) + { + *os << bt->name () + << " *"; + } else if (pt == AST_PredefinedType::PT_any) { *os << "const " @@ -755,6 +760,12 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( << bt->name () << "::_duplicate (val);" << be_uidt_nl; break; + case AST_PredefinedType::PT_value: + *os << "CORBA::add_ref (val);" << be_nl + << "this->u_." << ub->local_name () + << "_ = val;" << be_uidt_nl; + + break; case AST_PredefinedType::PT_any: *os << "ACE_NEW (" << be_idt << be_idt_nl << "this->u_." << ub->local_name () @@ -803,6 +814,19 @@ be_visitor_union_branch_public_ci::visit_predefined_type ( *os << "}"; break; + case AST_PredefinedType::PT_value: + // Get method. + *os << "// Retrieve the member." << be_nl + << "ACE_INLINE" << be_nl + << bt->name () << " *" << be_nl + << bu->name () << "::" << ub->local_name () + << " (void) const" << be_nl + << "{" << be_idt_nl; + *os << "return this->u_." << ub->local_name () + << "_;" << be_uidt_nl; + *os << "}"; + + break; case AST_PredefinedType::PT_any: // Get method with read-only access. *os << "// Retrieve the member." << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp index 419cd33e2a1..f26ebfbb386 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_arglist_ch.cpp @@ -155,8 +155,6 @@ be_visitor_valuetype_init_arglist_ch::gen_throw_spec (be_factory *node) *os << "," << be_nl; *os << excp->name (); - AST_Decl *d = ScopeAsDecl (excp->defined_in ()); - *os << d->repoID (); } } diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index 6f0f505d82c..d9a85b7bab4 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -114,6 +114,7 @@ public: idl_bool srv_outarg_pragma_inst_gen (void); idl_bool srv_retarg_tmpl_class_gen (void); idl_bool srv_retarg_pragma_inst_gen (void); + idl_bool ccm_pre_proc_gen (void); // Set the flag indicating that code generation is done. void cli_hdr_gen (idl_bool); @@ -155,6 +156,7 @@ public: void srv_outarg_pragma_inst_gen (idl_bool); void srv_retarg_tmpl_class_gen (idl_bool); void srv_retarg_pragma_inst_gen (idl_bool); + void ccm_pre_proc_gen (idl_bool); // Narrowing DEF_NARROW_METHODS1 (be_decl, AST_Decl); @@ -206,7 +208,7 @@ private: idl_bool srv_outarg_pragma_inst_gen_; idl_bool srv_retarg_tmpl_class_gen_; idl_bool srv_retarg_pragma_inst_gen_; - + idl_bool ccm_pre_proc_gen_; }; #endif // if !defined diff --git a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h index 9b66bc3ca9e..a1e5f0c6af8 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h +++ b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h @@ -62,6 +62,9 @@ public: virtual int visit_eventtype (be_eventtype *node); // visit eventtype + virtual int visit_eventtype_fwd (be_eventtype_fwd *node); + // visit eventtype_fwd + private: // Utility methods to handle the corresponding IDL declarations. int gen_provides (be_component *node); diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index e10a3f92a86..ff49f6faeda 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -4408,16 +4408,20 @@ provides_decl : if (c != 0) { - AST_Decl *d = s->lookup_by_name ($2, + AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist, I_TRUE); - if (d == 0) { - idl_global->err ()->lookup_error ($2); + idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist); } else if (d->node_type () != AST_Decl::NT_interface) { - idl_global->err ()->interface_expected (d); + if (ACE_OS::strcmp (d->local_name ()->get_string (), + "Object") + != 0) + { + idl_global->err ()->interface_expected (d); + } } else { @@ -4425,11 +4429,11 @@ provides_decl : AST_Interface::narrow_from_decl (d); AST_Component::port_description pd; - pd.id = $3; + pd.id = tao_yyvsp[0].idval; pd.impl = interface_type; c->provides ().enqueue_tail (pd); } - } + } } ; @@ -4489,11 +4493,16 @@ uses_decl : if (d == 0) { - idl_global->err ()->lookup_error ($3); + idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist); } else if (d->node_type () != AST_Decl::NT_interface) { - idl_global->err ()->interface_expected (d); + if (ACE_OS::strcmp (d->local_name ()->get_string (), + "Object") + != 0) + { + idl_global->err ()->interface_expected (d); + } } else { diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index ed35d76eec0..7e89c6900bc 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -6660,25 +6660,31 @@ tao_yyreduce: { AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist, I_TRUE); - if (d == 0) { idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist); + break; } else if (d->node_type () != AST_Decl::NT_interface) { - idl_global->err ()->interface_expected (d); - } - else - { - AST_Type *interface_type = - AST_Interface::narrow_from_decl (d); - - AST_Component::port_description pd; - pd.id = tao_yyvsp[0].idval; - pd.impl = interface_type; - c->provides ().enqueue_tail (pd); + // Nothing else but CORBA::Object can have + // this identifier. + if (ACE_OS::strcmp (d->local_name ()->get_string (), + "Object") + != 0) + { + idl_global->err ()->interface_expected (d); + break; + } } + + AST_Type *interface_type = + AST_Type::narrow_from_decl (d); + + AST_Component::port_description pd; + pd.id = tao_yyvsp[0].idval; + pd.impl = interface_type; + c->provides ().enqueue_tail (pd); } } break; @@ -6740,31 +6746,36 @@ tao_yyreduce: if (d == 0) { idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist); + break; } else if (d->node_type () != AST_Decl::NT_interface) { - idl_global->err ()->interface_expected (d); + if (ACE_OS::strcmp (d->local_name ()->get_string (), + "Object") + != 0) + { + idl_global->err ()->interface_expected (d); + break; + } } - else - { - AST_Type *interface_type = AST_Type::narrow_from_decl (d); - AST_Component *c = AST_Component::narrow_from_scope (s); + + AST_Type *interface_type = AST_Type::narrow_from_decl (d); + AST_Component *c = AST_Component::narrow_from_scope (s); - if (c != 0) + if (c != 0) + { + AST_Component::port_description ud; + ud.id = tao_yyvsp[0].idval; + ud.impl = interface_type; + ud.is_multiple = tao_yyvsp[-2].bval; + c->uses ().enqueue_tail (ud); + + if (ud.is_multiple == I_TRUE) { - AST_Component::port_description ud; - ud.id = tao_yyvsp[0].idval; - ud.impl = interface_type; - ud.is_multiple = tao_yyvsp[-2].bval; - c->uses ().enqueue_tail (ud); - - if (ud.is_multiple == I_TRUE) - { - // These datatypes must be created in the - // front end so they can be looked up - // when compiling the generated executor IDL. - idl_global->create_uses_multiple_stuff (c, ud); - } + // These datatypes must be created in the + // front end so they can be looked up + // when compiling the generated executor IDL. + idl_global->create_uses_multiple_stuff (c, ud); } } } diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 23e86fd5c0b..5cbdaf1b21c 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -1573,7 +1573,8 @@ UTL_Scope::lookup_by_name_local (Identifier *e, // the full definition member, whether defined yet or not if (nt == AST_Decl::NT_interface_fwd || nt == AST_Decl::NT_valuetype_fwd - || nt == AST_Decl::NT_component_fwd) + || nt == AST_Decl::NT_component_fwd + || nt == AST_Decl::NT_eventtype_fwd) { d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition (); } |