diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-24 18:49:36 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-03-24 18:49:36 +0000 |
commit | a1c3ff108b7062a0c358433b575c04275eeeae99 (patch) | |
tree | 037d276a79bad44cdb6dcef74a8d0152240544a5 | |
parent | b7df047406805123fde29d9a58ab94891f7da009 (diff) | |
download | ATCD-a1c3ff108b7062a0c358433b575c04275eeeae99.tar.gz |
ChangeLogTag: Wed Mar 24 18:48:59 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
47 files changed, 1210 insertions, 820 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index f5db7fe19b6..1f01db70a04 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,62 @@ +Wed Mar 24 18:48:59 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_codegen.cpp: + * TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_root/root_ci.cpp: + * TAO_IDL/be/be_visitor_root/root_sth.cpp: + * TAO_IDL/be/be_visitor_root/root_exs.cpp: + * TAO_IDL/be/be_visitor_root/root_ih.cpp: + * TAO_IDL/be/be_visitor_root/root_svh.cpp: + * TAO_IDL/be/be_visitor_root/cdr_op.cpp: + * TAO_IDL/be/be_visitor_root/root_ex_idl.cpp: + * TAO_IDL/be/be_visitor_root/serializer_op.cpp: + * TAO_IDL/be/be_visitor_root/root_cs.cpp: + * TAO_IDL/be/be_visitor_root/root_cnh.cpp: + * TAO_IDL/be/be_visitor_root/root_sh.cpp: + * TAO_IDL/be/be_visitor_root/root_svs.cpp: + * TAO_IDL/be/be_visitor_root/root_is.cpp: + * TAO_IDL/be/be_visitor_root/root_si.cpp: + * TAO_IDL/be/be_visitor_root/root.cpp: + * TAO_IDL/be/be_visitor_root/any_op.cpp: + * TAO_IDL/be/be_visitor_root/root_cns.cpp: + * TAO_IDL/be/be_visitor_root/root_exh.cpp: + * TAO_IDL/be/be_visitor_root/root_ss.cpp: + * TAO_IDL/be/be_visitor_root/root_ch.cpp: + * TAO_IDL/be/be_helper.cpp: + * TAO_IDL/be/be_visitor_module/module.cpp: + * TAO_IDL/be/be_visitor_decl.cpp: + * TAO_IDL/be_include/be_visitor_root/root_ch.h: + * TAO_IDL/be_include/be_visitor_root/root_ci.h: + * TAO_IDL/be_include/be_visitor_root/root_sth.h: + * TAO_IDL/be_include/be_visitor_root/root_exs.h: + * TAO_IDL/be_include/be_visitor_root/root_svh.h: + * TAO_IDL/be_include/be_visitor_root/root_ih.h: + * TAO_IDL/be_include/be_visitor_root/cdr_op.h: + * TAO_IDL/be_include/be_visitor_root/root_ex_idl.h: + * TAO_IDL/be_include/be_visitor_root/root_cs.h: + * TAO_IDL/be_include/be_visitor_root/root_cnh.h: + * TAO_IDL/be_include/be_visitor_root/root_sh.h: + * TAO_IDL/be_include/be_visitor_root/root_si.h: + * TAO_IDL/be_include/be_visitor_root/root_is.h: + * TAO_IDL/be_include/be_visitor_root/root_svs.h: + * TAO_IDL/be_include/be_visitor_root/root.h: + * TAO_IDL/be_include/be_visitor_root/any_op.h: + * TAO_IDL/be_include/be_visitor_root/root_cns.h: + * TAO_IDL/be_include/be_visitor_root/root_exh.h: + * TAO_IDL/be_include/be_visitor_root/root_ss.h: + * TAO_IDL/be_include/be_visitor_decl.h: + * TAO_IDL/be_include/be_visitor_root.h: + + Refactored the huge visit_root() method in base + class be_visitor_root into visit_root() methods + (also added) in the subclasses, which are the + ones actually instantiated at the top level of + the backend AST traversal. Also, additional + code generation and AST traversals, besides the + main AST traversal, were factored out into + self_explanatory methods in the appropriate + root visitor classes. + Tue Mar 23 16:08:50 UTC 2010 Adam Mitz <mitza@ociweb.com> * bin/tao_orb_tests.lst: diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 4ebf40cf202..2c9eeed371b 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - #include "be_codegen.h" #include "be_helper.h" #include "be_visitor_factory.h" @@ -1640,7 +1639,8 @@ TAO_CodeGen::end_client_header (void) << be_nl << be_nl; } - *this->client_header_ << "#endif /* ifndef */" << be_nl << be_nl; + *this->client_header_ << "#endif /* ifndef */\n" + << "\n"; return 0; } @@ -1653,6 +1653,8 @@ TAO_CodeGen::end_client_inline (void) // End versioned namespace support. Do not place include directives // before this. *this->client_inline_ << be_global->versioning_end (); + + *this->client_inline_ << "\n"; } void @@ -1663,6 +1665,8 @@ TAO_CodeGen::end_client_stubs (void) // End versioned namespace support. Do not place include directives // before this. *this->client_stubs_ << be_global->versioning_end (); + + *this->client_stubs_ << "\n"; } int @@ -1705,7 +1709,9 @@ TAO_CodeGen::end_server_header (void) << "\"\n"; } - *this->server_header_ << "#endif /* ifndef */\n"; + *this->server_header_ << "#endif /* ifndef */\n" + << "\n"; + return 0; } @@ -1717,6 +1723,8 @@ TAO_CodeGen::end_server_inline (void) // End versioned namespace support. Do not place include directives // before this. *this->server_inline_ << be_global->versioning_end (); + + *this->server_inline_ << "\n"; } int @@ -1804,7 +1812,8 @@ TAO_CodeGen::end_server_template_header (void) << "\"\n"; } - *this->server_template_header_ << "#endif /* ifndef */\n"; + *this->server_template_header_ << "#endif /* ifndef */\n" + << "\n"; return 0; } @@ -1816,7 +1825,8 @@ TAO_CodeGen::end_server_template_skeletons (void) *this->server_template_skeletons_ << be_global->versioning_end (); // Code to put the last #endif. - *this->server_template_skeletons_ << "\n#endif /* ifndef */\n"; + *this->server_template_skeletons_ << "\n#endif /* ifndef */\n" + << "\n"; return 0; } @@ -1829,7 +1839,8 @@ TAO_CodeGen::end_server_skeletons (void) *this->server_skeletons_ << be_global->versioning_end (); // Code to put the last #endif. - *this->server_skeletons_ << "\n\n#endif /* ifndef */\n"; + *this->server_skeletons_ << "\n\n#endif /* ifndef */\n" + << "\n"; return 0; } diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp index 82bc79dbf6d..5aa9884062b 100644 --- a/TAO/TAO_IDL/be/be_helper.cpp +++ b/TAO/TAO_IDL/be/be_helper.cpp @@ -597,3 +597,4 @@ TAO_OutStream::print (AST_Expression *expr) return *this; } + diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp index 70c5c1eb8c8..e3e0d38e57a 100644 --- a/TAO/TAO_IDL/be/be_visitor_decl.cpp +++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - #include "be_visitor_decl.h" #include "be_visitor_sequence.h" #include "be_visitor_context.h" @@ -21,9 +20,9 @@ #include "be_type.h" #include "ace/Log_Msg.h" -// Root visitor for client header be_visitor_decl::be_visitor_decl (be_visitor_context *ctx) - : ctx_ (ctx) + : ctx_ (ctx), + os_ (*ctx->stream ()) { } diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index e34d0ba5166..95d79f1c2c9 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ****************************************************** // Generic Module visitor // ****************************************************** @@ -38,8 +37,8 @@ be_visitor_module::visit_module (be_module *node) if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_module::visit_module - " - "codegen for scope failed\n"), + ACE_TEXT ("be_visitor_module::visit_module - ") + ACE_TEXT ("codegen for scope failed\n")), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp index 2537ca0b221..f312ff1a7e8 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/any_op.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // *************************************************************************** // Root visitor for generating Any operator declarations in the client header // and stub @@ -56,5 +55,22 @@ be_visitor_root_any_op::visit_root (be_root *node) -1); } + if (be_global->gen_anyop_files ()) + { + // Switch streams, ctx will be reassigned when this + // pass is done. + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_ROOT_ANY_OP_CH: + this->ctx_->stream (tao_cg->client_header ()); + break; + case TAO_CodeGen::TAO_ROOT_ANY_OP_CS: + this->ctx_->stream (tao_cg->client_stubs ()); + break; + default: + break; + } + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp index 8bd4640be36..e20bdbdf021 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/cdr_op.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // *************************************************************************** // Root visitor for generating CDR operator declarations in the client header // and stub @@ -34,8 +33,9 @@ be_visitor_root_cdr_op::visit_root (be_root *node) if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_cdr_op::visit_root - " - "codegen for scope failed\n"), + ACE_TEXT ("be_visitor_root_cdr_op::") + ACE_TEXT ("visit_root - codegen ") + ACE_TEXT ("for scope failed\n")), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 322e0e611a1..7e1ccc1d88e 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -26,547 +26,6 @@ be_visitor_root::~be_visitor_root (void) { } -// This method must be overridden by the derived root visitors. -int -be_visitor_root::init (void) -{ - return -1; -} - -int be_visitor_root::visit_root (be_root *node) -{ - // Open the appropriate output file based on what state we are in. The - // overridden "init" method of derived classes will do the job. - if (this->init () == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::init - " - "failed to initialize context\n"), - -1); - } - - // The SI and SS cases are caught in BE_produce() - if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SH - && !be_global->gen_skel_files ()) - { - return 0; - } - - TAO_OutStream * const os = this->ctx_->stream (); - - int status = 0; - be_visitor_context ctx = *this->ctx_; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CS: - { - be_visitor_arg_traits arg_visitor ("", &ctx); - status = node->accept (&arg_visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate stub arg traits\n"), - -1); - } - } - - break; - case TAO_CodeGen::TAO_ROOT_SS: - { - be_visitor_arg_traits arg_visitor ("S", &ctx); - status = node->accept (&arg_visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate skeleton arg traits\n"), - -1); - } - - if (be_global->gen_thru_poa_collocation () - || be_global->gen_direct_collocation ()) - { - be_visitor_arg_traits arg_visitor ("", &ctx); - status = node->accept (&arg_visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate collocated skeleton arg traits\n"), - -1); - } - } - } - - break; - case TAO_CodeGen::TAO_ROOT_EX_IDL: - { - } - - break; - default: - break; - } - - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::visit_root - " - "codegen for scope failed\n"), - -1); - } - - // If we are generating the client header file, this is the place to - // generate the proxy broker factory function pointer declarations - // and the extern declarations for non-defined interfaces. - if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_CH) - { - be_interface *i = 0; - be_interface_fwd *ifwd = 0; - size_t index = 0; - - size_t size = be_global->non_local_interfaces.size (); - - if (size > 0) - { - *os << be_nl << be_nl - << "// Proxy Broker Factory function pointer declarations." - << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - } - - for (index = 0; index < size; ++index) - { - be_global->non_local_interfaces.dequeue_head (i); - - if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) - { - *os << be_nl << be_nl - << "extern " << be_global->stub_export_macro () << be_nl - << "TAO::Collocation_Proxy_Broker *" << be_nl - << "(*" << i->flat_client_enclosing_scope () - << i->base_proxy_broker_name () - << "_Factory_function_pointer) (" - << be_idt << be_idt_nl - << "::CORBA::Object_ptr obj);" << be_uidt << be_uidt; - } - } - - size = be_global->non_defined_interfaces.size (); - - if (size > 0) - { - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__; - } - - for (index = 0; index < size; ++index) - { - be_global->non_defined_interfaces.dequeue_head (ifwd); - - *os << be_nl << be_nl; - - if (ifwd->is_valuetype ()) - { - *os << "// External declarations for undefined valuetype" - << be_nl << be_nl - << "// " << ifwd->full_name () << be_nl; - - *os << be_global->stub_export_macro () << be_nl - << "void" << be_nl - << "tao_" << ifwd->flat_name () - << "_add_ref (" - << be_idt << be_idt_nl - << ifwd->full_name () << " *" << be_uidt_nl - << ");" << be_uidt_nl << be_nl - << be_global->stub_export_macro () << be_nl - << "void" << be_nl - << "tao_" << ifwd->flat_name () - << "_remove_ref (" << be_idt << be_idt_nl - << ifwd->full_name () << " *" << be_uidt_nl - << ");" << be_uidt; - } - } - - size = be_global->mixed_parentage_interfaces.size (); - - if (size > 0) - { - *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - - *os << be_global->core_versioning_begin () << be_nl; - - *os << "// Overrides of CORBA::release and CORBA::is_nil for" - << be_nl - << "// interfaces that inherit from both CORBA::Object" << be_nl - << "// and CORBA::AbstractBase." << be_nl << be_nl - << "namespace CORBA" << be_nl - << "{" << be_idt; - } - - for (index = 0; index < size; ++index) - { - be_global->mixed_parentage_interfaces.dequeue_head (i); - - *os << be_nl - << "TAO_NAMESPACE_STORAGE_CLASS void release (" - << i->name () << "_ptr);" << be_nl - << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::Boolean is_nil (" - << i->name () << "_ptr);"; - } - - if (size > 0) - { - *os << be_uidt_nl - << "}"; - - *os << be_global->core_versioning_end () << be_nl; - } - } - - // Make one more pass over the entire tree and generate the OBV_ namespaces - // and OBV_ classes. - - bool obv = true; - status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CH); - break; - case TAO_CodeGen::TAO_ROOT_CI: - ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CI); - break; - case TAO_CodeGen::TAO_ROOT_CS: - ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS); - break; - default: - obv = false; - break; - } - - if (obv == true) - { - be_visitor_obv_module visitor (&ctx); - status = visitor.visit_scope (node); - obv = 0; - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate OBV_ things\n"), - -1); - } - } - - status = 0; - ctx = *this->ctx_; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - be_visitor_traits traits_visitor (&ctx); - status = node->accept (&traits_visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate traits\n"), - -1); - } - - if (be_global->gen_template_export ()) - { - be_visitor_template_export export_visitor (&ctx); - status = node->accept (&export_visitor); - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to export templates\n"), - -1); - } - } - } - - break; - default: - break; - } - - // The next thing we need to do is make one more pass thru the entire tree - // and generate code for all the <<= and >>= operators for all the - // user-defined types. - - ctx = *this->ctx_; - status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH); - - if (be_global->any_support ()) - { - be_visitor_root_any_op visitor (&ctx); - status = node->accept (&visitor); - } - - // Conditional switch to the *A.h stream is done - // in the visitor constructor. - if (be_global->gen_anyop_files ()) - { - (void) tao_cg->end_anyop_header (); - } - - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS); - - if (be_global->any_support ()) - { - be_visitor_root_any_op visitor (&ctx); - status = node->accept (&visitor); - } - - // Conditional switch to the *A.cpp stream is done - // in the visitor constructor. - if (be_global->gen_anyop_files ()) - { - (void) tao_cg->end_anyop_source (); - } - - - break; - } - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - case TAO_CodeGen::TAO_ROOT_TIE_SH: - case TAO_CodeGen::TAO_ROOT_SVH: - case TAO_CodeGen::TAO_ROOT_SVS: - case TAO_CodeGen::TAO_ROOT_EXH: - case TAO_CodeGen::TAO_ROOT_EXS: - case TAO_CodeGen::TAO_ROOT_CNH: - case TAO_CodeGen::TAO_ROOT_CNS: - case TAO_CodeGen::TAO_ROOT_EX_IDL: - break; - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_constant - " - "Bad context state\n"), - -1); - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate Any operators\n"), - -1); - } - - // Make another pass over the entire tree and generate the CDR operators. - ctx = *this->ctx_; - status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CH); - be_visitor_root_cdr_op visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CS); - be_visitor_root_cdr_op visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_SVH: - case TAO_CodeGen::TAO_ROOT_SVS: - case TAO_CodeGen::TAO_ROOT_EXH: - case TAO_CodeGen::TAO_ROOT_EXS: - case TAO_CodeGen::TAO_ROOT_CNH: - case TAO_CodeGen::TAO_ROOT_CNS: - case TAO_CodeGen::TAO_ROOT_EX_IDL: - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_TIE_SH: - break; // nothing to be done - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "Bad context state\n"), - -1); - } - } - - if (be_global->gen_dcps_type_support ()) - { - // Make another pass over the entire tree and generate the - // Serializer operators. - ctx = *this->ctx_; - status = 0; - - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - { - ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH); - be_visitor_root_cdr_op visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CS: - { - ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS); - be_visitor_root_cdr_op visitor (&ctx); - status = node->accept (&visitor); - break; - } - case TAO_CodeGen::TAO_ROOT_CI: - case TAO_CodeGen::TAO_ROOT_SH: - case TAO_CodeGen::TAO_ROOT_IH: - case TAO_CodeGen::TAO_ROOT_SI: - case TAO_CodeGen::TAO_ROOT_SS: - case TAO_CodeGen::TAO_ROOT_IS: - case TAO_CodeGen::TAO_ROOT_TIE_SH: - case TAO_CodeGen::TAO_ROOT_SVH: - case TAO_CodeGen::TAO_ROOT_SVS: - case TAO_CodeGen::TAO_ROOT_EXH: - case TAO_CodeGen::TAO_ROOT_EXS: - case TAO_CodeGen::TAO_ROOT_CNH: - case TAO_CodeGen::TAO_ROOT_CNS: - case TAO_CodeGen::TAO_ROOT_EX_IDL: - break; // nothing to be done - default: - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "Bad context state\n"), - -1); - } - } - } - - if (status == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root::" - "visit_root - " - "failed to generate CDR operators\n"), - -1); - } - - // Generate any final code such as #endifs and/or EOF newlines. - switch (this->ctx_->state ()) - { - case TAO_CodeGen::TAO_ROOT_CH: - (void) tao_cg->end_client_header (); - break; - case TAO_CodeGen::TAO_ROOT_CI: - (void) tao_cg->end_client_inline (); - break; - case TAO_CodeGen::TAO_ROOT_CS: - (void) tao_cg->end_client_stubs (); - break; - case TAO_CodeGen::TAO_ROOT_SH: - (void) tao_cg->end_server_header (); - break; - case TAO_CodeGen::TAO_ROOT_IS: - break; - case TAO_CodeGen::TAO_ROOT_IH: - (void) tao_cg->end_implementation_header ( - be_global->be_get_implementation_hdr_fname (0) - ); - break; - case TAO_CodeGen::TAO_ROOT_SI: - (void) tao_cg->end_server_inline (); - break; - case TAO_CodeGen::TAO_ROOT_SS: - if (be_global->gen_tie_classes ()) - { - (void) tao_cg->end_server_template_skeletons (); - } - - (void) tao_cg->end_server_skeletons (); - break; - case TAO_CodeGen::TAO_ROOT_TIE_SH: - if (be_global->gen_tie_classes ()) - { - (void) tao_cg->end_server_template_header (); - } - - break; - case TAO_CodeGen::TAO_ROOT_SVH: - (void) tao_cg->end_ciao_svnt_header (); - break; - case TAO_CodeGen::TAO_ROOT_SVS: - (void) tao_cg->end_ciao_svnt_source (); - break; - case TAO_CodeGen::TAO_ROOT_EXH: - (void) tao_cg->end_ciao_exec_header (); - break; - case TAO_CodeGen::TAO_ROOT_EXS: - (void) tao_cg->end_ciao_exec_source (); - break; - case TAO_CodeGen::TAO_ROOT_EX_IDL: - (void) tao_cg->end_ciao_exec_idl (); - break; - case TAO_CodeGen::TAO_ROOT_CNH: - (void) tao_cg->end_ciao_conn_header (); - break; - case TAO_CodeGen::TAO_ROOT_CNS: - (void) tao_cg->end_ciao_conn_source (); - break; - default: - break; - } - - // Make sure each file ends with a newline. - *os << "\n"; - - return 0; -} - int be_visitor_root::visit_module (be_module *node) { diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp index 90c797d020d..3c3d79bbf0e 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ch.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ******************************** // Root visitor for client header // ******************************** @@ -27,52 +26,361 @@ be_visitor_root_ch::~be_visitor_root_ch (void) } int +be_visitor_root_ch::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + this->gen_fwd_decls (); + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + this->gen_proxy_broker_factory_pointers (); + + this->gen_ref_counting_overrides (); + + this->gen_static_corba_overrides (); + + if (this->gen_obv_decls (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::") + ACE_TEXT ("visit_root - ") + ACE_TEXT ("failed to generate OBV_ decls\n")), + -1); + } + + if (this->gen_object_traits (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate object traits\n")), + -1); + } + + + if (this->gen_template_exports (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root::") + ACE_TEXT ("visit_root - ") + ACE_TEXT ("failed to export templates\n")), + -1); + } + + if (this->gen_any_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate Any operators\n")), + -1); + } + + + if (this->gen_cdr_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate CDR operators\n")), + -1); + } + + + if (this->gen_dds_serializer_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ch::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate DDS serialization\n")), + -1); + } + + (void) tao_cg->end_client_header (); + + return 0; +} + +int be_visitor_root_ch::init (void) { - // First open the client-side header file for writing - if (tao_cg->start_client_header (be_global->be_get_client_hdr_fname ()) - == -1) + /// First open the client-side file for writing + int status = + tao_cg->start_client_header ( + be_global->be_get_client_hdr_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ch::init - " - "Error opening client header file\n"), + ACE_TEXT ("be_visitor_root_ch::init - ") + ACE_TEXT ("Error opening client header file\n")), -1); } - // Initialize the stream. + /// Initialize the stream. this->ctx_->stream (tao_cg->client_header ()); + + return 0; +} - // If this IDL file contains an non local interface declaration, generated a +void +be_visitor_root_ch::gen_fwd_decls (void) +{ + TAO_OutStream &os_ = *this->ctx_->stream (); + + // If this IDL file contains an non local interface declaration, generate a // forward declaration of the proxy broker for a possible collocated call. if (idl_global->non_local_iface_seen_) { - TAO_OutStream *os = this->ctx_->stream (); - - *os << be_nl << be_nl + os_ << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// " << __FILE__ << ":" << __LINE__; - *os << be_global->core_versioning_begin () << be_nl; + os_ << be_global->core_versioning_begin () << be_nl; - *os << be_nl << be_nl + os_ << be_nl << be_nl << "namespace TAO" << be_nl << "{" << be_idt_nl; if (be_global->gen_direct_collocation () || be_global->gen_thru_poa_collocation ()) { - *os << "class Collocation_Proxy_Broker;" << be_nl; + os_ << "class Collocation_Proxy_Broker;" << be_nl; } if (idl_global->abstract_iface_seen_) { - *os << "template<typename T> class AbstractBase_Narrow_Utils;" << be_nl; + os_ << "template<typename T> class AbstractBase_Narrow_Utils;" << be_nl; } - *os << "template<typename T> class Narrow_Utils;" << be_uidt_nl + os_ << "template<typename T> class Narrow_Utils;" << be_uidt_nl << "}" ; - *os << be_global->core_versioning_end () << be_nl; + os_ << be_global->core_versioning_end () << be_nl; } +} - return 0; +void +be_visitor_root_ch::gen_proxy_broker_factory_pointers (void) +{ + size_t size = be_global->non_local_interfaces.size (); + + if (size == 0) + { + return; + } + + size_t index = 0; + be_interface *i = 0; + + TAO_OutStream &os_ = *this->ctx_->stream (); + + os_ << be_nl << be_nl + << "// Proxy Broker Factory function pointer declarations." + << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + for (index = 0; index < size; ++index) + { + be_global->non_local_interfaces.dequeue_head (i); + + if (be_global->gen_direct_collocation() || be_global->gen_thru_poa_collocation ()) + { + os_ << be_nl << be_nl + << "extern " << be_global->stub_export_macro () << be_nl + << "TAO::Collocation_Proxy_Broker *" << be_nl + << "(*" << i->flat_client_enclosing_scope () + << i->base_proxy_broker_name () + << "_Factory_function_pointer) (" + << be_idt << be_idt_nl + << "::CORBA::Object_ptr obj);" << be_uidt << be_uidt; + } + } } + +void +be_visitor_root_ch::gen_ref_counting_overrides (void) +{ + size_t size = be_global->non_defined_interfaces.size (); + + if (size == 0) + { + return; + } + + size_t index = 0; + be_interface_fwd *ifwd = 0; + + TAO_OutStream &os_ = *this->ctx_->stream (); + + os_ << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__; + + for (index = 0; index < size; ++index) + { + be_global->non_defined_interfaces.dequeue_head (ifwd); + + os_ << be_nl << be_nl; + + if (ifwd->is_valuetype ()) + { + os_ << "// External declarations for undefined valuetype" + << be_nl << be_nl + << "// " << ifwd->full_name () << be_nl; + + os_ << be_global->stub_export_macro () << be_nl + << "void" << be_nl + << "tao_" << ifwd->flat_name () + << "_add_ref (" + << be_idt << be_idt_nl + << ifwd->full_name () << " *" << be_uidt_nl + << ");" << be_uidt_nl << be_nl + << be_global->stub_export_macro () << be_nl + << "void" << be_nl + << "tao_" << ifwd->flat_name () + << "_remove_ref (" << be_idt << be_idt_nl + << ifwd->full_name () << " *" << be_uidt_nl + << ");" << be_uidt; + } + } +} + +void +be_visitor_root_ch::gen_static_corba_overrides (void) +{ + size_t size = be_global->mixed_parentage_interfaces.size (); + + if (size == 0) + { + return; + } + + size_t index = 0; + be_interface *i = 0; + + TAO_OutStream &os_ = *this->ctx_->stream (); + + os_ << be_nl << be_nl + << "// TAO_IDL - Generated from" << be_nl + << "// " << __FILE__ << ":" << __LINE__ + << be_nl; + + os_ << be_global->core_versioning_begin (); + + os_ << be_nl + << "// Overrides of CORBA::release and CORBA::is_nil for" + << be_nl + << "// interfaces that inherit from both CORBA::Object" << be_nl + << "// and CORBA::AbstractBase." << be_nl << be_nl + << "namespace CORBA" << be_nl + << "{" << be_idt; + + for (index = 0; index < size; ++index) + { + be_global->mixed_parentage_interfaces.dequeue_head (i); + + os_ << be_nl + << "TAO_NAMESPACE_STORAGE_CLASS void release (" + << i->name () << "_ptr);" << be_nl + << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::Boolean is_nil (" + << i->name () << "_ptr);"; + } + + os_ << be_uidt_nl + << "}"; + + os_ << be_global->core_versioning_end (); +} + +int +be_visitor_root_ch::gen_obv_decls (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CH); + + be_visitor_obv_module obv_visitor (&ctx); + + return obv_visitor.visit_scope (node); +} + +int +be_visitor_root_ch::gen_object_traits (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + be_visitor_traits traits_visitor (&ctx); + return node->accept (&traits_visitor); +} + +int +be_visitor_root_ch::gen_template_exports (be_root *node) +{ + if (! be_global->gen_template_export ()) + { + return 0; + } + + be_visitor_context ctx = *this->ctx_; + be_visitor_template_export export_visitor (&ctx); + return node->accept (&export_visitor); +} + +int +be_visitor_root_ch::gen_any_ops (be_root *node) +{ + if (! be_global->any_support ()) + { + return 0; + } + + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CH); + be_visitor_root_any_op any_op_visitor (&ctx); + int status = node->accept (&any_op_visitor); + + /// Conditional switch to the *A.h stream is done + /// in the visitor constructor. + if (be_global->gen_anyop_files ()) + { + (void) tao_cg->end_anyop_header (); + } + + return status; +} + +int +be_visitor_root_ch::gen_cdr_ops (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CH); + be_visitor_root_cdr_op visitor (&ctx); + return node->accept (&visitor); +} + +int +be_visitor_root_ch::gen_dds_serializer_ops (be_root *node) +{ + if (! be_global->gen_dcps_type_support ()) + { + return 0; + } + + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CH); + be_visitor_root_cdr_op visitor (&ctx); + return node->accept (&visitor); +} + diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp index 7840bfab032..9e06ed7d8c1 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ci.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ********************************* // Root visitor for client inline // ********************************* @@ -27,18 +26,65 @@ be_visitor_root_ci::~be_visitor_root_ci (void) } int +be_visitor_root_ci::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ci::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ci::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + + if (this->gen_obv_defns (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ci::") + ACE_TEXT ("visit_root - ") + ACE_TEXT ("failed to generate OBV_ defns\n")), + -1); + } + + (void) tao_cg->end_client_inline (); + + return 0; +} + +int be_visitor_root_ci::init (void) { - // first open the client-side inline file for writing - if (tao_cg->start_client_inline (be_global->be_get_client_inline_fname ()) - == -1) + /// First open the client-side file for writing + int status = + tao_cg->start_client_inline ( + be_global->be_get_client_inline_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ci - " - "Error opening client inline file\n"), + ACE_TEXT ("be_visitor_root_ci::init - ") + ACE_TEXT ("Error opening client inline file\n")), -1); } + /// Initialize the stream. this->ctx_->stream (tao_cg->client_inline ()); return 0; } + +int +be_visitor_root_ci::gen_obv_defns (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CI); + be_visitor_obv_module obv_visitor (&ctx); + return obv_visitor.visit_scope (node); +}
\ No newline at end of file diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cnh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cnh.cpp index 24b5c18e2fe..1ca24dc5c3f 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_cnh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_cnh.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO connector impl header // ******************************** @@ -28,6 +27,30 @@ be_visitor_root_cnh::~be_visitor_root_cnh (void) } int +be_visitor_root_cnh::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cnh::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cnh::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_conn_header (); + + return 0; +} + +int be_visitor_root_cnh::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cns.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cns.cpp index e3909ba17c7..bd5c3bf407e 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_cns.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_cns.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO connector impl source // ******************************** @@ -28,6 +27,30 @@ be_visitor_root_cns::~be_visitor_root_cns (void) } int +be_visitor_root_cns::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cns::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cns::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_conn_source (); + + return 0; +} + +int be_visitor_root_cns::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp index 4c9b4052b7c..e7c4eb731ee 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_cs.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // *********************************** // Root visitor for client stubs // *********************************** @@ -27,19 +26,160 @@ be_visitor_root_cs::~be_visitor_root_cs (void) } int +be_visitor_root_cs::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + + if (this->gen_arg_traits (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate stub arg traits\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + + if (this->gen_obv_defns (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::") + ACE_TEXT ("visit_root - ") + ACE_TEXT ("failed to generate OBV_ defns\n")), + -1); + } + + + if (this->gen_any_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate Any operators\n")), + -1); + } + + + if (this->gen_cdr_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate CDR operators\n")), + -1); + } + + + if (this->gen_dds_serializer_ops (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_cs::") + ACE_TEXT ("visit_root - failed to ") + ACE_TEXT ("generate DDS serialization\n")), + -1); + } + + (void) tao_cg->end_client_stubs (); + + return 0; +} + +int be_visitor_root_cs::init (void) { - // first open the file - if (tao_cg->start_client_stubs (be_global->be_get_client_stub_fname ()) - == -1) + /// First open the client-side file for writing + int status = + tao_cg->start_client_stubs ( + be_global->be_get_client_stub_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_cs - " - "Error opening client stub file\n"), + ACE_TEXT ("be_visitor_root_cs::init - ") + ACE_TEXT ("Error opening client source file\n")), -1); } - // init stream + /// Initialize the stream. this->ctx_->stream (tao_cg->client_stubs ()); return 0; } + +int +be_visitor_root_cs::gen_arg_traits (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + be_visitor_arg_traits arg_visitor ("", &ctx); + return node->accept (&arg_visitor); +} + +int +be_visitor_root_cs::gen_obv_defns (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_MODULE_OBV_CS); + be_visitor_obv_module obv_visitor (&ctx); + return obv_visitor.visit_scope (node); +} + +int +be_visitor_root_cs::gen_any_ops (be_root *node) +{ + if (! be_global->any_support ()) + { + return 0; + } + + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_ANY_OP_CS); + be_visitor_root_any_op any_op_visitor (&ctx); + int status = node->accept (&any_op_visitor); + + /// Conditional switch to the *A.cpp stream is done + /// in the visitor constructor. + if (be_global->gen_anyop_files ()) + { + (void) tao_cg->end_anyop_source (); + } + + return status; +} + +int +be_visitor_root_cs::gen_cdr_ops (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_CDR_OP_CS); + be_visitor_root_cdr_op visitor (&ctx); + return node->accept (&visitor); +} + +int +be_visitor_root_cs::gen_dds_serializer_ops (be_root *node) +{ + if (! be_global->gen_dcps_type_support ()) + { + return 0; + } + + be_visitor_context ctx = *this->ctx_; + ctx.state (TAO_CodeGen::TAO_ROOT_SERIALIZER_OP_CS); + be_visitor_root_cdr_op visitor (&ctx); + return node->accept (&visitor); +} + diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ex_idl.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ex_idl.cpp index 340403d3ed1..14dbb784521 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ex_idl.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ex_idl.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO executor IDL // ******************************** @@ -28,6 +27,30 @@ be_visitor_root_ex_idl::~be_visitor_root_ex_idl (void) } int +be_visitor_root_ex_idl::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ex_idl::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ex_idl::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_exec_idl (); + + return 0; +} + +int be_visitor_root_ex_idl::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_exh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_exh.cpp index 2e74bd9789c..2d464d829b7 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_exh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_exh.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO exec impl header // ******************************** @@ -28,6 +27,30 @@ be_visitor_root_exh::~be_visitor_root_exh (void) } int +be_visitor_root_exh::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_exh::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_exh::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_exec_header (); + + return 0; +} + +int be_visitor_root_exh::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_exs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_exs.cpp index 4964e49f02f..a2f4717080d 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_exs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_exs.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO exec impl source // ******************************** @@ -28,6 +27,30 @@ be_visitor_root_exs::~be_visitor_root_exs (void) } int +be_visitor_root_exs::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_exs::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_exs::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_exec_source (); + + return 0; +} + +int be_visitor_root_exs::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp index 06cf9e425e9..85d6656bdfd 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ih.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // *********************************** // Root visitor for implementation header // *********************************** @@ -27,22 +26,47 @@ be_visitor_root_ih::~be_visitor_root_ih (void) } int -be_visitor_root_ih::init (void) +be_visitor_root_ih::visit_root (be_root *node) { - if (tao_cg->start_implementation_header ( - be_global->be_get_implementation_hdr_fname () - ) - == -1) + if (this->init () == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ih::init - " - "Error :%p: Unable to open implementation header file : %s\n", - "start_implementation_header", - be_global->be_get_implementation_hdr_fname ()), + ACE_TEXT ("be_visitor_root_ih::init - ") + ACE_TEXT ("failed to initialize\n")), -1); } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ih::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_implementation_header ( + be_global->be_get_implementation_hdr_fname (false)); + return 0; +} + +int +be_visitor_root_ih::init (void) +{ + /// First open the implementation header file for writing. + int status = + tao_cg->start_implementation_header ( + be_global->be_get_implementation_hdr_fname ()); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ih::init - ") + ACE_TEXT ("Error opening impl header file\n")), + -1); + } + /// Initialize the stream. this->ctx_->stream (tao_cg->implementation_header ()); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp index 2b33b907f24..5fa99b5b944 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_is.cpp @@ -11,7 +11,6 @@ */ //============================================================================= - // ****************************************************** // Root visitor for implementation skeletons // ****************************************************** @@ -26,20 +25,44 @@ be_visitor_root_is::~be_visitor_root_is (void) } int +be_visitor_root_is::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_is::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_is::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + return 0; +} + +int be_visitor_root_is::init (void) { - // First open the file for writing. - if (tao_cg->start_implementation_skeleton ( - be_global->be_get_implementation_skel_fname () - ) - == -1) + /// First open the file for writing. + int status = + tao_cg->start_implementation_skeleton ( + be_global->be_get_implementation_skel_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_is::init - " - "Error opening implementation skeletons file\n"), + ACE_TEXT ("be_visitor_root_is::init - ") + ACE_TEXT ("Error opening impl source file\n")), -1); } + /// Initialize the stream. this->ctx_->stream (tao_cg->implementation_skeleton ()); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp index 9df2fb7282e..f9751a4ed35 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_sh.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // *********************************** // Root visitor for server header // *********************************** @@ -27,24 +26,55 @@ be_visitor_root_sh::~be_visitor_root_sh (void) } int +be_visitor_root_sh::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sh::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + /// The SI and SS cases are caught in BE_produce(). Sometimes + /// we want to generate an empty skeleton header file, which + /// has been done, so we can bail here. + if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_SH + && !be_global->gen_skel_files ()) + { + return 0; + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sh::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_server_header (); + + return 0; +} + +int be_visitor_root_sh::init (void) { - // open the file - if (tao_cg->start_server_header (be_global->be_get_server_hdr_fname ()) - == -1) + /// First open the server-side file for writing + int status = + tao_cg->start_server_header ( + be_global->be_get_server_hdr_fname ()); + + if (status == -1) { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_root_sh::init - " - "Error :%p: Unable to open server header file : %s\n", - "start_server_header", - be_global->be_get_server_hdr_fname () - ), - -1 - ); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sh::init - ") + ACE_TEXT ("Error opening server header file\n")), + -1); } - // set the stream and the next state. + /// Initialize the stream. this->ctx_->stream (tao_cg->server_header ()); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp index db113211591..e78bc2a685a 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_si.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // *********************************************** // Root visitor for server inline // *********************************************** @@ -27,19 +26,46 @@ be_visitor_root_si::~be_visitor_root_si (void) } int +be_visitor_root_si::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_si::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_si::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_server_inline (); + + return 0; +} + +int be_visitor_root_si::init (void) { - // first open the file for writing - if (tao_cg->start_server_inline (be_global->be_get_server_inline_fname ()) - == -1) + /// First open the server-side file for writing + int status = + tao_cg->start_server_inline ( + be_global->be_get_server_inline_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_si::init - " - "server inline open failed\n"), + ACE_TEXT ("be_visitor_root_si::init - ") + ACE_TEXT ("Error opening server inline file\n")), -1); } - // init stream + /// Initialize the stream. this->ctx_->stream (tao_cg->server_inline ()); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp index b9b647b79e7..f6e851a7bcc 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_ss.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ****************************************************** // Root visitor for server skeletons // ****************************************************** @@ -27,31 +26,69 @@ be_visitor_root_ss::~be_visitor_root_ss (void) } int +be_visitor_root_ss::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ss::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->gen_arg_traits (node) == -1) + { + /// Error message already output. + return -1; + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ss::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + if (be_global->gen_tie_classes ()) + { + (void) tao_cg->end_server_template_skeletons (); + } + + (void) tao_cg->end_server_skeletons (); + + return 0; +} + +int be_visitor_root_ss::init (void) { - // first open the file for writing - if (tao_cg->start_server_skeletons ( - be_global->be_get_server_skeleton_fname () - ) - == -1) + /// First open the server-side file for writing + int status = + tao_cg->start_server_skeletons ( + be_global->be_get_server_skeleton_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ss::init - " - "Error opening server skeletons file\n"), + ACE_TEXT ("be_visitor_root_ss::init - ") + ACE_TEXT ("Error opening server header file\n")), -1); } if (be_global->gen_tie_classes ()) { - if (tao_cg->start_server_template_skeletons ( - be_global->be_get_server_template_skeleton_fname () - ) - == -1) + status = + tao_cg->start_server_template_skeletons ( + be_global->be_get_server_template_skeleton_fname ()); + + if (status == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_ss::init - " - "Error opening server template skeleton file\n"), - -1); + ACE_TEXT ("be_visitor_root_ss::init - ") + ACE_TEXT ("Error opening server ") + ACE_TEXT ("template skeleton file\n")), + -1); } } @@ -59,3 +96,40 @@ be_visitor_root_ss::init (void) this->ctx_->stream (tao_cg->server_skeletons ()); return 0; } + +int +be_visitor_root_ss::gen_arg_traits (be_root *node) +{ + be_visitor_context ctx = *this->ctx_; + be_visitor_arg_traits arg_visitor ("S", &ctx); + int status = node->accept (&arg_visitor); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ss::") + ACE_TEXT ("gen_arg_traits - failed to ") + ACE_TEXT ("generate skeleton arg traits\n")), + -1); + } + + if (be_global->gen_thru_poa_collocation () + || be_global->gen_direct_collocation ()) + { + be_visitor_arg_traits arg_visitor ("", &ctx); + status = node->accept (&arg_visitor); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_ss::") + ACE_TEXT ("gen_arg_traits - failed to ") + ACE_TEXT ("generate collocated ") + ACE_TEXT ("skeleton arg traits\n")), + -1); + } + } + + return 0; +} + diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp index 9cfeb2b2b2a..fe3cc3cabc9 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_sth.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // **************************************** // Root visitor for server template header // **************************************** @@ -27,67 +26,31 @@ be_visitor_root_sth::~be_visitor_root_sth (void) } int -be_visitor_root_sth::init (void) +be_visitor_root_sth::visit_root (be_root *node) { - // Open the file. - if (tao_cg->start_server_template_header ( - be_global->be_get_server_template_hdr_fname () - ) - == -1) + if (! be_global->gen_tie_classes ()) { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_root_sth::init - " - "Error:Unable to open server template header file : %s\n", - be_global->be_get_server_template_hdr_fname () - ), - -1 - ); + return 0; } - - // Set the stream and the next state. - this->ctx_->stream (tao_cg->server_template_header ()); - return 0; -} - -int -be_visitor_root_sth::visit_scope (be_scope *node) -{ - for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); - !si.is_done (); - si.next ()) + + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sth::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) { - AST_Decl *d = si.item (); - - if (d == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_sth::visit_scope - " - "bad node in this scope\n"), - -1); - } - - be_decl *bd = be_decl::narrow_from_decl (d); - - // Set the scope node as "node" in which the code is being - // generated so that elements in the node's scope can use it - // for code generation. - this->ctx_->scope (node); - - // Set the node to be visited. - this->ctx_->node (bd); - - // Send the visitor. - if (bd == 0 || bd->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_sth::visit_scope - " - "codegen for scope failed\n"), - -1); - - } + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sth::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); } + (void) tao_cg->end_server_template_header (); + return 0; } @@ -168,3 +131,25 @@ be_visitor_root_sth::visit_component (be_component *node) return this->visit_interface (node); } +int +be_visitor_root_sth::init (void) +{ + /// First open the server-side file for writing + int status = + tao_cg->start_server_template_header ( + be_global->be_get_server_template_hdr_fname ()); + + if (status == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_sth::init - ") + ACE_TEXT ("Error opening server ") + ACE_TEXT ("template header file\n")), + -1); + } + + /// Initialize the stream. + this->ctx_->stream (tao_cg->server_template_header ()); + return 0; +} + diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_svh.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_svh.cpp index 78a0ea59cbb..02e07ace652 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_svh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_svh.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO servant header // ******************************** @@ -27,9 +26,33 @@ be_visitor_root_svh::~be_visitor_root_svh (void) } int +be_visitor_root_svh::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svh::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svh::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_svnt_header (); + + return 0; +} + +int be_visitor_root_svh::init (void) { - // First open the client-side header file for writing. + /// First open the file for writing. int status = tao_cg->start_ciao_svnt_header ( be_global->be_get_ciao_svnt_hdr_fname ()); @@ -43,7 +66,7 @@ be_visitor_root_svh::init (void) -1); } - // Initialize the stream. + /// Initialize the stream. this->ctx_->stream (tao_cg->ciao_svnt_header ()); return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_root/root_svs.cpp b/TAO/TAO_IDL/be/be_visitor_root/root_svs.cpp index 05f1bc60785..35f6d6c640d 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root_svs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root_svs.cpp @@ -12,7 +12,6 @@ */ //============================================================================= - // ******************************** // Root visitor for CIAO servant source // ******************************** @@ -27,6 +26,30 @@ be_visitor_root_svs::~be_visitor_root_svs (void) } int +be_visitor_root_svs::visit_root (be_root *node) +{ + if (this->init () == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svs::init - ") + ACE_TEXT ("failed to initialize\n")), + -1); + } + + if (this->visit_scope (node) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("be_visitor_root_svs::visit_root - ") + ACE_TEXT ("codegen for scope failed\n")), + -1); + } + + (void) tao_cg->end_ciao_svnt_source (); + + return 0; +} + +int be_visitor_root_svs::init (void) { // First open the client-side header file for writing. diff --git a/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp b/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp index 9aaba342be3..c0ae070ab2b 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/serializer_op.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // *************************************************************************** // Root visitor for generating Serializer operator declarations in the client header // and stub @@ -34,8 +33,9 @@ be_visitor_root_serializer_op::visit_root (be_root *node) if (this->visit_scope (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_root_serializer_op::visit_root - " - "codegen for scope failed\n"), + ACE_TEXT ("be_visitor_root_serializer_op::") + ACE_TEXT ("visit_root - codegen ") + ACE_TEXT ("for scope failed\n")), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp index dd2182c6cf8..f5b136c5369 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp @@ -13,7 +13,6 @@ */ //============================================================================= - // *************************************************************************** // Sequence visitor for generating CDR operator declarations in the client header // *************************************************************************** @@ -70,28 +69,33 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node) << "\n#define _TAO_CDR_OP_" << node->flat_name () << "_H_"; } - *os << be_global->core_versioning_begin () << be_nl; + *os << be_global->core_versioning_begin (); - *os << be_nl << be_nl + *os << be_nl << be_global->stub_export_macro () << " ::CORBA::Boolean" - << " operator<< (" << be_idt << be_idt_nl + << " operator<< (" << be_idt_nl << "TAO_OutputCDR &strm," << be_nl - << "const " << node->name () << " &_tao_sequence" << be_uidt_nl - << ");" << be_uidt_nl; - *os << be_global->stub_export_macro () << " ::CORBA::Boolean" - << " operator>> (" << be_idt << be_idt_nl + << "const " << node->name () << " &_tao_sequence);" + << be_uidt; + + *os << be_nl << be_nl + << be_global->stub_export_macro () << " ::CORBA::Boolean" + << " operator>> (" << be_idt_nl << "TAO_InputCDR &strm," << be_nl - << node->name () << " &_tao_sequence" << be_uidt_nl - << ");" << be_uidt; + << node->name () << " &_tao_sequence);" << be_uidt; if (be_global->gen_ostream_operators ()) { - *os << be_global->stub_export_macro () << " std::ostream&" - << " operator<< (std::ostream &strm, const " - << node->name () << " &_tao_sequence);" << be_nl; + *os << be_nl << be_nl + << be_global->stub_export_macro () << " std::ostream&" + << " operator<< (" << be_idt_nl + << "std::ostream &strm," << be_nl + << "const " << node->name () << " &_tao_sequence);" + << be_uidt; } - *os << be_global->core_versioning_end () << be_nl; + *os << be_nl + << be_global->core_versioning_end () << be_nl; if (tdef == 0) { diff --git a/TAO/TAO_IDL/be_include/be_visitor_decl.h b/TAO/TAO_IDL/be_include/be_visitor_decl.h index a6f9e616227..fda016def9f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_decl.h +++ b/TAO/TAO_IDL/be_include/be_visitor_decl.h @@ -12,12 +12,12 @@ */ //============================================================================= - #ifndef TAO_BE_VISITOR_DECL_H #define TAO_BE_VISITOR_DECL_H #include "be_visitor.h" #include "be_codegen.h" +#include "be_helper.h" /** * @class be_visitor_decl @@ -37,9 +37,6 @@ public: be_visitor_context *ctx (void); protected: - // Using a protected mechanism will allow derived visitors to access this - // information. - /// Any context information required by the visitor. be_visitor_context *ctx_; @@ -47,6 +44,9 @@ protected: /// contained by another. int gen_anonymous_base_type (be_type *bt, TAO_CodeGen::CG_STATE cg_state); + + /// Our file stream. + TAO_OutStream &os_; }; #endif // TAO_BE_VISITOR_DECL_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_root.h b/TAO/TAO_IDL/be_include/be_visitor_root.h index ad15631e1b8..0d86b3ba1ae 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root.h @@ -13,7 +13,6 @@ */ //============================================================================= - #ifndef TAO_BE_VISITOR_ROOT_H #define TAO_BE_VISITOR_ROOT_H diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h index 14407058d81..9af01696b13 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/any_op.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ANY_OP_H_ #define _BE_VISITOR_ROOT_ANY_OP_H_ @@ -29,15 +28,11 @@ */ class be_visitor_root_any_op : public be_visitor_root { - public: - /// constructor be_visitor_root_any_op (be_visitor_context *ctx); - /// destructor ~be_visitor_root_any_op (void); - /// visit root virtual int visit_root (be_root *node); }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h b/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h index 99bdce3a1d3..af0015c0fde 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/cdr_op.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_CDR_OP_H_ #define _BE_VISITOR_ROOT_CDR_OP_H_ @@ -29,15 +28,11 @@ */ class be_visitor_root_cdr_op : public be_visitor_root { - public: - /// constructor be_visitor_root_cdr_op (be_visitor_context *ctx); - /// destructor ~be_visitor_root_cdr_op (void); - /// visit root virtual int visit_root (be_root *node); }; diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root.h b/TAO/TAO_IDL/be_include/be_visitor_root/root.h index ed801734c1d..24c59cbcb4c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root.h @@ -14,7 +14,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_H_ #define _BE_VISITOR_ROOT_ROOT_H_ @@ -33,15 +32,9 @@ public: ~be_visitor_root (void); - /// These are the only methods that differ from those of the + /// This is the only method that differs from that of the /// be_visitor_module bass class. - virtual int visit_root (be_root *node); virtual int visit_module (be_module *node); - - // =helper. This is used by derived clases to set the right context - - /// will be overridden by derived classes that set the appropriate context - virtual int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h index 941ba17071b..724a20363ab 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ch.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_CH_H_ #define _BE_VISITOR_ROOT_ROOT_CH_H_ @@ -24,19 +23,35 @@ * * @brief be_visitor_root_ch * - * This is a concrete visitor to generate the client header for root + * This is a concrete visitor to generate the client + * header for root */ class be_visitor_root_ch : public be_visitor_root { public: - /// constructor be_visitor_root_ch (be_visitor_context *ctx); - /// destructor ~be_visitor_root_ch (void); + + virtual int visit_root (be_root *node); - /// set the right context and make a visitor - virtual int init (void); +private: + /// Open file and initialize stream. + int init (void); + + /// Encapsulating various bits of code generation peculiar + /// to the client header file, done either before or after + /// the main scope traversal. + void gen_fwd_decls (void); + void gen_proxy_broker_factory_pointers (void); + void gen_ref_counting_overrides (void); + void gen_static_corba_overrides (void); + int gen_obv_decls (be_root *node); + int gen_object_traits (be_root *node); + int gen_template_exports (be_root *node); + int gen_any_ops (be_root *node); + int gen_cdr_ops (be_root *node); + int gen_dds_serializer_ops (be_root *node); }; #endif /* _BE_VISITOR_ROOT_ROOT_CH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h index 08e667e8148..0125bec7840 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ci.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_CI_H_ #define _BE_VISITOR_ROOT_ROOT_CI_H_ @@ -24,19 +23,25 @@ * * @brief be_visitor_root_ci * - * This is a concrete visitor to generate the client inline for root + * This is a concrete visitor to generate the + * client inline for root */ class be_visitor_root_ci : public be_visitor_root { public: - /// constructor be_visitor_root_ci (be_visitor_context *ctx); - /// destructor ~be_visitor_root_ci (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); + + /// Generate OBV definitions in the client inline + /// file, done after the main scope traversal. + int gen_obv_defns (be_root *node); }; #endif /* _BE_VISITOR_ROOT_ROOT_CI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_cnh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_cnh.h index be1aeff2bd6..de913b91353 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_cnh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_cnh.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_CNH_H_ #define _BE_VISITOR_ROOT_ROOT_CNH_H_ @@ -25,7 +24,7 @@ * @brief be_visitor_root_cnh * * This is a concrete visitor to generate the CIAO connector - * header for root + * header for root. */ class be_visitor_root_cnh : public be_visitor_root { @@ -34,8 +33,11 @@ public: ~be_visitor_root_cnh (void); - /// Set the right context and make a visitor. - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_CNH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_cns.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_cns.h index 8cdedb07f9e..6ae6b51000e 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_cns.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_cns.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_CNS_H_ #define _BE_VISITOR_ROOT_ROOT_CNS_H_ @@ -34,8 +33,10 @@ public: ~be_visitor_root_cns (void); - /// Set the right context and make a visitor. - virtual int init (void); + virtual int visit_root (be_root *node); + + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_CNS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h index e60bb1fae44..e6a3a4daae9 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_cs.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_CS_H_ #define _BE_VISITOR_ROOT_ROOT_CS_H_ @@ -24,19 +23,30 @@ * * @brief be_visitor_root_cs * - * This is a concrete visitor to generate the client stubs for root + * This is a concrete visitor to generate the client + * stubs for root */ class be_visitor_root_cs : public be_visitor_root { public: - /// constructor be_visitor_root_cs (be_visitor_context *ctx); - /// destructor ~be_visitor_root_cs (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); + + /// Encapsulating various bits of code generation peculiar + /// to the client source file, done either before or after + /// he main scope traversal. + int gen_arg_traits (be_root *node); + int gen_obv_defns (be_root *node); + int gen_any_ops (be_root *node); + int gen_cdr_ops (be_root *node); + int gen_dds_serializer_ops (be_root *node); }; #endif /* _BE_VISITOR_ROOT_ROOT_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ex_idl.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ex_idl.h index 1902244fb87..76c6ffb4e87 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ex_idl.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ex_idl.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_EX_IDL_H_ #define _BE_VISITOR_ROOT_ROOT_EX_IDL_H_ @@ -34,8 +33,11 @@ public: ~be_visitor_root_ex_idl (void); - /// Set the right context and make a visitor. - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_EX_IDL_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_exh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_exh.h index d8d6ad8446e..1b2eff7b6fd 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_exh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_exh.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_EXH_H_ #define _BE_VISITOR_ROOT_ROOT_EXH_H_ @@ -33,9 +32,12 @@ public: be_visitor_root_exh (be_visitor_context *ctx); ~be_visitor_root_exh (void); + + virtual int visit_root (be_root *node); - /// Set the right context and make a visitor. - virtual int init (void); +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_EXH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_exs.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_exs.h index c220692c97c..8d61719030c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_exs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_exs.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_EXS_H_ #define _BE_VISITOR_ROOT_ROOT_EXS_H_ @@ -33,9 +32,12 @@ public: be_visitor_root_exs (be_visitor_context *ctx); ~be_visitor_root_exs (void); + + virtual int visit_root (be_root *node); - /// Set the right context and make a visitor. - virtual int init (void); +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_EXS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h index f6d4cce4b4a..4c44e2e4fcc 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ih.h @@ -14,7 +14,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_IH_H_ #define _BE_VISITOR_ROOT_ROOT_IH_H_ @@ -28,14 +27,15 @@ class be_visitor_root_ih : public be_visitor_root { public: - /// constructor be_visitor_root_ih (be_visitor_context *ctx); - /// destructor ~be_visitor_root_ih (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_IH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h index 972d900d024..1255a0a523b 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_is.h @@ -14,7 +14,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_IS_H_ #define _BE_VISITOR_ROOT_ROOT_IS_H_ @@ -28,14 +27,15 @@ class be_visitor_root_is : public be_visitor_root { public: - /// constructor be_visitor_root_is (be_visitor_context *ctx); - /// destructor ~be_visitor_root_is (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_IS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h index f76a93c4abd..7e10ef9dad5 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_sh.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_SH_H_ #define _BE_VISITOR_ROOT_ROOT_SH_H_ @@ -29,14 +28,14 @@ class be_visitor_root_sh : public be_visitor_root { public: - /// constructor be_visitor_root_sh (be_visitor_context *ctx); - /// destructor ~be_visitor_root_sh (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_SH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h index ce733f11915..f89c54e951d 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_si.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_SI_H_ #define _BE_VISITOR_ROOT_ROOT_SI_H_ @@ -29,14 +28,15 @@ class be_visitor_root_si : public be_visitor_root { public: - /// constructor be_visitor_root_si (be_visitor_context *ctx); - /// destructor ~be_visitor_root_si (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_SI_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h index 559f89f1821..03944b9e4cf 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_ss.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_SS_H_ #define _BE_VISITOR_ROOT_ROOT_SS_H_ @@ -29,14 +28,20 @@ class be_visitor_root_ss : public be_visitor_root { public: - /// constructor be_visitor_root_ss (be_visitor_context *ctx); - /// destructor ~be_visitor_root_ss (void); - /// set the right context and make a visitor - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); + + /// Generate arg template trait specializations in + /// the skeleton source file, done before the main + /// scope traversal. + int gen_arg_traits (be_root *node); }; #endif /* _BE_VISITOR_ROOT_ROOT_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h index 856772b8576..2f904c758ce 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_sth.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_STH_H_ #define _BE_VISITOR_ROOT_ROOT_STH_H_ @@ -30,24 +29,21 @@ class be_visitor_root_sth : public be_visitor_root { public: - /// Constructor. be_visitor_root_sth (be_visitor_context *ctx); - /// Destructor. ~be_visitor_root_sth (void); - /// Set the right context and make a visitor. - virtual int init (void); - - // Overrides of base class methods so we can skip unnecessary nodes. - - virtual int visit_scope (be_scope *node); + virtual int visit_root (be_root *node); virtual int visit_module (be_module *node); virtual int visit_interface (be_interface *node); virtual int visit_component (be_component *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_STH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_svh.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_svh.h index 68271e53556..39436b59abe 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_svh.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_svh.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_SVH_H_ #define _BE_VISITOR_ROOT_ROOT_SVH_H_ @@ -34,8 +33,11 @@ public: ~be_visitor_root_svh (void); - /// Set the right context and make a visitor. - virtual int init (void); + virtual int visit_root (be_root *node); + +private: + /// Open file and initialize stream. + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_SVH_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root_svs.h b/TAO/TAO_IDL/be_include/be_visitor_root/root_svs.h index 30bc7179fdf..bbacfeb73ea 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_root/root_svs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_root/root_svs.h @@ -15,7 +15,6 @@ */ //============================================================================= - #ifndef _BE_VISITOR_ROOT_ROOT_SVS_H_ #define _BE_VISITOR_ROOT_ROOT_SVS_H_ @@ -33,9 +32,12 @@ public: be_visitor_root_svs (be_visitor_context *ctx); ~be_visitor_root_svs (void); + + virtual int visit_root (be_root *node); +private: /// Set the right context and make a visitor. - virtual int init (void); + int init (void); }; #endif /* _BE_VISITOR_ROOT_ROOT_SVS_H_ */ |