diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_argument')
17 files changed, 822 insertions, 694 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp index 8ab31451328..33f70ae17a0 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, arglist, "$Id$") +ACE_RCSID (be_visitor_argument, + arglist, + "$Id$") // ************************************************************ @@ -41,10 +39,10 @@ be_visitor_args_arglist::~be_visitor_args_arglist (void) int be_visitor_args_arglist::visit_argument (be_argument *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node + TAO_OutStream *os = this->ctx_->stream (); + this->ctx_->node (node); - // retrieve the type + // Retrieve the type. be_type *bt = be_type::narrow_from_decl (node->field_type ()); if (!bt) @@ -153,7 +151,7 @@ int be_visitor_args_arglist::visit_interface_fwd (be_interface_fwd *node) int be_visitor_args_arglist::visit_native (be_native *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -167,15 +165,16 @@ int be_visitor_args_arglist::visit_native (be_native *node) *os << this->type_name (node) << " &"; break; } + return 0; } int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); + AST_PredefinedType::PredefinedType pt = node->pt (); - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { @@ -188,9 +187,10 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { // The only PT_pseudo that doesn't take a _ptr suffix. idl_bool is_tckind = @@ -223,9 +223,9 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else { switch (this->direction ()) { @@ -238,15 +238,15 @@ int be_visitor_args_arglist::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end of else + } + } return 0; } int be_visitor_args_arglist::visit_sequence (be_sequence *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -266,7 +266,7 @@ int be_visitor_args_arglist::visit_sequence (be_sequence *node) int be_visitor_args_arglist::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); if (node->width () == (long) sizeof (char)) { @@ -304,7 +304,7 @@ int be_visitor_args_arglist::visit_string (be_string *node) int be_visitor_args_arglist::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -324,7 +324,7 @@ int be_visitor_args_arglist::visit_structure (be_structure *node) int be_visitor_args_arglist::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -362,7 +362,7 @@ int be_visitor_args_arglist::visit_typedef (be_typedef *node) int be_visitor_args_arglist::visit_valuetype (be_valuetype *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp index c172a002252..74090920d4a 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/argument.cpp @@ -18,15 +18,13 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, argument, "$Id$") +ACE_RCSID (be_visitor_argument, + argument, + "$Id$") be_visitor_args::be_visitor_args (be_visitor_context *ctx) - : be_visitor_decl (ctx) - , fixed_direction_ (-1) + : be_visitor_decl (ctx), + fixed_direction_ (-1) { } @@ -47,23 +45,31 @@ be_visitor_args::type_name (be_type *node, const char *suffix) { static char namebuf [NAMEBUFSIZE]; - ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); + ACE_OS::memset (namebuf, + '\0', + NAMEBUFSIZE); - be_type *bt; // type to use + be_type *bt; - // use the typedefed name if that is the one used in the IDL defn + // Use the typedefed name if that is the one used in the IDL defn. if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } ACE_OS::sprintf (namebuf, "%s", bt->full_name ()); if (suffix) - ACE_OS::strcat (namebuf, - suffix); + { + ACE_OS::strcat (namebuf, + suffix); + } return namebuf; } @@ -73,7 +79,9 @@ AST_Argument::Direction be_visitor_args::direction (void) { if (this->fixed_direction_ != -1) - return AST_Argument::Direction (this->fixed_direction_); + { + return AST_Argument::Direction (this->fixed_direction_); + } // grab the argument node. We know that our context has stored the right // argument node diff --git a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp index e24a84e9ce0..59672368f62 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, invoke_cs, "$Id$") +ACE_RCSID (be_visitor_argument, + invoke_cs, + "$Id$") // **************************************************************************** @@ -43,9 +41,8 @@ be_visitor_args_invoke_cs:: int be_visitor_args_invoke_cs::visit_argument (be_argument *node) { this->ctx_->node (node); // save the argument node - - // retrieve the type of the argument be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -60,8 +57,6 @@ int be_visitor_args_invoke_cs::visit_argument (be_argument *node) TAO_OutStream *os = this->ctx_->stream (); // get output stream - os->indent (); - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { switch (this->direction ()) @@ -142,9 +137,8 @@ int be_visitor_args_invoke_cs::visit_argument (be_argument *node) int be_visitor_args_invoke_cs::visit_array (be_array *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -158,7 +152,7 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node) case AST_Argument::dir_INOUT: *os << node->name () << "_forany (" << arg->local_name () << ")"; - break; + break; case AST_Argument::dir_OUT: break; } @@ -170,17 +164,8 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node) case AST_Argument::dir_IN: break; case AST_Argument::dir_INOUT: - *os << "_tao_argument_" << arg->local_name (); - break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - { - *os << "_tao_argument_" << arg->local_name (); - } - else - { - *os << "_tao_argument_" << arg->local_name (); - } + *os << "_tao_argument_" << arg->local_name (); break; } } @@ -192,14 +177,14 @@ int be_visitor_args_invoke_cs::visit_array (be_array *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_enum (be_enum *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -233,14 +218,14 @@ int be_visitor_args_invoke_cs::visit_enum (be_enum *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_interface (be_interface *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -276,14 +261,14 @@ int be_visitor_args_invoke_cs::visit_interface (be_interface *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_interface_fwd (be_interface_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -369,9 +354,8 @@ int be_visitor_args_invoke_cs::visit_valuetype (be_valuetype *) int be_visitor_args_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -407,13 +391,14 @@ be_visitor_args_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get argument node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -424,6 +409,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: case AST_PredefinedType::PT_any: case AST_PredefinedType::PT_long: case AST_PredefinedType::PT_ulong: @@ -470,6 +456,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: case AST_PredefinedType::PT_any: case AST_PredefinedType::PT_long: case AST_PredefinedType::PT_ulong: @@ -506,6 +493,7 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: *os << arg->local_name () << ".ptr ()"; break; case AST_PredefinedType::PT_any: @@ -552,14 +540,14 @@ int be_visitor_args_invoke_cs::visit_predefined_type (be_predefined_type *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -595,14 +583,14 @@ int be_visitor_args_invoke_cs::visit_sequence (be_sequence *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -618,10 +606,10 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node) } else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { - // we need to make a distinction between bounded and unbounded strings + // We need to make a distinction between bounded and unbounded strings. if (node->max_size ()->ev ()->u.ulval == 0) { - // unbounded + // Unbounded. switch (this->direction ()) { case AST_Argument::dir_IN: @@ -636,7 +624,7 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node) } else { - // bounded + // Bounded. switch (this->direction ()) { case AST_Argument::dir_IN: @@ -678,14 +666,14 @@ int be_visitor_args_invoke_cs::visit_string (be_string *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -709,7 +697,7 @@ int be_visitor_args_invoke_cs::visit_structure (be_structure *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "*" << arg->local_name () << ".ptr ()"; else *os << arg->local_name (); @@ -724,14 +712,14 @@ int be_visitor_args_invoke_cs::visit_structure (be_structure *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_invoke_cs::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { @@ -755,7 +743,7 @@ int be_visitor_args_invoke_cs::visit_union (be_union *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << "*" << arg->local_name () << ".ptr ()"; else *os << arg->local_name (); @@ -777,6 +765,7 @@ int be_visitor_args_invoke_cs::visit_union (be_union *node) int be_visitor_args_invoke_cs::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -785,6 +774,7 @@ int be_visitor_args_invoke_cs::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp index 8842e708c3f..0be2a5f206d 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp @@ -19,11 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, marshal_ss, "$Id$") +ACE_RCSID (be_visitor_argument, + marshal_ss, + "$Id$") // ************************************************************************ @@ -44,10 +42,9 @@ be_visitor_args_marshal_ss:: int be_visitor_args_marshal_ss::visit_argument (be_argument *node) { - this->ctx_->node (node); // save the argument node - - // retrieve the type of the argument + this->ctx_->node (node); be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -144,9 +141,8 @@ int be_visitor_args_marshal_ss::visit_argument (be_argument *node) int be_visitor_args_marshal_ss::visit_array (be_array *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -184,14 +180,14 @@ int be_visitor_args_marshal_ss::visit_array (be_array *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_enum (be_enum *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -225,14 +221,14 @@ int be_visitor_args_marshal_ss::visit_enum (be_enum *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_interface (be_interface *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -266,14 +262,14 @@ int be_visitor_args_marshal_ss::visit_interface (be_interface *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -307,14 +303,14 @@ int be_visitor_args_marshal_ss::visit_interface_fwd (be_interface_fwd *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_valuetype (be_valuetype *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -348,14 +344,14 @@ int be_visitor_args_marshal_ss::visit_valuetype (be_valuetype *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -389,13 +385,16 @@ int be_visitor_args_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *) "Bad substate\n"), -1); } + return 0; } -int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) +int be_visitor_args_marshal_ss::visit_predefined_type ( + be_predefined_type *node + ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get argument node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -406,6 +405,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: *os << arg->local_name () << ".out ()"; break; case AST_PredefinedType::PT_any: @@ -454,6 +454,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: *os << arg->local_name () << ".in ()"; break; case AST_PredefinedType::PT_any: @@ -494,6 +495,7 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: *os << arg->local_name () << ".in ()"; break; case AST_PredefinedType::PT_any: @@ -523,11 +525,14 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) *os << "CORBA::Any::from_octet (" << arg->local_name () << ")"; break; default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal_ss::" - "visit_array - " - "Bad predefined type\n"), - -1); + ACE_ERROR_RETURN (( + LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal_ss::" + "visit_array - " + "Bad predefined type\n" + ), + -1 + ); } break; } @@ -540,14 +545,14 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -583,14 +588,14 @@ int be_visitor_args_marshal_ss::visit_sequence (be_sequence *) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -671,14 +676,14 @@ int be_visitor_args_marshal_ss::visit_string (be_string *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -702,7 +707,7 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << arg->local_name () << ".in ()"; else *os << arg->local_name (); @@ -717,14 +722,14 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node) "Bad substate\n"), -1); } + return 0; } int be_visitor_args_marshal_ss::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { @@ -748,7 +753,7 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node) *os << arg->local_name (); break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) *os << arg->local_name () << ".in ()"; else *os << arg->local_name (); @@ -770,6 +775,7 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node) int be_visitor_args_marshal_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -778,6 +784,7 @@ int be_visitor_args_marshal_ss::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp index cc952c4c0f9..7dea1734128 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/paramlist.cpp @@ -19,10 +19,6 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - ACE_RCSID (be_visitor_argument, paramlist, "$Id$") diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp index 865425354cd..2e8ebf3f89e 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp @@ -19,11 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, post_invoke_cs, "$Id$") +ACE_RCSID (be_visitor_argument, + post_invoke_cs, + "$Id$") // ************************************************************************* @@ -33,8 +31,9 @@ ACE_RCSID(be_visitor_argument, post_invoke_cs, "$Id$") // type and vice versa. // ************************************************************************* -be_visitor_args_post_invoke_cs::be_visitor_args_post_invoke_cs -(be_visitor_context *ctx) +be_visitor_args_post_invoke_cs::be_visitor_args_post_invoke_cs ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } @@ -46,10 +45,11 @@ be_visitor_args_post_invoke_cs::~be_visitor_args_post_invoke_cs (void) int be_visitor_args_post_invoke_cs::visit_argument (be_argument *node) { - this->ctx_->node (node); // save the argument node + this->ctx_->node (node); - // retrieve the type of the argument + // Retrieve the type of the argument. be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -77,10 +77,9 @@ be_visitor_args_post_invoke_cs::visit_argument (be_argument *node) int be_visitor_args_post_invoke_cs::visit_interface (be_interface *node) { - // we must narrow the out object reference to the appropriate type - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + // We must narrow the out object reference to the appropriate type. + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -101,16 +100,16 @@ be_visitor_args_post_invoke_cs::visit_interface (be_interface *node) default: break; } + return 0; } int be_visitor_args_post_invoke_cs::visit_interface_fwd (be_interface_fwd *node) { - // we must narrow the out object reference to the appropriate type - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + // We must narrow the out object reference to the appropriate type. + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -131,16 +130,16 @@ be_visitor_args_post_invoke_cs::visit_interface_fwd (be_interface_fwd *node) default: break; } + return 0; } int be_visitor_args_post_invoke_cs::visit_valuetype (be_valuetype *) { - // we must narrow the out object reference to the appropriate type - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + // We must narrow the out object reference to the appropriate type. + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -154,16 +153,16 @@ be_visitor_args_post_invoke_cs::visit_valuetype (be_valuetype *) default: break; } + return 0; } int be_visitor_args_post_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *) { - // we must narrow the out object reference to the appropriate type - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + // We must narrow the out object reference to the appropriate type. + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -177,15 +176,16 @@ be_visitor_args_post_invoke_cs::visit_valuetype_fwd (be_valuetype_fwd *) default: break; } + return 0; } int be_visitor_args_post_invoke_cs::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: @@ -208,6 +208,7 @@ be_visitor_args_post_invoke_cs::visit_string (be_string *node) case AST_Argument::dir_OUT: break; } + return 0; } @@ -215,6 +216,7 @@ int be_visitor_args_post_invoke_cs::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -223,6 +225,7 @@ be_visitor_args_post_invoke_cs::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp index a532881930a..e3362d2bf16 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_marshal_ss.cpp @@ -19,12 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, post_marshal_ss, "$Id$") - +ACE_RCSID (be_visitor_argument, + post_marshal_ss, + "$Id$") // ************************************************************************ // visitor for doing any post-processing after the marshaling is done @@ -45,6 +42,7 @@ int be_visitor_args_post_marshal_ss::visit_argument (be_argument *node) // retrieve the type be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -69,160 +67,10 @@ int be_visitor_args_post_marshal_ss::visit_argument (be_argument *node) return 0; } -int be_visitor_args_post_marshal_ss::visit_array (be_array *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_enum (be_enum *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_interface (be_interface *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_interface_fwd (be_interface_fwd *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_predefined_type (be_predefined_type *node) -{ - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } // end switch direction - } // end else if - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_sequence (be_sequence *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_string (be_string *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_structure (be_structure *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_post_marshal_ss::visit_union (be_union *) -{ - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - int be_visitor_args_post_marshal_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -231,6 +79,7 @@ int be_visitor_args_post_marshal_ss::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp index 06cfa4d0cce..41c9e5b9d10 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_upcall_ss.cpp @@ -19,17 +19,17 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, post_upcall_ss, "$Id$") +ACE_RCSID (be_visitor_argument, + post_upcall_ss, + "$Id$") // ************************************************************************ // visitor for doing any post-processing after the upcall is made // ************************************************************************ -be_visitor_args_post_upcall_ss::be_visitor_args_post_upcall_ss (be_visitor_context *ctx) +be_visitor_args_post_upcall_ss::be_visitor_args_post_upcall_ss ( + be_visitor_context *ctx + ) : be_visitor_scope (ctx) { } @@ -50,10 +50,11 @@ int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) // retrieve the type be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_compiled_args_post_upcall::" + "be_visitor_args_post_upcall::" "visit_argument - " "Bad argument type\n"), -1); @@ -65,7 +66,7 @@ int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) if (bt->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_compiled_args_post_upcall::" + "be_visitor_args_post_upcall::" "visit_argument - " "cannot accept visitor\n"), -1); @@ -81,8 +82,11 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) // if the current type is an alias, use that be_type *bt = node; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } switch (arg->direction ()) { @@ -105,6 +109,7 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) << arg->local_name () << be_uidt_nl << ");\n" << be_uidt; } + break; } return 0; @@ -113,14 +118,16 @@ int be_visitor_args_post_upcall_ss::visit_array (be_array *node) int be_visitor_args_post_upcall_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_compiled_args_post_upcall::" + "be_visitor_args_post_upcall::" "visit_typedef - " "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp index 43c173b574d..2c322980928 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/pre_invoke_cs.cpp @@ -19,11 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, pre_invoke_cs, "$Id$") +ACE_RCSID (be_visitor_argument, + pre_invoke_cs, + "$Id$") // ************************************************************************* @@ -78,7 +76,7 @@ be_visitor_args_pre_invoke_cs::cannot_return_zero (void) return 1; } else if (bt->base_node_type () == AST_Decl::NT_struct - && bt->size_type () == be_decl::FIXED) + && bt->size_type () == AST_Type::FIXED) { return 1; } @@ -139,7 +137,7 @@ be_visitor_args_pre_invoke_cs::visit_array (be_array *node) switch (this->direction ()) { case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) + if (node->size_type () == AST_Type::VARIABLE) { os->indent (); @@ -199,6 +197,7 @@ be_visitor_args_pre_invoke_cs::visit_predefined_type (be_predefined_type *node) switch (node->pt ()) { case AST_PredefinedType::PT_pseudo: + case AST_PredefinedType::PT_object: { switch (this->direction ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp index 8ccd92cb024..e4c9831a881 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_arglist.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_arglist, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_arglist, + "$Id$") // ************************************************************ @@ -150,6 +148,7 @@ int be_visitor_args_request_info_arglist::visit_interface (be_interface *node) *os << this->type_name (node, "_out"); break; } + return 0; } @@ -171,6 +170,7 @@ int be_visitor_args_request_info_arglist::visit_interface_fwd ( *os << this->type_name (node, "_out"); break; } + return 0; } @@ -190,6 +190,7 @@ int be_visitor_args_request_info_arglist::visit_native (be_native *node) *os << this->type_name (node) << " &"; break; } + return 0; } @@ -198,9 +199,9 @@ int be_visitor_args_request_info_arglist::visit_predefined_type ( ) { TAO_OutStream *os = this->ctx_->stream (); + AST_PredefinedType::PredefinedType pt = node->pt (); - // Check if the type is an any. - if (node->pt () == AST_PredefinedType::PT_any) + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { @@ -222,9 +223,10 @@ int be_visitor_args_request_info_arglist::visit_predefined_type ( break; } - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g. CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { switch (this->direction ()) { @@ -237,9 +239,9 @@ int be_visitor_args_request_info_arglist::visit_predefined_type ( case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end else if - else // Simple predefined types. + } + } + else { switch (this->direction ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp index e2e0b7496e7..993c3d44b18 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ch.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_ch, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_ch, + "$Id$") // ************************************************************ @@ -41,8 +39,8 @@ be_visitor_args_request_info_ch::~be_visitor_args_request_info_ch (void) int be_visitor_args_request_info_ch::visit_argument (be_argument *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node + TAO_OutStream *os = this->ctx_->stream (); + this->ctx_->node (node); // retrieve the type be_type *bt = be_type::narrow_from_decl (node->field_type ()); @@ -75,7 +73,7 @@ int be_visitor_args_request_info_ch::visit_argument (be_argument *node) int be_visitor_args_request_info_ch::visit_array (be_array *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -104,7 +102,7 @@ int be_visitor_args_request_info_ch::visit_array (be_array *node) int be_visitor_args_request_info_ch::visit_enum (be_enum *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -134,7 +132,7 @@ int be_visitor_args_request_info_ch::visit_enum (be_enum *node) int be_visitor_args_request_info_ch::visit_interface (be_interface *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -148,6 +146,7 @@ int be_visitor_args_request_info_ch::visit_interface (be_interface *node) *os << this->type_name (node, "_out"); break; } + return 0; } @@ -155,7 +154,7 @@ int be_visitor_args_request_info_ch::visit_interface_fwd ( be_interface_fwd *node ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -169,12 +168,13 @@ int be_visitor_args_request_info_ch::visit_interface_fwd ( *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_ch::visit_native (be_native *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -188,6 +188,7 @@ int be_visitor_args_request_info_ch::visit_native (be_native *node) *os << this->type_name (node) << " &"; break; } + return 0; } @@ -195,10 +196,10 @@ int be_visitor_args_request_info_ch::visit_predefined_type ( be_predefined_type *node ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); + AST_PredefinedType::PredefinedType pt = node-> pt (); - // Check if the type is an any. - if (node->pt () == AST_PredefinedType::PT_any) + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { @@ -220,9 +221,10 @@ int be_visitor_args_request_info_ch::visit_predefined_type ( break; } - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { switch (this->direction ()) { @@ -235,9 +237,9 @@ int be_visitor_args_request_info_ch::visit_predefined_type ( case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end else if - else // Simple predefined types. + } + } + else { switch (this->direction ()) { @@ -267,7 +269,7 @@ int be_visitor_args_request_info_ch::visit_predefined_type ( int be_visitor_args_request_info_ch::visit_sequence (be_sequence *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -294,7 +296,7 @@ int be_visitor_args_request_info_ch::visit_sequence (be_sequence *node) int be_visitor_args_request_info_ch::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); if (node->width () == 1) { @@ -332,7 +334,7 @@ int be_visitor_args_request_info_ch::visit_string (be_string *node) int be_visitor_args_request_info_ch::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -354,14 +356,14 @@ int be_visitor_args_request_info_ch::visit_structure (be_structure *node) break; } - } + return 0; } int be_visitor_args_request_info_ch::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -383,8 +385,8 @@ int be_visitor_args_request_info_ch::visit_union (be_union *node) break; } - } + return 0; } @@ -408,7 +410,7 @@ int be_visitor_args_request_info_ch::visit_typedef (be_typedef *node) int be_visitor_args_request_info_ch::visit_valuetype (be_valuetype *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -422,6 +424,7 @@ int be_visitor_args_request_info_ch::visit_valuetype (be_valuetype *node) *os << this->type_name (node, "_out"); break; } + return 0; } @@ -429,7 +432,7 @@ int be_visitor_args_request_info_ch::visit_valuetype_fwd ( be_valuetype_fwd *node ) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -443,6 +446,7 @@ int be_visitor_args_request_info_ch::visit_valuetype_fwd ( *os << this->type_name (node, "_out"); break; } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp index 09d7050b34e..07650498daf 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_cs.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_cs, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_cs, + "$Id$") // ************************************************************ @@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_cs, "$Id$") // definitions // ************************************************************ -be_visitor_args_request_info_cs::be_visitor_args_request_info_cs (be_visitor_context *ctx) +be_visitor_args_request_info_cs::be_visitor_args_request_info_cs ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp index 1d1ef00aa91..ea9a7062592 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_result.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_result, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_result, + "$Id$") // ************************************************************ @@ -30,25 +28,27 @@ ACE_RCSID(be_visitor_argument, request_info_result, "$Id$") // stored in the request info for interceptors // ************************************************************ -be_visitor_args_request_info_result::be_visitor_args_request_info_result (be_visitor_context *ctx) +be_visitor_args_request_info_result::be_visitor_args_request_info_result ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } -be_visitor_args_request_info_result::~be_visitor_args_request_info_result (void) +be_visitor_args_request_info_result::~be_visitor_args_request_info_result ( + void + ) { } int be_visitor_args_request_info_result::visit_argument (be_argument *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - this->ctx_->node (node); // save the argument node - be_type *bt; + TAO_OutStream *os = this->ctx_->stream (); + this->ctx_->node (node); os->indent (); + be_type *bt = be_type::narrow_from_decl (node->field_type ()); - // retrieve the type - bt = be_type::narrow_from_decl (node->field_type ()); if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -59,40 +59,47 @@ int be_visitor_args_request_info_result::visit_argument (be_argument *node) } if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_vardecl_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_vardecl_ss::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } *os << be_nl; + // Set the appropriate mode for each parameter. return 0; } int be_visitor_args_request_info_result::visit_array (be_array *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); - // if the current type is an alias, use that be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } os->indent (); + *os << bt->name () << "_forany _tao_forany_result" << " (this->result_);" << be_nl - << "this->result_val_ <<= _tao_forany_result;"<< be_nl; + << "this->result_val_ <<= _tao_forany_result;" << be_nl; + return 0; } int be_visitor_args_request_info_result::visit_enum (be_enum *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); *os << "this->result_val_ <<= this->result_;"; @@ -102,7 +109,7 @@ int be_visitor_args_request_info_result::visit_enum (be_enum *) int be_visitor_args_request_info_result::visit_interface (be_interface *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); *os << "this->result_val_ <<= this->result_;"; @@ -110,90 +117,98 @@ int be_visitor_args_request_info_result::visit_interface (be_interface *) return 0; } -int be_visitor_args_request_info_result::visit_interface_fwd (be_interface_fwd *) +int be_visitor_args_request_info_result::visit_interface_fwd ( + be_interface_fwd * + ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); *os << "this->result_val_ <<= this->result_;"; return 0; - } int be_visitor_args_request_info_result::visit_valuetype (be_valuetype *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); *os << "this->result_val_ <<= this->result_;"; return 0; - } -int be_visitor_args_request_info_result::visit_valuetype_fwd (be_valuetype_fwd *) +int be_visitor_args_request_info_result::visit_valuetype_fwd ( + be_valuetype_fwd * + ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); *os << "this->result_val_ <<= this->result_;"; return 0; - } int -be_visitor_args_request_info_result::visit_predefined_type (be_predefined_type *node) +be_visitor_args_request_info_result::visit_predefined_type ( + be_predefined_type *node + ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= "; + switch (node->pt ()) { case AST_PredefinedType::PT_boolean: *os << "CORBA::Any::from_boolean (this->result_);" << be_nl; + break; case AST_PredefinedType::PT_char: *os << "CORBA::Any::from_char (this->result_);"<<be_nl; + break; case AST_PredefinedType::PT_wchar: *os << "CORBA::Any::from_wchar (this->result_);"<<be_nl; + break; case AST_PredefinedType::PT_octet: *os << "CORBA::Any::from_octet (this->result_);"<<be_nl; - break; + break; default: *os << "this->result_;"<<be_nl; + break; } - return 0; + return 0; } int be_visitor_args_request_info_result::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= this->result_;"; return 0; - } int be_visitor_args_request_info_result::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= "; - // we need to make a distinction between bounded and unbounded strings + + // We need to make a distinction between bounded and unbounded strings. if (node->max_size ()->ev ()->u.ulval != 0) { - // bounded strings if (node->width () == (long) sizeof (char)) { *os << "CORBA::Any::from_string ((char *)"; @@ -202,44 +217,45 @@ be_visitor_args_request_info_result::visit_string (be_string *node) { *os << "CORBA::Any::from_wstring ((CORBA::WChar *)"; } + *os <<"this->result_, " << node->max_size ()->ev ()->u.ulval << ");"; } else + { *os << "this->result_; "; -return 0; + } + + return 0; } int be_visitor_args_request_info_result::visit_structure (be_structure *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= this->result_;"; return 0; - } int be_visitor_args_request_info_result::visit_union (be_union *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= this->result_;"; return 0; - } int be_visitor_args_request_info_result::visit_typedef (be_typedef *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - + TAO_OutStream *os = this->ctx_->stream (); os->indent (); + *os << "this->result_val_ <<= this->result_;"; return 0; - } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp index 07ffc2bf17a..049d3e7d874 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_sh.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_sh, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_sh, + "$Id$") // ************************************************************ @@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_sh, "$Id$") // definitions // ************************************************************ -be_visitor_args_request_info_sh::be_visitor_args_request_info_sh (be_visitor_context *ctx) +be_visitor_args_request_info_sh::be_visitor_args_request_info_sh ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } @@ -43,8 +43,6 @@ int be_visitor_args_request_info_sh::visit_argument (be_argument *node) { TAO_OutStream *os = this->ctx_->stream (); this->ctx_->node (node); - - // retrieve the type be_type *bt = be_type::narrow_from_decl (node->field_type ()); if (!bt) @@ -70,8 +68,10 @@ int be_visitor_args_request_info_sh::visit_argument (be_argument *node) // As we visit each type we print out the &. *os <<" "<< node->local_name () << "_;" << be_nl; + return 0; } + int be_visitor_args_request_info_sh::visit_array (be_array *node) { TAO_OutStream *os = this->ctx_->stream (); @@ -88,12 +88,13 @@ int be_visitor_args_request_info_sh::visit_array (be_array *node) *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_enum (be_enum *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -107,12 +108,13 @@ int be_visitor_args_request_info_sh::visit_enum (be_enum *node) *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_interface (be_interface *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -126,12 +128,13 @@ int be_visitor_args_request_info_sh::visit_interface (be_interface *node) *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_interface_fwd (be_interface_fwd *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -145,12 +148,13 @@ int be_visitor_args_request_info_sh::visit_interface_fwd (be_interface_fwd *node *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_native (be_native *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -164,15 +168,18 @@ int be_visitor_args_request_info_sh::visit_native (be_native *node) *os << this->type_name (node) << " &"; break; } + return 0; } -int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type *node) +int be_visitor_args_request_info_sh::visit_predefined_type ( + be_predefined_type *node + ) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream + TAO_OutStream *os = this->ctx_->stream (); + AST_PredefinedType::PredefinedType pt = node->pt (); - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { @@ -185,9 +192,10 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type * case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { switch (this->direction ()) { @@ -200,9 +208,9 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type * case AST_Argument::dir_OUT: *os << this->type_name (node, "_out"); break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else { switch (this->direction ()) { @@ -223,7 +231,7 @@ int be_visitor_args_request_info_sh::visit_predefined_type (be_predefined_type * int be_visitor_args_request_info_sh::visit_sequence (be_sequence *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -237,12 +245,13 @@ int be_visitor_args_request_info_sh::visit_sequence (be_sequence *node) *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); if (node->width () == 1) { @@ -280,7 +289,7 @@ int be_visitor_args_request_info_sh::visit_string (be_string *node) int be_visitor_args_request_info_sh::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -294,6 +303,7 @@ int be_visitor_args_request_info_sh::visit_structure (be_structure *node) *os << this->type_name (node, "_out"); break; } + return 0; } @@ -313,12 +323,14 @@ int be_visitor_args_request_info_sh::visit_union (be_union *node) *os << this->type_name (node, "_out"); break; } + return 0; } int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -327,6 +339,7 @@ int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } @@ -334,7 +347,7 @@ int be_visitor_args_request_info_sh::visit_typedef (be_typedef *node) int be_visitor_args_request_info_sh::visit_valuetype (be_valuetype *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -348,12 +361,15 @@ int be_visitor_args_request_info_sh::visit_valuetype (be_valuetype *node) *os << this->type_name (node, "_out"); break; } + return 0; } -int be_visitor_args_request_info_sh::visit_valuetype_fwd (be_valuetype_fwd *node) +int be_visitor_args_request_info_sh::visit_valuetype_fwd ( + be_valuetype_fwd *node + ) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); switch (this->direction ()) { @@ -367,6 +383,7 @@ int be_visitor_args_request_info_sh::visit_valuetype_fwd (be_valuetype_fwd *node *os << this->type_name (node, "_out"); break; } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp index e68b5b16c07..024686018c7 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/request_info_ss.cpp @@ -18,11 +18,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, request_info_ss, "$Id$") +ACE_RCSID (be_visitor_argument, + request_info_ss, + "$Id$") // ************************************************************ @@ -30,7 +28,9 @@ ACE_RCSID(be_visitor_argument, request_info_ss, "$Id$") // definitions // ************************************************************ -be_visitor_args_request_info_ss::be_visitor_args_request_info_ss (be_visitor_context *ctx) +be_visitor_args_request_info_ss::be_visitor_args_request_info_ss ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp index 857d33a1896..434f4f02025 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/upcall_ss.cpp @@ -19,11 +19,9 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, upcall_ss, "$Id$") +ACE_RCSID (be_visitor_argument, + upcall_ss, + "$Id$") // ************************************************************************ @@ -41,10 +39,9 @@ be_visitor_args_upcall_ss::~be_visitor_args_upcall_ss (void) int be_visitor_args_upcall_ss::visit_argument (be_argument *node) { - this->ctx_->node (node); // save the argument node - - // retrieve the type + this->ctx_->node (node); be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -70,9 +67,8 @@ int be_visitor_args_upcall_ss::visit_argument (be_argument *node) int be_visitor_args_upcall_ss::visit_array (be_array *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -85,29 +81,40 @@ int be_visitor_args_upcall_ss::visit_array (be_array *node) } *os << arg->local_name (); + break; case AST_Argument::dir_INOUT: *os << arg->local_name (); + break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".out ()"; + if (node->size_type () == AST_Type::VARIABLE) + { + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } + else + { + *os << arg->local_name () << ".out ()"; + } + } else - *os << arg->local_name (); + { + *os << arg->local_name (); + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_enum (be_enum *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); switch (this->direction ()) { @@ -115,190 +122,278 @@ int be_visitor_args_upcall_ss::visit_enum (be_enum *) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: *os << arg->local_name (); + break; } + return 0; } int be_visitor_args_upcall_ss::visit_interface (be_interface *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".inout ()"; + { + *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_interface_fwd (be_interface_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".inout ()"; + { + *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_valuetype (be_valuetype *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".inout ()"; + { + *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_valuetype_fwd (be_valuetype_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".inout ()"; + { + *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + AST_PredefinedType::PredefinedType pt = node->pt (); + + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: *os << arg->local_name (); + break; case AST_Argument::dir_OUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".inout ()"; + { + *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else { switch (this->direction ()) { @@ -306,6 +401,7 @@ int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: *os << arg->local_name (); + break; } // end switch direction } // end of else @@ -315,111 +411,157 @@ int be_visitor_args_upcall_ss::visit_predefined_type (be_predefined_type *node) int be_visitor_args_upcall_ss::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: *os << arg->local_name (); + break; case AST_Argument::dir_OUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_string (be_string *) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".in ()"; + { + *os << arg->local_name () << ".in ()"; + } + break; case AST_Argument::dir_INOUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else + { *os << arg->local_name () << ".inout ()"; + } + break; case AST_Argument::dir_OUT: if (this->ctx_->state () == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); + { + *os << arg->local_name (); + } else - *os << arg->local_name () << ".out ()"; + { + *os << arg->local_name () << ".out ()"; + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: *os << arg->local_name (); + break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".out ()"; + if (node->size_type () == AST_Type::VARIABLE) + { + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } + else + { + *os << arg->local_name () << ".out ()"; + } + } else - *os << arg->local_name (); + { + *os << arg->local_name (); + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: *os << arg->local_name (); + break; case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) - *os << arg->local_name (); - else - *os << arg->local_name () << ".out ()"; + if (node->size_type () == AST_Type::VARIABLE) + { + if (this->ctx_->state () + == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS) + { + *os << arg->local_name (); + } + else + { + *os << arg->local_name () << ".out ()"; + } + } else - *os << arg->local_name (); + { + *os << arg->local_name (); + } + break; } + return 0; } int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -428,6 +570,7 @@ int be_visitor_args_upcall_ss::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp index 6113da06ab4..b6d69df63d6 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp @@ -19,18 +19,18 @@ // // ============================================================================ -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, vardecl_ss, "$Id$") +ACE_RCSID (be_visitor_argument, + vardecl_ss, + "$Id$") // ************************************************************************ // Visitor to generate code for argument variable declaration // ************************************************************************ -be_visitor_args_vardecl_ss::be_visitor_args_vardecl_ss (be_visitor_context *ctx) +be_visitor_args_vardecl_ss::be_visitor_args_vardecl_ss ( + be_visitor_context *ctx + ) : be_visitor_args (ctx) { } @@ -41,10 +41,9 @@ be_visitor_args_vardecl_ss::~be_visitor_args_vardecl_ss (void) int be_visitor_args_vardecl_ss::visit_argument (be_argument *node) { - this->ctx_->node (node); // save the argument node - - // retrieve the type + this->ctx_->node (node); be_type *bt = be_type::narrow_from_decl (node->field_type ()); + if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, @@ -56,7 +55,6 @@ int be_visitor_args_vardecl_ss::visit_argument (be_argument *node) // Different types have different mappings when used as in/out or // inout parameters. Let this visitor deal with the type - if (bt->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -71,30 +69,35 @@ int be_visitor_args_vardecl_ss::visit_argument (be_argument *node) int be_visitor_args_vardecl_ss::visit_array (be_array *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";" << be_nl << bt->name () << "_forany _tao_forany_" << arg->local_name () << " (" << be_idt << be_idt_nl << arg->local_name () << be_uidt_nl << ");\n" << be_uidt; - break; + break; case AST_Argument::dir_OUT: os->indent (); + if (node->size_type () == be_type::VARIABLE) { *os << bt->name () << "_var " << arg->local_name () @@ -105,22 +108,27 @@ int be_visitor_args_vardecl_ss::visit_array (be_array *node) *os << bt->name () << " " << arg->local_name () << ";\n\n"; } + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_enum (be_enum *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { @@ -128,172 +136,220 @@ int be_visitor_args_vardecl_ss::visit_enum (be_enum *node) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_interface (be_interface *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_valuetype (be_valuetype *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_valuetype_fwd (be_valuetype_fwd *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } + + AST_PredefinedType::PredefinedType pt = node->pt (); - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) + if (pt == AST_PredefinedType::PT_any) { switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (pt == AST_PredefinedType::PT_pseudo + || pt == AST_PredefinedType::PT_object) { switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () + << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";\n"; + break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else { switch (this->direction ()) { @@ -301,47 +357,57 @@ int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; - } // end switch direction - } // end of else + } + } return 0; } int be_visitor_args_vardecl_ss::visit_sequence (be_sequence *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); + *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); + switch (this->direction ()) { case AST_Argument::dir_IN: @@ -372,65 +438,80 @@ int be_visitor_args_vardecl_ss::visit_string (be_string *node) break; } + return 0; } int be_visitor_args_vardecl_ss::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); - // check if it is variable sized + if (node->size_type () == be_type::VARIABLE) { *os << bt->name () << "_var " << arg->local_name () << ";\n"; } else - *os << bt->name () << " " << arg->local_name () << ";\n"; + { + *os << bt->name () << " " << arg->local_name () << ";\n"; + } + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - // if the current type is an alias, use that + TAO_OutStream *os = this->ctx_->stream (); + be_argument *arg = this->ctx_->be_node_as_argument (); be_type *bt; + if (this->ctx_->alias ()) - bt = this->ctx_->alias (); + { + bt = this->ctx_->alias (); + } else - bt = node; + { + bt = node; + } switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); + *os << bt->name () << " " << arg->local_name () << ";\n"; + break; case AST_Argument::dir_OUT: os->indent (); - // check if it is variable sized + if (node->size_type () == be_type::VARIABLE) { *os << bt->name () << "_var " @@ -438,15 +519,20 @@ int be_visitor_args_vardecl_ss::visit_union (be_union *node) } else - *os << bt->name () << " " << arg->local_name () << ";\n"; + { + *os << bt->name () << " " << arg->local_name () << ";\n"; + } + break; } + return 0; } int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -455,6 +541,7 @@ int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node) "accept on primitive type failed\n"), -1); } + this->ctx_->alias (0); return 0; } |