diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-17 02:16:19 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-17 02:16:19 +0000 |
commit | 407663427449950e092edecb81681c1966364611 (patch) | |
tree | b5972a3c83378bc13133d102da96d75783bd4d12 /TAO/TAO_IDL | |
parent | 6a31541a3da6cb1ff58b25769ac1f9af10904174 (diff) | |
download | ATCD-407663427449950e092edecb81681c1966364611.tar.gz |
wstring mods.
Diffstat (limited to 'TAO/TAO_IDL')
51 files changed, 805 insertions, 536 deletions
diff --git a/TAO/TAO_IDL/ast/ast_redef.cpp b/TAO/TAO_IDL/ast/ast_redef.cpp index 8decdd3ffb3..743fe52f677 100644 --- a/TAO/TAO_IDL/ast/ast_redef.cpp +++ b/TAO/TAO_IDL/ast/ast_redef.cpp @@ -90,6 +90,7 @@ can_be_redefined(AST_Decl *d) case AST_Decl::NT_argument: case AST_Decl::NT_enum_val: case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_array: case AST_Decl::NT_sequence: case AST_Decl::NT_union: diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index a8414a82a4a..8f8c2cecb08 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -190,6 +190,9 @@ be_sequence::managed_type (void) case AST_Decl::NT_string: this->mt_ = be_sequence::MNG_STRING; break; + case AST_Decl::NT_wstring: + this->mt_ = be_sequence::MNG_WSTRING; + break; case AST_Decl::NT_pre_defined: { be_predefined_type *bpd = be_predefined_type::narrow_from_decl @@ -296,6 +299,15 @@ be_sequence::instance_name () "_TAO_Bounded_String_Sequence_%s", this->flat_name()); break; + case be_sequence::MNG_WSTRING: // sequence of wstrings + if (this->unbounded ()) + ACE_OS::sprintf (namebuf, + "TAO_Unbounded_WString_Sequence"); + else + ACE_OS::sprintf (namebuf, + "_TAO_Bounded_WString_Sequence_%s", + this->flat_name()); + break; default: // not a managed type if (this->unbounded ()) { diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp index 943b74b6a3f..e3b1149ae3a 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_arglist.cpp @@ -218,7 +218,7 @@ be_visitor_args_ami_arglist::visit_sequence (be_sequence *node) } int -be_visitor_args_ami_arglist::visit_string (be_string *) +be_visitor_args_ami_arglist::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get the stream @@ -226,7 +226,14 @@ be_visitor_args_ami_arglist::visit_string (be_string *) { case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: - *os << "const char *"; + if (node->width () == sizeof (char)) + { + *os << "const char *"; + } + else + { + *os << "const CORBA::WChar *"; + } return 1; /* NOT REACHED */ } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp index 7eed73d1933..55b89068a03 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_arglist.cpp @@ -220,7 +220,7 @@ be_visitor_args_ami_handler_arglist::visit_sequence (be_sequence *node) } int -be_visitor_args_ami_handler_arglist::visit_string (be_string *) +be_visitor_args_ami_handler_arglist::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get the stream @@ -228,7 +228,14 @@ be_visitor_args_ami_handler_arglist::visit_string (be_string *) { case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - *os << "const char *"; + if (node->width () == sizeof (char)) + { + *os << "const char *"; + } + else + { + *os << "const CORBA::WChar *"; + } return 1; /* NOT REACHED */ } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp index 7f2031f7604..361d9a95fd7 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_compiled_marshal_cs.cpp @@ -564,8 +564,16 @@ int be_visitor_args_ami_handler_compiled_marshal_cs::visit_string (be_string *no } else { - *os << "CORBA::Any::to_string (" - << arg->local_name () << ".out (), " + 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 << ")"; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp index 9a2b8872e9a..125baebdb87 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_result_arg.cpp @@ -118,10 +118,19 @@ be_visitor_args_ami_handler_result_arg::visit_sequence (be_sequence *node) } int -be_visitor_args_ami_handler_result_arg::visit_string (be_string *) +be_visitor_args_ami_handler_result_arg::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const char *" << " _tao_retval"; + + if (node->width () == sizeof (char)) + { + *os << "const char *" << " _tao_retval"; + } + else + { + *os << "const CORBA::WChar *" << " _tao_retval"; + } + return 1; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp index 344d2a61ce0..8882b5f77af 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_upcall_cs.cpp @@ -81,11 +81,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_array (be_array *node) break; case AST_Argument::dir_OUT: case AST_Argument::dir_INOUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); if (node->size_type () == be_decl::VARIABLE) *os << arg->local_name () << ".in ()"; @@ -126,11 +121,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_interface (be_interface *) break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -149,11 +139,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_interface_fwd (be_interface_fwd break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -174,11 +159,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_valuetype (be_valuetype *) break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -197,11 +177,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_valuetype_fwd (be_valuetype_fwd break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -226,12 +201,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_predefined_type (be_predefined_ break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /* - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -245,11 +214,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_predefined_type (be_predefined_ break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -283,11 +247,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_sequence (be_sequence *) break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /*if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; break; @@ -312,12 +271,6 @@ int be_visitor_args_ami_handler_upcall_cs::visit_string (be_string *) break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - /* - if (this->ctx_->state () - == TAO_CodeGen::TAO_ARGUMENT_COLLOCATED_upcall_cs) - *os << arg->local_name (); - else - */ os->indent (); *os << arg->local_name () << ".in ()"; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp index 820cd915573..6062d53d13a 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/ami_handler_vardecl_cs.cpp @@ -295,7 +295,7 @@ int be_visitor_args_ami_handler_vardecl_cs::visit_sequence (be_sequence *node) return 0; } -int be_visitor_args_ami_handler_vardecl_cs::visit_string (be_string *) +int be_visitor_args_ami_handler_vardecl_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 @@ -307,14 +307,17 @@ int be_visitor_args_ami_handler_vardecl_cs::visit_string (be_string *) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << "CORBA::String_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "char *&" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".out ();" << be_nl; -#endif - *os << "CORBA::String_var " - << arg->local_name () << ";\n"; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var "; + } + else + { + *os << "CORBA::WString_var "; + } + + *os << arg->local_name () << ";\n"; break; } return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp index 0463198b3b8..dfb4cc09a39 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp @@ -241,22 +241,41 @@ int be_visitor_args_arglist::visit_sequence (be_sequence *node) return 0; } -int be_visitor_args_arglist::visit_string (be_string *) +int be_visitor_args_arglist::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get the stream - switch (this->direction ()) + if (node->width () == sizeof (char)) { - case AST_Argument::dir_IN: - *os << "const char *"; - break; - case AST_Argument::dir_INOUT: - *os << "char *&"; - break; - case AST_Argument::dir_OUT: - *os << "CORBA::String_out"; - break; + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const char *"; + break; + case AST_Argument::dir_INOUT: + *os << "char *&"; + break; + case AST_Argument::dir_OUT: + *os << "CORBA::String_out"; + break; + } } + else + { + switch (this->direction ()) + { + case AST_Argument::dir_IN: + *os << "const CORBA::WChar *"; + break; + case AST_Argument::dir_INOUT: + *os << "CORBA::WChar *&"; + break; + case AST_Argument::dir_OUT: + *os << "CORBA::WString_out"; + break; + } + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_cs.cpp index 18cae73c4c9..a1d43daebcd 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_cs.cpp @@ -645,13 +645,29 @@ int be_visitor_args_compiled_marshal_cs::visit_string (be_string *node) case AST_Argument::dir_IN: break; case AST_Argument::dir_INOUT: - *os << "CORBA::Any::to_string (" - << arg->local_name () << ", " + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string ("; + } + else + { + *os << "CORBA::Any::to_wstring ("; + } + + *os << arg->local_name () << ", " << node->max_size ()->ev ()->u.ulval - 1 << ")"; break; case AST_Argument::dir_OUT: - *os << "CORBA::Any::to_string (" - << arg->local_name () << ".ptr (), " + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string ("; + } + else + { + *os << "CORBA::Any::to_wstring ("; + } + + *os << arg->local_name () << ".ptr (), " << node->max_size ()->ev ()->u.ulval - 1 << ")"; break; } 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 index 3a81f4c227a..632ca60701a 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/compiled_marshal_ss.cpp @@ -607,8 +607,16 @@ int be_visitor_args_compiled_marshal_ss::visit_string (be_string *node) } else { - *os << "CORBA::Any::to_string (" - << arg->local_name () << ".out (), " + 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 << ")"; } @@ -642,8 +650,16 @@ int be_visitor_args_compiled_marshal_ss::visit_string (be_string *node) break; case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: - *os << "CORBA::Any::from_string ((char *)" - << arg->local_name () << ".in (), " + 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; } diff --git a/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp index 2c8fdc8592b..babe24ed4bb 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/docall_cs.cpp @@ -97,7 +97,6 @@ int be_visitor_args_docall_cs::visit_array (be_array *node) case AST_Argument::dir_OUT: if (node->size_type () == be_type::VARIABLE) // pass reference to the pointer to slice - // *os << "_tao_base_" << arg->local_name (); *os << arg->local_name () << ".ptr ()"; else *os << arg->local_name (); @@ -177,7 +176,6 @@ int be_visitor_args_docall_cs::visit_predefined_type (be_predefined_type *node) *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 @@ -227,7 +225,6 @@ int be_visitor_args_docall_cs::visit_sequence (be_sequence *) *os << "&" << arg->local_name (); break; case AST_Argument::dir_OUT: - // *os << "_tao_base_" << arg->local_name (); *os << arg->local_name () << ".ptr ()"; break; } @@ -248,7 +245,6 @@ int be_visitor_args_docall_cs::visit_string (be_string *) *os << "&" << arg->local_name (); break; case AST_Argument::dir_OUT: - //*os << "&_tao_base_" << arg->local_name (); *os << "&" << arg->local_name () << ".ptr ()"; break; } @@ -272,7 +268,6 @@ int be_visitor_args_docall_cs::visit_structure (be_structure *node) { // check if the size type is VARIABLE if (node->size_type () == be_type::VARIABLE) - // *os << "_tao_base_" << arg->local_name (); *os << arg->local_name () << ".ptr ()"; else *os << "&" << arg->local_name (); @@ -299,7 +294,6 @@ int be_visitor_args_docall_cs::visit_union (be_union *node) { // check if the size type is VARIABLE if (node->size_type () == be_type::VARIABLE) - //*os << "_tao_base_" << arg->local_name (); *os << arg->local_name () << ".ptr ()"; else *os << "&" << arg->local_name (); 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 4f20c0d2362..b7b28bc1b53 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/marshal_ss.cpp @@ -166,7 +166,6 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) break; case AST_Argument::dir_OUT: os->indent (); - // *os << "_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; break; } // end switch direction @@ -179,7 +178,6 @@ int be_visitor_args_marshal_ss::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_INOUT: case AST_Argument::dir_OUT: os->indent (); - // *os << "&_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; break; } // end switch direction @@ -215,7 +213,6 @@ int be_visitor_args_marshal_ss::visit_sequence (be_sequence *) break; case AST_Argument::dir_OUT: os->indent (); - // *os << "_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; break; } @@ -237,7 +234,6 @@ int be_visitor_args_marshal_ss::visit_string (be_string *) break; case AST_Argument::dir_OUT: os->indent (); - // *os << "&_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; break; } @@ -260,7 +256,6 @@ int be_visitor_args_marshal_ss::visit_structure (be_structure *node) case AST_Argument::dir_OUT: os->indent (); if (node->size_type () == be_type::VARIABLE) - // *os << "_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; else *os << "&" << arg->local_name (); @@ -285,7 +280,6 @@ int be_visitor_args_marshal_ss::visit_union (be_union *node) case AST_Argument::dir_OUT: os->indent (); if (node->size_type () == be_type::VARIABLE) - // *os << "_tao_ptr_" << arg->local_name (); *os << "&" << arg->local_name () << ".inout ()"; else *os << "&" << arg->local_name (); diff --git a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_compiled_cs.cpp b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_compiled_cs.cpp index 248523c8d3d..f9aba448cec 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_compiled_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_compiled_cs.cpp @@ -171,7 +171,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 *) +be_visitor_args_post_docall_compiled_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 @@ -182,7 +182,18 @@ be_visitor_args_post_docall_compiled_cs::visit_string (be_string *) break; case AST_Argument::dir_INOUT: os->indent (); - *os << "CORBA::string_free (" << arg->local_name () << ");" << be_nl; + + 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; 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 index 9aa12d3295c..c28d1ba24f7 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/post_docall_cs.cpp @@ -130,7 +130,7 @@ be_visitor_args_post_docall_cs::visit_interface_fwd (be_interface_fwd *node) } int -be_visitor_args_post_docall_cs::visit_string (be_string *) +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 @@ -140,7 +140,18 @@ be_visitor_args_post_docall_cs::visit_string (be_string *) case AST_Argument::dir_IN: break; case AST_Argument::dir_INOUT: - *os << "CORBA::string_free (" << arg->local_name () << ");" << be_nl; + + 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; 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 c5829ca7f92..134190870d9 100644 --- a/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_argument/vardecl_ss.cpp @@ -151,27 +151,12 @@ int be_visitor_args_vardecl_ss::visit_interface (be_interface *node) case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_ptr _tao_base_ptr_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_var_" << arg->local_name () << ".out ());\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; *os << "CORBA::Object_var _tao_base_var_" @@ -198,27 +183,12 @@ 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 (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () - << ";" << be_nl; - *os << "CORBA::Object_ptr &_tao_base_ptr_" << arg->local_name () - << " = _tao_base_var_" << arg->local_name () << ".out ();\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; *os << "CORBA::Object_var _tao_base_var_" << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "CORBA::Object_ptr _tao_base_ptr_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_var_" << arg->local_name () << ".out ());\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; *os << "CORBA::Object_var _tao_base_var_" @@ -267,14 +237,6 @@ int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node) break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";\n"; break; @@ -287,25 +249,11 @@ int be_visitor_args_vardecl_ss::visit_predefined_type (be_predefined_type *node) case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var " << arg->local_name () - << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = " << arg->local_name () << ".out ();\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";\n"; break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << "_ptr &_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");" << be_nl; -#endif *os << bt->name () << "_var " << arg->local_name () << ";\n"; break; @@ -348,14 +296,6 @@ int be_visitor_args_vardecl_ss::visit_sequence (be_sequence *node) break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";" << be_nl; break; @@ -363,7 +303,7 @@ int be_visitor_args_vardecl_ss::visit_sequence (be_sequence *node) return 0; } -int be_visitor_args_vardecl_ss::visit_string (be_string *) +int be_visitor_args_vardecl_ss::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get output stream be_argument *arg = this->ctx_->be_node_as_argument (); // get the argument @@ -373,27 +313,29 @@ int be_visitor_args_vardecl_ss::visit_string (be_string *) case AST_Argument::dir_IN: case AST_Argument::dir_INOUT: os->indent (); -#if 0 /* ASG */ - *os << "CORBA::String_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "char *&" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".out ();" << be_nl; -#endif - *os << "CORBA::String_var " - << arg->local_name () << ";\n"; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var " << arg->local_name () << ";\n"; + } + else + { + *os << "CORBA::WString_var " << arg->local_name () << ";\n"; + } + break; case AST_Argument::dir_OUT: os->indent (); -#if 0 /* ASG */ - *os << "CORBA::String_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << "char *&_tao_ptr_" << arg->local_name () << " = _tao_var_" - << arg->local_name () << ".out ();" << be_nl; - *os << "CORBA::String_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; -#endif - *os << "CORBA::String_var " - << arg->local_name () << ";\n"; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var " << arg->local_name () << ";\n"; + } + else + { + *os << "CORBA::WString_var " << arg->local_name () << ";\n"; + } + break; } return 0; @@ -423,14 +365,6 @@ int be_visitor_args_vardecl_ss::visit_structure (be_structure *node) // check if it is variable sized if (node->size_type () == be_type::VARIABLE) { -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";\n"; } @@ -465,14 +399,6 @@ int be_visitor_args_vardecl_ss::visit_union (be_union *node) // check if it is variable sized if (node->size_type () == be_type::VARIABLE) { -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_var_" - << arg->local_name () << ";" << be_nl; - *os << bt->name () << " *&_tao_ptr_" << arg->local_name () - << " = _tao_var_" << arg->local_name () << ".out ();" << be_nl; - *os << bt->name () << "_out " << arg->local_name () - << " (_tao_ptr_" << arg->local_name () << ");\n"; -#endif *os << bt->name () << "_var " << arg->local_name () << ";\n"; diff --git a/TAO/TAO_IDL/be/be_visitor_array/array.cpp b/TAO/TAO_IDL/be/be_visitor_array/array.cpp index a19959e36a1..f1adbd292c6 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array.cpp @@ -106,11 +106,19 @@ be_visitor_array::visit_sequence (be_sequence *node) } int -be_visitor_array::visit_string (be_string *) +be_visitor_array::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); - // *os << "CORBA::String_var"; - *os << "TAO_String_Manager"; + + if (node->width () == sizeof (char)) + { + *os << "TAO_String_Manager"; + } + else + { + *os << "TAO_WString_Manager"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp index 220a3c46cd0..9f878f1fc4b 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp @@ -545,6 +545,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt) // the following have a _var type and must be // handled in a special way case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: *os << ".out ()"; @@ -589,6 +590,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt) // the following have a _var type and must be // handled in a special way case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: *os << ".out ()"; @@ -642,6 +644,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt) // the following have a _var type and must be // handled in a special way case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: *os << ".in ()"; @@ -686,6 +689,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt) // the following have a _var type and must be // handled in a special way case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: *os << ".in ()"; diff --git a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp index 78a6dcbff64..d3e36ab70ab 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/ctor_assign.cpp @@ -249,7 +249,7 @@ int be_visitor_exception_ctor_assign::visit_sequence (be_sequence *) return 0; } -int be_visitor_exception_ctor_assign::visit_string (be_string *) +int be_visitor_exception_ctor_assign::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get output stream be_decl *bd = this->ctx_->node (); @@ -257,14 +257,33 @@ int be_visitor_exception_ctor_assign::visit_string (be_string *) os->indent (); if (this->ctx_->exception ()) // special ctor { - *os << "this->" << bd->local_name () << " = CORBA::string_dup (_tao_" - << bd->local_name () << ");\n"; + if (node->width () == sizeof (char)) + { + *os << "this->" << bd->local_name () + << " = CORBA::string_dup (_tao_" + << bd->local_name () << ");\n"; + } + else + { + *os << "this->" << bd->local_name () + << " = CORBA::wstring_dup (_tao_" + << bd->local_name () << ");\n"; + } } else { - *os << "this->" << bd->local_name () - << " = CORBA::string_dup (_tao_excp." << bd->local_name () - << ".in ());\n"; + if (node->width () == sizeof (char)) + { + *os << "this->" << bd->local_name () + << " = CORBA::string_dup (_tao_excp." + << bd->local_name () << ".in ());\n"; + } + else + { + *os << "this->" << bd->local_name () + << " = CORBA::wstring_dup (_tao_excp." + << bd->local_name () << ".in ());\n"; + } } return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp index f5647a4e9b1..25cec1980b3 100644 --- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp +++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ctor.cpp @@ -251,11 +251,19 @@ int be_visitor_exception_ctor::visit_sequence (be_sequence *node) return 0; } -int be_visitor_exception_ctor::visit_string (be_string *) +int be_visitor_exception_ctor::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get output stream + + if (node->width () == sizeof (char)) + { + *os << "const char *"; + } + else + { + *os << "const CORBA::WChar *"; + } - *os << "const char *"; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp index 21272a2a32b..8986d5f2114 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/cdr_op_ci.cpp @@ -510,7 +510,7 @@ be_visitor_field_cdr_op_ci::visit_string (be_string *) ), -1); } - // check what is the code generations substate. Are we generating code for + // check what is the code generation's substate. Are we generating code for // the in/out operators for our parent or for us? switch (this->ctx_->sub_state ()) { @@ -528,7 +528,7 @@ be_visitor_field_cdr_op_ci::visit_string (be_string *) ACE_ERROR_RETURN ((LM_ERROR, "(%N:%l) be_visitor_field_cdr_op_ci::" "visit_array - " - "bad sub state\n" + "bad substate\n" ), -1); } diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp index af980e349a4..32cf0b13ed9 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -373,24 +373,23 @@ be_visitor_field_ch::visit_sequence (be_sequence *node) // visit string type int -be_visitor_field_ch::visit_string (be_string *) +be_visitor_field_ch::visit_string (be_string *node) { TAO_OutStream *os; // output stream os = this->ctx_->stream (); os->indent (); // start from current indentation level - // set the right type; -#if 0 - if (this->ctx_->alias ()) + // set the right type; + if (node->width () == sizeof (char)) { - *os << this->ctx_->alias ()->nested_type_name (this->ctx_->scope ()) - << "_var"; + *os << "TAO_String_Manager"; } else - *os << "CORBA::String_var"; -#endif - *os << "TAO_String_Manager"; + { + *os << "TAO_WString_Manager"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp index ce3f1b178ce..034b57745f0 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_result_arg.cpp @@ -116,10 +116,19 @@ be_visitor_operation_ami_handler_result_arg::visit_sequence (be_sequence *node) } int -be_visitor_operation_ami_handler_result_arg::visit_string (be_string *) +be_visitor_operation_ami_handler_result_arg::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // get the stream - *os << "const char *" << " _tao_ami_result"; + + if (node->width () == sizeof (char)) + { + *os << "const char *" << " _tao_ami_result"; + } + else + { + *os << "const CORBA::WChar *" << " _tao_ami_result"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp b/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp index 675a5807d94..da1a5d88875 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/compiled_marshal.cpp @@ -400,19 +400,39 @@ int be_visitor_operation_rettype_compiled_marshal::visit_string (be_string *node } else { - *os << "CORBA::Any::from_string ((char *)_tao_retval.in (), " - << node->max_size ()->ev ()->u.ulval - 1 << ")"; + 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_retval"; + { + // unbounded + *os << "_tao_retval"; + } else - *os << "CORBA::Any::to_string (_tao_retval, " - << node->max_size ()->ev ()->u.ulval - 1 << ")"; + { + if (node->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string (_tao_retval, "; + } + else + { + *os << "CORBA::Any::to_wstring (_tao_retval, "; + } + + *os << node->max_size ()->ev ()->u.ulval - 1 << ")"; + } } else { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp index 860210a7aab..01f9a1b0aca 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype.cpp @@ -196,12 +196,20 @@ be_visitor_operation_rettype::visit_sequence (be_sequence *node) } int -be_visitor_operation_rettype::visit_string (be_string * /* node*/) +be_visitor_operation_rettype::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - *os << "char *"; + if (node->width () == sizeof (char)) + { + *os << "char *"; + } + else + { + *os << "CORBA::WChar *"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp index fae87d2e2e5..b71a3e0c7e1 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_assign_ss.cpp @@ -146,7 +146,7 @@ be_visitor_operation_rettype_assign_ss::visit_sequence (be_sequence *) } int -be_visitor_operation_rettype_assign_ss::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_assign_ss::visit_string (be_string *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp index d0a7b793551..dc8222ae52e 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_is.cpp @@ -121,7 +121,7 @@ be_visitor_operation_rettype_is::visit_sequence (be_sequence *) } int -be_visitor_operation_rettype_is::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_is::visit_string (be_string *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream 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 b1aadb26abe..9be55e90f62 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 @@ -48,7 +48,6 @@ be_visitor_operation_rettype_marshal_ss::visit_array (be_array *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - //*os << "_tao_ptr_retval"; *os << "_tao_retval.inout ()"; return 0; } @@ -70,7 +69,6 @@ be_visitor_operation_rettype_marshal_ss::visit_interface (be_interface *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; @@ -83,7 +81,6 @@ visit_interface_fwd (be_interface_fwd *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; @@ -97,7 +94,6 @@ be_visitor_operation_rettype_marshal_ss::visit_valuetype (be_valuetype *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; @@ -110,7 +106,6 @@ visit_valuetype_fwd (be_valuetype_fwd *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; @@ -132,12 +127,10 @@ visit_predefined_type (be_predefined_type *node) break; case AST_PredefinedType::PT_pseudo: os->indent (); - //*os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; break; case AST_PredefinedType::PT_any: os->indent (); - // *os << "_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; break; default: @@ -154,19 +147,17 @@ be_visitor_operation_rettype_marshal_ss::visit_sequence (be_sequence *) TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; } int -be_visitor_operation_rettype_marshal_ss::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_marshal_ss::visit_string (be_string *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - // *os << "&_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; return 0; @@ -179,7 +170,6 @@ be_visitor_operation_rettype_marshal_ss::visit_structure (be_structure *node) os->indent (); if (node->size_type () == be_type::VARIABLE) - //*os << "_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; else *os << "&_tao_retval"; @@ -210,7 +200,6 @@ be_visitor_operation_rettype_marshal_ss::visit_union (be_union *node) os->indent (); if (node->size_type () == be_type::VARIABLE) - // *os << "_tao_ptr_retval"; *os << "&_tao_retval.inout ()"; else *os << "&_tao_retval"; 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 d30a99cc54f..670bf03f328 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 @@ -79,7 +79,7 @@ be_visitor_operation_rettype_post_upcall_ss::visit_sequence (be_sequence *) } int -be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_post_upcall_ss::visit_string (be_string *) { return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp index 49e1870f8d3..c2847f594de 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_return_cs.cpp @@ -49,9 +49,6 @@ be_visitor_operation_rettype_return_cs::visit_array (be_array *) // Grab the out stream TAO_OutStream *os = this->ctx_->stream (); - // os->indent (); - // *os << "return _tao_retval;\n"; - *os << "_tao_retval"; return 0; } @@ -61,8 +58,6 @@ be_visitor_operation_rettype_return_cs::visit_enum (be_enum *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -72,8 +67,6 @@ be_visitor_operation_rettype_return_cs::visit_interface (be_interface *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - // os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -83,8 +76,6 @@ be_visitor_operation_rettype_return_cs::visit_interface_fwd (be_interface_fwd *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -96,8 +87,6 @@ be_visitor_operation_rettype_return_cs::visit_valuetype (be_valuetype *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -107,8 +96,6 @@ be_visitor_operation_rettype_return_cs::visit_valuetype_fwd (be_valuetype_fwd *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -120,14 +107,11 @@ be_visitor_operation_rettype_return_cs::visit_predefined_type (be_predefined_typ { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); switch (node->pt ()) { case AST_PredefinedType::PT_void: - // *os << "return;\n"; break; default: - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; break; } @@ -139,8 +123,6 @@ be_visitor_operation_rettype_return_cs::visit_sequence (be_sequence *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -150,8 +132,6 @@ be_visitor_operation_rettype_return_cs::visit_string (be_string *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -161,8 +141,6 @@ be_visitor_operation_rettype_return_cs::visit_structure (be_structure *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } @@ -188,8 +166,6 @@ be_visitor_operation_rettype_return_cs::visit_union (be_union *) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream - //os->indent (); - // *os << "return _tao_retval;\n"; *os << "_tao_retval"; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp index 5873b0d412f..3c903ab8023 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/rettype_vardecl_cs.cpp @@ -220,12 +220,20 @@ be_visitor_operation_rettype_vardecl_cs::visit_sequence (be_sequence *node) } int -be_visitor_operation_rettype_vardecl_cs::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_vardecl_cs::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); - *os << "char* _tao_retval = 0;"; + + if (node->width () == sizeof (char)) + { + *os << "char* _tao_retval = 0;"; + } + else + { + *os << "CORBA::WChar* _tao_retval = 0;"; + } *os << be_nl << be_nl; 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 88901556894..5188cd786b6 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 @@ -88,10 +88,7 @@ be_visitor_operation_rettype_vardecl_ss::visit_interface (be_interface *) // 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"; -#if 0 /* ASG */ - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();\n"; - *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; -#endif + return 0; } @@ -106,10 +103,6 @@ visit_interface_fwd (be_interface_fwd *) // 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 -#if 0 /* ASG */ - *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();\n"; - *os << "CORBA::Object_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << "CORBA::Object_var _tao_retval = CORBA::Object::_nil ();\n"; return 0; } @@ -155,18 +148,10 @@ visit_predefined_type (be_predefined_type *node) { case AST_PredefinedType::PT_pseudo: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_retval;\n"; - *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << bt->name () << "_var _tao_retval;\n"; break; case AST_PredefinedType::PT_any: os->indent (); -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_retval;\n"; - *os << bt->name () << "_ptr &_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << bt->name () << "_var _tao_retval;\n"; break; case AST_PredefinedType::PT_void: @@ -193,25 +178,26 @@ be_visitor_operation_rettype_vardecl_ss::visit_sequence (be_sequence *node) bt = node; os->indent (); -#if 0 /* ASg */ - *os << bt->name () << "_var _tao_retval;\n"; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << bt->name () << "_var _tao_retval;\n"; return 0; } int -be_visitor_operation_rettype_vardecl_ss::visit_string (be_string * /* node*/) +be_visitor_operation_rettype_vardecl_ss::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // grab the out stream os->indent (); -#if 0 /* ASG */ - *os << "CORBA::String_var _tao_retval;\n"; - *os << "char *&_tao_ptr_retval = _tao_retval.out ();\n"; -#endif - *os << "CORBA::String_var _tao_retval;\n"; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var _tao_retval;\n"; + } + else + { + *os << "CORBA::WString_var _tao_retval;\n"; + } + return 0; } @@ -231,10 +217,6 @@ be_visitor_operation_rettype_vardecl_ss::visit_structure (be_structure *node) // aggregate type if (node->size_type () == be_decl::VARIABLE) { -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_retval;\n"; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << bt->name () << "_var _tao_retval;\n"; } else @@ -274,10 +256,6 @@ be_visitor_operation_rettype_vardecl_ss::visit_union (be_union *node) // aggregate type if (node->size_type () == be_decl::VARIABLE) { -#if 0 /* ASG */ - *os << bt->name () << "_var _tao_retval;\n"; - *os << bt->name () << " *&_tao_ptr_retval = _tao_retval.out ();\n"; -#endif *os << bt->name () << "_var _tao_retval;\n"; } else diff --git a/TAO/TAO_IDL/be/be_visitor_rettype.cpp b/TAO/TAO_IDL/be/be_visitor_rettype.cpp index 86cde1f6cc7..7004b01dade 100644 --- a/TAO/TAO_IDL/be/be_visitor_rettype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_rettype.cpp @@ -1357,8 +1357,17 @@ be_visitor_typecode_defn::gen_typecode (be_string *node) // no typecode optimizations for anonymous strings os->indent (); // start from the current indentation level + // emit the enumeration - *os << "CORBA::tk_string, " << be_nl; + if (node->width () == sizeof (char)) + { + *os << "CORBA::tk_string, " << be_nl; + } + else + { + *os << "CORBA::tk_wstring, " << be_nl; + } + // size of the enum this->tc_offset_ += sizeof (ACE_CDR::ULong); diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp index 5ffe0a8aced..bce92dbc9c2 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/buffer_type.cpp @@ -100,10 +100,19 @@ be_visitor_sequence_buffer_type::visit_interface_fwd (be_interface_fwd *node) } int -be_visitor_sequence_buffer_type::visit_string (be_string *) +be_visitor_sequence_buffer_type::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); - *os << "char *"; + + if (node->width () == sizeof (char)) + { + *os << "char *"; + } + else + { + *os << "CORBA::WChar *"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp index 9144cd45fbf..fe056a1c96a 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp @@ -510,6 +510,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt) switch (bt->node_type ()) { case AST_Decl::NT_string: + case AST_Decl::NT_wstring: { be_string *str = be_string::narrow_from_decl (bt); @@ -528,8 +529,15 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt) } else { - *os << "CORBA::Any::to_string (_tao_sequence[i].out (), " - << str->max_size ()->ev ()->u.ulval << ")"; + if (str->width () == sizeof (char)) + { + *os << "CORBA::Any::to_string (_tao_sequence[i].out (), "; + } + else + { + *os << "CORBA::Any::to_wstring (_tao_sequence[i].out (), "; + } + *os << str->max_size ()->ev ()->u.ulval << ")"; } } break; @@ -570,6 +578,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt) switch (bt->node_type ()) { case AST_Decl::NT_string: + case AST_Decl::NT_wstring: case AST_Decl::NT_interface: case AST_Decl::NT_interface_fwd: *os << ".in ()"; diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp index 01632c2bdfd..ace226ecbb2 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/elemtype.cpp @@ -167,11 +167,19 @@ be_visitor_sequence_elemtype::visit_interface_fwd (be_interface_fwd *node) } int -be_visitor_sequence_elemtype::visit_string (be_string *) +be_visitor_sequence_elemtype::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); - *os << "TAO_SeqElem_String_Manager "; + if (node->width () == sizeof (char)) + { + *os << "TAO_SeqElem_String_Manager "; + } + else + { + *os << "TAO_SeqElem_WString_Manager "; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp index 60063ab9412..b6c3131f3c8 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp @@ -85,6 +85,12 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node) else *os << "TAO_Bounded_String_Sequence"; break; + case be_sequence::MNG_WSTRING: + if (node->unbounded ()) + *os << "TAO_Unbounded_WString_Sequence"; + else + *os << "TAO_Bounded_WString_Sequence"; + break; default: // not a managed type if (node->unbounded ()) *os << "TAO_Unbounded_Sequence<"; @@ -112,7 +118,8 @@ be_visitor_sequence_ch::gen_base_sequence_class (be_sequence *node) //delete visitor; // find out if the sequence is of a managed type and if it is bounded or not - if (node->managed_type () == be_sequence::MNG_STRING) + if (node->managed_type () == be_sequence::MNG_STRING + || node->managed_type () == be_sequence::MNG_WSTRING) { if (!node->unbounded ()) { @@ -167,53 +174,54 @@ be_visitor_sequence_ch::instantiate_sequence (be_sequence *node) // else // inheriting from the right class is enough break; + case be_sequence::MNG_WSTRING: // sequence of strings + if (!node->unbounded ()) + this->gen_bounded_wstr_sequence (node); + // else + // inheriting from the right class is enough + break; default: // not a managed type if (node->unbounded ()) - { -#if 1 - // TAO provides extensions for octet sequences, first find out - // if the base type is an octet (or an alias for octet) - be_predefined_type *predef = 0; - if (bt->base_node_type () == AST_Type::NT_pre_defined) - { - be_typedef* alias = - be_typedef::narrow_from_decl (bt); - - if (alias == 0) - { - predef = - be_predefined_type::narrow_from_decl (bt); - } - else - { - predef = be_predefined_type::narrow_from_decl - (alias->primitive_base_type ()); - } - } - if (predef != 0) - { - if (predef->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#else - // @@ This needs to be fixed. (Michael) - be_predefined_type * bpt = - be_predefined_type::narrow_from_decl (node->base_type()); - if (bpt) - { - if (bpt->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#endif - } + { + // TAO provides extensions for octet sequences, first find out + // if the base type is an octet (or an alias for octet) + be_predefined_type *predef = 0; + if (bt->base_node_type () == AST_Type::NT_pre_defined) + { + be_typedef* alias = + be_typedef::narrow_from_decl (bt); + + if (alias == 0) + { + predef = + be_predefined_type::narrow_from_decl (bt); + } + else + { + predef = + be_predefined_type::narrow_from_decl ( + alias->primitive_base_type () + ); + } + } + if (predef != 0) + { + if (predef->pt() != AST_PredefinedType::PT_octet) + { + this->gen_unbounded_sequence (node); + } + } + else + { + this->gen_unbounded_sequence (node); + } + } else - this->gen_bounded_sequence (node); + { + this->gen_bounded_sequence (node); + } break; - } + } // end of switch return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp index 54e6a1d3c44..4b674a94634 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ci.cpp @@ -119,53 +119,54 @@ be_visitor_sequence_ci::instantiate_sequence (be_sequence *node) // else // inheriting from the right class is enough break; + case be_sequence::MNG_WSTRING: // sequence of strings + if (!node->unbounded ()) + this->gen_bounded_wstr_sequence (node); + // else + // inheriting from the right class is enough + break; default: // not a managed type if (node->unbounded ()) - { -#if 1 - // TAO provides extensions for octet sequences, first find out - // if the base type is an octet (or an alias for octet) - be_predefined_type *predef = 0; - if (bt->base_node_type () == AST_Type::NT_pre_defined) - { - be_typedef* alias = - be_typedef::narrow_from_decl (bt); - - if (alias == 0) - { - predef = - be_predefined_type::narrow_from_decl (bt); - } - else - { - predef = be_predefined_type::narrow_from_decl - (alias->primitive_base_type ()); - } - } - if (predef != 0) - { - if (predef->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#else - // @@ This needs to be fixed. (Michael) - be_predefined_type * bpt = - be_predefined_type::narrow_from_decl (node->base_type()); - if (bpt) - { - if (bpt->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#endif - } + { + // TAO provides extensions for octet sequences, first find out + // if the base type is an octet (or an alias for octet) + be_predefined_type *predef = 0; + if (bt->base_node_type () == AST_Type::NT_pre_defined) + { + be_typedef* alias = + be_typedef::narrow_from_decl (bt); + + if (alias == 0) + { + predef = + be_predefined_type::narrow_from_decl (bt); + } + else + { + predef = + be_predefined_type::narrow_from_decl ( + alias->primitive_base_type () + ); + } + } + if (predef != 0) + { + if (predef->pt() != AST_PredefinedType::PT_octet) + { + this->gen_unbounded_sequence (node); + } + } + else + { + this->gen_unbounded_sequence (node); + } + } else - this->gen_bounded_sequence (node); + { + this->gen_bounded_sequence (node); + } break; - } + } // end of switch return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp index 254bfed4526..9b507d24e63 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_cs.cpp @@ -89,6 +89,12 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node) else *os << "TAO_Bounded_String_Sequence"; break; + case be_sequence::MNG_WSTRING: + if (node->unbounded ()) + *os << "TAO_Unbounded_WString_Sequence"; + else + *os << "TAO_Bounded_WString_Sequence"; + break; default: // not a managed type if (node->unbounded ()) *os << "TAO_Unbounded_Sequence<"; @@ -116,7 +122,8 @@ be_visitor_sequence_cs::gen_base_sequence_class (be_sequence *node) //delete visitor; // find out if the sequence is of a managed type and if it is bounded or not - if (node->managed_type () == be_sequence::MNG_STRING) + if (node->managed_type () == be_sequence::MNG_STRING + || node->managed_type () == be_sequence::MNG_WSTRING) { if (!node->unbounded ()) { @@ -332,53 +339,54 @@ be_visitor_sequence_cs::instantiate_sequence (be_sequence *node) // else // inheriting from the right class is enough break; + case be_sequence::MNG_WSTRING: // sequence of strings + if (!node->unbounded ()) + this->gen_bounded_wstr_sequence (node); + // else + // inheriting from the right class is enough + break; default: // not a managed type if (node->unbounded ()) - { -#if 1 - // TAO provides extensions for octet sequences, first find out - // if the base type is an octet (or an alias for octet) - be_predefined_type *predef = 0; - if (bt->base_node_type () == AST_Type::NT_pre_defined) - { - be_typedef* alias = - be_typedef::narrow_from_decl (bt); + { + // TAO provides extensions for octet sequences, first find out + // if the base type is an octet (or an alias for octet) + be_predefined_type *predef = 0; + if (bt->base_node_type () == AST_Type::NT_pre_defined) + { + be_typedef* alias = + be_typedef::narrow_from_decl (bt); - if (alias == 0) - { - predef = - be_predefined_type::narrow_from_decl (bt); - } - else - { - predef = be_predefined_type::narrow_from_decl - (alias->primitive_base_type ()); - } - } - if (predef != 0) - { - if (predef->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#else - // @@ This needs to be fixed. (Michael) - be_predefined_type * bpt = - be_predefined_type::narrow_from_decl (node->base_type()); - if (bpt) - { - if (bpt->pt() != AST_PredefinedType::PT_octet) - this->gen_unbounded_sequence (node); - } - else - this->gen_unbounded_sequence (node); -#endif - } + if (alias == 0) + { + predef = + be_predefined_type::narrow_from_decl (bt); + } + else + { + predef = + be_predefined_type::narrow_from_decl ( + alias->primitive_base_type () + ); + } + } + if (predef != 0) + { + if (predef->pt() != AST_PredefinedType::PT_octet) + { + this->gen_unbounded_sequence (node); + } + } + else + { + this->gen_unbounded_sequence (node); + } + } else - this->gen_bounded_sequence (node); + { + this->gen_bounded_sequence (node); + } break; - } + } // end of switch return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp index 84f2d7690cf..08d81074eb9 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -1453,8 +1453,17 @@ be_visitor_typecode_defn::gen_typecode (be_string *node) // no typecode optimizations for anonymous strings os->indent (); // start from the current indentation level + // emit the enumeration - *os << "CORBA::tk_string, " << be_nl; + if (node->width () == sizeof (char)) + { + *os << "CORBA::tk_string, " << be_nl; + } + else + { + *os << "CORBA::tk_wstring, " << be_nl; + } + // size of the enum this->tc_offset_ += sizeof (ACE_CDR::ULong); diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp index cf754a4db2c..bde7b0811a8 100644 --- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typedef/typedef_ch.cpp @@ -324,7 +324,7 @@ be_visitor_typedef_ch::visit_predefined_type (be_predefined_type *node) } int -be_visitor_typedef_ch::visit_string (be_string *) +be_visitor_typedef_ch::visit_string (be_string *node) { TAO_OutStream *os = this->ctx_->stream (); // output stream be_typedef *tdef = this->ctx_->tdef (); // typedef node @@ -332,14 +332,28 @@ be_visitor_typedef_ch::visit_string (be_string *) // now generate the typedefs os->indent (); - // typedef the type and the _slice type - *os << "typedef char *" - << " " << tdef->nested_type_name (scope) << ";" << be_nl; - // typedef the _var, _out, and _forany types - *os << "typedef CORBA::String_var" - << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; - *os << "typedef CORBA::String_out" - << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + + if (node->width () == sizeof (char)) + { + *os << "typedef char *" + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out, and _forany types + *os << "typedef CORBA::String_var" + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef CORBA::String_out" + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + } + else + { + *os << "typedef CORBA::WChar *" + << " " << tdef->nested_type_name (scope) << ";" << be_nl; + // typedef the _var, _out, and _forany types + *os << "typedef CORBA::WString_var" + << " " << tdef->nested_type_name (scope, "_var") << ";" << be_nl; + *os << "typedef CORBA::WString_out" + << " " << tdef->nested_type_name (scope, "_out") << ";" << be_nl; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp index 07cd21e0b21..c9cde187d0f 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/cdr_op_ci.cpp @@ -584,7 +584,7 @@ be_visitor_union_branch_cdr_op_ci::visit_sequence (be_sequence *node) // visit string type int -be_visitor_union_branch_cdr_op_ci::visit_string (be_string *) +be_visitor_union_branch_cdr_op_ci::visit_string (be_string *node) { TAO_OutStream *os; // output stream os = this->ctx_->stream (); @@ -605,8 +605,16 @@ be_visitor_union_branch_cdr_op_ci::visit_string (be_string *) switch (this->ctx_->sub_state ()) { case TAO_CodeGen::TAO_CDR_INPUT: - *os << "CORBA::String_var _tao_union_tmp;" << be_nl - << "result = strm >> _tao_union_tmp.out ();" << be_nl + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var _tao_union_tmp;" << be_nl; + } + else + { + *os << "CORBA::WString_var _tao_union_tmp;" << be_nl; + } + + *os << "result = strm >> _tao_union_tmp.out ();" << be_nl << "if (result)" << be_idt_nl << "_tao_union." << f->local_name () << " (_tao_union_tmp);" << be_uidt; diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp index 7686eb88d75..a52f5509f8f 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/private_ch.cpp @@ -309,7 +309,7 @@ be_visitor_union_branch_private_ch::visit_sequence (be_sequence *node) } int -be_visitor_union_branch_private_ch::visit_string (be_string *) +be_visitor_union_branch_private_ch::visit_string (be_string *node) { TAO_OutStream *os; // output stream be_decl *ub = this->ctx_->node (); // get union branch @@ -327,7 +327,16 @@ be_visitor_union_branch_private_ch::visit_string (be_string *) os = this->ctx_->stream (); os->indent (); - *os << "char *" << ub->local_name () << "_;\n"; + + if (node->width () == sizeof (char)) + { + *os << "char *" << ub->local_name () << "_;\n"; + } + else + { + *os << "CORBA::WChar *" << ub->local_name () << "_;\n"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp index e34bc423157..cb3ffbd981e 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_assign_cs.cpp @@ -370,7 +370,7 @@ be_visitor_union_branch_public_assign_cs::visit_sequence (be_sequence *node) } int -be_visitor_union_branch_public_assign_cs::visit_string (be_string *) +be_visitor_union_branch_public_assign_cs::visit_string (be_string *node) { TAO_OutStream *os; // output stream be_union_branch *ub = @@ -389,10 +389,20 @@ be_visitor_union_branch_public_assign_cs::visit_string (be_string *) os = this->ctx_->stream (); os->indent (); // start from current indentation + // set the discriminant to the appropriate label - *os << "this->u_." << ub->local_name () << "_ = " - << "CORBA::string_dup (u.u_." - << ub->local_name () << "_);" << be_uidt_nl; + *os << "this->u_." << ub->local_name () << "_ = "; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::string_dup (u.u_."; + } + else + { + *os << "CORBA::wstring_dup (u.u_."; + } + + *os << ub->local_name () << "_);" << be_uidt_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp index f2be1ad27d7..3e622df7a56 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ch.cpp @@ -509,7 +509,7 @@ be_visitor_union_branch_public_ch::visit_sequence (be_sequence *node) // visit string type int -be_visitor_union_branch_public_ch::visit_string (be_string *) +be_visitor_union_branch_public_ch::visit_string (be_string *node) { TAO_OutStream *os; // output stream be_decl *ub = this->ctx_->node (); // get union branch @@ -527,15 +527,31 @@ be_visitor_union_branch_public_ch::visit_string (be_string *) os = this->ctx_->stream (); os->indent (); + // three methods to set the string value - *os << "void " << ub->local_name () << " (char *); // set" << be_nl; - *os << "void " << ub->local_name () << " (const char *); // set" - << be_nl; - *os << "void " << ub->local_name () << " (const CORBA::String_var&); // set" - << be_nl; - //get method - *os << "const char *" << ub->local_name () - << " (void) const; // get method\n\n"; + if (node->width () == sizeof (char)) + { + *os << "void " << ub->local_name () << " (char *); // set" << be_nl; + *os << "void " << ub->local_name () << " (const char *); // set" + << be_nl; + *os << "void " << ub->local_name () << " (const CORBA::String_var&); // set" + << be_nl; + //get method + *os << "const char *" << ub->local_name () + << " (void) const; // get method\n\n"; + } + else + { + *os << "void " << ub->local_name () << " (CORBA::WChar *); // set" << be_nl; + *os << "void " << ub->local_name () << " (const CORBA::WChar *); // set" + << be_nl; + *os << "void " << ub->local_name () << " (const CORBA::WString_var&); // set" + << be_nl; + //get method + *os << "const CORBA::WChar *" << ub->local_name () + << " (void) const; // get method\n\n"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp index 6eaaba77bc8..7f7e3886fc2 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_ci.cpp @@ -669,7 +669,7 @@ be_visitor_union_branch_public_ci::visit_sequence (be_sequence *node) } int -be_visitor_union_branch_public_ci::visit_string (be_string *) +be_visitor_union_branch_public_ci::visit_string (be_string *node) { be_union_branch *ub = this->ctx_->be_node_as_union_branch (); // get union branch @@ -688,12 +688,21 @@ be_visitor_union_branch_public_ci::visit_string (be_string *) // three methods to set the string value - // (1) set method from char* + // (1) set method from char* or wchar* os->indent (); // start from current indentation *os << "// accessor to set the member" << be_nl - << "ACE_INLINE void" << be_nl - << bu->name () << "::" << ub->local_name () << " (char *val)" - << be_nl + << "ACE_INLINE void" << be_nl; + + if (node->width () == sizeof (char)) + { + *os << bu->name () << "::" << ub->local_name () << " (char *val)"; + } + else + { + *os << bu->name () << "::" << ub->local_name () << " (CORBA::WChar *val)"; + } + + *os << be_nl << "{" << be_idt_nl; // set the discriminant to the appropriate label *os << "// set the discriminant val" << be_nl; @@ -722,12 +731,20 @@ be_visitor_union_branch_public_ci::visit_string (be_string *) *os << "}\n\n"; - // (2) set method from const char * + // (2) set method from const char * or const wchar * *os << "// accessor to set the member" << be_nl << "ACE_INLINE void" << be_nl - << bu->name () << "::" << ub->local_name () - << " (const char *val)" << be_nl - << "{\n"; + << bu->name () << "::" << ub->local_name (); + + if (node->width () == sizeof (char)) + { + *os << " (const char *val)" << be_nl << "{\n"; + } + else + { + *os << " (const CORBA::WChar *val)" << be_nl << "{\n"; + } + os->incr_indent (); // set the discriminant to the appropriate label *os << "// set the discriminant val" << be_nl; @@ -752,16 +769,32 @@ be_visitor_union_branch_public_ci::visit_string (be_string *) *os << ";" << be_nl; *os << "// set the value" << be_nl - << "this->u_." << ub->local_name () << "_ = " - << "CORBA::string_dup (val);" << be_uidt_nl; - *os << "}\n\n"; + << "this->u_." << ub->local_name () << "_ = "; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::string_dup (val);" << be_uidt_nl << "}\n\n"; + } + else + { + *os << "CORBA::wstring_dup (val);" << be_uidt_nl << "}\n\n"; + } - // (3) set from const String_var& + // (3) set from const String_var& or WString_var& *os << "// accessor to set the member" << be_nl << "ACE_INLINE void" << be_nl - << bu->name () << "::" << ub->local_name () - << " (const CORBA::String_var &val)" << be_nl - << "{" << be_idt_nl; + << bu->name () << "::" << ub->local_name (); + + if (node->width () == sizeof (char)) + { + *os << " (const CORBA::String_var &val)" << be_nl; + } + else + { + *os << " (const CORBA::WString_var &val)" << be_nl; + } + + *os << "{" << be_idt_nl; // set the discriminant to the appropriate label *os << "// set the discriminant val" << be_nl; *os << "this->_reset ("; @@ -784,16 +817,33 @@ be_visitor_union_branch_public_ci::visit_string (be_string *) *os << ";" << be_nl; - *os << "// set the value" << be_nl - << "CORBA::String_var " << ub->local_name () - << "_var = val;" << be_nl + *os << "// set the value" << be_nl; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var " << ub->local_name (); + } + else + { + *os << "CORBA::WString_var " << ub->local_name (); + } + + *os << "_var = val;" << be_nl << "this->u_." << ub->local_name () << "_ = " << ub->local_name () << "_var._retn ();" << be_uidt_nl; *os << "}\n\n"; // get method - *os << "ACE_INLINE const char *" << be_nl - << bu->name () << "::" << ub->local_name () + if (node->width () == sizeof (char)) + { + *os << "ACE_INLINE const char *" << be_nl; + } + else + { + *os << "ACE_INLINE const CORBA::WChar *" << be_nl; + } + + *os << bu->name () << "::" << ub->local_name () << " (void) const // get method" << be_nl << "{" << be_idt_nl << "return this->u_." << ub->local_name () << "_;" << be_uidt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp index ac8e6a73120..606cca9c31e 100644 --- a/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_union_branch/public_reset_cs.cpp @@ -319,7 +319,7 @@ be_visitor_union_branch_public_reset_cs::visit_sequence (be_sequence *) } int -be_visitor_union_branch_public_reset_cs::visit_string (be_string *) +be_visitor_union_branch_public_reset_cs::visit_string (be_string *node) { be_union_branch *ub = this->ctx_->be_node_as_union_branch (); // get union branch @@ -336,8 +336,17 @@ be_visitor_union_branch_public_reset_cs::visit_string (be_string *) } TAO_OutStream *os = this->ctx_->stream (); - *os << "CORBA::string_free (this->u_." - << ub->local_name () << "_);" << be_nl + + if (node->width () == sizeof (char)) + { + *os << "CORBA::string_free (this->u_."; + } + else + { + *os << "CORBA::wstring_free (this->u_."; + } + + *os << ub->local_name () << "_);" << be_nl << "this->u_." << ub->local_name () << "_ = 0;" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp index e88495def71..d11108e183a 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp @@ -523,7 +523,7 @@ be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node) // visit string type int -be_visitor_valuetype_field_ch::visit_string (be_string *) +be_visitor_valuetype_field_ch::visit_string (be_string *node) { TAO_OutStream *os; // output stream be_decl *ub = this->ctx_->node (); // get state member @@ -541,19 +541,39 @@ be_visitor_valuetype_field_ch::visit_string (be_string *) os = this->ctx_->stream (); os->indent (); + // three methods to set the string value - *os << pre_op() - << "void " << ub->local_name () << " (char *)" - << post_op() << " // set" << be_nl; - *os << pre_op() - << "void " << ub->local_name () << " (const char *)" - << post_op() << " // set" << be_nl; - *os << pre_op() - << "void " << ub->local_name () << " (const CORBA::String_var&)" - << post_op() << " // set" << be_nl; - //get method - *os << pre_op() << "const char *" << ub->local_name () - << " (void) const" << post_op() << " // get method\n\n"; + if (node->width () == sizeof (char)) + { + *os << pre_op() + << "void " << ub->local_name () << " (char *)" + << post_op() << " // set" << be_nl; + *os << pre_op() + << "void " << ub->local_name () << " (const char *)" + << post_op() << " // set" << be_nl; + *os << pre_op() + << "void " << ub->local_name () << " (const CORBA::String_var&)" + << post_op() << " // set" << be_nl; + //get method + *os << pre_op() << "const char *" << ub->local_name () + << " (void) const" << post_op() << " // get method\n\n"; + } + else + { + *os << pre_op() + << "void " << ub->local_name () << " (CORBA::WChar *)" + << post_op() << " // set" << be_nl; + *os << pre_op() + << "void " << ub->local_name () << " (const CORBA::WChar *)" + << post_op() << " // set" << be_nl; + *os << pre_op() + << "void " << ub->local_name () << " (const CORBA::WString_var&)" + << post_op() << " // set" << be_nl; + //get method + *os << pre_op() << "const CORBA::WChar *" << ub->local_name () + << " (void) const" << post_op() << " // get method\n\n"; + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp index d1e2c9cdcc3..c63518184e7 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cs.cpp @@ -705,7 +705,7 @@ be_visitor_valuetype_field_cs::visit_sequence (be_sequence *node) } int -be_visitor_valuetype_field_cs::visit_string (be_string *) +be_visitor_valuetype_field_cs::visit_string (be_string *node) { be_decl *ub = this->ctx_->node (); // get field node @@ -724,13 +724,23 @@ be_visitor_valuetype_field_cs::visit_string (be_string *) // three methods to set the string value - // (1) set method from char* + // (1) set method from char* or wchar* os->indent (); // start from current indentation *os << "// accessor to set the member" << be_nl - << this->pre_op() << "void" << be_nl; - this->op_name(bu,os); - *os << "::" << ub->local_name () << " (char *val)" - << be_nl + << this->pre_op () << "void" << be_nl; + this->op_name (bu, + os); + + if (node->width () == sizeof (char)) + { + *os << "::" << ub->local_name () << " (char *val)"; + } + else + { + *os << "::" << ub->local_name () << " (CORBA::WChar *val)"; + } + + *os << be_nl << "{" << be_idt_nl; *os << "// set the value" << be_nl @@ -739,50 +749,96 @@ be_visitor_valuetype_field_cs::visit_string (be_string *) << " = val;" << be_uidt_nl << "}" << be_nl; - // (2) set method from const char * + // (2) set method from const char * or const wchar* *os << "// accessor to set the member" << be_nl - << this->pre_op() << "void" << be_nl; - this->op_name(bu,os); - *os << "::" << ub->local_name () - << " (const char *val)" << be_nl - << "{\n"; + << this->pre_op () << "void" << be_nl; + this->op_name (bu, + os); + *os << "::" << ub->local_name (); + + if (node->width () == sizeof (char)) + { + *os << " (const char *val)" << be_nl; + } + else + { + *os << " (const CORBA::WChar *val)" << be_nl; + } + + *os << "{\n"; os->incr_indent (); - *os << "// set the value" << be_nl - << "this->" - << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() - << " = " - << "CORBA::string_dup (val);" << be_uidt_nl; + *os << "// set the value" << be_nl + << "this->" + << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix () + << " = "; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::string_dup (val);" << be_uidt_nl; + } + else + { + *os << "CORBA::wstring_dup (val);" << be_uidt_nl; + } *os << "}" << be_nl; // (3) set from const String_var& *os << "// accessor to set the member" << be_nl - << this->pre_op() << "void" << be_nl; - this->op_name(bu,os); - *os << "::" << ub->local_name () - << " (const CORBA::String_var &val)" << be_nl - << "{" << be_idt_nl; - *os << ";" << be_nl; + << this->pre_op () << "void" << be_nl; + this->op_name (bu, + os); + *os << "::" << ub->local_name (); - *os << "// set the value" << be_nl - << "CORBA::String_var " << ub->local_name () - << "_var = val;" << be_nl - << "this->" - << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() - << " = " - << ub->local_name () << "_var._retn ();" << be_uidt_nl; + if (node->width () == sizeof (char)) + { + *os << " (const CORBA::String_var &val)" << be_nl; + } + else + { + *os << " (const CORBA::WString_var &val)" << be_nl; + } + + *os << "{" << be_idt_nl; + *os << ";" << be_nl; + + *os << "// set the value" << be_nl; + + if (node->width () == sizeof (char)) + { + *os << "CORBA::String_var " << ub->local_name (); + } + else + { + *os << "CORBA::WString_var " << ub->local_name (); + } + + *os << "_var = val;" << be_nl + << "this->" + << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix () + << " = " + << ub->local_name () << "_var._retn ();" << be_uidt_nl; *os << "}" << be_nl; // get method - *os << this->pre_op() << "const char *" << be_nl; - this->op_name(bu,os); + if (node->width () == sizeof (char)) + { + *os << this->pre_op () << "const char *" << be_nl; + } + else + { + *os << this->pre_op () << "const CORBA::WChar *" << be_nl; + } + + this->op_name (bu, + os); *os << "::" << ub->local_name () << " (void) const // get method" << be_nl << "{" << be_idt_nl << "return this->" - << bu->field_pd_prefix() << ub->local_name () << bu->field_pd_postfix() + << bu->field_pd_prefix () << ub->local_name () << bu->field_pd_postfix () << ";" << be_uidt_nl << "}\n\n"; return 0; diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h index fdb18fd7e53..f285305f49f 100644 --- a/TAO/TAO_IDL/be_include/be_sequence.h +++ b/TAO/TAO_IDL/be_include/be_sequence.h @@ -51,6 +51,7 @@ public: MNG_UNKNOWN , MNG_NONE, MNG_STRING, + MNG_WSTRING, MNG_OBJREF, MNG_PSEUDO }; diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 12711646731..e4b2a911f91 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -256,6 +256,7 @@ AST_Decl * add_type(AST_Type *type) idl_global->root()->add_sequence(AST_Sequence::narrow_from_decl(type)); break; case AST_Decl::NT_string: + case AST_Decl::NT_wstring: result = idl_global->root()->add_string(AST_String::narrow_from_decl(type)); break; @@ -672,6 +673,7 @@ AST_Decl *UTL_Scope::call_add() result = add_sequence(AST_Sequence::narrow_from_decl(decl)); break; case AST_Decl::NT_string: + case AST_Decl::NT_wstring: result = add_string(AST_String::narrow_from_decl(decl)); break; case AST_Decl::NT_struct: |