diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-10 18:38:14 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-03-10 18:38:14 +0000 |
commit | 8f826cab769a29d97bfc3afa7e174770df551c9f (patch) | |
tree | 98d6d5c03de01ac4ac6263f5d5579e5e0d94685b | |
parent | e3e9c942051125fa5b2ccb3bf542725ce013a9a6 (diff) | |
download | ATCD-8f826cab769a29d97bfc3afa7e174770df551c9f.tar.gz |
Removed unneeded stuff related to interpreted marshaling. Also
added/removed/renamed some files to make things more consistent.
59 files changed, 2064 insertions, 6024 deletions
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 34a079e9d22..9d9277cbdf2 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -1145,13 +1145,9 @@ TAO_CodeGen::node (void) void TAO_CodeGen::config_visitor_factory (void) { - // What strategy are we interested in? Interpreted or Compiled Marshaling? - // This is the top level distinction we make and strategize our visitor - // factory object accordingly - if (idl_global->compiled_marshaling ()) - this->visitor_factory_ = TAO_COMPILED_VISITOR_FACTORY::instance (); - else - this->visitor_factory_ = TAO_INTERPRETIVE_VISITOR_FACTORY::instance (); + // We have removed interpreted marshaling from TAO, so + // TAO_INTERPRETIVE_VISITOR_FACTORY is no more. + this->visitor_factory_ = TAO_COMPILED_VISITOR_FACTORY::instance (); } void diff --git a/TAO/TAO_IDL/be/be_visitor_argument.cpp b/TAO/TAO_IDL/be/be_visitor_argument.cpp index 5cc908e0e6e..c5098e438b5 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument.cpp @@ -25,19 +25,13 @@ // include all the individual files #include "be_visitor_argument/arglist.cpp" #include "be_visitor_argument/argument.cpp" -#include "be_visitor_argument/docall_cs.cpp" #include "be_visitor_argument/marshal_ss.cpp" -#include "be_visitor_argument/post_docall_cs.cpp" -#include "be_visitor_argument/post_docall_compiled_cs.cpp" -#include "be_visitor_argument/post_marshal_ss.cpp" #include "be_visitor_argument/post_upcall_ss.cpp" -#include "be_visitor_argument/pre_docall_cs.cpp" -#include "be_visitor_argument/pre_upcall_ss.cpp" #include "be_visitor_argument/upcall_ss.cpp" #include "be_visitor_argument/vardecl_ss.cpp" -#include "be_visitor_argument/compiled_marshal_cs.cpp" -#include "be_visitor_argument/compiled_marshal_ss.cpp" #include "be_visitor_argument/pre_invoke_cs.cpp" +#include "be_visitor_argument/invoke_cs.cpp" +#include "be_visitor_argument/post_invoke_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_ss.cpp deleted file mode 100644 index 632ca60701a..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_ss.cpp +++ /dev/null @@ -1,785 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// compiled_marshal_ss.cpp -// -// = DESCRIPTION -// Visitor generating the code that passes arguments to the CDR operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, compiled_marshal_ss, "$Id$") - - -// **************************************************************************** -// visitor for arguments passing to the CDR operators. -// **************************************************************************** - -be_visitor_args_compiled_marshal_ss:: -be_visitor_args_compiled_marshal_ss (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_compiled_marshal_ss:: -~be_visitor_args_compiled_marshal_ss (void) -{ -} - -int be_visitor_args_compiled_marshal_ss::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, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "(_tao_in >> "; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "(_tao_out << "; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "Bad substate\n"), - -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << ")"; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << ")"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_argument - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - *os << "_tao_forany_" << arg->local_name (); - break; - case AST_Argument::dir_INOUT: - *os << "_tao_forany_" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - *os << "_tao_forany_" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - *os << "_tao_forany_" << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_array - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_enum - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name () << ".out ()"; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name () << ".out ()"; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_interface_fwd - " - "Bad substate\n"), - -1); - } - return 0; -} - -#ifdef IDL_HAS_VALUETYPE - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name () << ".out ()"; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_valuetype - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name () << ".out ()"; - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_valuetype_fwd - " - "Bad substate\n"), - -1); - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << arg->local_name () << ".out ()"; - break; - case AST_PredefinedType::PT_any: - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::to_char (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::to_wchar (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::to_boolean (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::to_octet (" << arg->local_name () << ")"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - } - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << arg->local_name () << ".in ()"; - break; - case AST_PredefinedType::PT_any: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_octet: - *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); - } - break; - case AST_Argument::dir_OUT: - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << arg->local_name () << ".in ()"; - break; - case AST_PredefinedType::PT_any: - *os << arg->local_name () << ".in ()"; - break; - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << arg->local_name (); - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (" << arg->local_name () << ")"; - break; - case AST_PredefinedType::PT_octet: - *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); - } - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_array - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - // we need to make a distinction between bounded and unbounded strings - if (node->max_size ()->ev ()->u.ulval == 0) - { - *os << arg->local_name () << ".out ()"; - } - else - { - if (node->width () == sizeof (char)) - { - *os << "CORBA::Any::to_string ("; - } - else - { - *os << "CORBA::Any::to_wstring ("; - } - - *os << arg->local_name () << ".out (), " - << node->max_size ()->ev ()->u.ulval - 1 - << ")"; - } - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - // we need to make a distinction between bounded and unbounded strings - if (node->max_size ()->ev ()->u.ulval == 0) - { - // unbounded - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".in ()"; - break; - } - } - else - { - // bounded - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - if (node->width () == sizeof (char)) - { - *os << "CORBA::Any::from_string ((char *)"; - } - else - { - *os << "CORBA::Any::from_wstring ((CORBA::WChar *)"; - } - - *os << arg->local_name () << ".in (), " - << node->max_size ()->ev ()->u.ulval - 1 << ")"; - break; - } - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_string - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - *os << arg->local_name () << ".in ()"; - else - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_structure - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_args_compiled_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 - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - break; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - *os << arg->local_name () << ".in ()"; - else - *os << arg->local_name (); - break; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_compiled_marshal_ss::" - "visit_union - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_args_compiled_marshal_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_args_compiled_marshal_ss::" - "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/docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp deleted file mode 100644 index babe24ed4bb..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp +++ /dev/null @@ -1,319 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// docall_cs.cpp -// -// = DESCRIPTION -// Visitor generating the code that passes arguments to the do_static_call -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, docall_cs, "$Id$") - - -// **************************************************************************** -// visitor for argument passing to do_static_call. The do_static_call -// method takes an array with pointers to each argument (the type is -// actually void*). The total number of parameters is determined by the -// "calldata" parameter that must be passed before the variable list -// starts. -// Hence we pass the address of each argument. The case for _out is a bit -// tricky where we must first retrieve the pointer, allocate memory -// and pass it to do_static_call. This is done in the -// "pre_do_static_call" processing. -// **************************************************************************** - -be_visitor_args_docall_cs::be_visitor_args_docall_cs (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_docall_cs::~be_visitor_args_docall_cs (void) -{ -} - -int be_visitor_args_docall_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, - "be_visitor_args_docall_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - os->indent (); - *os << "*_tao_arg = "; - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_docall_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - *os << "; _tao_arg++;\n"; - - return 0; -} - -int be_visitor_args_docall_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 - - 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_type::VARIABLE) - // pass reference to the pointer to slice - *os << arg->local_name () << ".ptr ()"; - else - *os << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - // pass the address. Storage is already allocated - *os << "&" << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << "&_tao_base_" << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << "&_tao_base_" << arg->local_name (); - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - // check if the type is an any - if (node->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: - *os << arg->local_name () << ".ptr ()"; - break; - } // end switch direction - } // end of if any - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., - // CORBA::Object, - // CORBA::TypeCode - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - //*os << "&_tao_base_" << arg->local_name (); - *os << "&" << arg->local_name () << ".ptr ()"; - break; - } // end switch direction - } // end else if pseudo - else // simple predefined types - { - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - *os << "&" << arg->local_name (); - break; - } // end switch direction - } // end of else - - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - *os << arg->local_name () << ".ptr ()"; - break; - } - return 0; -} - -int be_visitor_args_docall_cs::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument - // node - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - *os << "&" << arg->local_name () << ".ptr ()"; - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - { - // check if the size type is VARIABLE - if (node->size_type () == be_type::VARIABLE) - *os << arg->local_name () << ".ptr ()"; - else - *os << "&" << arg->local_name (); - } - break; - } - return 0; -} - -int be_visitor_args_docall_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 - - os->indent (); - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - { - // check if the size type is VARIABLE - if (node->size_type () == be_type::VARIABLE) - *os << arg->local_name () << ".ptr ()"; - else - *os << "&" << arg->local_name (); - } - break; - } - return 0; -} - -int be_visitor_args_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_docall_cs::" - "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/compiled_marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp index a1d43daebcd..438efbf0b0d 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/invoke_cs.cpp @@ -8,7 +8,7 @@ // TAO IDL // // = FILENAME -// compiled_marshal_cs.cpp +// invoke_cs.cpp // // = DESCRIPTION // Visitor generating the code that passes arguments to the CDR operators @@ -22,25 +22,25 @@ #include "be.h" #include "be_visitor_argument.h" -ACE_RCSID(be_visitor_argument, compiled_marshal_cs, "$Id$") +ACE_RCSID(be_visitor_argument, invoke_cs, "$Id$") // **************************************************************************** // visitor for arguments passing to the CDR operators. // **************************************************************************** -be_visitor_args_compiled_marshal_cs:: -be_visitor_args_compiled_marshal_cs (be_visitor_context *ctx) +be_visitor_args_invoke_cs:: +be_visitor_args_invoke_cs (be_visitor_context *ctx) : be_visitor_args (ctx) { } -be_visitor_args_compiled_marshal_cs:: -~be_visitor_args_compiled_marshal_cs (void) +be_visitor_args_invoke_cs:: +~be_visitor_args_invoke_cs (void) { } -int be_visitor_args_compiled_marshal_cs::visit_argument (be_argument *node) +int be_visitor_args_invoke_cs::visit_argument (be_argument *node) { this->ctx_->node (node); // save the argument node @@ -140,7 +140,7 @@ int be_visitor_args_compiled_marshal_cs::visit_argument (be_argument *node) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_array (be_array *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 @@ -195,7 +195,7 @@ int be_visitor_args_compiled_marshal_cs::visit_array (be_array *node) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_enum (be_enum *) +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 @@ -236,7 +236,7 @@ int be_visitor_args_compiled_marshal_cs::visit_enum (be_enum *) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_interface (be_interface *) +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 @@ -279,7 +279,7 @@ int be_visitor_args_compiled_marshal_cs::visit_interface (be_interface *) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_interface_fwd (be_interface_fwd *) +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 @@ -324,7 +324,7 @@ int be_visitor_args_compiled_marshal_cs::visit_interface_fwd (be_interface_fwd * #ifdef IDL_HAS_VALUETYPE -int be_visitor_args_compiled_marshal_cs::visit_valuetype (be_valuetype *) +int be_visitor_args_invoke_cs::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 @@ -368,7 +368,7 @@ int be_visitor_args_compiled_marshal_cs::visit_valuetype (be_valuetype *) } int -be_visitor_args_compiled_marshal_cs::visit_valuetype_fwd (be_valuetype_fwd *) +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 @@ -413,7 +413,7 @@ be_visitor_args_compiled_marshal_cs::visit_valuetype_fwd (be_valuetype_fwd *) #endif /* IDL_HAS_VALUETYPE */ -int be_visitor_args_compiled_marshal_cs::visit_predefined_type (be_predefined_type *node) +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 @@ -558,7 +558,7 @@ int be_visitor_args_compiled_marshal_cs::visit_predefined_type (be_predefined_ty return 0; } -int be_visitor_args_compiled_marshal_cs::visit_sequence (be_sequence *) +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 @@ -601,7 +601,7 @@ int be_visitor_args_compiled_marshal_cs::visit_sequence (be_sequence *) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_string (be_string *node) +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 @@ -684,7 +684,7 @@ int be_visitor_args_compiled_marshal_cs::visit_string (be_string *node) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_structure (be_structure *node) +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 @@ -730,7 +730,7 @@ int be_visitor_args_compiled_marshal_cs::visit_structure (be_structure *node) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_union (be_union *node) +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 @@ -777,7 +777,7 @@ int be_visitor_args_compiled_marshal_cs::visit_union (be_union *node) return 0; } -int be_visitor_args_compiled_marshal_cs::visit_typedef (be_typedef *node) +int be_visitor_args_invoke_cs::visit_typedef (be_typedef *node) { this->ctx_->alias (node); if (node->primitive_base_type ()->accept (this) == -1) 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 b7b28bc1b53..4e30a8430e2 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp @@ -31,12 +31,14 @@ ACE_RCSID(be_visitor_argument, marshal_ss, "$Id$") // routines // ************************************************************************ -be_visitor_args_marshal_ss::be_visitor_args_marshal_ss (be_visitor_context *ctx) +be_visitor_args_marshal_ss:: +be_visitor_args_marshal_ss (be_visitor_context *ctx) : be_visitor_args (ctx) { } -be_visitor_args_marshal_ss::~be_visitor_args_marshal_ss (void) +be_visitor_args_marshal_ss:: +~be_visitor_args_marshal_ss (void) { } @@ -44,12 +46,12 @@ int be_visitor_args_marshal_ss::visit_argument (be_argument *node) { this->ctx_->node (node); // save the argument node - // retrieve the type + // retrieve the type of the argument be_type *bt = be_type::narrow_from_decl (node->field_type ()); if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_marshal_ss::" + "be_visitor_args_compiled_marshal_ss::" "visit_argument - " "Bad argument type\n"), -1); @@ -58,41 +60,129 @@ int be_visitor_args_marshal_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 + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + os->indent (); + *os << "(_tao_in >> "; + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + os->indent (); + *os << "(_tao_out << "; + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_argument - " + "Bad substate\n"), + -1); + } + if (bt->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_marshal_ss::" + "be_visitor_args_compiled_marshal_ss::" "visit_argument - " "cannot accept visitor\n"), -1); } + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << ")"; + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << ")"; + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_argument - " + "Bad substate\n"), + -1); + } + return 0; } -int be_visitor_args_marshal_ss::visit_array (be_array *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 - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - if (node->size_type () == be_type::VARIABLE) + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) { - *os << arg->local_name () << ".inout ()"; + case AST_Argument::dir_IN: + *os << "_tao_forany_" << arg->local_name (); + break; + case AST_Argument::dir_INOUT: + *os << "_tao_forany_" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + break; } - else + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) { - *os << arg->local_name (); + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + *os << "_tao_forany_" << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << "_tao_forany_" << arg->local_name (); + break; } - break; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_array - " + "Bad substate\n"), + -1); } return 0; } @@ -102,14 +192,38 @@ 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 - switch (this->direction ()) + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name (); - break; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name (); + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_enum - " + "Bad substate\n"), + -1); } return 0; } @@ -119,14 +233,38 @@ 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 - switch (this->direction ()) + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name () << ".out ()"; + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name () << ".in ()"; + break; + } + } + else { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "&_tao_base_var_" << arg->local_name () << ".inout ()"; - break; + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_interface - " + "Bad substate\n"), + -1); } return 0; } @@ -136,155 +274,500 @@ 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 - switch (this->direction ()) + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - os->indent (); - *os << "&_tao_base_var_" << arg->local_name () << ".inout ()"; - break; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name () << ".out ()"; + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name () << ".in ()"; + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_interface_fwd - " + "Bad substate\n"), + -1); } return 0; } -int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) +#ifdef IDL_HAS_VALUETYPE + +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 - // check if the type is an any - if (node->pt () == AST_PredefinedType::PT_any) + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { switch (this->direction ()) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: - os->indent (); - *os << "&" << arg->local_name (); + *os << arg->local_name () << ".out ()"; break; case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name () << ".inout ()"; break; - } // end switch direction - } // end of if - else if (node->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { switch (this->direction ()) { case AST_Argument::dir_IN: + break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name () << ".inout ()"; + *os << arg->local_name () << ".in ()"; + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_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 + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name () << ".out ()"; + break; + case AST_Argument::dir_OUT: break; - } // end switch direction - } // end else if - else // simple predefined types + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { switch (this->direction ()) { case AST_Argument::dir_IN: + break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name (); + *os << arg->local_name () << ".in ()"; break; - } // end switch direction - } // end of else + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_valuetype_fwd - " + "Bad substate\n"), + -1); + } + return 0; +} + +#endif /* IDL_HAS_VALUETYPE */ + +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 + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + *os << arg->local_name () << ".out ()"; + break; + case AST_PredefinedType::PT_any: + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_ushort: + case AST_PredefinedType::PT_float: + case AST_PredefinedType::PT_double: + case AST_PredefinedType::PT_longdouble: + *os << arg->local_name (); + break; + case AST_PredefinedType::PT_char: + *os << "CORBA::Any::to_char (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_wchar: + *os << "CORBA::Any::to_wchar (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_boolean: + *os << "CORBA::Any::to_boolean (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_octet: + *os << "CORBA::Any::to_octet (" << arg->local_name () << ")"; + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_predefined_type - " + "Bad predefined type\n"), + -1); + } + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + *os << arg->local_name () << ".in ()"; + break; + case AST_PredefinedType::PT_any: + *os << arg->local_name (); + break; + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_ushort: + case AST_PredefinedType::PT_float: + case AST_PredefinedType::PT_double: + case AST_PredefinedType::PT_longdouble: + *os << arg->local_name (); + break; + case AST_PredefinedType::PT_char: + *os << "CORBA::Any::from_char (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_wchar: + *os << "CORBA::Any::from_wchar (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_boolean: + *os << "CORBA::Any::from_boolean (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_octet: + *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); + } + break; + case AST_Argument::dir_OUT: + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + *os << arg->local_name () << ".in ()"; + break; + case AST_PredefinedType::PT_any: + *os << arg->local_name () << ".in ()"; + break; + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_ushort: + case AST_PredefinedType::PT_float: + case AST_PredefinedType::PT_double: + case AST_PredefinedType::PT_longdouble: + *os << arg->local_name (); + break; + case AST_PredefinedType::PT_char: + *os << "CORBA::Any::from_char (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_wchar: + *os << "CORBA::Any::from_wchar (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_boolean: + *os << "CORBA::Any::from_boolean (" << arg->local_name () << ")"; + break; + case AST_PredefinedType::PT_octet: + *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); + } + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_array - " + "Bad substate\n"), + -1); + } return 0; } int be_visitor_args_marshal_ss::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument // node - switch (this->direction ()) + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + *os << arg->local_name () << ".in ()"; + break; + } + } + else { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name () << ".inout ()"; - break; + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_interface - " + "Bad substate\n"), + -1); } return 0; } -int be_visitor_args_marshal_ss::visit_string (be_string *) +int be_visitor_args_marshal_ss::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument // node - switch (this->direction ()) + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "&" << arg->local_name () << ".inout ()"; - break; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + // we need to make a distinction between bounded and unbounded strings + if (node->max_size ()->ev ()->u.ulval == 0) + { + *os << arg->local_name () << ".out ()"; + } + else + { + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string ("; + } + else + { + *os << "CORBA::Any::to_wstring ("; + } + + *os << arg->local_name () << ".out (), " + << node->max_size ()->ev ()->u.ulval - 1 + << ")"; + } + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + // we need to make a distinction between bounded and unbounded strings + if (node->max_size ()->ev ()->u.ulval == 0) + { + // unbounded + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + *os << arg->local_name () << ".in ()"; + break; + } + } + else + { + // bounded + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + case AST_Argument::dir_OUT: + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::from_string ((char *)"; + } + else + { + *os << "CORBA::Any::from_wstring ((CORBA::WChar *)"; + } + + *os << arg->local_name () << ".in (), " + << node->max_size ()->ev ()->u.ulval - 1 << ")"; + break; + } + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_string - " + "Bad substate\n"), + -1); } return 0; } int be_visitor_args_marshal_ss::visit_structure (be_structure *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - if (node->size_type () == be_type::VARIABLE) - *os << "&" << arg->local_name () << ".inout ()"; - else - *os << "&" << arg->local_name (); - break; + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + if (node->size_type () == be_decl::VARIABLE) + *os << arg->local_name () << ".in ()"; + else + *os << arg->local_name (); + break; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_structure - " + "Bad substate\n"), + -1); } return 0; } int be_visitor_args_marshal_ss::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // get the stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument // node - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "&" << arg->local_name (); - break; - case AST_Argument::dir_OUT: - os->indent (); - if (node->size_type () == be_type::VARIABLE) - *os << "&" << arg->local_name () << ".inout ()"; - else - *os << "&" << arg->local_name (); - break; + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + break; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + break; + case AST_Argument::dir_INOUT: + *os << arg->local_name (); + break; + case AST_Argument::dir_OUT: + if (node->size_type () == be_decl::VARIABLE) + *os << arg->local_name () << ".in ()"; + else + *os << arg->local_name (); + break; + } } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_compiled_marshal_ss::" + "visit_union - " + "Bad substate\n"), + -1); + } + return 0; } @@ -294,7 +777,7 @@ int be_visitor_args_marshal_ss::visit_typedef (be_typedef *node) if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_marshal_ss::" + "be_visitor_args_compiled_marshal_ss::" "visit_typedef - " "accept on primitive type failed\n"), -1); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp deleted file mode 100644 index c28d1ba24f7..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp +++ /dev/null @@ -1,176 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// post_docall_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for post-processing of arguments following a -// do_static_call -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, post_docall_cs, "$Id$") - - -// ************************************************************************* -// visitor for argument to do any post docall processing. Not all types need -// this. Only those that have an _out type need this. In addition, interfaces -// need it because we need to convert from the interface type to the base Object -// type and vice versa. -// ************************************************************************* - -be_visitor_args_post_docall_cs::be_visitor_args_post_docall_cs -(be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_post_docall_cs::~be_visitor_args_post_docall_cs (void) -{ -} - -int -be_visitor_args_post_docall_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, - "be_visitor_args_pre_docall_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // 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, - "be_visitor_args_pre_docall_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_args_post_docall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - case AST_Argument::dir_OUT: - { - os->indent (); - // assign the narrowed obj reference - *os << arg->local_name () << " = " << node->name () - << "::_narrow (_tao_base_" << arg->local_name () - << ", ACE_TRY_ENV);" << be_nl; - *os << "CORBA::release (_tao_base_" << arg->local_name () - << ");\n"; - } - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_post_docall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_INOUT: - { - os->indent (); - // assign the narrowed obj reference - *os << arg->local_name () << " = " << node->name () - << "::_narrow (_tao_base_" << arg->local_name () - << ", ACE_TRY_ENV);" << be_nl; - *os << "CORBA::release (_tao_base_" << arg->local_name () - << ");\n"; - } - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_post_docall_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 - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: - - if (node->width () == sizeof (char)) - { - *os << "CORBA::string_free (" << arg->local_name () - << ");" << be_nl; - } - else - { - *os << "CORBA::wstring_free (" << arg->local_name () - << ");" << be_nl; - } - - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int -be_visitor_args_post_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_post_docall_cs::" - "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/post_docall_compiled_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp index f9aba448cec..5971d5b5615 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_compiled_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_invoke_cs.cpp @@ -8,11 +8,11 @@ // TAO IDL // // = FILENAME -// post_docall_compiled_cs.cpp +// post_invoke_cs.cpp // // = DESCRIPTION -// Visitor generating code for post-processing of arguments following a -// do_static_call, when compiled marshaling (default) is enabled. +// Visitor generating code for post-processing of arguments following an +// invocation. // // = AUTHOR // Jeff Parsons @@ -23,26 +23,28 @@ #include "be.h" #include "be_visitor_argument.h" +ACE_RCSID(be_visitor_argument, post_invoke_cs, "$Id$") + // ************************************************************************* -// visitor for argument to do any post docall processing. Not all types need +// visitor for argument to do any post invocation processing. Not all types need // this. Only those that have an _out type need this. In addition, interfaces // need it because we need to convert from the interface type to the base Object // type and vice versa. // ************************************************************************* -be_visitor_args_post_docall_compiled_cs::be_visitor_args_post_docall_compiled_cs +be_visitor_args_post_invoke_cs::be_visitor_args_post_invoke_cs (be_visitor_context *ctx) : be_visitor_args (ctx) { } -be_visitor_args_post_docall_compiled_cs::~be_visitor_args_post_docall_compiled_cs (void) +be_visitor_args_post_invoke_cs::~be_visitor_args_post_invoke_cs (void) { } int -be_visitor_args_post_docall_compiled_cs::visit_argument (be_argument *node) +be_visitor_args_post_invoke_cs::visit_argument (be_argument *node) { this->ctx_->node (node); // save the argument node @@ -73,7 +75,7 @@ be_visitor_args_post_docall_compiled_cs::visit_argument (be_argument *node) } int -be_visitor_args_post_docall_compiled_cs::visit_interface (be_interface *) +be_visitor_args_post_invoke_cs::visit_interface (be_interface *) { // we must narrow the out object reference to the appropriate type TAO_OutStream *os = this->ctx_->stream (); // get output stream @@ -97,7 +99,7 @@ be_visitor_args_post_docall_compiled_cs::visit_interface (be_interface *) } int -be_visitor_args_post_docall_compiled_cs::visit_interface_fwd (be_interface_fwd *) +be_visitor_args_post_invoke_cs::visit_interface_fwd (be_interface_fwd *) { // we must narrow the out object reference to the appropriate type TAO_OutStream *os = this->ctx_->stream (); // get output stream @@ -123,7 +125,7 @@ be_visitor_args_post_docall_compiled_cs::visit_interface_fwd (be_interface_fwd * #ifdef IDL_HAS_VALUETYPE int -be_visitor_args_post_docall_compiled_cs::visit_valuetype (be_valuetype *) +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 @@ -146,7 +148,7 @@ be_visitor_args_post_docall_compiled_cs::visit_valuetype (be_valuetype *) } int -be_visitor_args_post_docall_compiled_cs::visit_valuetype_fwd (be_valuetype_fwd *) +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 @@ -171,7 +173,7 @@ be_visitor_args_post_docall_compiled_cs::visit_valuetype_fwd (be_valuetype_fwd * #endif /* IDL_HAS_VALUETYPE */ int -be_visitor_args_post_docall_compiled_cs::visit_string (be_string *node) +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 @@ -202,7 +204,7 @@ be_visitor_args_post_docall_compiled_cs::visit_string (be_string *node) } int -be_visitor_args_post_docall_compiled_cs::visit_typedef (be_typedef *node) +be_visitor_args_post_invoke_cs::visit_typedef (be_typedef *node) { this->ctx_->alias (node); if (node->primitive_base_type ()->accept (this) == -1) 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 caa7a684efa..06cfa4d0cce 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 @@ -25,254 +25,26 @@ 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 (ctx) -{ -} - -be_visitor_args_post_upcall_ss::~be_visitor_args_post_upcall_ss (void) -{ -} - -int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) -{ - this->ctx_->node (node); // save the 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_args_post_upcall_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // 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, - "be_visitor_args_post_upcall_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_post_upcall_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_upcall_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_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 - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: // inout - case AST_Argument::dir_OUT: - os->indent (); - *os << "_tao_base_var_" << arg->local_name () - << " = CORBA::Object::_duplicate (" - << arg->local_name () << ".in ());\n"; - break; - } - return 0; -} - -int be_visitor_args_post_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 - switch (this->direction ()) - { - case AST_Argument::dir_IN: - break; - case AST_Argument::dir_INOUT: // inout - case AST_Argument::dir_OUT: - os->indent (); - *os << "_tao_base_var_" << arg->local_name () - << " = CORBA::Object::_duplicate (" - << arg->local_name () << ".in ());\n"; - break; - } - return 0; -} - -int be_visitor_args_post_upcall_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_upcall_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_upcall_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_upcall_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_upcall_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_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_args_post_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -// **************************************************************** - -// ************************************************************************ -// visitor for doing any post-processing after the upcall is made -// ************************************************************************ - -be_visitor_compiled_args_post_upcall::be_visitor_compiled_args_post_upcall (be_visitor_context *ctx) : be_visitor_scope (ctx) { } -be_visitor_compiled_args_post_upcall::~be_visitor_compiled_args_post_upcall (void) +be_visitor_args_post_upcall_ss::~be_visitor_args_post_upcall_ss (void) { } int -be_visitor_compiled_args_post_upcall::visit_operation (be_operation *node) +be_visitor_args_post_upcall_ss::visit_operation (be_operation *node) { return this->visit_scope (node); } -int be_visitor_compiled_args_post_upcall::visit_argument (be_argument *node) +int be_visitor_args_post_upcall_ss::visit_argument (be_argument *node) { this->ctx_->node (node); // save the argument node @@ -302,7 +74,7 @@ int be_visitor_compiled_args_post_upcall::visit_argument (be_argument *node) return 0; } -int be_visitor_compiled_args_post_upcall::visit_array (be_array *node) +int be_visitor_args_post_upcall_ss::visit_array (be_array *node) { TAO_OutStream *os = this->ctx_->stream (); be_argument *arg = this->ctx_->be_node_as_argument (); @@ -338,7 +110,7 @@ int be_visitor_compiled_args_post_upcall::visit_array (be_array *node) return 0; } -int be_visitor_compiled_args_post_upcall::visit_typedef (be_typedef *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) diff --git a/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp deleted file mode 100644 index 074e57cf3ed..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/pre_docall_cs.cpp +++ /dev/null @@ -1,362 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// pre_docall_cs.cpp -// -// = DESCRIPTION -// Visitor that generates code (if any) for pre-processing prior to call to -// do_static_call in the client stub -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, pre_docall_cs, "$Id$") - - -// ************************************************************************* -// visitor for argument to do any pre docall processing. Not all types need -// this. Only those that have an _out type need this. In addition, interfaces -// need it because we ned to convert from the interface type to the base Object -// type and vice versa. -// ************************************************************************* - -be_visitor_args_pre_docall_cs::be_visitor_args_pre_docall_cs -(be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_pre_docall_cs::~be_visitor_args_pre_docall_cs (void) -{ -} - -int -be_visitor_args_pre_docall_cs::void_return_type (void) -{ - // is the operation return type void? - be_argument *arg = this->ctx_->be_node_as_argument (); - ACE_ASSERT (arg != 0); - be_operation *op = be_operation::narrow_from_scope (arg->defined_in ()); - ACE_ASSERT (arg != 0); - - be_type *bt = be_type::narrow_from_decl (op->return_type ()); - if (bt->node_type () == AST_Decl::NT_pre_defined - && (be_predefined_type::narrow_from_decl (bt)->pt () - == AST_PredefinedType::PT_void)) - return 1; - else - return 0; -} - -int be_visitor_args_pre_docall_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, - "be_visitor_args_pre_docall_cs::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // 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, - "be_visitor_args_pre_docall_cs::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int -be_visitor_args_pre_docall_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 - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - if (node->size_type () == be_decl::VARIABLE) - { - os->indent (); - if (!this->void_return_type ()) - { - *os << "ACE_ALLOCATOR_RETURN (" << arg->local_name () - << ".ptr (), " << bt->name () << "_alloc (), _tao_retval);\n"; - } - else - { - *os << "ACE_ALLOCATOR (" << arg->local_name () - << ".ptr (), " << bt->name () << "_alloc ());\n"; - } - } - break; - default: - break; - } - return 0; - -} - -int -be_visitor_args_pre_docall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () - << " = " << arg->local_name () << ";\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_pre_docall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: - os->indent (); - *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () - << " = " << arg->local_name () << ";\n"; - break; - case AST_Argument::dir_OUT: - os->indent (); - *os << "CORBA::Object_ptr _tao_base_" << arg->local_name () << ";\n"; - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_pre_docall_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - // get the argument node - be_argument *arg = this->ctx_->be_node_as_argument (); - - - // pre do_static_call processing is valid only for pseudo objects and for Any - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - { - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - break; - default: - break; - } - } - break; - case AST_PredefinedType::PT_any: - { - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - os->indent (); - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (" << arg->local_name () - << ".ptr (), CORBA::Any, _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (" << arg->local_name () - << ".ptr (), CORBA::Any);\n"; - } - break; - default: - break; - } - } - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_pre_docall_cs::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 - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - // caller must have allocated the pointer - os->indent (); - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (" << arg->local_name () - << ".ptr (), " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (" << arg->local_name () - << ".ptr (), " << bt->name () << ");\n"; - } - break; - default: - break; - } - return 0; -} - -int -be_visitor_args_pre_docall_cs::visit_string (be_string *) -{ - return 0; -} - -int -be_visitor_args_pre_docall_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 - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (node->size_type () == be_type::VARIABLE) - { - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - // caller must have allocated the pointer - os->indent (); - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (" << arg->local_name () - << ".ptr (), " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (" << arg->local_name () - << ".ptr (), " << bt->name () << ");\n"; - } - break; - default: - break; - } - } - return 0; -} - -int -be_visitor_args_pre_docall_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 - // if the current type is an alias, use that - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - bt = node; - - if (node->size_type () == be_type::VARIABLE) - { - switch (this->direction ()) - { - case AST_Argument::dir_OUT: - os->indent (); - if (!this->void_return_type ()) - { - *os << "ACE_NEW_RETURN (" << arg->local_name () - << ".ptr (), " << bt->name () << ", _tao_retval);\n"; - } - else - { - *os << "ACE_NEW (" << arg->local_name () - << ".ptr (), " << bt->name () << ");\n"; - } - break; - default: - break; - } - } - return 0; -} - -int -be_visitor_args_pre_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_args_pre_docall_cs::" - "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 ed862708579..f98bccba939 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 @@ -35,7 +35,7 @@ ACE_RCSID(be_visitor_argument, pre_invoke_cs, "$Id$") be_visitor_args_pre_invoke_cs::be_visitor_args_pre_invoke_cs (be_visitor_context *ctx) - : be_visitor_args_pre_docall_cs (ctx) + : be_visitor_args (ctx) { } @@ -44,9 +44,94 @@ be_visitor_args_pre_invoke_cs::~be_visitor_args_pre_invoke_cs (void) } int +be_visitor_args_pre_invoke_cs::void_return_type (void) +{ + // is the operation return type void? + be_argument *arg = this->ctx_->be_node_as_argument (); + ACE_ASSERT (arg != 0); + be_operation *op = be_operation::narrow_from_scope (arg->defined_in ()); + ACE_ASSERT (arg != 0); + + be_type *bt = be_type::narrow_from_decl (op->return_type ()); + if (bt->node_type () == AST_Decl::NT_pre_defined + && (be_predefined_type::narrow_from_decl (bt)->pt () + == AST_PredefinedType::PT_void)) + return 1; + else + return 0; +} + +int be_visitor_args_pre_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, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // 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, + "be_visitor_args_pre_docall_cs::" + "visit_argument - " + "cannot accept visitor\n"), + -1); + } + + return 0; +} + +int +be_visitor_args_pre_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 + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + if (node->size_type () == be_decl::VARIABLE) + { + os->indent (); + if (!this->void_return_type ()) + { + *os << "ACE_ALLOCATOR_RETURN (" << arg->local_name () + << ".ptr (), " << bt->name () << "_alloc (), _tao_retval);\n"; + } + else + { + *os << "ACE_ALLOCATOR (" << arg->local_name () + << ".ptr (), " << bt->name () << "_alloc ());\n"; + } + } + break; + default: + break; + } + return 0; + +} + +int be_visitor_args_pre_invoke_cs::visit_interface (be_interface *) { - // overriding action return 0; } @@ -56,3 +141,184 @@ be_visitor_args_pre_invoke_cs::visit_interface_fwd (be_interface_fwd *) return 0; } +int +be_visitor_args_pre_invoke_cs::visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + // get the argument node + be_argument *arg = this->ctx_->be_node_as_argument (); + + + // pre do_static_call processing is valid only for pseudo objects and for Any + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + break; + default: + break; + } + } + break; + case AST_PredefinedType::PT_any: + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (" << arg->local_name () + << ".ptr (), CORBA::Any, _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (" << arg->local_name () + << ".ptr (), CORBA::Any);\n"; + } + break; + default: + break; + } + } + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_invoke_cs::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 + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + // caller must have allocated the pointer + os->indent (); + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (" << arg->local_name () + << ".ptr (), " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (" << arg->local_name () + << ".ptr (), " << bt->name () << ");\n"; + } + break; + default: + break; + } + return 0; +} + +int +be_visitor_args_pre_invoke_cs::visit_string (be_string *) +{ + return 0; +} + +int +be_visitor_args_pre_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 + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (node->size_type () == be_type::VARIABLE) + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + // caller must have allocated the pointer + os->indent (); + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (" << arg->local_name () + << ".ptr (), " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (" << arg->local_name () + << ".ptr (), " << bt->name () << ");\n"; + } + break; + default: + break; + } + } + return 0; +} + +int +be_visitor_args_pre_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 + // if the current type is an alias, use that + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + bt = node; + + if (node->size_type () == be_type::VARIABLE) + { + switch (this->direction ()) + { + case AST_Argument::dir_OUT: + os->indent (); + if (!this->void_return_type ()) + { + *os << "ACE_NEW_RETURN (" << arg->local_name () + << ".ptr (), " << bt->name () << ", _tao_retval);\n"; + } + else + { + *os << "ACE_NEW (" << arg->local_name () + << ".ptr (), " << bt->name () << ");\n"; + } + break; + default: + break; + } + } + return 0; +} + +int +be_visitor_args_pre_invoke_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_args_pre_docall_cs::" + "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_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/pre_upcall_ss.cpp deleted file mode 100644 index 9ab4133b028..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_argument/pre_upcall_ss.cpp +++ /dev/null @@ -1,200 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// pre_upcall_ss.cpp -// -// = DESCRIPTION -// Visitor that generates any pre-processing of arguments prior to making -// the upcall (in the skeleton). -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_argument.h" - -ACE_RCSID(be_visitor_argument, pre_upcall_ss, "$Id$") - - -// ************************************************************************ -// visitor for passing arguments to the upcall -// ************************************************************************ - -be_visitor_args_pre_upcall_ss::be_visitor_args_pre_upcall_ss (be_visitor_context *ctx) - : be_visitor_args (ctx) -{ -} - -be_visitor_args_pre_upcall_ss::~be_visitor_args_pre_upcall_ss (void) -{ -} - -int be_visitor_args_pre_upcall_ss::visit_argument (be_argument *node) -{ - this->ctx_->node (node); // save the 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_args_pre_upcall_ss::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // 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, - "be_visitor_args_pre_upcall_ss::" - "visit_argument - " - "cannot accept visitor\n"), - -1); - } - - return 0; -} - -int be_visitor_args_pre_upcall_ss::visit_array (be_array *) -{ - return 0; -} - -int be_visitor_args_pre_upcall_ss::visit_enum (be_enum *) -{ - return 0; -} - -int be_visitor_args_pre_upcall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - os->indent (); - *os << arg->local_name () << " = " << node->name () - << "::_narrow (_tao_base_var_" << arg->local_name () - << ".in (), ACE_TRY_ENV);\n"; - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_pre_upcall_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 - - switch (this->direction ()) - { - case AST_Argument::dir_IN: - case AST_Argument::dir_INOUT: // inout - os->indent (); - *os << arg->local_name () << " = " << node->name () - << "::_narrow (_tao_base_var_" << arg->local_name () - << ".in (), ACE_TRY_ENv);\n"; - break; - case AST_Argument::dir_OUT: - break; - } - return 0; -} - -int be_visitor_args_pre_upcall_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_pre_upcall_ss::visit_sequence (be_sequence *) -{ - return 0; -} - -int be_visitor_args_pre_upcall_ss::visit_string (be_string *) -{ - return 0; -} - -int be_visitor_args_pre_upcall_ss::visit_structure (be_structure *) -{ - return 0; -} - -int be_visitor_args_pre_upcall_ss::visit_union (be_union *) -{ - return 0; -} - -int be_visitor_args_pre_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_args_pre_upcall_ss::" - "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/vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp index 134190870d9..1759a21f25b 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp @@ -151,15 +151,11 @@ int be_visitor_args_vardecl_ss::visit_interface (be_interface *node) case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";\n"; + *os << bt->name () << "_var " << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); *os << bt->name () << "_var " - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () << ";\n"; break; } @@ -183,15 +179,11 @@ int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node) case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";\n"; + *os << bt->name () << "_var " << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); *os << bt->name () << "_var " - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () << ";\n"; break; } @@ -201,14 +193,60 @@ int be_visitor_args_vardecl_ss::visit_interface_fwd (be_interface_fwd *node) #ifdef IDL_HAS_VALUETYPE -int be_visitor_args_vardecl_ss::visit_valuetype (be_valuetype *) +int be_visitor_args_vardecl_ss::visit_valuetype (be_valuetype *node) { - return -1; + 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 + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + 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 *) +int be_visitor_args_vardecl_ss::visit_valuetype_fwd (be_valuetype_fwd *node) { - return -1; + 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 + be_type *bt; + if (this->ctx_->alias ()) + bt = this->ctx_->alias (); + else + 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; } #endif /* IDL_HAS_VALUETYPE */ @@ -426,136 +464,3 @@ int be_visitor_args_vardecl_ss::visit_typedef (be_typedef *node) } -// ************************************************************************ -// Visitor to generate code for argument variable declaration for compiled -// marshaling. This provides only the overriden methods. The rest is handled by -// the base class that works for interpretiveskeletons. -// ************************************************************************ - -be_compiled_visitor_args_vardecl_ss:: -be_compiled_visitor_args_vardecl_ss (be_visitor_context *ctx) - : be_visitor_args_vardecl_ss (ctx) -{ -} - -be_compiled_visitor_args_vardecl_ss::~be_compiled_visitor_args_vardecl_ss (void) -{ -} - -int be_compiled_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 - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - 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_compiled_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 - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - 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; -} - - -#ifdef IDL_HAS_VALUETYPE - -int be_compiled_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 - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - 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_compiled_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 - be_type *bt; - if (this->ctx_->alias ()) - bt = this->ctx_->alias (); - else - 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; -} - -#endif /* IDL_HAS_VALUETYPE */ diff --git a/TAO/TAO_IDL/be/be_visitor_factory.cpp b/TAO/TAO_IDL/be/be_visitor_factory.cpp index 6e7c23a823b..f4f627ca848 100644 --- a/TAO/TAO_IDL/be/be_visitor_factory.cpp +++ b/TAO/TAO_IDL/be/be_visitor_factory.cpp @@ -115,13 +115,7 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_ROOT_CDR_OP_CH: case TAO_CodeGen::TAO_ROOT_CDR_OP_CI: case TAO_CodeGen::TAO_ROOT_CDR_OP_CS: - // this is the starting point for generation of all CDR operators. If we - // do not use compiled marshaling, we do not need these operators - if (idl_global->compiled_marshaling ()) - return new be_visitor_root_cdr_op (new_ctx); - else - // return a NO_OP visitor - return new be_visitor_decl (new_ctx); + return new be_visitor_root_cdr_op (new_ctx); case TAO_CodeGen::TAO_MODULE_CH: return new be_visitor_module_ch (new_ctx); @@ -239,9 +233,6 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS: case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OBV_CH: - //case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: - //case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: - //case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OTHERS: return new be_visitor_obv_operation_arglist (new_ctx); case TAO_CodeGen::TAO_MODULE_OBV_CH: @@ -479,151 +470,6 @@ TAO_Common_Visitor_Factory::make_visitor (be_visitor_context *ctx) return 0; } -// The concrete visitor factory for operation visitors generating interpretive -// stubs and skeletons - -TAO_Interpretive_Visitor_Factory::TAO_Interpretive_Visitor_Factory (void) -{ -} - -// destructor -TAO_Interpretive_Visitor_Factory::~TAO_Interpretive_Visitor_Factory (void) -{ -} - -be_visitor * -TAO_Interpretive_Visitor_Factory::make_visitor (be_visitor_context *ctx) -{ - TAO_CodeGen::CG_STATE st = ctx->state (); - // create a new context so that ownership issues are not confused. This newly - // created context is a copy of what was sent by the caller. The newly - // created visitor will own this new copy. - be_visitor_context *new_ctx = new be_visitor_context (*ctx); - - switch (st) - { - case TAO_CodeGen::TAO_UNION_ANY_OP_CS: - return new be_visitor_union_any_op_interpretive_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_CH: - return new be_visitor_operation_ch (new_ctx); - case TAO_CodeGen::TAO_OPERATION_CS: - return new be_interpretive_visitor_operation_cs (new_ctx); - case TAO_CodeGen::TAO_OPERATION_SH: - return new be_visitor_operation_sh (new_ctx); - case TAO_CodeGen::TAO_OPERATION_IH: - return new be_visitor_operation_ih (new_ctx); - case TAO_CodeGen::TAO_OPERATION_SS: - return new be_interpretive_visitor_operation_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_IS: - return new be_visitor_operation_is (new_ctx); - case TAO_CodeGen::TAO_OPERATION_THRU_POA_COLLOCATED_SH: - return new be_visitor_operation_thru_poa_collocated_sh (new_ctx); - case TAO_CodeGen::TAO_OPERATION_THRU_POA_COLLOCATED_SS: - return new be_visitor_operation_thru_poa_collocated_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_DIRECT_COLLOCATED_SH: - return new be_visitor_operation_direct_collocated_sh (new_ctx); - case TAO_CodeGen::TAO_OPERATION_DIRECT_COLLOCATED_SS: - return new be_visitor_operation_direct_collocated_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CH: - return new be_visitor_operation_smart_proxy_ch (new_ctx); - case TAO_CodeGen::TAO_OPERATION_SMART_PROXY_CS: - return new be_visitor_operation_smart_proxy_cs (new_ctx); - case TAO_CodeGen::TAO_OPERATION_RETTYPE_CH: - case TAO_CodeGen::TAO_OPERATION_RETTYPE_OTHERS: - return new be_visitor_operation_rettype (new_ctx); - case TAO_CodeGen::TAO_OPERATION_RETTYPE_IS: - return new be_visitor_operation_rettype_is (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_CS: - return new be_visitor_operation_rettype_vardecl_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_PRE_INVOKE_CS: - return new be_visitor_operation_rettype_pre_docall_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS: - return new be_visitor_operation_rettype_docall_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS: - return new be_visitor_operation_rettype_post_docall_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS: - return new be_visitor_operation_rettype_return_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS: - return new be_visitor_operation_exceptlist_cs (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS: - return new be_visitor_operation_rettype_vardecl_ss (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS: - case TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS: - return new be_visitor_operation_rettype_marshal_ss (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS: - return new be_visitor_operation_rettype_assign_ss (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS: - return new be_visitor_operation_rettype_post_upcall_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: - case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: - case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: - case TAO_CodeGen::TAO_OPERATION_ARGLIST_IS: - case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: - case TAO_CodeGen::TAO_OPERATION_ARGLIST_OTHERS: - return new be_visitor_operation_arglist (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS: - case TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS: - case TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS: - case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: - return new be_visitor_operation_argument (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_TIE_SH: - return new be_visitor_operation_tie_sh (new_ctx); - case TAO_CodeGen::TAO_OPERATION_TIE_SI: - return new be_visitor_operation_tie_si (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_CH: - case TAO_CodeGen::TAO_ARGUMENT_ARGLIST_OTHERS: - return new be_visitor_args_arglist (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_PRE_INVOKE_CS: - return new be_visitor_args_pre_docall_cs (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_INVOKE_CS: - return new be_visitor_args_docall_cs (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_POST_INVOKE_CS: - return new be_visitor_args_post_docall_cs (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS: - return new be_visitor_args_vardecl_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS: - return new be_visitor_args_pre_upcall_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS: - case TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS: - return new be_visitor_args_upcall_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS: - return new be_visitor_args_post_upcall_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS: - case TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS: - return new be_visitor_args_marshal_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_SS: - return new be_visitor_args_post_marshal_ss (new_ctx); - default: - // cannot handle it; delegate it to the common visitor factory - delete new_ctx; - return TAO_COMMON_VISITOR_FACTORY::instance ()->make_visitor (ctx); - } -} - // The concrete visitor factory for operation visitors generating compiled // stubs and skeletons @@ -648,19 +494,18 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) switch (st) { case TAO_CodeGen::TAO_UNION_ANY_OP_CS: - return new be_visitor_union_any_op_compiled_cs (new_ctx); - + return new be_visitor_union_any_op_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_CH: return new be_visitor_operation_ch (new_ctx); case TAO_CodeGen::TAO_OPERATION_CS: - return new be_compiled_visitor_operation_cs (new_ctx); + return new be_visitor_operation_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_SH: return new be_visitor_operation_sh (new_ctx); case TAO_CodeGen::TAO_OPERATION_SS: - return new be_compiled_visitor_operation_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_IS: + return new be_visitor_operation_ss (new_ctx); + case TAO_CodeGen::TAO_OPERATION_IS: return new be_visitor_operation_is (new_ctx); - case TAO_CodeGen::TAO_OPERATION_IH: + case TAO_CodeGen::TAO_OPERATION_IH: return new be_visitor_operation_ih (new_ctx); case TAO_CodeGen::TAO_OPERATION_THRU_POA_COLLOCATED_SH: return new be_visitor_operation_thru_poa_collocated_sh (new_ctx); @@ -686,11 +531,7 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_operation_rettype_pre_invoke_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS: - return new be_visitor_operation_rettype_compiled_marshal (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); + return new be_visitor_operation_rettype_marshal_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_RETURN_CS: return new be_visitor_operation_rettype_return_cs (new_ctx); @@ -699,22 +540,14 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_operation_exceptlist_cs (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_DECL_SS: - return new be_compiled_visitor_operation_rettype_vardecl_ss (new_ctx); - - case TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); + return new be_visitor_operation_rettype_vardecl_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS: - return new be_visitor_operation_rettype_compiled_marshal (new_ctx); + return new be_visitor_operation_rettype_marshal_ss (new_ctx); case TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS: return new be_visitor_operation_rettype_assign_ss (new_ctx); - case TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); - case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: case TAO_CodeGen::TAO_OPERATION_ARGLIST_IH: @@ -725,12 +558,10 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) case TAO_CodeGen::TAO_OPERATION_ARG_PRE_INVOKE_CS: case TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS: - case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: case TAO_CodeGen::TAO_OPERATION_ARG_DECL_SS: - case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: return new be_visitor_operation_argument (new_ctx); case TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS: @@ -754,33 +585,21 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) return new be_visitor_args_pre_invoke_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_INVOKE_CS: - return new be_visitor_args_compiled_marshal_cs (new_ctx); + return new be_visitor_args_invoke_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_POST_INVOKE_CS: - return new be_visitor_args_post_docall_compiled_cs (new_ctx); + return new be_visitor_args_post_invoke_cs (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS: - return new be_compiled_visitor_args_vardecl_ss (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); + return new be_visitor_args_vardecl_ss (new_ctx); case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS: case TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS: return new be_visitor_args_upcall_ss (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); - case TAO_CodeGen::TAO_ARGUMENT_DEMARSHAL_SS: case TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS: - return new be_visitor_args_compiled_marshal_ss (new_ctx); - - case TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_SS: - // this is a NO-OP - return new be_visitor_decl (new_ctx); + return new be_visitor_args_marshal_ss (new_ctx); // AMI next generation visitors. case TAO_CodeGen::TAO_AMI_INTERFACE_CH: @@ -816,10 +635,8 @@ TAO_Compiled_Visitor_Factory::make_visitor (be_visitor_context *ctx) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Singleton<TAO_Interpretive_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; template class ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Singleton<TAO_Interpretive_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> #pragma instantiate ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/TAO_IDL/be/be_visitor_operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation.cpp index b388271bb7b..068a95af267 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation.cpp @@ -44,17 +44,14 @@ #include "be_visitor_operation/rettype.cpp" #include "be_visitor_operation/rettype_is.cpp" #include "be_visitor_operation/rettype_assign_ss.cpp" -#include "be_visitor_operation/rettype_docall_cs.cpp" #include "be_visitor_operation/rettype_marshal_ss.cpp" -#include "be_visitor_operation/rettype_post_docall_cs.cpp" +#include "be_visitor_operation/rettype_post_invoke_cs.cpp" #include "be_visitor_operation/rettype_post_upcall_ss.cpp" -#include "be_visitor_operation/rettype_pre_docall_cs.cpp" #include "be_visitor_operation/rettype_return_cs.cpp" #include "be_visitor_operation/rettype_vardecl_cs.cpp" #include "be_visitor_operation/rettype_vardecl_ss.cpp" #include "be_visitor_operation/tie_sh.cpp" #include "be_visitor_operation/tie_si.cpp" -#include "be_visitor_operation/compiled_marshal.cpp" #include "be_visitor_operation/rettype_pre_invoke_cs.cpp" #include "be_visitor_operation/ami_ch.cpp" #include "be_visitor_operation/ami_cs.cpp" diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp index 53139d5f7c0..cbaa17ba9a5 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp @@ -169,21 +169,21 @@ be_visitor_operation_argument::visit_argument (be_argument *node) case TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS: ctx.state (TAO_CodeGen::TAO_ARGUMENT_MARSHAL_SS); break; - case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS); - break; +// case TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS: +// ctx.state (TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS); +// break; case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: ctx.state (TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_UPCALL_SS); break; case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: ctx.state (TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS); break; - case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS); - break; - case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: - ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_SS); - break; +// case TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS: +// ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS); +// break; +// case TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS: +// ctx.state (TAO_CodeGen::TAO_ARGUMENT_POST_MARSHAL_SS); +// break; default: { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp deleted file mode 100644 index 0a27984e205..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp +++ /dev/null @@ -1,509 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// compiled_marshal.cpp -// -// = DESCRIPTION -// Visitor generating the code that passes retval to the CDR operators. The -// "OUTPUT" substate deals with the server side skeletons whereas the -// "INPUT" substate deals with the client stubs. Also notice that the type -// of parameter passed to the operator depends on the manner in which the -// variable is declared i.e., in the skeleton, we may have _var types but -// not in the stubs. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "be.h" -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, compiled_marshal, "$Id$") - - -// **************************************************************************** -// visitor for arguments passing to the CDR operators. -// **************************************************************************** - -be_visitor_operation_rettype_compiled_marshal:: -be_visitor_operation_rettype_compiled_marshal (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_rettype_compiled_marshal:: -~be_visitor_operation_rettype_compiled_marshal (void) -{ -} - -int be_visitor_operation_rettype_compiled_marshal:: -visit_operation (be_operation *node) -{ - this->ctx_->node (node); // save the argument node - - // retrieve the type of the argument - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_argument - " - "Bad argument type\n"), - -1); - } - - // Different types have different mappings when used as in/out or - // inout parameters. Let this visitor deal with the type - - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - os->indent (); - *os << "(_tao_out << "; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - os->indent (); - *os << "(_tao_in >> "; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_operation - " - "Bad substate\n"), - -1); - } - - if (bt->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_operation - " - "cannot accept visitor\n"), - -1); - } - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << ")"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << ")"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_operation - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_array (be_array *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval_forany"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_retval_forany"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_array - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_retval"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_enum - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval.in ()"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_safe_retval.inout ()"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval.in ()"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_safe_retval.inout ()"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_interface - " - "Bad substate\n"), - -1); - } - return 0; -} - -#ifdef IDL_HAS_VALUETYPE - -int be_visitor_operation_rettype_compiled_marshal::visit_valuetype (be_valuetype *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval.in ()"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_safe_retval.inout ()"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_valuetype - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_valuetype_fwd (be_valuetype_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval.in ()"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_safe_retval.inout ()"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_valuetype - " - "Bad substate\n"), - -1); - } - return 0; -} - -#endif /* IDL_HAS_VALUETYPE */ - -int be_visitor_operation_rettype_compiled_marshal::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << "_tao_retval.in ()"; - break; - case AST_PredefinedType::PT_any: - *os << "_tao_retval.in ()"; - break; - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << "_tao_retval"; - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::from_char (_tao_retval)"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::from_wchar (_tao_retval)"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::from_boolean (_tao_retval)"; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::from_octet (_tao_retval)"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - switch (node->pt ()) - { - case AST_PredefinedType::PT_pseudo: - *os << "_tao_safe_retval.inout ()"; - break; - case AST_PredefinedType::PT_any: - *os << "_tao_safe_retval.inout ()"; - break; - case AST_PredefinedType::PT_long: - case AST_PredefinedType::PT_ulong: - case AST_PredefinedType::PT_longlong: - case AST_PredefinedType::PT_ulonglong: - case AST_PredefinedType::PT_short: - case AST_PredefinedType::PT_ushort: - case AST_PredefinedType::PT_float: - case AST_PredefinedType::PT_double: - case AST_PredefinedType::PT_longdouble: - *os << "_tao_retval"; - break; - case AST_PredefinedType::PT_char: - *os << "CORBA::Any::to_char (_tao_retval)"; - break; - case AST_PredefinedType::PT_wchar: - *os << "CORBA::Any::to_wchar (_tao_retval)"; - break; - case AST_PredefinedType::PT_boolean: - *os << "CORBA::Any::to_boolean (_tao_retval)"; - break; - case AST_PredefinedType::PT_octet: - *os << "CORBA::Any::to_octet (_tao_retval)"; - break; - default: - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_predefined_type - " - "Bad predefined type\n"), - -1); - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_predefined_type - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - *os << "_tao_retval.in ()"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - *os << "_tao_safe_retval.inout ()"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_sequence - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_string (be_string *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - // differentiate between bounded and unbounded - if (node->max_size ()->ev ()->u.ulval == 0) - { - *os << "_tao_retval.in ()"; - } - else - { - if (node->width () == sizeof (char)) - { - *os << "CORBA::Any::from_string ((char *)_tao_retval.in (), "; - } - else - { - *os << "CORBA::Any::from_wstring ((CORBA::WChar *)_tao_retval.in (), "; - } - - *os << node->max_size ()->ev ()->u.ulval - 1 << ")"; - } - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - // differentiate between bounded and unbounded - if (node->max_size ()->ev ()->u.ulval == 0) - { - // unbounded - *os << "_tao_safe_retval.inout ()"; - } - else - { - if (node->width () == sizeof (char)) - { - *os << "CORBA::Any::to_string (_tao_safe_retval.inout (), "; - } - else - { - *os << "CORBA::Any::to_wstring (_tao_safe_retval.inout (), "; - } - - *os << node->max_size ()->ev ()->u.ulval - 1 << ")"; - } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_string - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - if (node->size_type () == be_decl::VARIABLE) - *os << "_tao_retval.in ()"; - else - *os << "_tao_retval"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - if (node->size_type () == be_decl::VARIABLE) - *os << "_tao_safe_retval.inout ()"; - else - *os << "_tao_retval"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_structure - " - "Bad substate\n"), - -1); - } - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // get output stream - - if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) - { - if (node->size_type () == be_decl::VARIABLE) - *os << "_tao_retval.in ()"; - else - *os << "_tao_retval"; - } - else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) - { - if (node->size_type () == be_decl::VARIABLE) - *os << "_tao_safe_retval.inout ()"; - else - *os << "_tao_retval"; - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_union - " - "Bad substate\n"), - -1); - } - - return 0; -} - -int be_visitor_operation_rettype_compiled_marshal::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_compiled_marshal::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp index 1fc5ca97e3d..3856ab6b9fc 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_cs.cpp @@ -136,7 +136,7 @@ be_visitor_operation_cs::visit_operation (be_operation *node) // Generate any "pre" stub information such as tables or declarations // This is a template method and the actual work will be done by the // derived class - if (this->gen_pre_stub_info (node, bt) == -1) + if (this->gen_pre_stub_info (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_operation_cs::" @@ -294,412 +294,7 @@ be_visitor_operation_cs::visit_argument (be_argument *node) } int -be_visitor_operation_cs::gen_raise_exception (be_type *bt, - const char *excep, - const char *completion_status) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (this->void_return_type (bt)) - { - *os << "ACE_THROW (" - << excep << " (" << completion_status << "));\n"; - } - else - { - if (bt->size_type () == be_decl::VARIABLE - || bt->base_node_type () == AST_Decl::NT_array) - { - *os << "ACE_THROW_RETURN (" << excep - << " (" << completion_status << "), 0);\n"; - } - else - { - *os << "ACE_THROW_RETURN (" << excep - << " (" << completion_status << "), _tao_retval);\n"; - } - } - return 0; -} - -int -be_visitor_operation_cs::gen_raise_interceptor_exception (be_type *bt, - const char *excep, - const char *completion_status) -{ - TAO_OutStream *os = this->ctx_->stream (); - - if (this->void_return_type (bt)) - { - *os << "TAO_INTERCEPTOR_THROW (" - << excep << " (" - << completion_status << ")" - << ");"; - } - else - { - if (bt->size_type () == be_decl::VARIABLE - || bt->base_node_type () == AST_Decl::NT_array) - { - *os << "TAO_INTERCEPTOR_THROW_RETURN (" << excep - << " (" << completion_status << "), 0);\n"; - } - else - { - *os << "TAO_INTERCEPTOR_THROW_RETURN (" << excep - << " (" << completion_status << "), _tao_retval);\n"; - } - } - return 0; -} - -int -be_visitor_operation_cs::gen_check_exception (be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // check if there is an exception - if (this->void_return_type (bt)) - { - *os << "ACE_CHECK;\n"; - //<< "_tao_environment);\n"; - } - else - { - if (bt->size_type () == be_decl::VARIABLE - || bt->base_node_type () == AST_Decl::NT_array) - { - *os << "ACE_CHECK_RETURN (0);\n"; - } - else - { - *os << "ACE_CHECK_RETURN (_tao_retval);\n"; - } - } - - return 0; -} - -int -be_visitor_operation_cs::gen_check_interceptor_exception (be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // check if there is an exception - if (this->void_return_type (bt)) - { - *os << "TAO_INTERCEPTOR_CHECK;\n"; - //<< "_tao_environment);\n"; - } - else - { - if (bt->size_type () == be_decl::VARIABLE - || bt->base_node_type () == AST_Decl::NT_array) - { - *os << "TAO_INTERCEPTOR_CHECK_RETURN (0);\n"; - } - else - { - *os << "TAO_INTERCEPTOR_CHECK_RETURN (_tao_retval);\n"; - } - } - - return 0; -} - -const char* -be_visitor_operation_cs::compute_operation_name (be_operation *node) -{ - if (this->operation_name_ == 0) - { - size_t len = 3; // length for two double quotes - // and the null termination char. - if (this->ctx_->attribute ()) - len += 5; // "Added length for "_set_" or "_get_". - - len += ACE_OS::strlen (node->original_local_name ()->get_string ()); - - ACE_NEW_RETURN (this->operation_name_, - char [len], - 0); - - ACE_OS::strcpy (this->operation_name_, "\""); - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - ACE_OS::strcat (this->operation_name_, "_set_"); - else - ACE_OS::strcat (this->operation_name_, "_get_"); - } - ACE_OS::strcat (this->operation_name_, - node->original_local_name ()->get_string ()); - ACE_OS::strcat (this->operation_name_, "\""); - } - return this->operation_name_; -} -// ************************************************************ -// Operation visitor for interpretive client stubs -// ************************************************************ - -be_interpretive_visitor_operation_cs:: -be_interpretive_visitor_operation_cs (be_visitor_context *ctx) - : be_visitor_operation_cs (ctx) -{ -} - -be_interpretive_visitor_operation_cs::~be_interpretive_visitor_operation_cs (void) -{ -} - -// concrete implementation of the template methods - -int -be_interpretive_visitor_operation_cs::gen_pre_stub_info (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // Generate the TAO_Param_Data table - os->indent (); - *os << "static const TAO_Param_Data "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << - "_paramdata [] = " << be_nl; - *os << "{\n"; - os->incr_indent (); - - // entry for the return type - *os << "{" << bt->tc_name () << ", PARAM_RETURN, 0}"; - if (node->nmembers () > 0) - *os << ",\n"; - - // generate entries for the param data table for arguments - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_cs::" - "gen_pre_stub_info - " - "visit scope failed\n"), - -1); - } - *os << "\n"; - os->decr_indent (); - *os << "}; // " << node->flat_name () << "_paramdata\n\n"; - - // Check if this operation raises any exceptions. In that case, we must - // generate a list of exception typecodes. This is not valid for - // attributes - if (!this->ctx_->attribute ()) - { - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_EXCEPTLIST_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) " - "be_interpretive_visitor_operation_cs::" - "gen_pre_stub_info - " - "Exceptionlist generation error\n"), - -1); - } - } - - // now generate the calldata table - os->indent (); - *os << "static const TAO_Call_Data "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () - << "_calldata = " << be_nl - << "{" << this->compute_operation_name (node) - << ", "; - - // are we oneway or two operation? - if (node->flags () == AST_Operation::OP_oneway) - { - *os << "0, "; // for false - } - else - { - *os << "1, "; // for true - } - // insert the size of the paramdata table i.e., number of arguments + 1 - // for return type - *os << (node->argument_count () + 1) << ", "; - - // insert the address of the paramdata table - // first check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_paramdata, "; - - // insert exception list (if any) - node for attributes - if (this->ctx_->attribute ()) - *os << "0, 0};\n\n"; - else - { - if (node->exceptions ()) - { - *os << node->exceptions ()->length () - << ", _tao_" << node->flat_name () << "_exceptiondata};\n\n"; - } - else - *os << "0, 0};\n\n"; - } - return 0; -} - -int -be_interpretive_visitor_operation_cs::gen_marshal_and_invoke (be_operation - *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - os->indent (); - *os << "void* _tao_arguments[" - << node->argument_count () + 1 << "];" << be_nl - << "const void** _tao_arg = ACE_const_cast (const void**,_tao_arguments);" << be_nl - << "*_tao_arg = "; - - // pass the appropriate return value to docall - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for return var in do_static_call failed\n"), - -1); - } - *os << "; _tao_arg++;\n"; - - // pass each argument to do_static_call - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for return var in do_static_call failed\n"), - -1); - } - - // call do_static_call with appropriate number of arguments - os->indent (); - *os << "istub->do_static_call (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata," << be_nl - << "_tao_arguments" << be_uidt_nl - << ");\n"; - - os->indent (); - // check if there is an exception - if (this->gen_check_exception (bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_interpretive_visitor_operation_cs::" - "gen_marshal_and_invoke - " - "codegen for checking exception failed\n"), - -1); - - } - - // do any post processing for the arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for args post do_static_call failed\n"), - -1); - } - - // do any post processing for the retval - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_INVOKE_CS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for return type post do_static_call failed\n"), - -1); - } - - return 0; -} - -// ************************************************************ -// Operation visitor for compiled client stubs -// ************************************************************ - -be_compiled_visitor_operation_cs:: -be_compiled_visitor_operation_cs (be_visitor_context *ctx) - : be_visitor_operation_cs (ctx) -{ -} - -be_compiled_visitor_operation_cs::~be_compiled_visitor_operation_cs (void) -{ -} - -// concrete implementation of the template methods - -int -be_compiled_visitor_operation_cs::gen_pre_stub_info (be_operation *node, - be_type *) +be_visitor_operation_cs::gen_pre_stub_info (be_operation *node) { // Check if this operation raises any exceptions. In that case, we must @@ -725,9 +320,8 @@ be_compiled_visitor_operation_cs::gen_pre_stub_info (be_operation *node, } int -be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation - *node, - be_type *bt) +be_visitor_operation_cs::gen_marshal_and_invoke (be_operation *node, + be_type *bt) { TAO_OutStream *os = this->ctx_->stream (); be_visitor *visitor; @@ -1000,13 +594,13 @@ be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation ctx = *this->ctx_; be_visitor_context *new_ctx = new be_visitor_context (ctx); - be_visitor_operation_compiled_rettype_post_docall vis2 (new_ctx); + be_visitor_operation_rettype_post_invoke_cs vis2 (new_ctx); if (bt->accept (&vis2) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_compiled_visitor_operation_cs::" "gen_pre_stub_info - " - "codegen rettype [post docall] failed\n"), + "codegen rettype [post invoke] failed\n"), -1); } } @@ -1138,3 +732,152 @@ be_compiled_visitor_operation_cs::gen_marshal_and_invoke (be_operation return 0; } + +int +be_visitor_operation_cs::gen_raise_exception (be_type *bt, + const char *excep, + const char *completion_status) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (this->void_return_type (bt)) + { + *os << "ACE_THROW (" + << excep << " (" << completion_status << "));\n"; + } + else + { + if (bt->size_type () == be_decl::VARIABLE + || bt->base_node_type () == AST_Decl::NT_array) + { + *os << "ACE_THROW_RETURN (" << excep + << " (" << completion_status << "), 0);\n"; + } + else + { + *os << "ACE_THROW_RETURN (" << excep + << " (" << completion_status << "), _tao_retval);\n"; + } + } + return 0; +} + +int +be_visitor_operation_cs::gen_raise_interceptor_exception (be_type *bt, + const char *excep, + const char *completion_status) +{ + TAO_OutStream *os = this->ctx_->stream (); + + if (this->void_return_type (bt)) + { + *os << "TAO_INTERCEPTOR_THROW (" + << excep << " (" + << completion_status << ")" + << ");"; + } + else + { + if (bt->size_type () == be_decl::VARIABLE + || bt->base_node_type () == AST_Decl::NT_array) + { + *os << "TAO_INTERCEPTOR_THROW_RETURN (" << excep + << " (" << completion_status << "), 0);\n"; + } + else + { + *os << "TAO_INTERCEPTOR_THROW_RETURN (" << excep + << " (" << completion_status << "), _tao_retval);\n"; + } + } + return 0; +} + +int +be_visitor_operation_cs::gen_check_exception (be_type *bt) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + // check if there is an exception + if (this->void_return_type (bt)) + { + *os << "ACE_CHECK;\n"; + //<< "_tao_environment);\n"; + } + else + { + if (bt->size_type () == be_decl::VARIABLE + || bt->base_node_type () == AST_Decl::NT_array) + { + *os << "ACE_CHECK_RETURN (0);\n"; + } + else + { + *os << "ACE_CHECK_RETURN (_tao_retval);\n"; + } + } + + return 0; +} + +int +be_visitor_operation_cs::gen_check_interceptor_exception (be_type *bt) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + // check if there is an exception + if (this->void_return_type (bt)) + { + *os << "TAO_INTERCEPTOR_CHECK;\n"; + //<< "_tao_environment);\n"; + } + else + { + if (bt->size_type () == be_decl::VARIABLE + || bt->base_node_type () == AST_Decl::NT_array) + { + *os << "TAO_INTERCEPTOR_CHECK_RETURN (0);\n"; + } + else + { + *os << "TAO_INTERCEPTOR_CHECK_RETURN (_tao_retval);\n"; + } + } + + return 0; +} + +const char* +be_visitor_operation_cs::compute_operation_name (be_operation *node) +{ + if (this->operation_name_ == 0) + { + size_t len = 3; // length for two double quotes + // and the null termination char. + if (this->ctx_->attribute ()) + len += 5; // "Added length for "_set_" or "_get_". + + len += ACE_OS::strlen (node->original_local_name ()->get_string ()); + + ACE_NEW_RETURN (this->operation_name_, + char [len], + 0); + + ACE_OS::strcpy (this->operation_name_, "\""); + if (this->ctx_->attribute ()) + { + // now check if we are a "get" or "set" operation + if (node->nmembers () == 1) // set + ACE_OS::strcat (this->operation_name_, "_set_"); + else + ACE_OS::strcat (this->operation_name_, "_get_"); + } + ACE_OS::strcat (this->operation_name_, + node->original_local_name ()->get_string ()); + ACE_OS::strcat (this->operation_name_, "\""); + } + return this->operation_name_; +} + diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp index 18a98dd2e62..3c83c5607c1 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -128,7 +128,7 @@ be_visitor_operation_ss::visit_operation (be_operation *node) *os << "{\n" << be_idt; // generate all the tables and other pre-skel info - if (this->gen_pre_skel_info (node, bt) == -1) + if (this->gen_pre_skel_info (node) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_operation_ss::" @@ -222,19 +222,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node) *os << "#endif /* TAO_HAS_INTERCEPTORS */\n\n"; - // do pre upcall processing if any - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_PRE_UPCALL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for pre upcall failed\n"), - -1); - } // make the upcall and assign to the return val ctx = *this->ctx_; ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_ASSIGN_SS); @@ -306,20 +293,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node) << "ACE_CHECK;\n" << "#endif /* TAO_HAS_INTERCEPTORS */\n\n"; - // do any post processing for the arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_UPCALL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for args in post upcall failed\n"), - -1); - } - // check if we are oneway in which case, we are done if (node->flags () == AST_Operation::OP_oneway) { @@ -345,34 +318,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - // do any post processing for the retval - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_POST_UPCALL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for return type post upcall failed\n"), - -1); - } - - // do any post processing for the arguments - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_POST_MARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for args in post marshal failed\n"), - -1); - } - os->decr_indent (); *os << "}\n\n"; return 0; @@ -417,340 +362,7 @@ be_visitor_operation_ss::visit_argument (be_argument *node) } int -be_visitor_operation_ss::gen_raise_exception (be_type *, - const char *excep, - const char *completion_status, - const char * /* env */) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - *os << "ACE_THROW (" - << excep << " (" << completion_status << ") " - << ");\n"; - return 0; -} - -int -be_visitor_operation_ss::gen_check_exception (be_type *, const char * /* env */) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // check if there is an exception - *os << "ACE_CHECK;\n"; - // << env << ");\n"; - - return 0; -} - -int -be_visitor_operation_ss::gen_check_interceptor_exception (be_type *, const char * /* env */) -{ - TAO_OutStream *os = this->ctx_->stream (); - - os->indent (); - // check if there is an exception - *os << "TAO_INTERCEPTOR_CHECK;\n"; - // << env << ");\n"; - - return 0; -} - -const char * -be_visitor_operation_ss::compute_operation_name (be_operation *node) -{ - if (this->operation_name_ == 0) - { - size_t len = 3; // the null termination char. - if (this->ctx_->attribute ()) - len += 5; // "Added length for "_set_" or "_get_". - - len += ACE_OS::strlen (node->local_name ()->get_string ()); - - ACE_NEW_RETURN (this->operation_name_, - char [len], - 0); - - ACE_OS::strcpy (this->operation_name_, "\""); - if (this->ctx_->attribute ()) - { - if (node->nmembers () == 1) - ACE_OS::strcat (this->operation_name_, "_set_"); - else - ACE_OS::strcat (this->operation_name_, "_get_"); - } - ACE_OS::strcat (this->operation_name_, - node->local_name ()->get_string ()); - ACE_OS::strcat (this->operation_name_, "\""); - } - return this->operation_name_; -} - -// ********************************************************************* -// Operation visitor for server skeletons using interpretive marshaling -// ********************************************************************* - -be_interpretive_visitor_operation_ss:: -be_interpretive_visitor_operation_ss (be_visitor_context *ctx) - : be_visitor_operation_ss (ctx) -{ -} - -be_interpretive_visitor_operation_ss:: -~be_interpretive_visitor_operation_ss (void) -{ -} - -int -be_interpretive_visitor_operation_ss::gen_pre_skel_info (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor_context ctx; - - os->indent (); - // generate the param_data and call_data tables. We generate these if and - // only if none of our arguments is of "native" type. Native types cannot be - // marshaled. - // native type does not exist. Generate the static tables - - // generate the TAO_Param_Data_Skel table - *os << "static const TAO_Param_Data_Skel "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << - "_paramdata [] = " << be_nl; - *os << "{\n"; - os->incr_indent (); - - // entry for the return type - *os << "{" << bt->tc_name () << ", 0, 0}"; - if (node->nmembers () > 0) - *os << ",\n"; - - // generate entries for the param data table for arguments - if (this->visit_scope (node) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "visit scope failed\n"), - -1); - } - *os << "\n"; - os->decr_indent (); - *os << "}; // " << node->flat_name () << "_paramdata\n\n"; - - // now generate the calldata table - os->indent (); - *os << "static const TAO_Call_Data_Skel "; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () - << "_calldata = " << be_nl - << "{" - << "\""; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->local_name () << "\", "; - - // are we oneway or two operation? - if (node->flags () == AST_Operation::OP_oneway) - { - *os << "0, "; // for false - } - else - { - *os << "1, "; // for true - } - // insert the size of the paramdata table i.e., number of arguments + 1 - // for return type - *os << (node->argument_count () + 1) << ", "; - - // insert the address of the paramdata table - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_paramdata};\n\n"; - - return 0; -} - -int -be_interpretive_visitor_operation_ss::gen_demarshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // setup parameters for demarshaling and demarshal them - os->indent (); - *os << "_tao_server_request.demarshal (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata,\n"; - - // pass the appropriate return value to the demarshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_DEMARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for return var in demarshal failed\n"), - -1); - } - // insert a comma after the return val if there are arguments - if (node->argument_count () > 0) - *os << ",\n"; - - // pass each argument to the demarshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for argument in demarshal failed\n"), - -1); - } - - // end the demarshal call - *os << be_uidt_nl; - *os << ");" << be_nl; - - *os << "ACE_CHECK;\n"; - - return 0; -} - -int -be_interpretive_visitor_operation_ss::gen_marshal_params (be_operation *node, - be_type *bt) -{ - TAO_OutStream *os = this->ctx_->stream (); - be_visitor *visitor; - be_visitor_context ctx; - - // setup parameters for marshaling and marshal them into the - // outgoing stream - os->indent (); - *os << "_tao_server_request.marshal (" << be_idt_nl - << "ACE_TRY_ENV, " << be_nl - // << "_tao_skel_environment, " << be_nl - << "&"; - // check if we are an attribute node in disguise - if (this->ctx_->attribute ()) - { - // now check if we are a "get" or "set" operation - if (node->nmembers () == 1) // set - *os << "_set_"; - else - *os << "_get_"; - } - *os << node->flat_name () << "_calldata,\n"; - - // pass the appropriate return value to the marshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_RETVAL_MARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (bt->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for return var in marshal failed\n"), - -1); - } - // insert a comma after the return val if there are arguments - if (node->argument_count () > 0) - { - *os << ",\n"; - } - - // pass each argument to the marshal operation - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_MARSHAL_SS); - visitor = tao_cg->make_visitor (&ctx); - if (!visitor || (node->accept (visitor) == -1)) - { - delete visitor; - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for argument in marshal failed\n"), - -1); - } - // end the marshal call - *os << be_uidt_nl; - *os << ");\n"; - - return 0; -} - -// ********************************************************************* -// Operation visitor for server skeletons using compiled marshaling -// ********************************************************************* - -be_compiled_visitor_operation_ss:: -be_compiled_visitor_operation_ss (be_visitor_context *ctx) - : be_visitor_operation_ss (ctx) -{ -} - -be_compiled_visitor_operation_ss:: -~be_compiled_visitor_operation_ss (void) -{ -} - -int -be_compiled_visitor_operation_ss::gen_pre_skel_info (be_operation *node, - be_type *) +be_visitor_operation_ss::gen_pre_skel_info (be_operation *node) { TAO_OutStream *os = this->ctx_->stream (); @@ -768,8 +380,8 @@ be_compiled_visitor_operation_ss::gen_pre_skel_info (be_operation *node, } int -be_compiled_visitor_operation_ss::gen_demarshal_params (be_operation *node, - be_type *bt) +be_visitor_operation_ss::gen_demarshal_params (be_operation *node, + be_type *bt) { TAO_OutStream *os = this->ctx_->stream (); be_visitor *visitor; @@ -820,8 +432,8 @@ be_compiled_visitor_operation_ss::gen_demarshal_params (be_operation *node, } int -be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node, - be_type *bt) +be_visitor_operation_ss::gen_marshal_params (be_operation *node, + be_type *bt) { TAO_OutStream *os = this->ctx_->stream (); be_visitor *visitor; @@ -852,7 +464,7 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node, ctx = *this->ctx_; be_visitor_context *new_ctx = new be_visitor_context (ctx); - be_visitor_operation_compiled_rettype_post_upcall visitor (new_ctx); + be_visitor_operation_rettype_post_upcall_ss visitor (new_ctx); if (bt->accept (&visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -865,7 +477,7 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node, // Generate any temporary variables to demarshal the arguments ctx = *this->ctx_; - be_visitor_compiled_args_post_upcall vis1 (new be_visitor_context (ctx)); + be_visitor_args_post_upcall_ss vis1 (new be_visitor_context (ctx)); if (node->accept (&vis1) == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -936,3 +548,75 @@ be_compiled_visitor_operation_ss::gen_marshal_params (be_operation *node, return 0; } + +int +be_visitor_operation_ss::gen_raise_exception (be_type *, + const char *excep, + const char *completion_status, + const char * /* env */) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + *os << "ACE_THROW (" + << excep << " (" << completion_status << ") " + << ");\n"; + return 0; +} + +int +be_visitor_operation_ss::gen_check_exception (be_type *, const char * /* env */) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + // check if there is an exception + *os << "ACE_CHECK;\n"; + // << env << ");\n"; + + return 0; +} + +int +be_visitor_operation_ss::gen_check_interceptor_exception (be_type *, const char * /* env */) +{ + TAO_OutStream *os = this->ctx_->stream (); + + os->indent (); + // check if there is an exception + *os << "TAO_INTERCEPTOR_CHECK;\n"; + // << env << ");\n"; + + return 0; +} + +const char * +be_visitor_operation_ss::compute_operation_name (be_operation *node) +{ + if (this->operation_name_ == 0) + { + size_t len = 3; // the null termination char. + if (this->ctx_->attribute ()) + len += 5; // "Added length for "_set_" or "_get_". + + len += ACE_OS::strlen (node->local_name ()->get_string ()); + + ACE_NEW_RETURN (this->operation_name_, + char [len], + 0); + + ACE_OS::strcpy (this->operation_name_, "\""); + if (this->ctx_->attribute ()) + { + if (node->nmembers () == 1) + ACE_OS::strcat (this->operation_name_, "_set_"); + else + ACE_OS::strcat (this->operation_name_, "_get_"); + } + ACE_OS::strcat (this->operation_name_, + node->local_name ()->get_string ()); + ACE_OS::strcat (this->operation_name_, "\""); + } + return this->operation_name_; +} + diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp deleted file mode 100644 index 1e21d6a8106..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_docall_cs.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_docall_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for passing the return type variable to the -// do_static_call method in the stub. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, rettype_docall_cs, "$Id$") - - -// ***************************************************************************** -// be_visitor_operation_rettype_docall_cs -// -// This visitor generates code that passes the return type variable to the -// do_static_call method -// ***************************************************************************** - -be_visitor_operation_rettype_docall_cs::be_visitor_operation_rettype_docall_cs -(be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_rettype_docall_cs:: -~be_visitor_operation_rettype_docall_cs (void) -{ -} - -int -be_visitor_operation_rettype_docall_cs::visit_array (be_array *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "_tao_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_enum (be_enum *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_base_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_base_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - switch (node->pt ()) - { - case AST_PredefinedType::PT_void: - *os << "0"; - break; - case AST_PredefinedType::PT_any: - *os << "_tao_retval"; - break; - default: - *os << "&_tao_retval"; - break; - } - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_sequence (be_sequence *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "_tao_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_string (be_string *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - // check if the struct is variable - if (node->size_type () == be_type::VARIABLE) - *os << "_tao_retval"; - else - *os << "&_tao_retval"; - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_operation_rettype_docall_cs::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - // check if the union is variable - if (node->size_type () == be_type::VARIABLE) - *os << "_tao_retval"; - else - *os << "&_tao_retval"; - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp index 9be55e90f62..79b11b385de 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_marshal_ss.cpp @@ -11,24 +11,27 @@ // rettype_marshal_ss.cpp // // = DESCRIPTION -// Visitor generating code for marshaling the return type variable +// Visitor generating the code that passes retval to the CDR operators. The +// "OUTPUT" substate deals with the server side skeletons whereas the +// "INPUT" substate deals with the client stubs. Also notice that the type +// of parameter passed to the operator depends on the manner in which the +// variable is declared i.e., in the skeleton, we may have _var types but +// not in the stubs. // // = AUTHOR // Aniruddha Gokhale // // ============================================================================ -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - +#include "idl.h" +#include "be.h" #include "be_visitor_operation.h" ACE_RCSID(be_visitor_operation, rettype_marshal_ss, "$Id$") // **************************************************************************** -// Visitor that passes the return value to the marshal/demarshal routine +// visitor for arguments passing to the CDR operators. // **************************************************************************** be_visitor_operation_rettype_marshal_ss:: @@ -42,149 +45,461 @@ be_visitor_operation_rettype_marshal_ss:: { } -int -be_visitor_operation_rettype_marshal_ss::visit_array (be_array *) +int be_visitor_operation_rettype_marshal_ss:: +visit_operation (be_operation *node) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + this->ctx_->node (node); // save the argument node + + // retrieve the type of the argument + be_type *bt = be_type::narrow_from_decl (node->return_type ()); + if (!bt) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_argument - " + "Bad argument type\n"), + -1); + } + + // Different types have different mappings when used as in/out or + // inout parameters. Let this visitor deal with the type + + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + os->indent (); + *os << "(_tao_out << "; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + os->indent (); + *os << "(_tao_in >> "; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_operation - " + "Bad substate\n"), + -1); + } + + if (bt->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_operation - " + "cannot accept visitor\n"), + -1); + } + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << ")"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << ")"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_operation - " + "Bad substate\n"), + -1); + } - os->indent (); - *os << "_tao_retval.inout ()"; return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_enum (be_enum *) +int be_visitor_operation_rettype_marshal_ss::visit_array (be_array *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval_forany"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_retval_forany"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_array - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_interface (be_interface *) +int be_visitor_operation_rettype_marshal_ss::visit_enum (be_enum *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval.inout ()"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_retval"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_enum - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss:: -visit_interface_fwd (be_interface_fwd *) +int be_visitor_operation_rettype_marshal_ss::visit_interface (be_interface *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream - os->indent (); - *os << "&_tao_retval.inout ()"; + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval.in ()"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_safe_retval.inout ()"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_interface - " + "Bad substate\n"), + -1); + } + return 0; +} + +int be_visitor_operation_rettype_marshal_ss::visit_interface_fwd (be_interface_fwd *) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval.in ()"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_safe_retval.inout ()"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_interface - " + "Bad substate\n"), + -1); + } return 0; } #ifdef IDL_HAS_VALUETYPE -int -be_visitor_operation_rettype_marshal_ss::visit_valuetype (be_valuetype *) +int be_visitor_operation_rettype_marshal_ss::visit_valuetype (be_valuetype *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval.inout ()"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval.in ()"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_safe_retval.inout ()"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_valuetype - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss:: -visit_valuetype_fwd (be_valuetype_fwd *) +int be_visitor_operation_rettype_marshal_ss::visit_valuetype_fwd (be_valuetype_fwd *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval.inout ()"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval.in ()"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_safe_retval.inout ()"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_valuetype - " + "Bad substate\n"), + -1); + } return 0; } #endif /* IDL_HAS_VALUETYPE */ -int -be_visitor_operation_rettype_marshal_ss:: -visit_predefined_type (be_predefined_type *node) +int be_visitor_operation_rettype_marshal_ss::visit_predefined_type (be_predefined_type *node) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream - switch (node->pt ()) + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) { - case AST_PredefinedType::PT_void: - os->indent (); - *os << "0"; - break; - case AST_PredefinedType::PT_pseudo: - os->indent (); - *os << "&_tao_retval.inout ()"; - break; - case AST_PredefinedType::PT_any: - os->indent (); - *os << "&_tao_retval.inout ()"; - break; - default: - os->indent (); - *os << "&_tao_retval"; - break; + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + *os << "_tao_retval.in ()"; + break; + case AST_PredefinedType::PT_any: + *os << "_tao_retval.in ()"; + break; + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_ushort: + case AST_PredefinedType::PT_float: + case AST_PredefinedType::PT_double: + case AST_PredefinedType::PT_longdouble: + *os << "_tao_retval"; + break; + case AST_PredefinedType::PT_char: + *os << "CORBA::Any::from_char (_tao_retval)"; + break; + case AST_PredefinedType::PT_wchar: + *os << "CORBA::Any::from_wchar (_tao_retval)"; + break; + case AST_PredefinedType::PT_boolean: + *os << "CORBA::Any::from_boolean (_tao_retval)"; + break; + case AST_PredefinedType::PT_octet: + *os << "CORBA::Any::from_octet (_tao_retval)"; + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_predefined_type - " + "Bad predefined type\n"), + -1); + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + switch (node->pt ()) + { + case AST_PredefinedType::PT_pseudo: + *os << "_tao_safe_retval.inout ()"; + break; + case AST_PredefinedType::PT_any: + *os << "_tao_safe_retval.inout ()"; + break; + case AST_PredefinedType::PT_long: + case AST_PredefinedType::PT_ulong: + case AST_PredefinedType::PT_longlong: + case AST_PredefinedType::PT_ulonglong: + case AST_PredefinedType::PT_short: + case AST_PredefinedType::PT_ushort: + case AST_PredefinedType::PT_float: + case AST_PredefinedType::PT_double: + case AST_PredefinedType::PT_longdouble: + *os << "_tao_retval"; + break; + case AST_PredefinedType::PT_char: + *os << "CORBA::Any::to_char (_tao_retval)"; + break; + case AST_PredefinedType::PT_wchar: + *os << "CORBA::Any::to_wchar (_tao_retval)"; + break; + case AST_PredefinedType::PT_boolean: + *os << "CORBA::Any::to_boolean (_tao_retval)"; + break; + case AST_PredefinedType::PT_octet: + *os << "CORBA::Any::to_octet (_tao_retval)"; + break; + default: + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_predefined_type - " + "Bad predefined type\n"), + -1); + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_predefined_type - " + "Bad substate\n"), + -1); } return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_sequence (be_sequence *) +int be_visitor_operation_rettype_marshal_ss::visit_sequence (be_sequence *) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "&_tao_retval.inout ()"; + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + *os << "_tao_retval.in ()"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + *os << "_tao_safe_retval.inout ()"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_sequence - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_string (be_string *) +int be_visitor_operation_rettype_marshal_ss::visit_string (be_string *node) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream + + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + // differentiate between bounded and unbounded + if (node->max_size ()->ev ()->u.ulval == 0) + { + *os << "_tao_retval.in ()"; + } + else + { + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::from_string ((char *)_tao_retval.in (), "; + } + else + { + *os << "CORBA::Any::from_wstring ((CORBA::WChar *)_tao_retval.in (), "; + } + + *os << node->max_size ()->ev ()->u.ulval - 1 << ")"; + } + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + // differentiate between bounded and unbounded + if (node->max_size ()->ev ()->u.ulval == 0) + { + // unbounded + *os << "_tao_safe_retval.inout ()"; + } + else + { + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string (_tao_safe_retval.inout (), "; + } + else + { + *os << "CORBA::Any::to_wstring (_tao_safe_retval.inout (), "; + } + + *os << node->max_size ()->ev ()->u.ulval - 1 << ")"; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_string - " + "Bad substate\n"), + -1); + } + return 0; +} - os->indent (); - *os << "&_tao_retval.inout ()"; +int be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // get output stream + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + if (node->size_type () == be_decl::VARIABLE) + *os << "_tao_retval.in ()"; + else + *os << "_tao_retval"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + if (node->size_type () == be_decl::VARIABLE) + *os << "_tao_safe_retval.inout ()"; + else + *os << "_tao_retval"; + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_structure - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node) +int be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node) { - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + TAO_OutStream *os = this->ctx_->stream (); // get output stream - os->indent (); - if (node->size_type () == be_type::VARIABLE) - *os << "&_tao_retval.inout ()"; + if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_OUTPUT) + { + if (node->size_type () == be_decl::VARIABLE) + *os << "_tao_retval.in ()"; + else + *os << "_tao_retval"; + } + else if (this->ctx_->sub_state () == TAO_CodeGen::TAO_CDR_INPUT) + { + if (node->size_type () == be_decl::VARIABLE) + *os << "_tao_safe_retval.inout ()"; + else + *os << "_tao_retval"; + } else - *os << "&_tao_retval"; + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_compiled_marshal::" + "visit_union - " + "Bad substate\n"), + -1); + } return 0; } -int -be_visitor_operation_rettype_marshal_ss::visit_typedef (be_typedef *node) +int be_visitor_operation_rettype_marshal_ss::visit_typedef (be_typedef *node) { - this->ctx_->alias (node); // set the alias node + this->ctx_->alias (node); if (node->primitive_base_type ()->accept (this) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_marshal_ss::" + "be_visitor_operation_rettype_compiled_marshal::" "visit_typedef - " "accept on primitive type failed\n"), -1); @@ -192,17 +507,3 @@ be_visitor_operation_rettype_marshal_ss::visit_typedef (be_typedef *node) this->ctx_->alias (0); return 0; } - -int -be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - if (node->size_type () == be_type::VARIABLE) - *os << "&_tao_retval.inout ()"; - else - *os << "&_tao_retval"; - - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp deleted file mode 100644 index 73d5d1bdc86..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_docall_cs.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_post_docall_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for return type post processing following a -// do_static_call. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, rettype_post_docall_cs, "$Id$") - - -// ******************************************************************************* -// be_visitor_operation_rettype_post_docall_cs -// -// This visitor generates code that passes the return type variable to the -// do_static_call method -// ******************************************************************************** - -be_visitor_operation_rettype_post_docall_cs:: -be_visitor_operation_rettype_post_docall_cs (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_rettype_post_docall_cs:: -~be_visitor_operation_rettype_post_docall_cs (void) -{ -} - -int -be_visitor_operation_rettype_post_docall_cs::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - os->indent (); - *os << "_tao_retval = " << bt->name () - << "::_narrow (_tao_base_retval, ACE_TRY_ENV);" << be_nl; - *os << "CORBA::release (_tao_base_retval);\n"; - return 0; -} - -int -be_visitor_operation_rettype_post_docall_cs:: -visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - os->indent (); - *os << "_tao_retval = " << bt->name () - << "::_narrow (_tao_base_retval, ACE_TRY_ENV);" << be_nl; - *os << "CORBA::release (_tao_base_retval);\n"; - return 0; -} - -// **************************************************************** - -be_visitor_operation_compiled_rettype_post_docall:: - be_visitor_operation_compiled_rettype_post_docall (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -int -be_visitor_operation_compiled_rettype_post_docall::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt = node; - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - - *os << bt->name () << "_forany _tao_retval_forany (" - << be_idt << be_idt_nl - << "_tao_safe_retval.inout ()" << be_uidt_nl - << ");\n" << be_uidt; - return 0; -} - -int -be_visitor_operation_compiled_rettype_post_docall::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_post_docall::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp new file mode 100644 index 00000000000..10361e70771 --- /dev/null +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_invoke_cs.cpp @@ -0,0 +1,71 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_invoke_cs.cpp +// +// = DESCRIPTION +// Visitor generating code for return type post processing following a +// do_static_call. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#include "idl.h" +#include "idl_extern.h" +#include "be.h" + +#include "be_visitor_operation.h" + +ACE_RCSID(be_visitor_operation, rettype_post_invoke_cs, "$Id$") + + +// ******************************************************************************* +// be_visitor_operation_rettype_post_invoke_cs +// ******************************************************************************** + +be_visitor_operation_rettype_post_invoke_cs:: + be_visitor_operation_rettype_post_invoke_cs (be_visitor_context *ctx) + : be_visitor_decl (ctx) +{ +} + +int +be_visitor_operation_rettype_post_invoke_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt = node; + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + + *os << bt->name () << "_forany _tao_retval_forany (" + << be_idt << be_idt_nl + << "_tao_safe_retval.inout ()" << be_uidt_nl + << ");\n" << be_uidt; + return 0; +} + +int +be_visitor_operation_rettype_post_invoke_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_post_docall::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp index 670bf03f328..8e547ffee36 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_post_upcall_ss.cpp @@ -32,96 +32,14 @@ ACE_RCSID(be_visitor_operation, rettype_post_upcall_ss, "$Id$") // visitor to do any post processing for return type after an upcall // **************************************************************************** -be_visitor_operation_rettype_post_upcall_ss::be_visitor_operation_rettype_post_upcall_ss (be_visitor_context - *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_rettype_post_upcall_ss::~be_visitor_operation_rettype_post_upcall_ss (void) -{ -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_array (be_array *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_enum (be_enum *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_interface (be_interface *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_interface_fwd (be_interface_fwd *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_predefined_type (be_predefined_type *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_sequence (be_sequence *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_structure (be_structure *) -{ - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_post_upcall_ss::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_operation_rettype_post_upcall_ss::visit_union (be_union *) -{ - return 0; -} - -// **************************************************************** - -be_visitor_operation_compiled_rettype_post_upcall:: - be_visitor_operation_compiled_rettype_post_upcall (be_visitor_context *ctx) +be_visitor_operation_rettype_post_upcall_ss:: + be_visitor_operation_rettype_post_upcall_ss (be_visitor_context *ctx) : be_visitor_decl (ctx) { } int -be_visitor_operation_compiled_rettype_post_upcall::visit_array (be_array *node) +be_visitor_operation_rettype_post_upcall_ss::visit_array (be_array *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream be_type *bt = node; @@ -137,7 +55,7 @@ be_visitor_operation_compiled_rettype_post_upcall::visit_array (be_array *node) } int -be_visitor_operation_compiled_rettype_post_upcall::visit_typedef (be_typedef *node) +be_visitor_operation_rettype_post_upcall_ss::visit_typedef (be_typedef *node) { this->ctx_->alias (node); // set the alias node if (node->primitive_base_type ()->accept (this) == -1) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp deleted file mode 100644 index 1c4299f8ca7..00000000000 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_docall_cs.cpp +++ /dev/null @@ -1,179 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_pre_docall_cs.cpp -// -// = DESCRIPTION -// Visitor generating code for doing any pre-processing of return type prior -// to making the do_static_call. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#include "idl.h" -#include "idl_extern.h" -#include "be.h" - -#include "be_visitor_operation.h" - -ACE_RCSID(be_visitor_operation, rettype_pre_docall_cs, "$Id$") - - -// ***************************************************************************** -// be_visitor_operation_rettype_pre_docall_cs -// -// This visitor generates code that passes the return type variable to the -// do_static_call method -// ***************************************************************************** - -be_visitor_operation_rettype_pre_docall_cs:: -be_visitor_operation_rettype_pre_docall_cs (be_visitor_context *ctx) - : be_visitor_decl (ctx) -{ -} - -be_visitor_operation_rettype_pre_docall_cs:: -~be_visitor_operation_rettype_pre_docall_cs (void) -{ -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_array (be_array *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - os->indent (); - *os << "ACE_ALLOCATOR_RETURN (_tao_retval, " << bt->name () - << "_alloc (), _tao_retval);" << be_nl; - *os << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_interface (be_interface *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "CORBA::Object_ptr _tao_base_retval = CORBA::Object::_nil ();\n"; - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_interface_fwd (be_interface_fwd *) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << "CORBA::Object_ptr _tao_base_retval = CORBA::Object::_nil ();\n"; - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs:: -visit_predefined_type (be_predefined_type *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - switch (node->pt ()) - { - case AST_PredefinedType::PT_any: - os->indent (); - *os << "ACE_NEW_RETURN (_tao_retval, CORBA::Any, _tao_retval);" << be_nl - << "CORBA::Any_var _tao_safe_retval (_tao_retval);\n"; - break; - default: - break; - } - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_sequence (be_sequence *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - os->indent (); - *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl - << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_structure (be_structure *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - // check if the union is variable - if (node->size_type () == be_type::VARIABLE) - { - os->indent (); - *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl - << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; - } - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_typedef (be_typedef *node) -{ - this->ctx_->alias (node); // set the alias node - if (node->primitive_base_type ()->accept (this) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_operation_rettype_pre_docall_cs::" - "visit_typedef - " - "accept on primitive type failed\n"), - -1); - } - this->ctx_->alias (0); - return 0; -} - -int -be_visitor_operation_rettype_pre_docall_cs::visit_union (be_union *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - be_type *bt; // return type - - if (this->ctx_->alias ()) // a typedefed return type - bt = this->ctx_->alias (); - else - bt = node; - - // check if the union is variable - if (node->size_type () == be_type::VARIABLE) - { - os->indent (); - *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl - << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; - } - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp index 5b0c21c3a24..469226ec3cf 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_pre_invoke_cs.cpp @@ -12,7 +12,7 @@ // // = DESCRIPTION // Visitor generating code for doing any pre-processing of return type prior -// to making the do_static_call. +// to making the invocation. // // = AUTHOR // Aniruddha Gokhale @@ -30,12 +30,11 @@ ACE_RCSID(be_visitor_operation, rettype_pre_invoke_cs, "$Id$") // ***************************************************************************** // be_visitor_operation_rettype_pre_invoke_cs -// // ***************************************************************************** be_visitor_operation_rettype_pre_invoke_cs:: be_visitor_operation_rettype_pre_invoke_cs (be_visitor_context *ctx) - : be_visitor_operation_rettype_pre_docall_cs (ctx) + : be_visitor_decl (ctx) { } @@ -45,6 +44,24 @@ be_visitor_operation_rettype_pre_invoke_cs:: } int +be_visitor_operation_rettype_pre_invoke_cs::visit_array (be_array *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << "ACE_ALLOCATOR_RETURN (_tao_retval, " << bt->name () + << "_alloc (), _tao_retval);" << be_nl; + *os << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; + return 0; +} + +int be_visitor_operation_rettype_pre_invoke_cs::visit_interface (be_interface *) { // don't do anything. This is the overriding action @@ -57,3 +74,97 @@ be_visitor_operation_rettype_pre_invoke_cs::visit_interface_fwd (be_interface_fw return 0; } +int +be_visitor_operation_rettype_pre_invoke_cs:: +visit_predefined_type (be_predefined_type *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + + switch (node->pt ()) + { + case AST_PredefinedType::PT_any: + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, CORBA::Any, _tao_retval);" << be_nl + << "CORBA::Any_var _tao_safe_retval (_tao_retval);\n"; + break; + default: + break; + } + return 0; +} + +int +be_visitor_operation_rettype_pre_invoke_cs::visit_sequence (be_sequence *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl + << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; + return 0; +} + +int +be_visitor_operation_rettype_pre_invoke_cs::visit_structure (be_structure *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + // check if the union is variable + if (node->size_type () == be_type::VARIABLE) + { + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl + << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; + } + return 0; +} + +int +be_visitor_operation_rettype_pre_invoke_cs::visit_typedef (be_typedef *node) +{ + this->ctx_->alias (node); // set the alias node + if (node->primitive_base_type ()->accept (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "be_visitor_operation_rettype_pre_docall_cs::" + "visit_typedef - " + "accept on primitive type failed\n"), + -1); + } + this->ctx_->alias (0); + return 0; +} + +int +be_visitor_operation_rettype_pre_invoke_cs::visit_union (be_union *node) +{ + TAO_OutStream *os = this->ctx_->stream (); // grab the out stream + be_type *bt; // return type + + if (this->ctx_->alias ()) // a typedefed return type + bt = this->ctx_->alias (); + else + bt = node; + + // check if the union is variable + if (node->size_type () == be_type::VARIABLE) + { + os->indent (); + *os << "ACE_NEW_RETURN (_tao_retval, " << bt->name () << ", _tao_retval);" << be_nl + << bt->name () << "_var _tao_safe_retval (_tao_retval);\n"; + } + return 0; +} + diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp index 5188cd786b6..344469c60b4 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_ss.cpp @@ -78,32 +78,23 @@ be_visitor_operation_rettype_vardecl_ss::visit_enum (be_enum *node) } int -be_visitor_operation_rettype_vardecl_ss::visit_interface (be_interface *) +be_visitor_operation_rettype_vardecl_ss::visit_interface (be_interface *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // due to the virtual inheritance and the fact that we will be passing the - // address of the objref to the marshaling routine, we use the base - // CORBA::Object_ptr as the type for the return value even though the actual - // return type may be some derived class - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();\n"; - + *os << node->name () << "_var _tao_retval;\n"; return 0; } int be_visitor_operation_rettype_vardecl_ss:: -visit_interface_fwd (be_interface_fwd *) +visit_interface_fwd (be_interface_fwd *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // due to the virtual inheritance and the fact that we will be passing the - // address of the objref to the marshaling routine, we use the base - // CORBA::Object_ptr as the type for the return value even though the actual - // return type may be some derived class - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();\n"; + *os << node->name () << "_var _tao_retval;\n"; return 0; } @@ -264,41 +255,3 @@ be_visitor_operation_rettype_vardecl_ss::visit_union (be_union *node) } -// ******************************************************************************** -// be_visitor_operation_rettype_vardecl_ss -// This visitor generates code for variable declaration and initialization -// of the return type. -// ******************************************************************************** - -be_compiled_visitor_operation_rettype_vardecl_ss -::be_compiled_visitor_operation_rettype_vardecl_ss -(be_visitor_context *ctx) - : be_visitor_operation_rettype_vardecl_ss (ctx) -{ -} - -be_compiled_visitor_operation_rettype_vardecl_ss:: -~be_compiled_visitor_operation_rettype_vardecl_ss (void) -{ -} - -int -be_compiled_visitor_operation_rettype_vardecl_ss::visit_interface (be_interface *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << node->name () << "_var _tao_retval;\n"; - return 0; -} - -int -be_compiled_visitor_operation_rettype_vardecl_ss:: -visit_interface_fwd (be_interface_fwd *node) -{ - TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - - os->indent (); - *os << node->name () << "_var _tao_retval;\n"; - return 0; -} diff --git a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp index bf0bed0a9b3..a88d4b0a42a 100644 --- a/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union/any_op_cs.cpp @@ -58,12 +58,19 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << ")" << be_uidt_nl << "{" << be_idt_nl << "ACE_TRY_NEW_ENV" << be_nl - << "{" << be_idt_nl; - - if (this->gen_insertion (os, node) != 0) - return -1; - - *os << "}" << be_nl + << "{" << be_idt_nl + << "TAO_OutputCDR stream;" << be_nl + << "if (stream << _tao_elem)" << be_nl + << "{" << be_idt_nl + << "_tao_any._tao_replace (" << be_idt << be_idt_nl + << node->tc_name () << "," << be_nl + << "TAO_ENCAP_BYTE_ORDER," << be_nl + << "stream.begin ()," << be_nl + << "ACE_TRY_ENV" << be_uidt_nl + << ");" << be_uidt_nl + << "ACE_TRY_CHECK;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl << "ACE_CATCHANY" << be_nl << "{" << be_nl << "}" << be_nl @@ -76,12 +83,26 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << ")" << be_uidt_nl << "{" << be_idt_nl << "ACE_TRY_NEW_ENV" << be_nl - << "{" << be_idt_nl; - - if (this->gen_insertion_nocopy (os, node) != 0) - return -1; - - *os << "}" << be_nl + << "{" << be_idt_nl + << "TAO_OutputCDR stream;" << be_nl + << "if (stream << *_tao_elem)" << be_nl + << "{" << be_idt_nl + << "_tao_any._tao_replace (" << be_idt << be_idt_nl + << node->tc_name () << "," << be_nl + << "TAO_ENCAP_BYTE_ORDER," << be_nl + << "stream.begin ()," << be_nl + << "1," << be_nl + << "_tao_elem," << be_nl + << node->name () << "::_tao_any_destructor," << be_nl + << "ACE_TRY_ENV" << be_uidt_nl + << ");" << be_uidt_nl + << "ACE_TRY_CHECK;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl + << "{" << be_idt_nl + << "delete _tao_elem;" << be_uidt_nl + << "}" << be_uidt_nl + << "}" << be_nl << "ACE_CATCHANY" << be_nl << "{" << be_idt_nl << "delete _tao_elem;" << be_uidt_nl @@ -114,16 +135,27 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << "{" << be_idt_nl << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" << be_nl - << "TAO_InputCDR stream (" << be_idt << be_idt_nl << "_tao_any._tao_get_cdr ()," << be_nl << "_tao_any._tao_byte_order ()" << be_uidt_nl - << ");" << be_uidt_nl; - - if (this->gen_extraction (os, node) != 0) - return -1; - - *os << be_uidt_nl + << ");" << be_uidt_nl + << be_nl << "if (stream >> *_tao_elem)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->_tao_replace (" << be_idt << be_idt_nl + << node->tc_name () << "," << be_nl + << "1," << be_nl + << "ACE_reinterpret_cast (void *, _tao_elem)," << be_nl + << node->name () << "::_tao_any_destructor," << be_nl + << "ACE_TRY_ENV" << be_uidt_nl + << ");" << be_uidt_nl + << "ACE_TRY_CHECK;" << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl + << "{" << be_idt_nl + << "delete _tao_elem;" << be_nl + << "_tao_elem = 0;" << be_uidt_nl + << "}" << be_uidt_nl << "}" << be_uidt_nl << "}" << be_nl << "ACE_CATCHANY" << be_nl @@ -160,16 +192,32 @@ be_visitor_union_any_op_cs::visit_union (be_union *node) << "{" << be_idt_nl << "ACE_NEW_RETURN (_tao_elem, " << node->name () << ", 0);" << be_nl - << "TAO_InputCDR stream (" << be_idt << be_idt_nl << "_tao_any._tao_get_cdr ()," << be_nl << "_tao_any._tao_byte_order ()" << be_uidt_nl << ");" << be_uidt_nl; - if (this->gen_const_extraction (os, node) != 0) - return -1; - - *os << be_uidt_nl + *os << be_nl << "if (stream >> *(" << node->name () + << " *)_tao_elem)" << be_nl + << "{" << be_idt_nl + << "((CORBA::Any *)&_tao_any)->_tao_replace (" + << be_idt << be_idt_nl + << node->tc_name () << "," << be_nl + << "1," << be_nl + << "ACE_reinterpret_cast (void *, ACE_const_cast (" + << node->name () << " *&, _tao_elem))," << be_nl + << node->name () << "::_tao_any_destructor," << be_nl + << "ACE_TRY_ENV" << be_uidt_nl + << ");" << be_uidt_nl + << "ACE_TRY_CHECK;" << be_nl + << "return 1;" << be_uidt_nl + << "}" << be_nl + << "else" << be_nl + << "{" << be_idt_nl + << "delete ACE_const_cast (" << node->name () + << " *&, _tao_elem);" << be_nl + << "_tao_elem = 0;" << be_uidt_nl + << "}" << be_uidt_nl << "}" << be_uidt_nl << "}" << be_nl << "ACE_CATCHANY" << be_nl @@ -221,164 +269,3 @@ be_visitor_union_any_op_cs::visit_union_branch (be_union_branch *node) return 0; } -// **************************************************************** - -be_visitor_union_any_op_compiled_cs:: -be_visitor_union_any_op_compiled_cs (be_visitor_context *ctx) - : be_visitor_union_any_op_cs (ctx) -{ -} - -int -be_visitor_union_any_op_compiled_cs:: -gen_insertion (TAO_OutStream *os, - be_union *node) -{ - *os << "TAO_OutputCDR stream;" << be_nl - << "if (stream << _tao_elem)" << be_nl - << "{" << be_idt_nl - << "_tao_any._tao_replace (" << be_idt << be_idt_nl - << node->tc_name () << "," << be_nl - << "TAO_ENCAP_BYTE_ORDER," << be_nl - << "stream.begin ()," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_uidt_nl - << "}" << be_uidt_nl; - return 0; -} - -int -be_visitor_union_any_op_compiled_cs:: -gen_insertion_nocopy (TAO_OutStream *os, - be_union *node) -{ - *os << "TAO_OutputCDR stream;" << be_nl - << "if (stream << *_tao_elem)" << be_nl - << "{" << be_idt_nl - << "_tao_any._tao_replace (" << be_idt << be_idt_nl - << node->tc_name () << "," << be_nl - << "TAO_ENCAP_BYTE_ORDER," << be_nl - << "stream.begin ()," << be_nl - << "1," << be_nl - << "_tao_elem," << be_nl - << node->name () << "::_tao_any_destructor," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl - << "{" << be_idt_nl - << "delete _tao_elem;" << be_uidt_nl - << "}" << be_uidt_nl; - return 0; -} - -int -be_visitor_union_any_op_compiled_cs:: -gen_extraction (TAO_OutStream *os, - be_union *node) -{ - *os << be_nl << "if (stream >> *_tao_elem)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->_tao_replace (" << be_idt << be_idt_nl - << node->tc_name () << "," << be_nl - << "1," << be_nl - << "ACE_reinterpret_cast (void *, _tao_elem)," << be_nl - << node->name () << "::_tao_any_destructor," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl - << "{" << be_idt_nl - << "delete _tao_elem;" << be_nl - << "_tao_elem = 0;" << be_uidt_nl - << "}"; - return 0; -} - -int -be_visitor_union_any_op_compiled_cs:: -gen_const_extraction (TAO_OutStream *os, - be_union *node) -{ - *os << be_nl << "if (stream >> *(" << node->name () - << " *)_tao_elem)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->_tao_replace (" - << be_idt << be_idt_nl - << node->tc_name () << "," << be_nl - << "1," << be_nl - << "ACE_reinterpret_cast (void *, ACE_const_cast (" - << node->name () << " *&, _tao_elem))," << be_nl - << node->name () << "::_tao_any_destructor," << be_nl - << "ACE_TRY_ENV" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl - << "return 1;" << be_uidt_nl - << "}" << be_nl - << "else" << be_nl - << "{" << be_idt_nl - << "delete ACE_const_cast (" << node->name () - << " *&, _tao_elem);" << be_nl - << "_tao_elem = 0;" << be_uidt_nl - << "}"; - return 0; -} - -// **************************************************************** - -be_visitor_union_any_op_interpretive_cs:: -be_visitor_union_any_op_interpretive_cs (be_visitor_context *ctx) - : be_visitor_union_any_op_cs (ctx) -{ -} - -int -be_visitor_union_any_op_interpretive_cs:: -gen_insertion (TAO_OutStream *os, - be_union *node) -{ - *os << "_tao_any.replace (" << node->tc_name () - << ", _any_val, 1, ACE_TRY_ENV);" << " // copy the value" << be_nl - << "ACE_TRY_CHECK;" << be_uidt_nl; - return 0; -} - -int -be_visitor_union_any_op_interpretive_cs:: -gen_insertion_nocopy (TAO_OutStream *os, - be_union *node) -{ - *os << "_tao_any.replace (" << node->tc_name () << ", " - << "_tao_elem, 1, ACE_TRY_ENV); // consume it" << be_nl - << "ACE_TRY_CHECK;" << be_uidt_nl; - return 0; -} - -int -be_visitor_union_any_op_interpretive_cs:: -gen_extraction (TAO_OutStream *os, - be_union *node) -{ - *os << "if (stream.decode (" << node->tc_name () - << ", _tao_elem, 0, ACE_TRY_ENV)" << be_nl - << " == CORBA::TypeCode::TRAVERSE_CONTINUE)" << be_nl - << "{" << be_idt_nl - << "((CORBA::Any *)&_tao_any)->replace (" - << node->tc_name () << ", _tao_elem, 1, ACE_TRY_ENV);" << be_nl - << "ACE_TRY_CHECK;" << be_uidt_nl - << "}"; - return 0; -} - -int -be_visitor_union_any_op_interpretive_cs:: -gen_const_extraction (TAO_OutStream *os, - be_union *node) -{ - return this->gen_extraction (os, - node); -} diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp index c98515ab002..ee26d59dec1 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/arglist.cpp @@ -84,10 +84,7 @@ be_visitor_obv_operation_arglist::visit_operation (be_operation *node) << "TAO_default_environment ())" << be_uidt; break; -// case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IH: -// case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IS: -// case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_OTHERS: - case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS: + case TAO_CodeGen::TAO_OBV_OPERATION_ARGLIST_IMPL_CS: // last argument - is always CORBA::Environment *os << "CORBA::Environment &ACE_TRY_ENV)"; break; diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h index 85697babcde..3739337d4f1 100644 --- a/TAO/TAO_IDL/be_include/be_codegen.h +++ b/TAO/TAO_IDL/be_include/be_codegen.h @@ -71,14 +71,9 @@ public: TAO_ARGUMENT_MARSHAL_SS, // passing argument node to the TAO_ARGUMENT_DEMARSHAL_SS, // demarshal and marshal // operations - TAO_ARGUMENT_POST_MARSHAL_SS, - TAO_ARGUMENT_PRE_UPCALL_SS, // preprocessing of argument - // variable before upcall TAO_ARGUMENT_UPCALL_SS, // passing argument variable to upcall - TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument - // variable to upcall - TAO_ARGUMENT_POST_UPCALL_SS, // postprocessing of argument - // variable after upcall + TAO_ARGUMENT_COLLOCATED_UPCALL_SS, // passing argument + // variable to upcall // emitting code for attributes. TAO_ATTRIBUTE_CH, // in client header @@ -260,7 +255,6 @@ public: TAO_OPERATION_RETVAL_INVOKE_CS, // passing the return type // variable to do_static_call TAO_OPERATION_ARG_INVOKE_CS, // passing argument variable to do_static_call - TAO_OPERATION_RETVAL_POST_INVOKE_CS, // processing of return type // after do_static_call TAO_OPERATION_ARG_POST_INVOKE_CS, // processing of arg after do_static_call TAO_OPERATION_RETVAL_RETURN_CS, // returning the return type @@ -268,18 +262,14 @@ public: TAO_OPERATION_EXCEPTLIST_CS, // generating the exception list TAO_OPERATION_RETVAL_DECL_SS, // return type decl in skeleton TAO_OPERATION_ARG_DECL_SS, // argument decl in skeleton - TAO_OPERATION_RETVAL_DEMARSHAL_SS, // passing return type variable TAO_OPERATION_ARG_DEMARSHAL_SS, // and argument variables to the TAO_OPERATION_RETVAL_MARSHAL_SS, // marshal and demarshal operations TAO_OPERATION_ARG_MARSHAL_SS, - TAO_OPERATION_ARG_POST_MARSHAL_SS, TAO_OPERATION_RETVAL_ASSIGN_SS, // assigning to return type // variable - TAO_OPERATION_ARG_PRE_UPCALL_SS, // pre upcall processing TAO_OPERATION_ARG_UPCALL_SS, // variables to upcall TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS, // variables to upcall for // collocated op - TAO_OPERATION_RETVAL_POST_UPCALL_SS, // post upcall processing for TAO_OPERATION_ARG_POST_UPCALL_SS, // return and argument variables TAO_OPERATION_RESULT_SS, // XXXASG rm? TAO_OPERATION_TIE_SH, diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument.h b/TAO/TAO_IDL/be_include/be_visitor_argument.h index 560d37f2859..9837a64c5ba 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument.h @@ -26,18 +26,12 @@ #include "be_visitor_scope.h" #include "be_visitor_argument/argument.h" #include "be_visitor_argument/arglist.h" -#include "be_visitor_argument/pre_docall_cs.h" -#include "be_visitor_argument/docall_cs.h" -#include "be_visitor_argument/post_docall_cs.h" -#include "be_visitor_argument/post_docall_compiled_cs.h" #include "be_visitor_argument/vardecl_ss.h" -#include "be_visitor_argument/pre_upcall_ss.h" #include "be_visitor_argument/upcall_ss.h" #include "be_visitor_argument/post_upcall_ss.h" #include "be_visitor_argument/marshal_ss.h" -#include "be_visitor_argument/post_marshal_ss.h" -#include "be_visitor_argument/compiled_marshal_cs.h" -#include "be_visitor_argument/compiled_marshal_ss.h" #include "be_visitor_argument/pre_invoke_cs.h" +#include "be_visitor_argument/invoke_cs.h" +#include "be_visitor_argument/post_invoke_cs.h" #endif /* _BE_VISITOR_ARGUMENT_H */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/compiled_marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/compiled_marshal_ss.h deleted file mode 100644 index e04b8edf204..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/compiled_marshal_ss.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// compiled_marshal_ss.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments for passing the arguments -// to the CDR << and >> operators -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_SS_H_ -#define _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_SS_H_ - -// ************************************************************ -// class be_visitor_args_compiled_marshal_ss -// ************************************************************ -class be_visitor_args_compiled_marshal_ss : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_compiled_marshal_ss - // - // = DESCRIPTION - // Code to be generated when making the do_static_call - // -public: - be_visitor_args_compiled_marshal_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_compiled_marshal_ss (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h deleted file mode 100644 index 03054f5ee01..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/docall_cs.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// docall_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments for passing the arguments -// to the docall in the client side stub. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_DOCALL_CS_H_ -#define _BE_VISITOR_ARGUMENT_DOCALL_CS_H_ - -// ************************************************************ -// class be_visitor_args_docall_cs -// ************************************************************ -class be_visitor_args_docall_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_docall_cs - // - // = DESCRIPTION - // Code to be generated when making the do_static_call - // -public: - be_visitor_args_docall_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_docall_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/compiled_marshal_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h index 47a30f5b143..928a85ca126 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/compiled_marshal_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/invoke_cs.h @@ -8,7 +8,7 @@ // TAO IDL // // = FILENAME -// compiled_marshal_cs.h +// invoke_cs.h // // = DESCRIPTION // Visitors for generation of code for Arguments for passing the arguments @@ -19,26 +19,27 @@ // // ============================================================================ -#ifndef _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_CS_H_ -#define _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_CS_H_ +#ifndef _BE_VISITOR_ARGUMENT_INVOKE_CS_H_ +#define _BE_VISITOR_ARGUMENT_INVOKE_CS_H_ // ************************************************************ -// class be_visitor_args_compiled_marshal_cs +// class be_visitor_args_invoke_cs // ************************************************************ -class be_visitor_args_compiled_marshal_cs : public be_visitor_args + +class be_visitor_args_invoke_cs : public be_visitor_args { // // = TITLE - // be_visitor_args_compiled_marshal_cs + // be_visitor_args_invoke_cs // // = DESCRIPTION - // Code to be generated when making the do_static_call + // Code to be generated when making the invocation // public: - be_visitor_args_compiled_marshal_cs (be_visitor_context *ctx); + be_visitor_args_invoke_cs (be_visitor_context *ctx); // constructor - virtual ~be_visitor_args_compiled_marshal_cs (void); + virtual ~be_visitor_args_invoke_cs (void); // destructor virtual int visit_argument (be_argument *node); @@ -86,4 +87,4 @@ public: }; -#endif /* _BE_VISITOR_ARGUMENT_COMPILED_MARSHAL_CS_H_ */ +#endif /* _BE_VISITOR_ARGUMENT_INVOKE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h index e116238f598..61d68377f42 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/marshal_ss.h @@ -32,7 +32,7 @@ class be_visitor_args_marshal_ss : public be_visitor_args // be_visitor_args_marshal_ss // // = DESCRIPTION - // Visitor for passing argument to the marshaling/demarshaling routine + // Code to be generated when making the invocation // public: be_visitor_args_marshal_ss (be_visitor_context *ctx); @@ -58,6 +58,14 @@ public: virtual int visit_interface_fwd (be_interface_fwd *node); // visit interface forward +#ifdef IDL_HAS_VALUETYPE + virtual int visit_valuetype (be_valuetype *node); + // visit valuetype + + virtual int visit_valuetype_fwd (be_valuetype_fwd *node); + // visit valuetype forward +#endif /* IDL_HAS_VALUETYPE */ + virtual int visit_predefined_type (be_predefined_type *node); // visit predefined type @@ -75,7 +83,6 @@ public: virtual int visit_typedef (be_typedef *node); // visit the typedef type - }; #endif /* _BE_VISITOR_ARGUMENT_MARSHAL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h deleted file mode 100644 index 4d5e5876eea..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_cs.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// post_docall_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments for docall post processing -// in the client side stub. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_ -#define _BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_ - -// ************************************************************ -// class be_visitor_args_post_docall_cs -// ************************************************************ -class be_visitor_args_post_docall_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_post_docall_cs - // - // = DESCRIPTION - // Code to be generated after the do_static_call is done - // -public: - be_visitor_args_post_docall_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_post_docall_cs (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_string (be_string *node); - // visit the string type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type -}; - -#endif /* _BE_VISITOR_ARGUMENT_POST_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_compiled_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_invoke_cs.h index 53ae360551c..d48f456799f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/post_docall_compiled_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_invoke_cs.h @@ -8,7 +8,7 @@ // TAO IDL // // = FILENAME -// post_docall_cs.h +// post_invoke_cs.h // // = DESCRIPTION // Visitors for generation of code for Arguments for docall post processing @@ -19,26 +19,27 @@ // // ============================================================================ -#ifndef _BE_VISITOR_ARGUMENT_POST_DOCALL_COMPILED_CS_H_ -#define _BE_VISITOR_ARGUMENT_POST_DOCALL_COMPILED_CS_H_ +#ifndef _BE_VISITOR_ARGUMENT_POST_INVOKE_CS_H_ +#define _BE_VISITOR_ARGUMENT_POST_INVOKE_CS_H_ // ************************************************************ -// class be_visitor_args_post_docall_compiled_cs +// class be_visitor_args_post_invoke_cs // ************************************************************ -class be_visitor_args_post_docall_compiled_cs : public be_visitor_args + +class be_visitor_args_post_invoke_cs : public be_visitor_args { // // = TITLE - // be_visitor_args_post_docall_compiled_cs + // be_visitor_args_post_invoke_cs // // = DESCRIPTION - // Code to be generated after the do_static_call is done + // Code to be generated after the invocation is done // public: - be_visitor_args_post_docall_compiled_cs (be_visitor_context *ctx); + be_visitor_args_post_invoke_cs (be_visitor_context *ctx); // constructor - virtual ~be_visitor_args_post_docall_compiled_cs (void); + virtual ~be_visitor_args_post_invoke_cs (void); // destructor virtual int visit_argument (be_argument *node); @@ -67,4 +68,4 @@ public: // visit string }; -#endif /* _BE_VISITOR_ARGUMENT_POST_DOCALL_COMPILED_CS_H_ */ +#endif /* _BE_VISITOR_ARGUMENT_POST_INVOKE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h index 63ac801198b..32ff63812a7 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/post_upcall_ss.h @@ -26,11 +26,12 @@ // ************************************************************ // class be_visitor_args_post_upcall_ss // ************************************************************ -class be_visitor_args_post_upcall_ss : public be_visitor_args + +class be_visitor_args_post_upcall_ss : public be_visitor_scope { // // = TITLE - // be_visitor_args_post_upcall_ss + // be_visitor_compiled_args_post_upcall // // = DESCRIPTION // Visitor for post processing after upcall @@ -45,70 +46,14 @@ public: virtual int visit_argument (be_argument *node); // visit the argument node - // =visit all the nodes that can be the types for the argument + virtual int visit_operation (be_operation *node); + // visit operation node virtual int visit_array (be_array *node); // visit array type - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - virtual int visit_typedef (be_typedef *node); // visit the typedef type - -}; - -// **************************************************************** - -// ************************************************************ -// class be_visitor_compiled_args_post_upcall -// ************************************************************ - -class be_visitor_compiled_args_post_upcall : public be_visitor_scope -{ - // - // = TITLE - // be_visitor_compiled_args_post_upcall - // - // = DESCRIPTION - // Visitor for post processing after upcall - // -public: - be_visitor_compiled_args_post_upcall (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_compiled_args_post_upcall (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_operation (be_operation *node); - virtual int visit_array (be_array *node); - virtual int visit_typedef (be_typedef *node); }; #endif /* _BE_VISITOR_ARGUMENT_POST_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h deleted file mode 100644 index fb5acb67951..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_docall_cs.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// pre_docall_cs.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments for pre docall processing -// in client side stub that uses interpretive marshaling. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_ -#define _BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_ - -// ************************************************************ -// class be_visitor_args_pre_docall_cs -// ************************************************************ -class be_visitor_args_pre_docall_cs : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_docall_cs - // - // = DESCRIPTION - // Code to be generated when making the do_static_call - // -public: - be_visitor_args_pre_docall_cs (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_pre_docall_cs (void); - // destructor - - virtual int void_return_type (void); - // return true if the operation return type is void - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_PRE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_invoke_cs.h b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_invoke_cs.h index 9edb4b60288..fb7550e15f0 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_invoke_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_invoke_cs.h @@ -12,7 +12,7 @@ // // = DESCRIPTION // Visitors for generation of code for Arguments for pre invoke processing -// in client side stub that uses compiled marshaling. +// in client side stub. // // = AUTHOR // Aniruddha Gokhale @@ -25,7 +25,7 @@ // ************************************************************ // class be_visitor_args_pre_invoke_cs // ************************************************************ -class be_visitor_args_pre_invoke_cs : public be_visitor_args_pre_docall_cs +class be_visitor_args_pre_invoke_cs : public be_visitor_args { // // = TITLE @@ -41,12 +41,40 @@ public: virtual ~be_visitor_args_pre_invoke_cs (void); // destructor + virtual int void_return_type (void); + // return true if the operation return type is void + + virtual int visit_argument (be_argument *node); + // visit the argument node + + // =visit all the nodes that can be the types for the argument + + virtual int visit_array (be_array *node); + // visit array type + virtual int visit_interface (be_interface *node); // visit interface virtual int visit_interface_fwd (be_interface_fwd *node); // visit interface forward + virtual int visit_predefined_type (be_predefined_type *node); + // visit predefined type + + virtual int visit_sequence (be_sequence *node); + // visit sequence type + + virtual int visit_string (be_string *node); + // visit string type + + virtual int visit_structure (be_structure *node); + // visit structure type + + virtual int visit_union (be_union *node); + // visit union type + + virtual int visit_typedef (be_typedef *node); + // visit the typedef type }; #endif /* _BE_VISITOR_ARGUMENT_PRE_INVOKE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h deleted file mode 100644 index bb2b3430e79..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/pre_upcall_ss.h +++ /dev/null @@ -1,81 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// pre_upcall_ss.h -// -// = DESCRIPTION -// Visitors for generation of code for Arguments. This generates the -// pre upcall processing of arguments in the server-side skeleton. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_ -#define _BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_ - -// ************************************************************ -// class be_visitor_args_pre_upcall_ss -// ************************************************************ -class be_visitor_args_pre_upcall_ss : public be_visitor_args -{ - // - // = TITLE - // be_visitor_args_upcall_ss - // - // = DESCRIPTION - // Visitor for passing argument to the upcall - // -public: - be_visitor_args_pre_upcall_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_visitor_args_pre_upcall_ss (void); - // destructor - - virtual int visit_argument (be_argument *node); - // visit the argument node - - // =visit all the nodes that can be the types for the argument - - virtual int visit_array (be_array *node); - // visit array type - - virtual int visit_enum (be_enum *node); - // visit the enum node - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - - virtual int visit_predefined_type (be_predefined_type *node); - // visit predefined type - - virtual int visit_sequence (be_sequence *node); - // visit sequence type - - virtual int visit_string (be_string *node); - // visit string type - - virtual int visit_structure (be_structure *node); - // visit structure type - - virtual int visit_union (be_union *node); - // visit union type - - virtual int visit_typedef (be_typedef *node); - // visit the typedef type - -}; - -#endif /* _BE_VISITOR_ARGUMENT_PRE_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h index a4209caeb9e..5cf3e6c3dfa 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_argument/vardecl_ss.h @@ -86,40 +86,4 @@ public: }; -// ************************************************************ -// class be_compiled_visitor_args_vardecl_ss -// ************************************************************ -class be_compiled_visitor_args_vardecl_ss : public be_visitor_args_vardecl_ss -{ - // - // = TITLE - // be_compiled_visitor_args_vardecl_ss - // - // = DESCRIPTION - // Visitor for variable declaration for argument for compiled marshaling - // skeletons - // -public: - be_compiled_visitor_args_vardecl_ss (be_visitor_context *ctx); - // constructor - - virtual ~be_compiled_visitor_args_vardecl_ss (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit interface - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit interface forward - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - -}; - #endif /* _BE_VISITOR_ARGUMENT_VARDECL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_factory.h b/TAO/TAO_IDL/be_include/be_visitor_factory.h index 2061b51bb04..4eb8b631457 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_factory.h +++ b/TAO/TAO_IDL/be_include/be_visitor_factory.h @@ -62,27 +62,6 @@ public: // make the right visitor based on the context and code generation state }; -class TAO_Interpretive_Visitor_Factory : public TAO_Visitor_Factory -{ - // =TITLE - // TAO_Interpretive_Visitor_Factory - // - // =DESCRIPTION - // A concrete visitor factory for generating the visitors for stubs and - // skeletons using interpretive marshaling. - -public: - - TAO_Interpretive_Visitor_Factory (void); - // constructor - - virtual ~TAO_Interpretive_Visitor_Factory (void); - // destructor - - virtual be_visitor *make_visitor (be_visitor_context *); - // make the right visitor based on the context and code generation state -}; - class TAO_Compiled_Visitor_Factory : public TAO_Visitor_Factory { // =TITLE @@ -106,7 +85,6 @@ public: // Singleton instance of the BE Visitor Factory typedef ACE_Singleton<TAO_Common_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_COMMON_VISITOR_FACTORY; -typedef ACE_Singleton<TAO_Interpretive_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_INTERPRETIVE_VISITOR_FACTORY; typedef ACE_Singleton<TAO_Compiled_Visitor_Factory, ACE_SYNCH_RECURSIVE_MUTEX> TAO_COMPILED_VISITOR_FACTORY; #endif /* if !defined _TAO_BE_VISITOR_FACTORY_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation.h index 7fe73eabedd..fdefb686fcd 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation.h @@ -41,9 +41,7 @@ #include "be_visitor_operation/rettype.h" #include "be_visitor_operation/rettype_is.h" #include "be_visitor_operation/rettype_vardecl_cs.h" -#include "be_visitor_operation/rettype_pre_docall_cs.h" -#include "be_visitor_operation/rettype_docall_cs.h" -#include "be_visitor_operation/rettype_post_docall_cs.h" +#include "be_visitor_operation/rettype_post_invoke_cs.h" #include "be_visitor_operation/rettype_return_cs.h" #include "be_visitor_operation/exceptlist_cs.h" #include "be_visitor_operation/argument.h" @@ -53,7 +51,6 @@ #include "be_visitor_operation/rettype_assign_ss.h" #include "be_visitor_operation/rettype_post_upcall_ss.h" #include "be_visitor_operation/rettype_marshal_ss.h" -#include "be_visitor_operation/compiled_marshal.h" #include "be_visitor_operation/rettype_pre_invoke_cs.h" #include "be_visitor_operation/ami_ch.h" #include "be_visitor_operation/ami_cs.h" diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/compiled_marshal.h b/TAO/TAO_IDL/be_include/be_visitor_operation/compiled_marshal.h deleted file mode 100644 index e27360f0b29..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/compiled_marshal.h +++ /dev/null @@ -1,90 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// compiled_marshal.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the code -// for passing the return type variable to the CDR ops -// made. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_RETTYPE_COMPILED_MARSHAL_H_ -#define _BE_VISITOR_OPERATION_RETTYPE_COMPILED_MARSHAL_H_ - -// ************************************************************ -// Operation visitor for passing return variable to do_static_call -// ************************************************************ - -class be_visitor_operation_rettype_compiled_marshal :public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_compiled_marshal - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration ofr an operation - // return type - // -public: - be_visitor_operation_rettype_compiled_marshal (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_rettype_compiled_marshal (void); - // destructor - - int visit_operation (be_operation *node); - // visit operation - - int visit_array (be_array *node); - // visit an array node - - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - -#ifdef IDL_HAS_VALUETYPE - virtual int visit_valuetype (be_valuetype *node); - // visit valuetype - - virtual int visit_valuetype_fwd (be_valuetype_fwd *node); - // visit valuetype forward -#endif /* IDL_HAS_VALUETYPE */ - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - - int visit_typedef (be_typedef *node); - // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - -}; - -#endif /* _BE_VISITOR_OPERATION_RETTYPE_COMPILED_MARSHAL_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h index 887f6c3dd0b..60c35235659 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_cs.h @@ -49,10 +49,11 @@ public: // visit argument to generate ParamData entries // = template methods - virtual int gen_pre_stub_info (be_operation *, be_type *) = 0; + virtual int gen_pre_stub_info (be_operation *node); // generate any info before the actual code for the stub is generated - virtual int gen_marshal_and_invoke (be_operation *, be_type *) = 0; + virtual int gen_marshal_and_invoke (be_operation *node, + be_type *bt); // generate code that marshals the arguments and transmits them // =helper @@ -60,16 +61,16 @@ public: // stuff to output after every member of the scope is handled virtual int gen_raise_exception (be_type *, - const char * excep, - const char * status); + const char *excep, + const char *status); // helper that generates code for raising an exception virtual int gen_check_exception (be_type *); // helper that generates code for checking for an exception virtual int gen_raise_interceptor_exception (be_type *, - const char * excep, - const char * status); + const char *excep, + const char *status); // helper that generates code for raising an exception within // interceptor's try block @@ -85,58 +86,4 @@ private: char *operation_name_; }; -// specialized visitors - -class be_interpretive_visitor_operation_cs : public be_visitor_operation_cs -{ - // - // = TITLE - // be_interpretive_visitor_operation_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for operation - // using interpretive marshaling. - // - // -public: - be_interpretive_visitor_operation_cs (be_visitor_context *); - // ctor - - ~be_interpretive_visitor_operation_cs (void); - // dtor - - virtual int gen_pre_stub_info (be_operation *, be_type *); - // generate any info before the actual code for the stub is generated - - virtual int gen_marshal_and_invoke (be_operation *, be_type *); - // generate code that marshals the arguments and transmits them - -}; - -class be_compiled_visitor_operation_cs : public be_visitor_operation_cs -{ - // - // = TITLE - // be_compiled_visitor_operation_cs - // - // = DESCRIPTION - // This is a concrete visitor to generate the client stubs for operation - // using compiled marshaling. - // - // -public: - be_compiled_visitor_operation_cs (be_visitor_context *); - // ctor - - ~be_compiled_visitor_operation_cs (void); - // dtor - - virtual int gen_pre_stub_info (be_operation *, be_type *); - // generate any info before the actual code for the stub is generated - - virtual int gen_marshal_and_invoke (be_operation *, be_type *); - // generate code that marshals the arguments and transmits them - -}; - #endif /* _BE_VISITOR_OPERATION_OPERATION_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h index b1d0bceb5bd..1b73adb8edd 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation_ss.h @@ -50,13 +50,15 @@ public: // template methods - virtual int gen_pre_skel_info (be_operation *, be_type *) = 0; + virtual int gen_pre_skel_info (be_operation *node); // generate any pre skeleton code info - virtual int gen_demarshal_params (be_operation *, be_type *) = 0; + virtual int gen_demarshal_params (be_operation *node, + be_type *bt); // generate code for demarshaling incoming parameters - virtual int gen_marshal_params (be_operation *, be_type *) = 0; + virtual int gen_marshal_params (be_operation *node, + be_type *bt); // generate code for marshaling outgoing parameters // = helper @@ -64,9 +66,9 @@ public: // stuff to output after every member of the scope is handled virtual int gen_raise_exception (be_type *, - const char * excep, - const char * status, - const char * env); + const char *excep, + const char *status, + const char *env); // helper that generates code for raising an exception virtual int gen_check_exception (be_type *, const char *env); @@ -84,68 +86,4 @@ private: char *operation_name_; }; -// concrete visitors - -class be_interpretive_visitor_operation_ss : public be_visitor_operation_ss -{ - // - // = TITLE - // be_interpretive_visitor_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for - // operation using interpretive marshaling - // - // -public: - be_interpretive_visitor_operation_ss (be_visitor_context *ctx); - // constructor - - ~be_interpretive_visitor_operation_ss (void); - // destructor - - // template methods - - virtual int gen_pre_skel_info (be_operation *, be_type *); - // generate any pre skeleton code info - - virtual int gen_demarshal_params (be_operation *, be_type *); - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *, be_type *); - // generate code for marshaling outgoing parameters - -}; - -class be_compiled_visitor_operation_ss : public be_visitor_operation_ss -{ - // - // = TITLE - // be_compiled_visitor_operation_ss - // - // = DESCRIPTION - // This is a concrete visitor to generate the server skeletons for - // operation using compiled marshaling - // - // -public: - be_compiled_visitor_operation_ss (be_visitor_context *ctx); - // constructor - - ~be_compiled_visitor_operation_ss (void); - // destructor - - // template methods - - virtual int gen_pre_skel_info (be_operation *, be_type *); - // generate any pre skeleton code info - - virtual int gen_demarshal_params (be_operation *, be_type *); - // generate code for demarshaling incoming parameters - - virtual int gen_marshal_params (be_operation *, be_type *); - // generate code for marshaling outgoing parameters - -}; - #endif /* _BE_VISITOR_OPERATION_OPERATION_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h deleted file mode 100644 index bb7de8fe3ad..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_docall_cs.h +++ /dev/null @@ -1,79 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_docall_cs.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the code -// for passing the return type variable to the docall -// made. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_ -#define _BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_ - -// ************************************************************ -// Operation visitor for passing return variable to do_static_call -// ************************************************************ - -class be_visitor_operation_rettype_docall_cs :public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_docall_cs - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration ofr an operation - // return type - // -public: - be_visitor_operation_rettype_docall_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_rettype_docall_cs (void); - // destructor - - int visit_array (be_array *node); - // visit an array node - - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - - int visit_typedef (be_typedef *node); - // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - -}; - -#endif /* _BE_VISITOR_OPERATION_RETTYPE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h index 845ddb5f6c1..50602a01f57 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_marshal_ss.h @@ -12,7 +12,8 @@ // // = DESCRIPTION // Visitor for generating code for IDL operations. This generates the code -// for passing the return type variable to the marshaler. +// for passing the return type variable to the CDR ops +// made. // // = AUTHOR // Aniruddha Gokhale @@ -20,22 +21,21 @@ // ============================================================================ #ifndef _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SS_H_ -#define _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SSH_ +#define _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SS_H_ -// *********************************************************************** -// Operation visitor for passing return type to the marshal/demarshal routine -// inside the server skeleton -// *********************************************************************** +// ************************************************************ +// Operation visitor for passing return variable to invocation +// ************************************************************ -class be_visitor_operation_rettype_marshal_ss : public be_visitor_decl +class be_visitor_operation_rettype_marshal_ss :public be_visitor_decl { // // = TITLE - // be_visitor_operation_rettype_marshal_ss + // be_visitor_operation_rettype_compiled_marshal // // = DESCRIPTION - // This is a visitor to pass return type to the marshal/demarshal routines - // + // This is a visitor to generate a variable declaration ofr an operation + // return type // public: be_visitor_operation_rettype_marshal_ss (be_visitor_context *ctx); @@ -44,6 +44,9 @@ public: ~be_visitor_operation_rettype_marshal_ss (void); // destructor + int visit_operation (be_operation *node); + // visit operation + int visit_array (be_array *node); // visit an array node @@ -84,4 +87,4 @@ public: }; -#endif /* _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SSH_ */ +#endif /* _BE_VISITOR_OPERATION_RETTYPE_MARSHAL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h deleted file mode 100644 index 9129e0b86aa..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_docall_cs.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_post_docall_cs.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the code -// for post processing of the return type variable after the docall is -// made. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_ -#define _BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_ - -// ************************************************************ -// Operation visitor for postprocessing after do_static_call is invoked -// ************************************************************ - -class be_visitor_operation_rettype_post_docall_cs :public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_psot_docall_cs - // - // = DESCRIPTION - // This is a visitor to generate any post processing after the do_static_call is - // made - // -public: - be_visitor_operation_rettype_post_docall_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_rettype_post_docall_cs (void); - // destructor - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node -}; - -// **************************************************************** - -class be_visitor_operation_compiled_rettype_post_docall : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_post_docall - // - // = DESCRIPTION - // This is a visitor for post processing after the invocation in - // compiled marshaling - // - // -public: - be_visitor_operation_compiled_rettype_post_docall (be_visitor_context *ctx); - // constructor - - int visit_array (be_array *node); - int visit_typedef (be_typedef *node); -}; - -#endif /* _BE_VISITOR_OPERATION_RETTYPE_POST_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_invoke_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_invoke_cs.h new file mode 100644 index 00000000000..6c03c2a5924 --- /dev/null +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_invoke_cs.h @@ -0,0 +1,52 @@ +// +// $Id$ +// + +// ============================================================================ +// +// = LIBRARY +// TAO IDL +// +// = FILENAME +// rettype_post_invoke_cs.h +// +// = DESCRIPTION +// Visitor for generating code for IDL operations. This generates the code +// for post processing of the return type variable after the docall is +// made. +// +// = AUTHOR +// Aniruddha Gokhale +// +// ============================================================================ + +#ifndef _BE_VISITOR_OPERATION_RETTYPE_POST_INVOKE_CS_H_ +#define _BE_VISITOR_OPERATION_RETTYPE_POST_INVOKE_CS_H_ + +// ************************************************************ +// Operation visitor for postprocessing after invocation +// ************************************************************ + +class be_visitor_operation_rettype_post_invoke_cs : public be_visitor_decl +{ + // + // = TITLE + // be_visitor_operation_rettype_post_docall + // + // = DESCRIPTION + // This is a visitor for post processing after the invocation in + // compiled marshaling + // + // +public: + be_visitor_operation_rettype_post_invoke_cs (be_visitor_context *ctx); + // constructor + + int visit_array (be_array *node); + // visit an array node + + int visit_typedef (be_typedef *node); + // visit a typedef node +}; + +#endif /* _BE_VISITOR_OPERATION_RETTYPE_POST_INVOKE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h index 3ba7eedbef3..55b0a515e03 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_post_upcall_ss.h @@ -31,7 +31,7 @@ class be_visitor_operation_rettype_post_upcall_ss : public be_visitor_decl { // // = TITLE - // be_visitor_operation_rettype_post_upcall_ss + // be_visitor_operation_rettype_post_upcall // // = DESCRIPTION // This is a visitor for post processing after an upcall @@ -41,60 +41,11 @@ public: be_visitor_operation_rettype_post_upcall_ss (be_visitor_context *ctx); // constructor - ~be_visitor_operation_rettype_post_upcall_ss (void); - // destructor - int visit_array (be_array *node); // visit an array node - int visit_enum (be_enum *node); - // visit an enum node - - int visit_interface (be_interface *node); - // visit an interface node - - int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - - int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - int visit_sequence (be_sequence *node); - // visit a sequence node - - int visit_string (be_string *node); - // visit a sequence node - - int visit_structure (be_structure *node); - // visit a structure node - int visit_typedef (be_typedef *node); // visit a typedef node - - int visit_union (be_union *node); - // visit a union node - -}; - -// **************************************************************** - -class be_visitor_operation_compiled_rettype_post_upcall : public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_post_upcall - // - // = DESCRIPTION - // This is a visitor for post processing after an upcall in - // compiled marshaling - // - // -public: - be_visitor_operation_compiled_rettype_post_upcall (be_visitor_context *ctx); - // constructor - - int visit_array (be_array *node); - int visit_typedef (be_typedef *node); }; #endif /* _BE_VISITOR_OPERATION_RETTYPE_POST_UPCALL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h deleted file mode 100644 index 2a11b2cd605..00000000000 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_docall_cs.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// $Id$ -// - -// ============================================================================ -// -// = LIBRARY -// TAO IDL -// -// = FILENAME -// rettype_pre_docall_cs.h -// -// = DESCRIPTION -// Visitor for generating code for IDL operations. This generates the code -// for pre processing of the return type variable before the docall is -// made. -// -// = AUTHOR -// Aniruddha Gokhale -// -// ============================================================================ - -#ifndef _BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_ -#define _BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_ - -// ************************************************************ -// Operation visitor for preprocessing before do_static_call is invoked -// ************************************************************ - -class be_visitor_operation_rettype_pre_docall_cs :public be_visitor_decl -{ - // - // = TITLE - // be_visitor_operation_rettype_pre_docall_cs - // - // = DESCRIPTION - // This is a visitor to generate any pre processing before the do_static_call is - // made - // -public: - be_visitor_operation_rettype_pre_docall_cs (be_visitor_context *ctx); - // constructor - - ~be_visitor_operation_rettype_pre_docall_cs (void); - // destructor - - virtual int visit_array (be_array *node); - // visit an array node - - virtual int visit_interface (be_interface *node); - // visit an interface node - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit an interface node - - virtual int visit_predefined_type (be_predefined_type *node); - // visit a predefined type node - - virtual int visit_sequence (be_sequence *node); - // visit a sequence node - - virtual int visit_structure (be_structure *node); - // visit a structure node - - virtual int visit_typedef (be_typedef *node); - // visit a typedef node - - virtual int visit_union (be_union *node); - // visit a union node - -}; - -#endif /* _BE_VISITOR_OPERATION_RETTYPE_PRE_DOCALL_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_invoke_cs.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_invoke_cs.h index 2abe28ed76f..3ffbc85229c 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_invoke_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_pre_invoke_cs.h @@ -27,16 +27,15 @@ // Operation visitor for preprocessing before invoke is invoked // ************************************************************ -class be_visitor_operation_rettype_pre_invoke_cs : - public be_visitor_operation_rettype_pre_docall_cs +class be_visitor_operation_rettype_pre_invoke_cs : public be_visitor_decl { // // = TITLE // be_visitor_operation_rettype_pre_invoke_cs // // = DESCRIPTION - // This is a visitor to generate any pre processing before the do_static_call is - // made + // This is a visitor to generate any pre processing before + // the invocation is made. // public: be_visitor_operation_rettype_pre_invoke_cs (be_visitor_context *ctx); @@ -45,12 +44,29 @@ public: ~be_visitor_operation_rettype_pre_invoke_cs (void); // destructor + virtual int visit_array (be_array *node); + // visit an array node + virtual int visit_interface (be_interface *node); // visit an interface node virtual int visit_interface_fwd (be_interface_fwd *node); // visit an interface node + virtual int visit_predefined_type (be_predefined_type *node); + // visit a predefined type node + + virtual int visit_sequence (be_sequence *node); + // visit a sequence node + + virtual int visit_structure (be_structure *node); + // visit a structure node + + virtual int visit_typedef (be_typedef *node); + // visit a typedef node + + virtual int visit_union (be_union *node); + // visit a union node }; #endif /* _BE_VISITOR_OPERATION_RETTYPE_PRE_INVOKE_CS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h index 5adf69c8c89..44ee6ef34eb 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/rettype_vardecl_ss.h @@ -84,35 +84,4 @@ public: }; -// ************************************************************ -// Operation visitor for return type variable declaration in the server -// skeleton using compiled marshaling. This one overrides 2 methods of the base -// class -// ************************************************************ - -class be_compiled_visitor_operation_rettype_vardecl_ss : - public be_visitor_operation_rettype_vardecl_ss -{ - // - // = TITLE - // be_compiled_visitor_operation_rettype_vardecl_ss - // - // = DESCRIPTION - // This is a visitor to generate a variable declaration ofr an operation - // return type in the server skeleton using compiled marshaling - // -public: - be_compiled_visitor_operation_rettype_vardecl_ss (be_visitor_context *ctx); - // constructor - - ~be_compiled_visitor_operation_rettype_vardecl_ss (void); - // destructor - - virtual int visit_interface (be_interface *node); - // visit an interface node - - virtual int visit_interface_fwd (be_interface_fwd *node); - // visit an interface fwd node -}; - #endif /* _BE_VISITOR_OPERATION_RETTYPE_VARDECL_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h index 630fae55433..0d16aefd684 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h +++ b/TAO/TAO_IDL/be_include/be_visitor_union/any_op_cs.h @@ -28,11 +28,11 @@ class be_visitor_union_any_op_cs : public be_visitor_union { // // = TITLE - // be_visitor_union_any_op_cs + // be_visitor_union_any_op_compiled_cs // // = DESCRIPTION - // This is a base class for the visitors generate the Any - // operator implementations + // This is a visitor for unions that generates the Any + // operator implementations. // public: @@ -42,73 +42,8 @@ public: ~be_visitor_union_any_op_cs (void); // destructor - // template methods that the derived visitors must implement. - // They generate the body for the insertion and extraction - // operators. - virtual int gen_insertion_nocopy (TAO_OutStream* os, - be_union *node) = 0; - virtual int gen_insertion (TAO_OutStream* os, - be_union *node) = 0; - virtual int gen_extraction (TAO_OutStream* os, - be_union *node) = 0; - virtual int gen_const_extraction (TAO_OutStream *os, - be_union *node) = 0; - // = The be_visitor methods. virtual int visit_union (be_union *node); - virtual int visit_union_branch (be_union_branch *node); -}; - -class be_visitor_union_any_op_compiled_cs : public be_visitor_union_any_op_cs -{ - // - // = TITLE - // be_visitor_union_any_op_compiled_cs - // - // = DESCRIPTION - // This is a concrete visitor for union that generates the Any - // operator implementations, using compiled marshaling. - // - -public: - be_visitor_union_any_op_compiled_cs (be_visitor_context *ctx); - // constructor - - // = See be_visitor_union_any_op_cs - virtual int gen_insertion (TAO_OutStream *os, - be_union *node); - virtual int gen_insertion_nocopy (TAO_OutStream *os, - be_union *node); - virtual int gen_extraction (TAO_OutStream *os, - be_union *node); - virtual int gen_const_extraction (TAO_OutStream *os, - be_union *node); -}; - -class be_visitor_union_any_op_interpretive_cs : public be_visitor_union_any_op_cs -{ - // - // = TITLE - // be_visitor_union_any_op_interpretive_cs - // - // = DESCRIPTION - // This is a concrete visitor for union that generates the Any - // operator implementations, using interpretive marshaling. - // - -public: - be_visitor_union_any_op_interpretive_cs (be_visitor_context *ctx); - // constructor - - // = See be_visitor_union_any_op_cs - virtual int gen_insertion (TAO_OutStream* os, - be_union *node); - virtual int gen_insertion_nocopy (TAO_OutStream* os, - be_union *node); - virtual int gen_extraction (TAO_OutStream* os, - be_union *node); - virtual int gen_const_extraction (TAO_OutStream *os, - be_union *node); -}; + virtual int visit_union_branch (be_union_branch *node);}; #endif /* _BE_VISITOR_UNION_ANY_OP_CS_H_ */ diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index 13036241b7e..ab1c8137ab3 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -121,8 +121,6 @@ DRV_usage (void) cerr << GTDEVEL (" -g <gperf_path>\tPath for the GPERF program. Default is $ACE_ROOT/bin/gperf\n"); cerr << GTDEVEL (" -Cw\t\t\tWarning if identifier spellings differ only in case (default is error)\n"); cerr << GTDEVEL (" -Ce\t\t\tError if identifier spellings differ only in case (default)\n"); - cerr << GTDEVEL (" -Gc\t\t\tenable Compiled marshaling (default)\n"); - cerr << GTDEVEL (" -Gi\t\t\tenable Interpretive marshaling (default is compiled)\n"); cerr << GTDEVEL (" -Ge [0|1]\t\t\tDisable/Enable generation of CORBA::Environment arguments (enabled by default if ACE_HAS_EXCEPTIONS)\n"); cerr << GTDEVEL (" -Gt\t\t\tenable optimized TypeCode support (unopt by default)\n"); #ifdef IDL_HAS_VALUETYPE @@ -607,21 +605,11 @@ DRV_parse_args (long ac, char **av) break; case 'G': // Enable generation of ... - if (av[i][2] == 'c') - { - // compiled marshaling support - idl_global->compiled_marshaling (1); - } - else if (av[i][2] == 'C') + if (av[i][2] == 'C') { // AMI with Call back. idl_global->ami_call_back (I_TRUE); } - else if (av[i][2] == 'i') - { - // interpretive marshaling support - idl_global->compiled_marshaling (0); - } else if (av[i][2] == 'e') { int option = atoi (av[i+1]); @@ -632,13 +620,11 @@ DRV_parse_args (long ac, char **av) } else if (av[i][2] == 'l') { - // optimized typecode support - idl_global->gen_locality_constraint (1); - // Automatically switch on the generation of // direct collocated stubs and supress the generation // of thru_poa collocated stubs and ami_call_back stuff // if we are building for locality constraint interfaces. + idl_global->gen_locality_constraint (1); idl_global->gen_thru_poa_collocation (0); idl_global->gen_direct_collocation (1); idl_global->ami_call_back (0); diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index d8679786da6..6a6467e9313 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -537,12 +537,6 @@ public: virtual idl_bool obv_support (void); // check if OBV (Valuetype) support is enabled - virtual void compiled_marshaling (idl_bool); - // enable compiled marshaling support - - virtual idl_bool compiled_marshaling (void); - // check if we use compiled marshaling - virtual void gen_impl_files (idl_bool); //enable generation of implementation files @@ -740,9 +734,6 @@ private: idl_bool obv_opt_accessor_; // do we optimize valuetype accessors? - idl_bool compiled_marshaling_; - // do we support compiled marshaling? - idl_bool gen_impl_files_; // are we generating implementation files? diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 29ccad767e9..a017d603c6b 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -137,7 +137,6 @@ IDL_GlobalData::IDL_GlobalData (void) #else obv_support_ (I_FALSE), // ever #endif - compiled_marshaling_ (I_TRUE), gen_impl_files_ (I_FALSE), gen_copy_ctor_ (I_FALSE), gen_assign_op_ (I_FALSE), @@ -1356,18 +1355,6 @@ IDL_GlobalData::obv_support (void) } void -IDL_GlobalData::compiled_marshaling (idl_bool val) -{ - this->compiled_marshaling_ = val; -} - -idl_bool -IDL_GlobalData::compiled_marshaling (void) -{ - return this->compiled_marshaling_; -} - -void IDL_GlobalData::gen_impl_files (idl_bool val) { this->gen_impl_files_ = val; |