summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1997-11-23 00:32:55 +0000
committergokhale <asgokhale@users.noreply.github.com>1997-11-23 00:32:55 +0000
commit7ca64920fd3a7f93628dfa61040e0430fc1fac39 (patch)
tree7398e81b2892953cd7a0b23c61820e13276a528c
parent076351de7809d2f5bb4e891a9f75373e590b479f (diff)
downloadATCD-7ca64920fd3a7f93628dfa61040e0430fc1fac39.tar.gz
code for attributes and other fixes
CVS: CVS: CVS: CVS:
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp603
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp31
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_state_argument.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_state_attribute.cpp1053
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp3
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h25
8 files changed, 1773 insertions, 62 deletions
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index b3503600442..fa87112369b 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -2,7 +2,7 @@
//
// = LIBRARY
// TAO IDL
-//
+//
// = FILENAME
// be_attribute.cpp
//
@@ -12,9 +12,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems, Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#include "idl.h"
@@ -34,63 +34,615 @@ be_attribute::be_attribute (idl_bool ro, AST_Type *ft, UTL_ScopedName *n,
AST_Field (AST_Decl::NT_attr, ft, n, p),
AST_Decl (AST_Decl::NT_attr, n, p)
{
- // computes the repoID
- compute_repoID ();
-
- // computes the fully scoped name
- compute_fullname ();
-
- // compute the flattened fully scoped name
- compute_flatname ();
}
+// Handling attributes is very similar to operations. Attributes are mapped to
+// two methods - one to set the value and one to get the value. For a readonly
+// attribute we only have the method that retrieves the value. For the "set"
+// method we pass an in parameter which is of the type of the attribute. So the
+// handling here is exactly like the "in" parameters for arguments. The
+// handling of the "get" method is exactly like the return values of
+// operations.
+
int
be_attribute::gen_client_header (void)
{
- be_type *bt; // the field type
+ TAO_OutStream *ch; // output stream
+ be_type *bt; // type node
+ be_state *s; // state based code gen object
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cg->push (TAO_CodeGen::TAO_ATTRIBUTE_CH);
+ ch = cg->client_header ();
- cg->node (this); // pass oursleves thru singleton
- cg->outstream (cg->client_header ());
+ ch->indent (); // start with the current indentation level
bt = be_type::narrow_from_decl (this->field_type ());
-#if 0
- // XXXASG
- if ((bt == NULL) ||
- ((bt != NULL) && (bt->gen_type () == -1)))
+ if (!bt)
{
- ACE_ERROR ((LM_ERROR, "be_attribute: error generating mapping\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_header - "
+ "bad type\n"),
+ -1);
+ }
+
+
+ // first the "get" method
+
+ // the retrieve method is defined virtual
+ *ch << "virtual ";
+
+ // first generate the return type
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH); // we are now generating
+ // an attribute "get"
+ // definition with the
+ // return type first
+
+ s = cg->make_state (); // retrieve state based object
+
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_header - "
+ "return type generation failure\n"),
+ -1);
+ }
+ cg->pop (); // restore previous state
+
+ // generate the operation name
+ // additional argument in the form of CORBA::Environment since TAO does not
+ // yet support C++ style Exceptions. However, we can have an option to the
+ // "tao" IDL compiler to ask it to generate code for exceptions. This will be
+ // handled in a later release.
+ *ch << " " << this->local_name () << " (CORBA::Environment &env);\n";
+
+ // now the set method. However, this is not defined if we are readonly
+ if (!this->readonly ())
+ {
+ ch->indent ();
+ *ch << "virtual void " << this->local_name () << "(";
+
+ // we pass the type as an "in" parameter
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH);
+
+ s = cg->make_state (); // retrieve state based object
+
+ if (!s || !bt || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_header - "
+ "in param type generation failure\n"),
+ -1);
+ }
+ cg->pop (); // restore previous state
+ *ch << ", CORBA::Environment &env);\n";
}
-#endif
- cg->pop (); // restore previous state
return 0;
}
int
be_attribute::gen_client_stubs (void)
{
+ TAO_OutStream *cs; // output stream
+ TAO_NL nl; // end line
+ be_type *bt; // type node
+ be_state *s; // state based code gen object
+
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ cs = cg->client_stubs ();
+
+ // retrieve the type
+ bt = be_type::narrow_from_decl (this->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs - "
+ "bad type\n"),
+ -1);
+ }
+
+ // first the retrieve method
+ cs->indent (); // start with current indentation level
+
+ // generate the TAO_Param_Data table for the "get" method
+ *cs << "static const TAO_Param_Data _get_" << this->flatname () <<
+ "_paramdata [] = " << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+
+ // entry for the return type
+ *cs << "{" << bt->tc_name () << ", PARAM_RETURN, 0}";
+ cs->decr_indent ();
+ *cs << "};\n\n";
+
+ // now generate the calldata table
+
+ cs->indent ();
+ *cs << "static const TAO_Call_Data _get_" << this->flatname () << "_calldata = "
+ << nl;
+ *cs << "{";
+ // prepend a "_get_"
+ *cs << "\"_get_" << this->local_name () << "\", ";
+ *cs << "1, "; // always a twoway call
+ *cs << "1, "; // size is 1
+ // insert the address of the paramdata table
+ *cs << "_get_" << this->flatname () << "_paramdata, ";
+ // XXXASG - Exception list goes here (if it exists) - TODO
+ *cs << "0, 0};\n\n";
+
+ // now generate the actual stub
+
+ // first generate the return type
+ cs->indent ();
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS); // declare a return
+ // type of the stub
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs - "
+ "return type generation failure\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // generate the operation name
+ *cs << " " << this->name () << "(CORBA::Environment &env)" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+
+ // declare a return type
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs - "
+ "retval declaration failure\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // generate code that calls QueryInterface
+ *cs << "STUB_Object *istub;\n\n";
+ cs->indent ();
+ *cs << "if (this->QueryInterface (IID_STUB_Object, " <<
+ "(void **)&istub) != NOERROR)" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" <<
+ nl;
+
+ // return the appropriate error value on exception
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs - "
+ "failure returning from exception\n"),
+ -1);
+ }
+ cg->pop ();
+
+ cs->decr_indent ();
+ *cs << "}" << nl;
+ *cs << "this->Release (); // QueryInterface has bumped up our refcount" << nl;
+
+ // call do_call with appropriate number of arguments
+ *cs << "istub->do_call (env, &_get_" << this->flatname () <<
+ "_calldata, &retval);" << nl;
+
+ // return the retval
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_operation::gen_client_stubs\n"
+ "return val return generation failure\n"),
+ -1);
+ return -1;
+ }
+ cg->pop ();
+
+ cs->decr_indent (0);
+ *cs << "\n}\n\n";
+
+ if (this->readonly ())
+ return 0; // we were readonly, nothing else to do.
+
+ // Now generate the stub for the "set" method
+ cs->indent (); // start with current indentation level
+
+ // generate the TAO_Param_Data table for the "set" method
+ *cs << "static const TAO_Param_Data _set_" << this->flatname () <<
+ "_paramdata [] = " << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+
+ // entry for the return type
+ *cs << "{CORBA::_tc_void, PARAM_RETURN, 0}," << nl;
+ *cs << "{" << bt->tc_name () << ", PARAM_IN, 0}\n";
+ cs->decr_indent ();
+ *cs << "};\n\n";
+
+ // now generate the calldata table
+
+ cs->indent ();
+ *cs << "static const TAO_Call_Data _set_" << this->flatname () << "_calldata = "
+ << nl;
+ *cs << "{";
+ // prepend a "_set_"
+ *cs << "\"_set_" << this->local_name () << "\", ";
+ *cs << "1, "; // always a twoway call
+ *cs << "2, "; // size is 2
+ // insert the address of the paramdata table
+ *cs << "_get_" << this->flatname () << "_paramdata, ";
+ // XXXASG - Exception list goes here (if it exists) - TODO
+ *cs << "0, 0};\n\n";
+
+ // now generate the actual stub
+
+ cs->indent ();
+ *cs << "void " << this->name () << "(";
+ // generate the in parameter
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_operation::gen_client_stubs - "
+ "failure in argument generation in signature\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // last argument - is always CORBA::Environment
+ *cs << ", CORBA::Environment &env)" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+
+ // generate code that calls QueryInterface
+ *cs << "STUB_Object *istub;\n\n";
+ cs->indent ();
+ *cs << "if (this->QueryInterface (IID_STUB_Object, " <<
+ "(void **)&istub) != NOERROR)" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << "env.exception (new CORBA::DATA_CONVERSION (CORBA::COMPLETED_NO));" <<
+ nl;
+ *cs << "return;\n";
+ cs->decr_indent ();
+ *cs << "}" << nl;
+ *cs << "this->Release (); // QueryInterface has bumped up our refcount" << nl;
+
+ // do any pre do_call stuff with the lone IN parameter
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS);
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_atribute::gen_client_stubs - "
+ "failure generating pre docall stuff\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // call do_call with appropriate number of arguments
+ *cs << "istub->do_call (env, &_set_" << this->flatname () <<
+ "_calldata, 0"; // no return value
+
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs - "
+ "in param in docall generation failure\n"),
+ -1);
+ return -1;
+ }
+ cg->pop ();
+ *cs << ");" << nl;
+
+ // do any post do_call processing
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS);
+ s = cg->make_state ();
+ if (!s || !bt || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_client_stubs\n"
+ "post docall generation failure\n"),
+ -1);
+ return -1;
+ }
+ cg->pop ();
+
+ cs->decr_indent (0);
+ *cs << "\n}\n\n";
+
return 0;
}
int
be_attribute::gen_server_header (void)
{
+ TAO_OutStream *sh; // output stream
+ be_type *bt; // type node
+ be_state *s; // state based code generator object
+ TAO_NL nl; // newline generator
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+
+ sh = cg->server_header ();
+
+ // first retrieve the type
+ bt = be_type::narrow_from_decl (this->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_header - "
+ "bad type\n"),
+ -1);
+ }
+
+ // first the "get" method
+
+ sh->indent (); // start with the current indentation level
+
+ // the retrieve method is defined pure virtual
+ *sh << "virtual ";
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH); // we are now generating
+ // an operation
+ // definition with the
+ // return type first
+
+ s = cg->make_state (); // retrieve state based object
+
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_header - "
+ "return type generation failure\n"),
+ -1);
+ }
+ cg->pop (); // restore previous state
+
+ *sh << " " << this->local_name () << " (CORBA::Environment &env) = 0;" << nl;
+
+ // generate the static method corresponding to the method
+ *sh << "static void _get_" << this->local_name () <<
+ "_skel (CORBA::ServerRequest &req, " <<
+ "CORBA::Object_ptr obj, CORBA::Environment &env);\n\n";
+
+
+ // now the set method. However, this is not defined if we are readonly
+ if (this->readonly ())
+ return 0;
+
+ sh->indent ();
+ *sh << "virtual void " << this->local_name () << "(";
+
+ // we pass the type as an "in" parameter
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH);
+
+ s = cg->make_state (); // retrieve state based object
+
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_header - "
+ "in param type generation failure\n"),
+ -1);
+ }
+ cg->pop (); // restore previous state
+ *sh << ", CORBA::Environment &env) = 0;" << nl;
+
+ // generate the static method corresponding to the method
+ *sh << "static void _set_" << this->local_name () <<
+ "_skel (CORBA::ServerRequest &req, " <<
+ "CORBA::Object_ptr obj, CORBA::Environment &env);\n\n";
+
+
return 0;
}
int
be_attribute::gen_server_skeletons (void)
{
+ TAO_OutStream *ss; // output stream
+ TAO_NL nl; // end line
+ be_type *bt; // type node
+ be_state *s; // state based code gen object
+ be_interface *intf; // enclosing interface node
+
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ ss = cg->server_skeletons ();
+
+ ss->indent (); // start with the current indentation level
+
+ // retrieve our type
+ bt = be_type::narrow_from_decl (this->field_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "bad type\n"),
+ -1);
+ }
+
+ // retrieve our enclosing interface decl
+ intf = be_interface::narrow_from_decl (ScopeAsDecl (this->defined_in ()));
+ if (!intf)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "bad enclosing interface\n"),
+ -1);
+ }
+
+
+ // code generation - first the "get" method
+ *ss << "void " << intf->full_skel_name () << "::_get_"
+ << this->local_name () << "_skel ("
+ << "CORBA::ServerRequest &_tao_server_request, "
+ << "CORBA::Object_ptr _tao_object_reference, "
+ << "CORBA::Environment &_tao_environment)" << nl;
+ *ss << "{\n";
+ ss->incr_indent ();
+ // define a variable that will eventually point to our implementation object
+ *ss << intf->full_skel_name () << "_ptr \t impl;" << nl;
+ // store the result in this Any
+ *ss << "CORBA::Any *result;" << nl;
+ // emit the return type
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS); // emit type for return
+ // value
+ // get a state based code gen object
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "codegen for return val decl failed\n"),
+ -1);
+ }
+ cg->pop ();
+
+ ss->indent ();
+ *ss << "// this method has no incoming parameters. Nothing to parse" << nl;
+
+ // make the upcall
+ *ss << "impl = (" << intf->full_skel_name () << "_ptr) _tao_object_reference->get_subclass ();"
+ << nl;
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS);
+ s = cg->make_state ();
+ // emit code to assign to retval
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "codegen for return val assign failed\n"),
+ -1);
+ }
+ *ss << " = impl->" << this->local_name () << "(_tao_environment);" << nl;
+ cg->pop ();
+
+ // insert our return val into the result
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "codegen for returning result failed\n"),
+ -1);
+ }
+ cg->pop ();
+ // insert the result into the server request
+ *ss << "_tao_server_request.result (result, _tao_environment);\n";
+ ss->decr_indent ();
+ *ss << "}\n\n";
+
+ if (this->readonly ())
+ return 0; // nothing else to do as we are readonly
+
+ // generate skeleton for the "set" method
+
+ ss->indent ();
+ *ss << "void " << intf->full_skel_name () << "::_set_"
+ << this->local_name () << "_skel ("
+ << "CORBA::ServerRequest &_tao_server_request, "
+ << "CORBA::Object_ptr _tao_object_reference, "
+ << "CORBA::Environment &_tao_environment)" << nl;
+ *ss << "{\n";
+ ss->incr_indent ();
+ // define an NVList to hold the in argument
+ *ss << "CORBA::NVList_ptr \t nvlist;" << nl;
+ // define a variable that will eventually point to our implementation object
+ *ss << intf->full_skel_name () << "_ptr \t impl;" << nl;
+
+ // if we have any arguments, get each one of them and allocate an Any and
+ // NamedValue for each. In addition, define a variable of that type
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "codegen for returning result failed\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // declare an NVList and create one
+ ss->indent ();
+ *ss << "// create an NV list and populate it with typecodes" << nl;
+ *ss << "_tao_server_request.orb ()->create_list (0, nvlist); // initialize a list" << nl;
+
+ // add the "in" argument
+ // emit code that adds this argument to the NVList
+ *ss << "nv_" << this->local_name () << " = nvlist->add_value (\"" <<
+ this->local_name () << "\", any_" << this->local_name () <<
+ ", CORBA::ARG_IN, _tao_environment);" << nl;
+
+ *ss << "// parse the arguments" << nl;
+ *ss << "_tao_server_request.params (nvlist, _tao_environment);" << nl;
+ *ss << "if (_tao_environment.exception ()) return;" << nl;
+
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "preupcall code failed\n"),
+ -1);
+ }
+ cg->pop ();
+
+ // make the upcall
+ *ss << "impl = (" << intf->full_skel_name () << "_ptr) _tao_object_reference->get_subclass ();"
+ << nl;
+
+ *ss << "impl->" << this->local_name () << "(";
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "upcall code failed\n"),
+ -1);
+ }
+ cg->pop ();
+ *ss << "_tao_environment);" << nl;
+
+ cg->push (TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS);
+ s = cg->make_state ();
+ if (!s || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_attribute::gen_server_skeletons - "
+ "post upcall code failed\n"),
+ -1);
+ }
+ cg->pop ();
+
+ *ss << "\n";
+ ss->decr_indent ();
+ *ss << "}\n\n";
+
return 0;
}
// Generates the client-side inline information
-int
+int
be_attribute::gen_client_inline (void)
{
// nothing to be done
@@ -98,7 +650,7 @@ be_attribute::gen_client_inline (void)
}
// Generates the server-side inline
-int
+int
be_attribute::gen_server_inline (void)
{
// nothing to be done
@@ -108,4 +660,3 @@ be_attribute::gen_server_inline (void)
// Narrowing
IMPL_NARROW_METHODS2 (be_attribute, AST_Attribute, be_decl)
IMPL_NARROW_FROM_DECL (be_attribute)
-
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index 56ba66b01f2..72468faa7bf 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -106,11 +106,32 @@ TAO_CodeGen::make_state (void)
case TAO_SEQUENCE_BODY_CS:
case TAO_SEQUENCE_BODY_CI:
return TAO_BE_STATE_SEQUENCE::instance ();
+ case TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ case TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ case TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ case TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ case TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ case TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ case TAO_ATTRIBUTE_DOCALL_CS:
+ case TAO_ATTRIBUTE_POST_DOCALL_CS:
+ case TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ case TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ case TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ case TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ case TAO_ATTRIBUTE_RESULT_SS:
+ case TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ case TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ case TAO_ATTRIBUTE_UPCALL_SS:
+ case TAO_ATTRIBUTE_POST_UPCALL_SS:
+ return TAO_BE_STATE_ATTRIBUTE::instance ();
default:
return 0;
}
}
+// change the string to all upcase
const char *
TAO_CodeGen::upcase (const char *str)
{
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 3ea2a24c2eb..8b730d4dff9 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -568,7 +568,7 @@ int be_interface::gen_server_skeletons (void)
*ss << "CORBA::POA_ptr oa = TAO_ORB_Core_instance ()->root_poa (); " <<
"// underlying OA" << nl;
*ss << "const ACE_INET_Addr &addr = ocp->orb_params ()->addr ();" << nl;
- *ss << "this->optable_ = &tao_" << local_name () << "_optable;" << nl <<
+ *ss << "this->optable_ = &tao_" << this->flatname () << "_optable;" << nl <<
nl;
*ss << "// set up an IIOP object" << nl;
#if 0
@@ -663,7 +663,7 @@ be_interface::gen_operation_table (void)
ss = cg->server_skeletons ();
ss->indent (); // start from current indentation level
- *ss << "static const TAO_operation_db_entry " << local_name () <<
+ *ss << "static const TAO_operation_db_entry " << this->flatname () <<
"_operations [] = {\n";
ss->incr_indent ();
if (this->nmembers () > 0)
@@ -689,6 +689,29 @@ be_interface::gen_operation_table (void)
<< nl;
count++;
}
+ else if (d->node_type () == AST_Decl::NT_attr)
+ {
+ AST_Attribute *attr;
+
+ // generate only the "get" entry if we are readonly
+ *ss << "{\"_get_" << d->local_name () << "\", &" <<
+ this->full_skel_name () << "::_get_" << d->local_name () <<
+ "_skel}," << nl;
+ count++;
+
+ attr = AST_Attribute::narrow_from_decl (d);
+ if (!attr)
+ return -1;
+
+ if (!attr->readonly ())
+ {
+ // the set method
+ *ss << "{\"_set_" << d->local_name () << "\", &" <<
+ this->full_skel_name () << "::_set_" << d->local_name
+ () << "_skel}," << nl;
+ count++;
+ }
+ }
}
si->next ();
} // end of while
@@ -701,8 +724,8 @@ be_interface::gen_operation_table (void)
// XXXASG - this code should be based on using different strategies for
// demux - for next release
- *ss << "TAO_Dynamic_Hash_OpTable tao_" << local_name () << "_optable " <<
- "(" << local_name () << "_operations, " << count << ", " << 2*count << ");"
+ *ss << "TAO_Dynamic_Hash_OpTable tao_" << this->flatname () << "_optable " <<
+ "(" << this->flatname () << "_operations, " << count << ", " << 2*count << ");"
<< nl;
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 83c149ca129..96dc38d0182 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -444,7 +444,7 @@ be_sequence::gen_client_stubs (void)
*cs << "return;\n";
cs->decr_indent ();
- *cs << "for (int i = 0; i < this->length_; ++i)" << nl;
+ *cs << "for (CORBA::ULong i = 0; i < this->length_; ++i)" << nl;
*cs << "{\n";
cs->incr_indent ();
*cs << "tmp[i] = this->buffer_[i];\n";
diff --git a/TAO/TAO_IDL/be/be_state_argument.cpp b/TAO/TAO_IDL/be/be_state_argument.cpp
index 92b456e9106..c42831e448b 100644
--- a/TAO/TAO_IDL/be/be_state_argument.cpp
+++ b/TAO/TAO_IDL/be/be_state_argument.cpp
@@ -1002,7 +1002,11 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS:
{
// declare a variable
- *os << "char *" << arg->local_name () << ";" <<
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ";" <<
nl;
// now define a NamedValue_ptr
*os << "CORBA::NamedValue_ptr nv_" << arg->local_name () <<
@@ -1044,10 +1048,24 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
}
break;
case TAO_CodeGen::TAO_ARGUMENT_CH:
+ {
+ *os << "const ";
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->nested_type_name (bif);
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ", ";
+ }
+ break;
case TAO_CodeGen::TAO_ARGUMENT_SH:
case TAO_CodeGen::TAO_ARGUMENT_CS:
{
- *os << "const char *" << arg->local_name () << ", ";
+ *os << "const ";
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ", ";
}
break;
default:
@@ -1063,7 +1081,11 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS:
{
// declare a variable
- *os << "char *" << arg->local_name () << ";" <<
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ";" <<
nl;
// now define a NamedValue_ptr
*os << "CORBA::NamedValue_ptr nv_" << arg->local_name () <<
@@ -1105,10 +1127,22 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
}
break;
case TAO_CodeGen::TAO_ARGUMENT_CH:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->nested_type_name (bif);
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ", ";
+ }
+ break;
case TAO_CodeGen::TAO_ARGUMENT_SH:
case TAO_CodeGen::TAO_ARGUMENT_CS:
{
- *os << "char *&" << arg->local_name () << ", ";
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << " " << arg->local_name () << ", ";
}
break;
default:
@@ -1124,21 +1158,39 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
case TAO_CodeGen::TAO_ARGUMENT_VARDECL_SS:
{
// declare a variable
- *os << "char *" << arg->local_name () << ";" <<
- nl;
- // now define a NamedValue_ptr
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << arg->local_name () << ";" << nl;
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name () << "_out";
+ else
+ *os << "CORBA::String_out";
+ *os << " " << arg->local_name () << "_out (" <<
+ arg->local_name () << ");" << nl;
+ // we also declare a corresponding char*
+ // passed to the decoder
+ *os << "char **_tao_base_" << arg->local_name ()
+ << " = new char*;" << nl;
+ // now define a NamedValue_ptr
*os << "CORBA::NamedValue_ptr nv_" << arg->local_name () <<
";" << nl;
- // declare an Any
+ // declare an Any
*os << "CORBA::Any \t any_" << arg->local_name () << " (" <<
- bt->tc_name () << ", &" << arg->local_name () <<
+ bt->tc_name () << ", _tao_base_" << arg->local_name () <<
", 1); // ORB owns" << nl;
+
}
break;
case TAO_CodeGen::TAO_ARGUMENT_PRE_DOCALL_CS:
{
// declare a string variable
- *os << "char *_tao_base_" << arg->local_name () << ";" << nl;
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name ();
+ else
+ *os << "char *";
+ *os << " _tao_base_" << arg->local_name () << ";" << nl;
}
break;
case TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS:
@@ -1156,7 +1208,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_ARGUMENT_UPCALL_SS:
{
- *os << arg->local_name () << ", ";
+ *os << arg->local_name () << "_out, ";
}
break;
case TAO_CodeGen::TAO_ARGUMENT_PRE_UPCALL_SS:
@@ -1166,19 +1218,28 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_ARGUMENT_POST_UPCALL_SS:
{
- // nothing
+ // out parameter is cast
+ *os << "*_tao_base_" << arg->local_name () << " = " <<
+ arg->local_name () << "_out;" << nl;
}
break;
case TAO_CodeGen::TAO_ARGUMENT_CH:
{
- *os << bt->nested_type_name (bif, "_out") << " " <<
- arg->local_name () << ", ";
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->nested_type_name (bif, "_out");
+ else
+ *os << "CORBA::String_out";
+ *os << " " << arg->local_name () << ", ";
}
break;
case TAO_CodeGen::TAO_ARGUMENT_CS:
case TAO_CodeGen::TAO_ARGUMENT_SH:
{
- *os << bt->name () << "_out " << arg->local_name () << ", ";
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ *os << bt->name () << "_out";
+ else
+ *os << "CORBA::String_out";
+ *os << " " << arg->local_name () << ", ";
}
break;
default:
@@ -1705,7 +1766,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS:
{
- // nothing
+ *os << ", &" << arg->local_name ();
}
break;
case TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS:
@@ -1774,7 +1835,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS:
{
- // nothing
+ *os << ", &" << arg->local_name ();
}
break;
case TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS:
@@ -1843,7 +1904,7 @@ be_state_argument::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case TAO_CodeGen::TAO_ARGUMENT_DOCALL_CS:
{
- // nothing
+ *os << ", &" << arg->local_name ();
}
break;
case TAO_CodeGen::TAO_ARGUMENT_POST_DOCALL_CS:
diff --git a/TAO/TAO_IDL/be/be_state_attribute.cpp b/TAO/TAO_IDL/be/be_state_attribute.cpp
index aa85a7a7842..73fb5819be5 100644
--- a/TAO/TAO_IDL/be/be_state_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_state_attribute.cpp
@@ -26,10 +26,1055 @@ be_state_attribute::be_state_attribute (void)
int
be_state_attribute::gen_code (be_type *bt, be_decl *d, be_type *type)
{
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
- ACE_UNUSED_ARG (d);
- ACE_UNUSED_ARG (type);
+ TAO_OutStream *os = 0; // output stream
+ TAO_NL nl; // end line
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ be_attribute *attr; // attribute node
+ be_interface *bif; // enclosing scope which is an interface
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ os = cg->client_header ();
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ os = cg->client_stubs ();
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ os = cg->server_header ();
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ os = cg->server_skeletons ();
+ break;
+ }
+
+ // retrieve the ATTRIBUTE node
+ attr = be_attribute::narrow_from_decl (d);
+ if (!attr)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute.cpp - "
+ "Bad attribute node\n"),
+ -1);
+ }
+
+ // get the enclosing interface scope to be used in the NESTED_CLASS macro
+ bif = be_interface::narrow_from_decl (ScopeAsDecl (attr->defined_in ()));
+ if (!bif)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute.cpp - "
+ "Bad interface\n"),
+ -1);
+ }
+
+ if (!type) // not a recursive call
+ type = bt;
+ else // recursively called thru a typedef. "type" will have the most primitive
+ // base class of the typedef
+ ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef);
+
+ // Two level switching
+ // (1) switch on node type
+ // (2) switch on current code generation state
+
+ switch (type->node_type ()) // LEVEL (1) switch based on node type
+ {
+ case AST_Decl::NT_interface: // type is an obj reference
+ case AST_Decl::NT_interface_fwd: // type is an obj reference
+ {
+ // what state are we in
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // to keep MSVC++ happy
+ *os << bt->nested_type_name (bif, "_ptr") << " ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // to keep the MSVC++ compiler happy
+ *os << bt->nested_type_name (bif, "_ptr") << " " <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name () << "_ptr ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << bt->name () << "_ptr " << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ *os << "CORBA::Object_ptr retval = CORBA::Object::_nil ();" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return " << bt->name () << "::_nil ();\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return " << bt->name () << "::_narrow (retval, env);" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ *os << "CORBA::Object_ptr *retval ="
+ " new CORBA::Object_ptr;" << nl;
+ *os << "*retval = CORBA::Object::_nil ();" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << "*retval"; // assign to retval
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // assign to a CORBA::Object_ptr
+ *os << "CORBA::Object_ptr _tao_base_" << attr->local_name ()
+ << " = " << attr->local_name () << "; // cast it" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ // pass the cast value
+ *os << ", &_tao_base_" << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing for in parameters
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << "_ptr ";
+ *os << attr->local_name () << ";" << nl;
+ // we also declare a corresponding CORBA::Object_ptr to be
+ // passed to the decoder
+ *os << "CORBA::Object_ptr _tao_base_" << attr->local_name ()
+ << ";" << nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &_tao_base_" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // convert from the CORBA::Object_ptr to the interface type
+ // using a _narrow
+ *os << attr->local_name () << " = " << bt->name () <<
+ "::_narrow (_tao_base_" << attr->local_name () << ", " <<
+ "_tao_environment);" << nl;
+ *os << "if (_tao_environment.exception ()) return;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing for an in parameter
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // switch state
+ } // end of case interface/interface_fwd
+ break;
+ case AST_Decl::NT_pre_defined: // type is predefined type
+ {
+ be_predefined_type *bpd = be_predefined_type::narrow_from_decl (type);
+
+ // check if the type is an any
+ if (bpd->pt () == AST_PredefinedType::PT_any)
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ // if it is an any, return a pointer to it
+ *os << bt->name () << " *retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ // if it is an any, return a pointer to it
+ *os << "return 0;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ // if it is an any, return a pointer to it
+ *os << bt->name () << " *retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ // if it is an any, return a pointer to it
+ *os << "retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ // if it is an any, return a pointer to it
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ *os << bt->name () << " ";
+ // declare a variable
+ *os << attr->local_name () << ";" << nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // XXXASG - TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ // XXXASG - TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // XXXASG - TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // XXXASG - TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // XXXASG - TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << bt->nested_type_name (bif);
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name () << "* ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << "const " << bt->nested_type_name (bif) << " &" <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << "const " << bt->name () << " &" << attr->local_name
+ ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end of if
+ else if (bpd->pt () == AST_PredefinedType::PT_pseudo) // e.g., CORBA::Object
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ // pseudo object, return a pointer
+ *os << bt->name () << "_ptr retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ // pseudo object, return a pointer
+ *os << "return 0;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ // pseudo object, return a pointer
+ *os << bt->name () << "_ptr *retval = new " << bt->name () <<
+ "_ptr;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ // pseudo object, return a pointer
+ *os << "*retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ // pseudo object, return a pointer
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << "_ptr ";
+ *os << attr->local_name () << ";" << nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // no casting necessary as we already are object_ptr
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ *os << ", &" << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing to be done as we are Object_ptr
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << bt->nested_type_name (bif);
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << "const " << bt->nested_type_name (bif) << " &" <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << "const " << bt->name () << " &" << attr->local_name
+ ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end of switch state
+ } // end else if
+ else // simple predefined types
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ *os << bt->name () << " retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return retval;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ *os << bt->name () << " *retval = new " << bt->name () << ";"
+ << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << " *retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << " " << attr->local_name () << ";" <<
+ nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ *os << ", &" << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << bt->nested_type_name (bif);
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // keep MSVC++ happy
+ *os << "const " << bt->nested_type_name (bif) << " &" <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << "const " << bt->name () << " &" << attr->local_name
+ ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end of else
+ } // end of case predefined
+ break;
+ case AST_Decl::NT_string: // type is a string
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ *os << bt->name () << " retval = 0;" << nl;
+ }
+ else
+ {
+ *os << "char *retval = 0;" << nl;
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return 0;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ *os << bt->name () << " *retval = new " << bt->name () << "*;" << nl;
+ }
+ else
+ {
+ *os << "char **retval = new char*;" << nl;
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << "*retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << "char *" << attr->local_name () << ";" <<
+ nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ *os << ", &" << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ // to keep MSVC++ happy
+ *os << bt->nested_type_name (bif);
+ }
+ else
+ {
+ *os << "char *";
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ *os << bt->name ();
+ }
+ else
+ {
+ *os << "char *";
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ {
+ *os << "const char *" << attr->local_name ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end case string
+ break;
+ case AST_Decl::NT_array: // type is an array
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ *os << bt->name () << "_slice *retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return 0;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ *os << bt->name () << "_slice *retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << "retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << " " << attr->local_name ()
+ << ";" << nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", " << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // XXXASG TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ // XXXASG TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // XXXASG TODO
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // to keep MSVC++ happy
+ *os << bt->nested_type_name (bif, "_slice") << " *";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name () << "_slice *";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // to keep the MSVC++ compiler happy
+ *os << "const " << bt->nested_type_name (bif) << " " <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << "const " << bt->name () << " " << attr->local_name ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end of case array
+ break;
+ case AST_Decl::NT_sequence: // type is a sequence
+ case AST_Decl::NT_struct: // type is a struct
+ case AST_Decl::NT_union: // type is a union
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << " " << attr->local_name () <<
+ ";" << nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ *os << ", &" << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ *os << bt->name () << " *retval = 0;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return 0;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ *os << bt->name () << " *retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << "retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ if (bt->size_type () == be_decl::VARIABLE)
+ // to keep MSVC++ happy
+ *os << bt->nested_type_name (bif) << " *";
+ else
+ *os << bt->nested_type_name (bif);
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ if (bt->size_type () == be_decl::VARIABLE)
+ *os << bt->name () << " *";
+ else
+ *os << bt->name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // to keep the MSVC++ compiler happy
+ *os << "const " << bt->nested_type_name (bif) << " &" <<
+ attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << "const " << bt->name () << " &" << attr->local_name ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end case
+ break;
+ case AST_Decl::NT_enum: // type is an enum
+ {
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
+ {
+ *os << bt->name () << " retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
+ {
+ *os << "return retval;\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS:
+ {
+ *os << "return retval;" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_SS:
+ {
+ *os << bt->name () << " *retval = new " << bt->name () << ";" <<
+ nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_ASSIGN_SS:
+ {
+ *os << "*retval";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RESULT_SS:
+ {
+ *os << "result = new CORBA::Any (" << bt->tc_name () <<
+ ", retval, 1); // ORB owns" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SS:
+ {
+ // declare a variable
+ *os << bt->name () << " " << attr->local_name () << ";" <<
+ nl;
+ // now define a NamedValue_ptr
+ *os << "CORBA::NamedValue_ptr nv_" << attr->local_name () <<
+ ";" << nl;
+ // declare an Any
+ *os << "CORBA::Any \t any_" << attr->local_name () << " (" <<
+ bt->tc_name () << ", &" << attr->local_name () <<
+ "); // ORB does not own" << nl;
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_DOCALL_CS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_UPCALL_SS:
+ {
+ *os << attr->local_name () << ", ";
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_PRE_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_POST_UPCALL_SS:
+ {
+ // nothing
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CH:
+ {
+ // to keep the MSVC++ compiler happy
+ *os << bt->nested_type_name (bif) << " " << attr->local_name
+ ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_INPARAM_TYPE_SH:
+ {
+ *os << bt->name () << " " << attr->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CH:
+ {
+ // to keep MSVC++ happy
+ *os << bt->nested_type_name (bif);
+ }
+ break;
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_CS:
+ case TAO_CodeGen::TAO_ATTRIBUTE_RETURN_TYPE_SH:
+ {
+ *os << bt->name ();
+ }
+ break;
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_attribute - unknown state\n"), -1);
+ }
+ } // end switch state
+ } // end case
+ break;
+ case AST_Decl::NT_except: // type is an exception
+ {
+ // XXXASG TODO: is this allowed ???
+ }
+ break;
+ case AST_Decl::NT_typedef: // type is a typedef
+ {
+ be_type *temp;
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+
+ if (!t)
+ return -1;
+
+ temp = t->primitive_base_type ();
+ // make a recursive call
+ return this->gen_code (t, d, temp);
+ } // end of case
+ break;
+ } //end switch node type
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index da7b19ee23f..811c83166e8 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -74,9 +74,6 @@ be_string::gen_client_header (void)
TAO_OutStream *ch; // output stream
TAO_NL nl; // end line
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (nl);
-
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index e9a6849922a..c4176c2e93d 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -189,12 +189,25 @@ public:
TAO_ARGUMENT_POST_UPCALL_SS,
// emitting code for attributes
- TAO_ATTRIBUTE_CH,
- TAO_ATTRIBUTE_CI,
- TAO_ATTRIBUTE_CS,
- TAO_ATTRIBUTE_SH,
- TAO_ATTRIBUTE_SI,
- TAO_ATTRIBUTE_SS,
+ TAO_ATTRIBUTE_RETURN_TYPE_CH,
+ TAO_ATTRIBUTE_INPARAM_TYPE_CH,
+ TAO_ATTRIBUTE_RETURN_TYPE_CS,
+ TAO_ATTRIBUTE_RETVAL_DECL_CS,
+ TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS,
+ TAO_ATTRIBUTE_RETVAL_RETURN_CS,
+ TAO_ATTRIBUTE_INPARAM_TYPE_CS,
+ TAO_ATTRIBUTE_PRE_DOCALL_CS,
+ TAO_ATTRIBUTE_DOCALL_CS,
+ TAO_ATTRIBUTE_POST_DOCALL_CS,
+ TAO_ATTRIBUTE_RETURN_TYPE_SH,
+ TAO_ATTRIBUTE_INPARAM_TYPE_SH,
+ TAO_ATTRIBUTE_RETVAL_DECL_SS,
+ TAO_ATTRIBUTE_RETVAL_ASSIGN_SS,
+ TAO_ATTRIBUTE_RESULT_SS,
+ TAO_ATTRIBUTE_INPARAM_TYPE_SS,
+ TAO_ATTRIBUTE_PRE_UPCALL_SS,
+ TAO_ATTRIBUTE_UPCALL_SS,
+ TAO_ATTRIBUTE_POST_UPCALL_SS,
// emitting code for typedefs
TAO_TYPEDEF_CH,