summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog-98c71
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp706
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp92
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp64
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp73
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp123
-rw-r--r--TAO/TAO_IDL/be/be_state.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_state_exception.cpp233
-rw-r--r--TAO/TAO_IDL/be/be_state_sequence.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_state_structure.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_state_typedef.cpp97
-rw-r--r--TAO/TAO_IDL/be/be_state_union.cpp353
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp210
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp81
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_decl.h5
-rw-r--r--TAO/TAO_IDL/be_include/be_scope.h11
-rw-r--r--TAO/TAO_IDL/be_include/be_sequence.h17
-rw-r--r--TAO/TAO_IDL/be_include/be_state.h18
-rw-r--r--TAO/TAO_IDL/narrow/narrow.cpp4
-rw-r--r--TAO/docs/releasenotes/index.html8
-rw-r--r--TAO/tao/deep_free.cpp48
-rw-r--r--TAO/tao/poa.cpp8
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/cubit.idl2
29 files changed, 1691 insertions, 656 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 46c0a1cf7f7..674d4c8caca 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,10 +1,73 @@
+Thu Dec 18 15:06:23 1997 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
+ Thanks to Keith Nicewarner <knicewar@sanders.com>, Tom Richards
+ <tomr@mcmenterprise.com>, and Carlos O'Ryan <coryan@cs.wustl.edu>
+ for reporting bugs which led to some of the changes below.
+
+ * TAO_IDL/be/be_array.cpp: Preliminary support for arrays. Not
+ complete.
+
+ * TAO_IDL/be/{be_operation, be_attribute}.cpp: The ParamData
+ structure *must* hold the "size" of the outermost level of the
+ return values and out parameters because the ORB has to allocate
+ memory for it and hence needs to know the size. We had a 0 in it
+ which crashed any return types that were variable in size.
+
+ * TAO_IDL/be/be_codegen.cpp: Added a new state for
+ unions. Corresponding change to the *.h file.
+
+ * TAO_IDL/be/be_decl.cpp: Added a method called "scope" that
+ returns the corresponding scope defined by this node (if one
+ exists). Added method to the *.h file also.
+
+ * TAO_IDL/be/be_scope.cpp: Added a method called "decl" that
+ returns the be_decl method corresponding to this scope. The header
+ file was also updated.
+
+ * TAO_IDL/be/{be_exception, be_state_exception}.cpp: I was making
+ the most stupid mistake of generating constructors per member
+ rather than one constructor that takes all the members as a
+ parameter.
+
+ * TAO_IDL/be/{be_sequence, be_state_sequence}.cpp: Changed the
+ naming scheme for anonymous sequences to avoid code bloat.
+
+ * TAO_IDL/be/be_state.cpp: Added template instantiation for
+ additional state to deal with code generation of members of
+ unions.
+
+ * TAO_IDL/be/be_state_structure.cpp: Made some changes so that
+ spurious code for array members doesn't get generated.
+
+ * TAO_IDL/be/{be_union, be_state_union}.cpp: Added a new state
+ because we were not generating code for union members that were
+ sequences or structs.
+
+ * TAO_IDL/be/be_type.cpp: Modified netsed_type_name to use the new
+ methods on class be_decl/be_scope.
+
+ * TAO_IDL/be/be_union_branch.cpp: gen_client_stubs uses the same
+ strategy as the other gen_client methods.
+
+ * TAO/tao/deep_free.cpp: In deep_free of structures, instead of
+ passing the address of a string member to be freed, we were simply
+ passing the string that led to a segmentation fault. A careful
+ code review is necessary.
+
+ * TAO/tao/orb_core.cpp: Made "use_ior" as default as ooposed to
+ using the URL based scheme for IORs. This was necessary to have
+ interoperability with other ORBs.
+
+ * TAO/tao/poa.cpp: The server request was being released
+ immediately after returning from the dispatch method. This should
+ be done after all return/inout/out parameters are marshaled.
+
Tue Dec 17 12:53:01 1997 Brian Mendel <brian.r.mendel@boeing.com>
* tao/encode.cpp: Additional changes for wchar's
Tue Dec 17 10:37:45 1997 Brian Mendel <brian.r.mendel@boeing.com>
- * tao/TAO.dsp: Removed obsolete files from the VC++ project.
+ * tao/TAO.dsp: Removed obsolete files from the VC++ project.
Changed name of folder from Include Files to Inline Files.
Inserted new header files for classview.
@@ -16,11 +79,11 @@ Tue Dec 17 10:37:45 1997 Brian Mendel <brian.r.mendel@boeing.com>
* tao/encode.cpp: Inserted wslen and wscpy back to handle wchar
problems with VxWOrks and GHS.
-
+
Tue Dec 16 18:29:42 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
- * orbsvcs/README:
- * docs/orbsvcs.html:
+ * orbsvcs/README:
+ * docs/orbsvcs.html:
Started up the documentation for TAO services, at this point
only the directory hierarchy is explained.
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 53399719aa4..02ba86dde28 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -32,11 +32,7 @@ be_array::be_array (UTL_ScopedName *n, unsigned long ndims, UTL_ExprList *dims)
: AST_Array (n, ndims, dims),
AST_Decl (AST_Decl::NT_array, n, NULL)
{
- be_type *bt;
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (bt);
-
+#if 0
// if we are inside of a union, we change our local name to have an
// underscore before us
AST_Decl *d = ScopeAsDecl (this->defined_in ());
@@ -55,23 +51,129 @@ be_array::be_array (UTL_ScopedName *n, unsigned long ndims, UTL_ExprList *dims)
I_FALSE), NULL));
this->set_name (myname);
}
+#endif
+}
+
+// create a name for ourselves
+int
+be_array::create_name (void)
+{
+ char namebuf [NAMEBUFSIZE];
+ be_type *bt; // base type;
+ unsigned long i;
+ UTL_ScopedName *n = NULL;
+ be_decl *scope; // scope in which we are defined
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer
+ // retrieve the base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad base type\n"),
+ 0);
+ }
+ // the name always starts this way
+ ACE_OS::sprintf (namebuf, "_tao_array_%s", bt->local_name ()->get_string ());
+ // now append dimensions
+ for (i = 0; i < this->n_dims (); i++)
+ {
+ AST_Expression *expr = this->dims ()[i]; // retrieve the ith
+
+ // dimension value
+ if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad array dimension\n"),
+ -1);
+ }
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ ACE_OS::sprintf (namebuf, "%s_%d", namebuf, ((int)expr->ev ()->u.ulval));
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "create_name - "
+ "bad dimension value\n"),
+ -1);
+ }
+ }
+
+ // now see if we have a fully scoped name and if so, generate one
+ scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
+ if (scope)
+ {
+ // make a copy of the enclosing scope's name
+ n = (UTL_ScopedName *)scope->name ()->copy () ;
+
+ // add our local name as the last component
+ n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup
+ (namebuf), 1,
+ 0, I_FALSE),
+ NULL));
+ // set the fully scoped name
+ this->set_name (n);
+ }
+ else
+ {
+ // We better be not here because we must be inside some scope,
+ // atleast the ROOT scope.
+ return -1;
+ }
+ return 0;
}
// Code generation
int
+be_array::gen_dimensions (TAO_OutStream *os, unsigned short slice)
+{
+ unsigned long i; // loop index
+
+ // print our dimensions
+ for (i = (slice?1:0); i < this->n_dims (); i++)
+ {
+ AST_Expression *expr = this->dims ()[i]; // retrieve the ith
+
+ // dimension value
+ if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_dimensions - "
+ "bad array dimension\n"),
+ -1);
+ }
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ *os << "[" << ((int)expr->ev ()->u.ulval) << "]";
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_dimensions - "
+ "bad dimension value\n"),
+ -1);
+ }
+ }
+ return 0;
+}
+
+int
be_array::gen_client_header (void)
{
TAO_OutStream *ch; // output stream
- unsigned long i; // loop index
TAO_NL nl; // end line
be_type *bt; // our base type
- be_decl *d; // enclosing scope
be_state *s; // state based code gen object
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (d);
-
if (!this->cli_hdr_gen_) // not already generated
{
// retrieve a singleton instance of the code generator
@@ -80,97 +182,128 @@ be_array::gen_client_header (void)
ch = cg->client_header (); // retrieve client hdr stream
+#if 0
+ if (this->create_name () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "name creation failed\n"),
+ 0);
+ }
+#endif
s = cg->make_state (); // get the state-based code generation object
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "Bad state\n"),
+ -1);
+ }
+ // retrieve the base type
bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "Bad type\n"),
+ -1);
+ }
+
+ // generate the ifdefined macro for the array type
+ ch->gen_ifdef_macro (this->flatname ());
- // generate our base type
- if (!s || !bt || (s->gen_code (bt, this) == -1))
+ ch->indent (); // start from current indentation
+ // generate code for our base type if required and then print the type
+ // name
+ if (s->gen_code (bt, this) == -1)
{
- ACE_ERROR ((LM_ERROR, "be_array: type generation failed\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "state based codegen failed\n"),
+ -1);
}
// print our name
*ch << " " << this->local_name ();
// print our dimensions
- for (i = 0; i < this->n_dims (); i++)
+ if (this->gen_dimensions (ch) == -1)
{
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimensions\n\n"));
- return -1;
- }
- if (expr->ev ()->et == AST_Expression::EV_ulong)
- {
- *ch << "[" << ((int)expr->ev ()->u.ulval) << "]";
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimension value\n"));
- return -1;
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "dimension codegen failed\n"),
+ -1);
}
+
*ch << ";" << nl;
// if our base type is VARIABLE length, then we are variable length too
this->size_type (bt->size_type ());
-
cg->pop ();
cg->push (TAO_CodeGen::TAO_ARRAY_OTHER_CH); // rest of the array defn
s = cg->make_state ();
-
- *ch << "typedef ";
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "bad state\n"),
+ -1);
+ }
// now generate the slice definition
- if (!s || !bt || (s->gen_code (bt, this) == -1))
+ *ch << "typedef ";
+ if (s->gen_code (bt, this) == -1)
{
- ACE_ERROR ((LM_ERROR, "be_array: type generation failed\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "state based codegen failed\n"),
+ -1);
}
*ch << " " << this->local_name () << "_slice";
// print dimensions except first one
- for (i = 1; i < this->n_dims (); i++)
+ if (this->gen_dimensions (ch, 1) == -1)
{
- // no error checking. Assumption is that everything is valid since we
- // already checked it before.
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
- // dimension value
- *ch << "[" << ((int)expr->ev ()->u.ulval) << "]";
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "slice dimensions codegen failed\n"),
+ -1);
}
*ch << ";" << nl;
// memory management functions
+
+ // The T_alloc method
// first find if we are inside a scope
if (this->is_nested ()) // we were defined inside a scope. Hence the
- // memory management
- // functions become static members of the enclosing class
+ // memory management functions become static
+ // members of the enclosing class
*ch << "static ";
+
+ // the return type is a pointer to slice
*ch << this->local_name () << "_slice *" << this->local_name () <<
"_alloc (void);" << nl;
+ // the T_dup method
if (this->is_nested ())
*ch << "static ";
*ch << this->local_name () << "_slice *" << this->local_name () <<
"_dup (const " << this->local_name () << "_slice *);" << nl;
+ // the T_free method
if (this->is_nested ())
*ch << "static ";
*ch << "void " << this->local_name () << "_free (" << this->local_name ()
<< "_slice *);\n\n";
- // generate the _var, _out, and _forany definition
- this->gen_var_defn ();
- this->gen_out_defn ();
- this->gen_forany_defn ();
-
// Generate the typecode decl
- // All names in the root scope have length 2 (for the root and
- // ourself). The children have length greater than 2. Thus, if our name
- // length is 2 or less, we are outermost and our typecode decl must be
- // extern, else we are defined static inside the enclosing scope.
if (this->is_nested ())
{
// we have a scoped name
@@ -185,6 +318,45 @@ be_array::gen_client_header (void)
*ch << "extern CORBA::TypeCode_ptr " << this->tc_name
()->last_component () << ";\n\n";
}
+ ch->gen_endif ();
+
+ // generate the ifdefined macro
+ ch->gen_ifdef_macro (this->flatname (), "_var");
+ // generate the _var, _out, and _forany definition
+ if (this->gen_var_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "error generating _var class\n"),
+ -1);
+ }
+ ch->gen_endif ();
+
+ // generate the ifdefined macro
+ ch->gen_ifdef_macro (this->flatname (), "_out");
+ if (this->gen_out_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "error generating _out class\n"),
+ -1);
+ }
+ ch->gen_endif ();
+
+ // generate the ifdefined macro
+ ch->gen_ifdef_macro (this->flatname (), "_forany");
+ if (this->gen_forany_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_header - "
+ "error generating _forany class\n"),
+ -1);
+ }
+ ch->gen_endif ();
+
this->cli_hdr_gen_ = I_TRUE;
cg->pop ();
}
@@ -196,7 +368,7 @@ be_array::gen_client_stubs (void)
{
TAO_OutStream *cs; // output stream
TAO_NL nl; // end line
-
+ unsigned long i;
if (!this->cli_stub_gen_)
{
@@ -230,19 +402,70 @@ be_array::gen_client_stubs (void)
cg->pop ();
this->cli_stub_gen_ = I_TRUE;
- }
- return 0;
-}
-
-int
-be_array::gen_server_header (void)
-{
- return 0;
-}
+ // T_dup method
+ *cs << this->name () << "_slice *" << nl;
+ *cs << this->name () << "_dup (" << this->name () << "_slice * s)" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ *cs << this->name () << "_slice *temp;" << nl;
+ *cs << "// alloc an array" << nl;
+ *cs << "temp = " << this->name () << "_alloc ();" << nl;
+ *cs << "// copy each individual elements" << nl;
+ // generate nested loops for as many dimensions as there are
+ for (i = 0; i < this->n_dims (); i++)
+ {
+ AST_Expression *expr = this->dims ()[i]; // retrieve the ith
+ // dimension value
+ if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_stubs - "
+ "bad array dimension\n"),
+ -1);
+ }
+ if (expr->ev ()->et == AST_Expression::EV_ulong)
+ {
+ // generate a loop for each dimension
+ *cs << "for (CORBA::ULong i" << i << " = 0; i" << i << " < " <<
+ expr->ev ()->u.ulval << "; i" << i << "++)\n";
+ cs->incr_indent ();
+ }
+ else
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_stubs - "
+ "bad array dimension value\n"),
+ -1);
+ }
+ }
-int
-be_array::gen_server_skeletons (void)
-{
+ // now generate code such that every element of the array gets assigned
+ // inside the innermost level of the nested loops generated above
+ *cs << "temp"; // generate the lvalue
+ for (i = 0; i < this->n_dims (); i++)
+ {
+ *cs << "[i" << i << "]";
+ }
+ *cs << " = ";
+ *cs << "s"; // generate the rvalue
+ for (i = 0; i < this->n_dims (); i++)
+ {
+ *cs << "[i" << i << "]";
+ }
+ *cs << ";\n";
+ for (i = 0; i < this->n_dims (); i++)
+ {
+ // decrement indentation as many times as the number of dimensions
+ cs->decr_indent (0);
+ }
+ cs->indent ();
+ *cs << "return temp;\n";
+ // one more to get to the outermost level
+ cs->decr_indent ();
+ *cs << "}\n\n";
+ }
return 0;
}
@@ -253,124 +476,65 @@ be_array::gen_client_inline (void)
if (!this->cli_inline_gen_)
{
TAO_OutStream *ci; // output stream
- unsigned long i; // loop index
TAO_NL nl; // end line
be_type *bt; // our base type
- be_decl *d; // enclosing scope
be_state *s; // state based code gen obj
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (d);
-
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
ci = cg->client_inline ();
cg->push (TAO_CodeGen::TAO_ARRAY_DEFN_CI);
s = cg->make_state ();
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_inline - "
+ "bad state\n"),
+ -1);
+ }
// retrieve our base type
bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_inline - "
+ "bad base type\n"),
+ -1);
+ }
// first define the _alloc, _dup and _free methods
// If we are defined inside some scope, these methods become static
// members of the enclosing scope
- ci->indent (); // start from current indentation
-
// alloc method
+ ci->indent (); // start from current indentation
*ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << this->name () << "_alloc (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
- *ci << "new ";
+ *ci << "return new ";
if (s->gen_code (bt, this) == -1)
- return -1;
-
- ci->decr_indent ();
- *ci << "}\n\n";
-
- // dup method
- *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
- *ci << this->name () << "_dup (" << this->name () << "_slice * s)" << nl;
- *ci << "{\n";
- ci->incr_indent ();
- *ci << this->name () << "_slice *temp;" << nl;
- *ci << "temp = " << this->name () << "_alloc ();" << nl;
- *ci << "// copy each individual elements" << nl;
- for (i = 0; i < this->n_dims (); i++)
{
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimensions\n\n"));
- return -1;
- }
- if (expr->ev ()->et == AST_Expression::EV_ulong)
- {
- // generate a loop for each dimension
- *ci << "for (CORBA::ULong i" << i << " = 0; i" << i << " < " <<
- expr->ev ()->u.ulval << "; i" << i << "++)\n";
- ci->incr_indent ();
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimension value\n"));
- return -1;
- }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_inline - "
+ "state based codegen failed\n"),
+ -1);
}
-
- // the code below looks terribly complex. However, all it is trying to do
- // is to generate code of the form
- // temp [i0][i1].... =
- *ci << "temp ";
- for (i = 0; i < this->n_dims (); i++)
+ if (this->gen_dimensions (ci) == -1)
{
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimensions\n\n"));
- return -1;
- }
- if (expr->ev ()->et == AST_Expression::EV_ulong)
- {
- *ci << "[" << ((int)expr->ev ()->u.ulval) << "]";
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimension value\n"));
- return -1;
- }
- }
- *ci << " = s";
- for (i = 0; i < this->n_dims (); i++)
- {
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
- // dimension value
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimensions\n\n"));
- return -1;
- }
- if (expr->ev ()->et == AST_Expression::EV_ulong)
- {
- *ci << "[" << ((int)expr->ev ()->u.ulval) << "]";
- }
- else
- {
- ACE_ERROR ((LM_ERROR, "be_array: bad dimension value\n"));
- return -1;
- }
- }
- *ci << ";\n";
- for (i = 0; i < this->n_dims (); i++)
- {
- // decrement indentation as many times as the number of dimensions
- ci->decr_indent ();
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_array::"
+ "gen_client_inline - "
+ "dimensions codegen failed\n"),
+ -1);
}
+ *ci << ";\n";
ci->decr_indent ();
*ci << "}\n\n";
@@ -413,7 +577,18 @@ be_array::gen_client_inline (void)
return 0;
}
-// Generates the server-side inline
+int
+be_array::gen_server_header (void)
+{
+ return 0;
+}
+
+int
+be_array::gen_server_skeletons (void)
+{
+ return 0;
+}
+
int
be_array::gen_server_inline (void)
{
@@ -448,19 +623,19 @@ be_array::gen_var_defn (void)
ch->incr_indent ();
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- // constr
- *ch << namebuf << " (" << local_name () << "_slice *);" << nl;
+ // constr from pointer to slice
+ *ch << namebuf << " (" << this->local_name () << "_slice *);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
// destructor
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
+ // assignment operator from a pointer to slice
+ *ch << namebuf << " &operator= (" << this->local_name () << "_slice *);" <<
+ nl;
// assignment from _var
- *ch << namebuf << " &operator= (const " << namebuf <<
- " &);" << nl;
+ *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
// arrow operator
// nothing here
@@ -468,35 +643,25 @@ be_array::gen_var_defn (void)
// other extra types (cast operators, [] operator, and others)
// overloaded [] operator
- *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
- *ch << "const " << namebuf <<
+ *ch << this->local_name () << "_slice &operator[] (CORBA::ULong index);" <<
+ nl;
+ *ch << "const " << this->local_name () <<
"_slice &operator[] (CORBA::ULong index) const;" << nl;
// cast operators
- *ch << "operator const " << local_name () << "_slice *&() const;" << nl;
- *ch << "operator " << local_name () << "_slice *&();" << nl;
+ *ch << "operator const " << this->local_name () << "_slice *&() const;" <<
+ nl;
+ *ch << "operator " << this->local_name () << "_slice *&();" << nl;
+ // in, inout, out and _retn
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
- if (this->size_type () == be_decl::FIXED)
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << " out (void);" << nl;
- *ch << local_name () << "_slice *_retn (void);" << nl;
- }
- else
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << "_slice *&out (void);" << nl;
- *ch << local_name () << " *_retn (void);" << nl;
- }
+ *ch << "const " << this->local_name () << "_slice *in (void) const;" << nl;
+ *ch << this->local_name () << "_slice *inout (void);" << nl;
+ *ch << this->local_name () << "_slice *&out (void);" << nl;
+ *ch << this->local_name () << "_slice *_retn (void);" << nl;
// generate an additional member function that returns the underlying pointer
-
- *ch << local_name () << "_slice *ptr (void) const;\n";
+ *ch << this->local_name () << "_slice *ptr (void) const;\n";
*ch << "\n";
ch->decr_indent ();
@@ -526,7 +691,7 @@ be_array::gen_var_impl (void)
ACE_OS::sprintf (fname, "%s_var", this->fullname ());
ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_var", local_name ()->get_string ());
+ ACE_OS::sprintf (lname, "%s_var", this->local_name ()->get_string ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -542,14 +707,11 @@ be_array::gen_var_impl (void)
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- be_array *b;
-
- b = be_array::narrow_from_decl (this);
// default constr
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ ((" << name () << "_slice *)0)" << nl;
+ *ci << "\t" << ": ptr_ ((" << this->name () << "_slice *)0)" << nl;
*ci << "{}\n\n";
// constr from a _slice *
@@ -584,7 +746,7 @@ be_array::gen_var_impl (void)
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
- "_slice p)" << nl;
+ "_slice *p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "// is what we own the same that is being assigned to us?" <<
@@ -624,7 +786,7 @@ be_array::gen_var_impl (void)
// other extra methods - cast operators ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
+ *ci << fname << "::operator const " << this->name () <<
"_slice *&() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -662,7 +824,7 @@ be_array::gen_var_impl (void)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -671,7 +833,7 @@ be_array::gen_var_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -680,7 +842,7 @@ be_array::gen_var_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -689,7 +851,7 @@ be_array::gen_var_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -699,7 +861,7 @@ be_array::gen_var_impl (void)
// the additional ptr () member function
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice *" << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::ptr (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -736,26 +898,25 @@ be_array::gen_out_defn (void)
// No default constructor
- // constructor from a pointer
- *ch << namebuf << " (" << local_name () << "_slice *&);" << nl;
+ // constructor from a pointer to slice
+ *ch << namebuf << " (" << this->local_name () << "_slice *&);" << nl;
// constructor from a _var &
- *ch << namebuf << " (" << local_name () << "_var &);" << nl;
+ *ch << namebuf << " (" << this->local_name () << "_var &);" << nl;
// constructor from a _out &
*ch << namebuf << " (" << namebuf << " &);" << nl;
// assignment operator from a _out &
*ch << namebuf << " &operator= (" << namebuf << " &);" << nl;
- // assignment operator from a pointer &, cast operator, ptr fn, operator
- // -> and any other extra operators
// assignment from slice *
- *ch << namebuf << " &operator= (" << local_name () << "_slice *);" << nl;
+ *ch << namebuf << " &operator= (" << this->local_name () << "_slice *);" <<
+ nl;
// cast
- *ch << "operator " << local_name () << "_slice *&();" << nl;
+ *ch << "operator " << this->local_name () << "_slice *&();" << nl;
// ptr fn
- *ch << local_name () << "_slice *&ptr (void);" << nl;
+ *ch << this->local_name () << "_slice *&ptr (void);" << nl;
// operator [] instead of ->
- *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
- *ch << "const " << namebuf <<
- "_slice &operator[] (CORBA::ULong index) const;" << nl;
+ *ch << this->local_name () << "_slice &operator[] (CORBA::ULong index);" << nl;
+ *ch << "const " << this->local_name () << "_slice &operator[] " <<
+ "(CORBA::ULong index) const;" << nl;
*ch << "\n";
ch->decr_indent ();
@@ -763,7 +924,7 @@ be_array::gen_out_defn (void)
ch->incr_indent ();
*ch << local_name () << "_slice *&ptr_;" << nl;
*ch << "// assignment from T_var not allowed" << nl;
- *ch << "void operator= (const " << local_name () << "_var &);\n";
+ *ch << "void operator= (const " << this->local_name () << "_var &);\n";
ch->decr_indent ();
*ch << "};\n\n";
@@ -798,13 +959,10 @@ be_array::gen_out_impl (void)
*ci << "// Inline operations for class " << fname << nl;
*ci << "// *************************************************************\n\n";
- be_array *b;
-
- b = be_array::narrow_from_decl (this);
// constr from a pointer to slice
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_slice *&p)" << nl;
+ *ci << fname << "::" << lname << " (" << this->name () << "_slice *&p)" << nl;
*ci << "\t: ptr_ (p)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -898,15 +1056,11 @@ int
be_array::gen_forany_defn (void)
{
TAO_OutStream *ch; // output stream
- long i; // loop index
TAO_NL nl; // end line
- char namebuf [NAMEBUFSIZE]; // to hold the _out name
-
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (i);
+ char namebuf [NAMEBUFSIZE]; // names
ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (namebuf, "%s_forany", local_name ()->get_string ());
+ ACE_OS::sprintf (namebuf, "%s_forany", this->local_name ()->get_string ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
@@ -924,52 +1078,57 @@ be_array::gen_forany_defn (void)
ch->incr_indent ();
// default constr
*ch << namebuf << " (void); // default constructor" << nl;
- // constr
- *ch << namebuf << " (" << local_name () << "_slice *);" << nl;
+ // constr from pointer to slice
+ *ch << namebuf << " (" << this->local_name () << "_slice *, " <<
+ "CORBA::Boolean nocopy=0);" << nl;
// copy constructor
*ch << namebuf << " (const " << namebuf <<
" &); // copy constructor" << nl;
// destructor
*ch << "~" << namebuf << " (void); // destructor" << nl;
*ch << nl;
- // assignment operator from a pointer
- *ch << namebuf << " &operator= (" << local_name () <<
- "_slice *, CORBA::Boolean nocopy=0);" << nl;
+ // assignment operator from a pointer to slice
+ *ch << namebuf << " &operator= (" << this->local_name () << "_slice *);" <<
+ nl;
// assignment from _var
- *ch << namebuf << " &operator= (const " << namebuf <<
- " &);" << nl;
+ *ch << namebuf << " &operator= (const " << namebuf << " &);" << nl;
+
+ // arrow operator
+ // nothing here
+ *ch << nl;
+ // other extra types (cast operators, [] operator, and others)
// overloaded [] operator
- *ch << namebuf << "_slice &operator[] (CORBA::ULong index);" << nl;
- *ch << "const " << namebuf <<
+ *ch << this->local_name () << "_slice &operator[] (CORBA::ULong index);" <<
+ nl;
+ *ch << "const " << this->local_name () <<
"_slice &operator[] (CORBA::ULong index) const;" << nl;
// cast operators
- *ch << "operator const " << local_name () << "_slice *&() (void) const;" << nl;
- *ch << "operator " << local_name () << "_slice *&() (void);" << nl;
+ *ch << "operator const " << this->local_name () << "_slice *&() const;" <<
+ nl;
+ *ch << "operator " << this->local_name () << "_slice *&();" << nl;
+ // in, inout, out and _retn
*ch << "// in, inout, out, _retn " << nl;
- // the return types of in, out, inout, and _retn are based on the parameter
- // passing rules and the base type
- if (this->size_type () == be_decl::FIXED)
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << " out (void);" << nl;
- *ch << local_name () << "_slice *_retn (void);" << nl;
- }
- else
- {
- *ch << "const " << local_name () << " in (void) const;" << nl;
- *ch << local_name () << " inout (void);" << nl;
- *ch << local_name () << "_slice *&out (void);" << nl;
- *ch << local_name () << " *_retn (void);" << nl;
- }
+ *ch << "const " << this->local_name () << "_slice *in (void) const;" << nl;
+ *ch << this->local_name () << "_slice *inout (void);" << nl;
+ *ch << this->local_name () << "_slice *&out (void);" << nl;
+ *ch << this->local_name () << "_slice *_retn (void);" << nl;
+
+ // generate an additional member function that returns the underlying pointer
+ *ch << this->local_name () << "_slice *ptr (void) const;\n";
+
*ch << "\n";
ch->decr_indent ();
+
+ // generate the private section
*ch << "private:\n";
ch->incr_indent ();
- *ch << local_name () << "_slice *ptr_;\n";
+ *ch << "friend ACE_CORBA_1 (Any);" << nl;
+ *ch << this->local_name () << "_slice *ptr_;" << nl;
+ *ch << "CORBA::Boolean nocopy_;\n";
+
ch->decr_indent ();
*ch << "};\n\n";
@@ -980,28 +1139,22 @@ int
be_array::gen_forany_impl (void)
{
TAO_OutStream *ci; // output stream
- long i; // loop index
TAO_NL nl; // end line
char fname [NAMEBUFSIZE]; // to hold the full and
char lname [NAMEBUFSIZE]; // local _var names
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (i);
-
ACE_OS::memset (fname, '\0', NAMEBUFSIZE);
ACE_OS::sprintf (fname, "%s_forany", this->fullname ());
ACE_OS::memset (lname, '\0', NAMEBUFSIZE);
- ACE_OS::sprintf (lname, "%s_forany", local_name ()->get_string ());
+ ACE_OS::sprintf (lname, "%s_forany", this->local_name ()->get_string ());
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
ci = cg->client_inline ();
- // generate the forany implementation in the inline file
- // Depending upon the data type, there are some differences which we account
- // for over here.
+ // generate the var implementation in the inline file
ci->indent (); // start with whatever was our current indent level
@@ -1014,14 +1167,17 @@ be_array::gen_forany_impl (void)
*ci << "ACE_INLINE" << nl;
*ci << fname << "::" << lname <<
" (void) // default constructor" << nl;
- *ci << "\t" << ": ptr_ ((" << name () << "_slice *)0)" << nl;
+ *ci << "\t" << ": ptr_ ((" << this->name () << "_slice *)0)," << nl;
+ *ci << "\t nocopy_ (0)" << nl;
*ci << "{}\n\n";
// constr from a _slice *
ci->indent ();
*ci << "ACE_INLINE" << nl;
- *ci << fname << "::" << lname << " (" << name () << "_slice *p)" << nl;
- *ci << "\t: ptr_ (p)" << nl;
+ *ci << fname << "::" << lname << " (" << name () << "_slice *p, " <<
+ "CORBA::Boolean nocopy)" << nl;
+ *ci << "\t: ptr_ (p)," << nl;
+ *ci << "\t nocopy_ (nocopy)" << nl;
*ci << "{}\n\n";
// copy constructor (deep copy)
@@ -1031,7 +1187,8 @@ be_array::gen_forany_impl (void)
" &p) // copy constructor" << nl;
*ci << "{\n";
ci->incr_indent ();
- *ci << "this->ptr_ = " << this->name () << "_dup (p->ptr);\n";
+ *ci << "this->ptr_ = " << this->name () << "_dup (p.ptr_);" << nl;
+ *ci << "this->nocopy_ = p.nocopy_;\n";
ci->decr_indent ();
*ci << "}\n\n";
@@ -1049,7 +1206,7 @@ be_array::gen_forany_impl (void)
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (" << this->name () <<
- "_slice p)" << nl;
+ "_slice *p)" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "// is what we own the same that is being assigned to us?" <<
@@ -1066,7 +1223,7 @@ be_array::gen_forany_impl (void)
ci->decr_indent ();
*ci << "}\n\n";
- // assignment operator from _var
+ // assignment operator from _forany
ci->indent ();
*ci << "ACE_INLINE " << fname << " &" << nl;
*ci << fname << "::operator= (const " << fname <<
@@ -1079,7 +1236,8 @@ be_array::gen_forany_impl (void)
*ci << "// not assigning to ourselves" << nl;
*ci << this->name () << "_free (this->ptr_); // free old stuff" << nl;
*ci << "this->ptr_ = " << this->name () <<
- "_dup (p->ptr);// deep copy\n";
+ "_dup (p.ptr_);// deep copy" << nl;
+ *ci << "this->nocopy_ = p.nocopy_;\n";
ci->decr_indent ();
*ci << "}" << nl;
*ci << "return *this;\n";
@@ -1089,8 +1247,8 @@ be_array::gen_forany_impl (void)
// other extra methods - cast operators ()
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator const " << name () <<
- "_slice &() const // cast" << nl;
+ *ci << fname << "::operator const " << this->name () <<
+ "_slice *&() const // cast" << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -1099,7 +1257,7 @@ be_array::gen_forany_impl (void)
ci->indent ();
*ci << "ACE_INLINE " << nl;
- *ci << fname << "::operator " << name () << "_slice &() // cast " << nl;
+ *ci << fname << "::operator " << name () << "_slice *&() // cast " << nl;
*ci << "{\n";
ci->incr_indent ();
*ci << "return this->ptr_;\n";
@@ -1127,7 +1285,7 @@ be_array::gen_forany_impl (void)
// in, inout, out, and _retn
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::in (void) const" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -1136,7 +1294,7 @@ be_array::gen_forany_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::inout (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -1145,7 +1303,7 @@ be_array::gen_forany_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << fname << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::out (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -1154,7 +1312,7 @@ be_array::gen_forany_impl (void)
*ci << "}\n\n";
ci->indent ();
- *ci << "ACE_INLINE " << name () << "_slice " << nl;
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
*ci << fname << "::_retn (void)" << nl;
*ci << "{\n";
ci->incr_indent ();
@@ -1162,6 +1320,16 @@ be_array::gen_forany_impl (void)
ci->decr_indent ();
*ci << "}\n\n";
+ // the additional ptr () member function
+ ci->indent ();
+ *ci << "ACE_INLINE " << this->name () << "_slice *" << nl;
+ *ci << fname << "::ptr (void) const" << nl;
+ *ci << "{\n";
+ ci->incr_indent ();
+ *ci << "return this->ptr_;\n";
+ ci->decr_indent ();
+ *ci << "}\n\n";
+
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index ddd4e089afd..16d889307d4 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -155,7 +155,35 @@ be_attribute::gen_client_stubs (void)
cs->incr_indent ();
// entry for the return type
- *cs << "{" << bt->tc_name () << ", PARAM_RETURN, 0}";
+ *cs << "{" << bt->tc_name () << ", PARAM_RETURN, ";
+ // Are we returning a pointer to value? i.e., is the type variable? If it is,
+ // we must tell the stub what is the size of the top level structure
+ if (bt->size_type () == be_decl::VARIABLE)
+ {
+ switch (bt->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ // no need of size here
+ *cs << "0}";
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ be_predefined_type *bpd = be_predefined_type::narrow_from_decl
+ (bt);
+ if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ // no need of size here
+ *cs << "0}";
+ else
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ break;
+ default:
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ }
+ else
+ *cs << "0}";
cs->decr_indent ();
*cs << "};\n\n";
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index b0c94ac48bd..c40fdb55ac8 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -69,6 +69,9 @@ TAO_CodeGen::make_state (void)
return TAO_BE_STATE_UNION_PUBLIC_CH::instance ();
case TAO_UNION_PUBLIC_CI:
return TAO_BE_STATE_UNION_PUBLIC_CI::instance ();
+ case TAO_UNION_PUBLIC_CS:
+ case TAO_UNION_PUBLIC_ASSIGN_CS:
+ return TAO_BE_STATE_UNION_PUBLIC_CS::instance ();
case TAO_UNION_PRIVATE_CH:
return TAO_BE_STATE_UNION_PRIVATE_CH::instance ();
case TAO_OPERATION_CH:
@@ -132,7 +135,10 @@ TAO_CodeGen::make_state (void)
case TAO_ATTRIBUTE_POST_UPCALL_SS:
return TAO_BE_STATE_ATTRIBUTE::instance ();
case TAO_EXCEPTION_CH:
+ case TAO_EXCEPTION_CTOR_CH:
case TAO_EXCEPTION_CS:
+ case TAO_EXCEPTION_CTOR_CS:
+ case TAO_EXCEPTION_CTOR_ASSIGN_CS:
case TAO_EXCEPTION_CI:
return TAO_BE_STATE_EXCEPTION::instance ();
default:
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index d7c7448bb89..f8ff330b522 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -377,9 +377,9 @@ be_decl::tc_name2long (const char *name, long *&larr, long &arrlen)
idl_bool
be_decl::is_nested (void)
{
- AST_Decl *d;
+ be_decl *d;
- d = ScopeAsDecl (this->defined_in ());
+ d = be_scope::narrow_from_scope (this->defined_in ())->decl ();
// if we have an outermost scope and if that scope is not that of the Root,
// then we are defined at some nesting level
if (d && d->node_type () != AST_Decl::NT_root)
@@ -424,6 +424,46 @@ be_decl::compute_size_type (void)
return 0;
}
+// return the scope created by this node (if one exists, else NULL)
+be_scope *
+be_decl::scope (void)
+{
+ be_decl *d = this;
+
+ switch (this->node_type()) {
+ case AST_Decl::NT_interface_fwd:
+ /*
+ * Resolve forward declared interface by looking at full_definition()
+ * field and iterating
+ */
+ d = be_interface::narrow_from_decl ((be_interface_fwd::narrow_from_decl
+ (this))->full_definition ());
+ /*
+ * Fall through
+ */
+ case AST_Decl::NT_interface:
+ return be_interface::narrow_from_decl (d);
+ case AST_Decl::NT_module:
+ return be_module::narrow_from_decl (d);
+ case AST_Decl::NT_root:
+ return be_root::narrow_from_decl (d);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_decl (d);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_decl (d);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_decl (d);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_decl (d);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_decl (d);
+ case AST_Decl::NT_sequence:
+ return be_sequence::narrow_from_decl (d);
+ default:
+ return (be_scope *)0;
+ }
+}
+
// narrowing methods
IMPL_NARROW_METHODS1 (be_decl, AST_Decl)
IMPL_NARROW_FROM_DECL (be_decl)
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index 39da248c8ad..c68e469a21c 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -85,9 +85,19 @@ be_exception::gen_client_header (void)
if (!this->cli_hdr_gen_) // not already generated
{
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
TAO_OutStream *ch = cg->client_header (); // output stream
TAO_NL nl; // end line
+ be_scope *s = be_scope::narrow_from_scope (DeclAsScope (this)); // the
+ // scope
+ // defined by us
+
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_exception::"
+ "gen_client_header - "
+ "bad scope\n"), -1);
+ }
cg->push (TAO_CodeGen::TAO_EXCEPTION_CH);
ch->indent (); // start from whatever indentation level we were at
@@ -113,20 +123,43 @@ be_exception::gen_client_header (void)
*ch << this->local_name () << " (const " << this->local_name () <<
" &); // copy ctor" << nl;
*ch << "~" << this->local_name () << "(void); // dtor" << nl;
+
+ // generate constructor that takes each member as a parameter. We need a
+ // new state. Such a constructor exists if we have members
+ if (this->member_count () > 0)
+ {
+ cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_CH);
+ s->comma (1); // tell the scope to generate a comma after every
+ // member is generated
+ *ch << this->local_name () << "(";
+ if (be_scope::gen_client_header () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_exception::"
+ "gen_client_header - "
+ "codegen for scope failed\n"), -1);
+ }
+ *ch << ");" << nl;
+ s->comma (0); // revert comma generation state
+ cg->pop (); // revert to previous state
+ }
+
// assignment operator
*ch << this->local_name () << " &operator= (const " << this->local_name
() << " &);" << nl;
// the static _narrow method
*ch << "static " << this->local_name () <<
" *_narrow (CORBA::Exception *);\n";
- // generate code for members i.e., generate a constructor that takes in
- // that member as a value as well as generate the member
+
+ // generate the members
if (be_scope::gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_exception::gen_client_header -"
+ "(%N:%l) be_exception::"
+ "gen_client_header - "
"codegen for scope failed\n"), -1);
}
+
ch->decr_indent ();
*ch << "};" << nl;
@@ -189,7 +222,7 @@ be_exception::gen_client_inline (void)
*ci << "}\n\n";
cg->push (TAO_CodeGen::TAO_EXCEPTION_CI);
- // constructors for individual members
+ // generate inline code required of any anonymous types of members
if (be_scope::gen_client_inline () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -208,7 +241,17 @@ be_exception::gen_client_stubs (void)
{
TAO_OutStream *cs; // output stream
TAO_NL nl; // end line
+ be_scope *s = be_scope::narrow_from_scope (DeclAsScope (this)); // the scope
+ // defined by
+ // us
+ if (!s)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_exception::"
+ "gen_client_stubs - "
+ "bad scope\n"), -1);
+ }
if (!this->cli_stub_gen_)
{
@@ -259,6 +302,44 @@ be_exception::gen_client_stubs (void)
cs->decr_indent ();
*cs << "}\n\n";
+ // constructor taking all members. We need a new state here. Also, such a
+ // constructor exists if we have any members
+ if (this->member_count () > 0)
+ {
+ cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_CS);
+ s->comma (1); // scope should produce comma after every parameter is
+ // defined
+ cs->indent ();
+ *cs << "// special constructor" << nl;
+ *cs << this->name () << "::" << this->local_name () << "(";
+ if (be_scope::gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_exception::gen_client_stubs -"
+ "codegen for scope failed\n"), -1);
+ }
+ s->comma (0);
+ cg->pop ();
+ *cs << ")" << nl;
+
+ *cs << "\t: CORBA_UserException " <<
+ "(ACE_CORBA_3 (TypeCode, _duplicate) (" << this->tc_name () <<
+ "))" << nl;
+ *cs << "{\n";
+ cs->incr_indent ();
+ // assign each individual member. We need yet another state
+ cg->push (TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS);
+ if (be_scope::gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_exception::gen_client_stubs -"
+ "codegen for scope failed\n"), -1);
+ }
+ cg->pop (); // revert to previous state
+ cs->decr_indent ();
+ *cs << "}\n\n";
+ }
+
// narrow method
cs->indent ();
*cs << "// narrow" << nl;
@@ -311,6 +392,7 @@ be_exception::gen_server_header (void)
return 0;
}
+
int
be_exception::gen_server_inline (void)
{
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index 7246c27031d..28bf7cb1c39 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -135,7 +135,35 @@ be_operation::gen_client_stubs (void)
cs->incr_indent ();
// entry for the return type
- *cs << "{" << bt->tc_name () << ", PARAM_RETURN, 0}";
+ *cs << "{" << bt->tc_name () << ", PARAM_RETURN, ";
+ // Are we returning a pointer to value? i.e., is the type variable? If it is,
+ // we must tell the stub what is the size of the top level structure
+ if (bt->size_type () == be_decl::VARIABLE)
+ {
+ switch (bt->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ // no need of size here
+ *cs << "0}";
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ be_predefined_type *bpd = be_predefined_type::narrow_from_decl
+ (bt);
+ if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ // no need of size here
+ *cs << "0}";
+ else
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ break;
+ default:
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ }
+ else
+ *cs << "0}";
paramtblsize++;
// if we have any arguments, get each one of them
if (this->nmembers () > 0)
@@ -167,7 +195,39 @@ be_operation::gen_client_stubs (void)
*cs << ", PARAM_INOUT, 0}";
break;
case AST_Argument::dir_OUT:
- *cs << ", PARAM_OUT, 0}";
+ {
+ *cs << ", PARAM_OUT, 0}";
+#if 0
+ // Are we returning a pointer to value? i.e., is the type variable? If it is,
+ // we must tell the stub what is the size of the top level structure
+ if (bt->size_type () == be_decl::VARIABLE)
+ {
+ switch (bt->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ // no need of size here
+ *cs << "0}";
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ be_predefined_type *bpd =
+ be_predefined_type::narrow_from_decl (bt);
+ if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ // no need of size here
+ *cs << "0}";
+ else
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ break;
+ default:
+ *cs << "sizeof (" << bt->name () << ")}";
+ }
+ }
+ else
+ *cs << "0}";
+#endif
+ }
break;
} // end switch
paramtblsize++;
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index 4b653b0a2a1..e25ddf47fc5 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -7,12 +7,14 @@
// Default Constructor
be_scope::be_scope (void)
+ : comma_ (0)
{
}
// Constructor
be_scope::be_scope (AST_Decl::NodeType type)
- : UTL_Scope (type)
+ : UTL_Scope (type),
+ comma_ (0)
{
}
@@ -21,12 +23,20 @@ be_scope::~be_scope (void)
}
// Code generation methods
+void
+be_scope::comma (unsigned short comma)
+{
+ this->comma_ = comma;
+}
+
int
be_scope::gen_client_header (void)
{
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->client_header (); // output stream
if (this->nmembers () > 0)
{
@@ -73,6 +83,10 @@ be_scope::gen_client_header (void)
}
} // no imported
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -85,6 +99,8 @@ be_scope::gen_client_stubs (void)
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->client_stubs (); // output stream
if (this->nmembers () > 0)
{
@@ -125,6 +141,10 @@ be_scope::gen_client_stubs (void)
}
} // not imported
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -137,6 +157,8 @@ be_scope::gen_client_inline (void)
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->client_inline (); // output stream
if (this->nmembers () > 0)
{
@@ -175,6 +197,10 @@ be_scope::gen_client_inline (void)
}
} // not imported
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -187,6 +213,8 @@ be_scope::gen_server_header (void)
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->server_header (); // output stream
if (this->nmembers () > 0)
{
@@ -227,6 +255,10 @@ be_scope::gen_server_header (void)
}
} // not imported
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -239,6 +271,8 @@ be_scope::gen_server_skeletons (void)
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->server_skeletons (); // output stream
if (this->nmembers () > 0)
{
@@ -278,6 +312,10 @@ be_scope::gen_server_skeletons (void)
}
} // not imported
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -290,6 +328,8 @@ be_scope::gen_server_inline (void)
UTL_ScopeActiveIterator *si;
AST_Decl *d;
be_decl *bd;
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ TAO_OutStream *os = cg->server_inline (); // output stream
if (this->nmembers () > 0)
{
@@ -329,6 +369,10 @@ be_scope::gen_server_inline (void)
}
}
si->next ();
+ if (!si->is_done () && this->comma_)
+ {
+ *os << ", "; // generate a comma
+ }
} // end of while
delete si; // free the iterator object
}
@@ -408,6 +452,33 @@ be_scope::tc_encap_len (void)
return encap_len;
}
+// return the scope created by this node (if one exists, else NULL)
+be_decl *
+be_scope::decl (void)
+{
+ switch (this->scope_node_type())
+ {
+ case AST_Decl::NT_interface:
+ return be_interface::narrow_from_scope (this);
+ case AST_Decl::NT_module:
+ return be_module::narrow_from_scope (this);
+ case AST_Decl::NT_root:
+ return be_root::narrow_from_scope (this);
+ case AST_Decl::NT_except:
+ return be_exception::narrow_from_scope (this);
+ case AST_Decl::NT_union:
+ return be_union::narrow_from_scope (this);
+ case AST_Decl::NT_struct:
+ return be_structure::narrow_from_scope (this);
+ case AST_Decl::NT_enum:
+ return be_enum::narrow_from_scope (this);
+ case AST_Decl::NT_op:
+ return be_operation::narrow_from_scope (this);
+ default:
+ return (be_decl *)0;
+ }
+}
+
// narrowing methods
IMPL_NARROW_METHODS1 (be_scope, UTL_Scope)
IMPL_NARROW_FROM_SCOPE (be_scope)
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 2819862eca6..653df305024 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -35,7 +35,6 @@ be_sequence::be_sequence (AST_Expression *v, AST_Type *t)
AST_Decl (AST_Decl::NT_sequence,
NULL,
NULL),
- seq_node_ (NULL),
mt_ (be_sequence::MNG_UNKNOWN)
{
// check if we are bounded or unbounded. An expression value of 0 means
@@ -53,41 +52,69 @@ be_sequence::be_sequence (AST_Expression *v, AST_Type *t)
// VARIABLE
}
+// helper to create_name
+const char *
+be_sequence::gen_name (void)
+{
+ char namebuf [NAMEBUFSIZE];
+ be_type *bt; // base type;
+ be_sequence *seq;
+
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer
+ // retrieve the base type
+ bt = be_type::narrow_from_decl (this->base_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_sequence::"
+ "gen_name - "
+ "bad base type\n"),
+ 0);
+ }
+ if (bt->node_type () == AST_Decl::NT_sequence)
+ {
+ // our base type is an anonymous sequence
+ be_sequence *seq;
+ seq = be_sequence::narrow_from_decl (bt);
+ if (!seq)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_sequence::"
+ "gen_name - "
+ "error converting base type to sequence\n"),
+ 0);
+ }
+ seq->set_defined_in (this); // set ourselves as its parent
+ this->fe_add_sequence (seq); // add the child to our scope
+ ACE_OS::sprintf (namebuf, "_tao_seq_%s", seq->gen_name ());
+ }
+ else
+ {
+ ACE_OS::sprintf (namebuf, "_tao_seq_%s", bt->local_name ()->get_string ());
+ }
+ // append the size (if any)
+ if (!this->unbounded_)
+ {
+ ACE_OS::sprintf (namebuf, "%s_%d", namebuf, this->max_size ()->ev
+ ()->u.ulval);
+ }
+ return namebuf;
+}
+
// create a name for ourselves
int
be_sequence::create_name (void)
{
- static char namebuf [200];
+ static char namebuf [NAMEBUFSIZE];
UTL_ScopedName *n = NULL;
- be_decl *d; // may point to a typedef node
be_decl *scope; // scope in which we are defined
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
-
-
- d = cg->node (); // retrieve the node that was passed in via the CodeGen
- // object
- if (!d)
- return -1; // error, we cannot be free standing.
+ ACE_OS::memset (namebuf, '\0', NAMEBUFSIZE); // reset the buffer
+ ACE_OS::strcpy (namebuf, this->gen_name ()); // generate a local name
- // we generate a name for ourselves. Start by generating a local name
-
- ACE_OS::memset (namebuf, '\0', 200);
- ACE_OS::sprintf (namebuf, "_tao__seq_%s", d->local_name ()->get_string ());
-
- if (d->node_type () == AST_Decl::NT_sequence)
- {
- // this means that we are an anonymous sequence who happens to be a
- // base type of the sequence denoted by the node "d".
- // Hence we set our enclosing scope to be the node "d"
- this->set_defined_in (DeclAsScope (d));
- }
-
- // now set our fully scoped name
-
- // now see if we have a fully scoped name.
- scope = be_decl::narrow_from_decl (ScopeAsDecl (this->defined_in ()));
- if (scope != NULL)
+ // now see if we have a fully scoped name and if so, generate one
+ scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
+ if (scope)
{
// make a copy of the enclosing scope's name
n = (UTL_ScopedName *)scope->name ()->copy () ;
@@ -109,14 +136,6 @@ be_sequence::create_name (void)
return 0;
}
-void
-be_sequence::compute_scoped_name (void)
-{
- UTL_ScopedName *n = (UTL_ScopedName *)this->seq_node_->name ()->copy ();
- n->nconc (this->name ());
- this->set_name (n);
-}
-
// Does this sequence have a managed type sequence element?
be_sequence::MANAGED_TYPE
be_sequence::managed_type (void)
@@ -963,6 +982,9 @@ be_sequence::gen_client_inline (void)
-1);
}
+ // generate the ifdefined macro for type
+ ci->gen_ifdef_macro (this->flatname ());
+
// freebuf method
ci->indent ();
*ci << "ACE_INLINE void" << nl;
@@ -1090,6 +1112,10 @@ be_sequence::gen_client_inline (void)
ci->decr_indent ();
*ci << "}\n\n";
cg->pop ();
+ ci->gen_endif (); // endif macro
+
+ // generate the ifdefined macro for the var type
+ ci->gen_ifdef_macro (this->flatname (), "_var");
// generate the implementations for the _var and _impl classes
if (this->gen_var_impl () == -1)
@@ -1100,6 +1126,10 @@ be_sequence::gen_client_inline (void)
"var implementation failed\n"),
-1);
}
+ ci->gen_endif ();
+
+ // generate the ifdefined macro for the var type
+ ci->gen_ifdef_macro (this->flatname (), "_out");
if (this->gen_out_impl () == -1)
{
@@ -1109,6 +1139,7 @@ be_sequence::gen_client_inline (void)
"out impl failed\n"),
-1);
}
+ ci->gen_endif (); // endif macro
this->cli_inline_gen_ = I_TRUE;
}
@@ -2355,6 +2386,26 @@ be_sequence::tc_encap_len (void)
return this->encap_len_;
}
+/*
+ * Add this be_sequence to the locally defined types in this scope
+ */
+be_sequence *
+be_sequence::fe_add_sequence (be_sequence *t)
+{
+ if (t == NULL)
+ return NULL;
+
+ this->add_to_local_types(t);
+ return t;
+}
+
+// overridden method
+be_decl *
+be_sequence::decl (void)
+{
+ return this;
+}
+
// Narrowing
IMPL_NARROW_METHODS3 (be_sequence, AST_Sequence, be_scope, be_type)
IMPL_NARROW_FROM_DECL (be_sequence)
diff --git a/TAO/TAO_IDL/be/be_state.cpp b/TAO/TAO_IDL/be/be_state.cpp
index b642299a154..59312eaeaa5 100644
--- a/TAO/TAO_IDL/be/be_state.cpp
+++ b/TAO/TAO_IDL/be/be_state.cpp
@@ -34,6 +34,7 @@ template class ACE_Singleton<be_state_union_disctypedefn_ch, ACE_SYNCH_RECURSIVE
template class ACE_Singleton<be_state_union_disctypedefn_ci, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<be_state_union_public_ch, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<be_state_union_public_ci, ACE_SYNCH_RECURSIVE_MUTEX>;
+template class ACE_Singleton<be_state_union_public_cs, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<be_state_union_private_ch, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<be_state_operation, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<be_state_argument, ACE_SYNCH_RECURSIVE_MUTEX>;
@@ -50,6 +51,7 @@ template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
#pragma instantiate ACE_Singleton<be_state_union_disctypedefn_ci, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<be_state_union_public_ch, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<be_state_union_public_ci, ACE_SYNCH_RECURSIVE_MUTEX>
+#pragma instantiate ACE_Singleton<be_state_union_public_cs, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<be_state_union_private_ch, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<be_state_operation, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<be_state_argument, ACE_SYNCH_RECURSIVE_MUTEX>
diff --git a/TAO/TAO_IDL/be/be_state_exception.cpp b/TAO/TAO_IDL/be/be_state_exception.cpp
index 26815fd3817..b260dadb437 100644
--- a/TAO/TAO_IDL/be/be_state_exception.cpp
+++ b/TAO/TAO_IDL/be/be_state_exception.cpp
@@ -27,22 +27,29 @@ int
be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
{
TAO_OutStream *os; // output stream
- TAO_NL nl; // end of line
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
be_field *f; // field node
be_exception *bexcp; // enclosing exception node
switch (cg->state ())
{
- case TAO_CodeGen::TAO_EXCEPTION_CH:
+ case TAO_CodeGen::TAO_EXCEPTION_CH: // used for defining members
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH: // used for defining the
+ // parameters to the special
+ // constructor
os = cg->client_header ();
break;
- case TAO_CodeGen::TAO_EXCEPTION_CS:
- os = cg->client_stubs ();
- break;
- case TAO_CodeGen::TAO_EXCEPTION_CI:
+ case TAO_CodeGen::TAO_EXCEPTION_CI: // for generating inline functions for
+ // specific anonymous types
os = cg->client_inline ();
break;
+ case TAO_CodeGen::TAO_EXCEPTION_CS: // for copy ctor and assignment op
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS: // for the parameters of the
+ // special constructor
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS: // for assigning to members
+ // inside the special ctor
+ os = cg->client_stubs ();
+ break;
}
f = be_field::narrow_from_decl (d); // downcast to field node
@@ -54,6 +61,7 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
-1);
}
+ // retrieve the exception node
bexcp = be_exception::narrow_from_scope (f->defined_in ());
if (!bexcp)
{
@@ -83,38 +91,39 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
case TAO_CodeGen::TAO_EXCEPTION_CH:
{
os->indent (); // start from current indentation
- // constructor taking this type
- *os << bexcp->local_name () << "(const " << bt->nested_type_name
- (bexcp, "_ptr") << "&); // constructor" << nl;
*os << bt->nested_type_name (bexcp, "_var") << " " << f->local_name
() << ";\n";
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CI:
+ case TAO_CodeGen::TAO_EXCEPTION_CS:
{
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const " << bt->name () << "_ptr &_tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name () <<
- "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
+ // assign
+ os->indent (); // start with current indentation
+ *os << "this->" << f->local_name () << " = _tao_excp." <<
+ f->local_name () << ";\n";
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CS:
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH:
+ {
+ *os << "const " << bt->nested_type_name (bexcp, "_ptr") << "&";
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS:
+ {
+ *os << "const " << bt->name () << "_ptr &_tao_" << f->local_name
+ ();
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
{
// assign
os->indent (); // start with current indentation
- *os << "this->" << f->local_name () << " = _tao_excp." <<
+ *os << "this->" << f->local_name () << " = _tao_" <<
f->local_name () << ";\n";
}
break;
+ case TAO_CodeGen::TAO_EXCEPTION_CI:
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -138,80 +147,75 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
{
switch (bpd->pt ())
{
- case AST_PredefinedType::PT_any:
case AST_PredefinedType::PT_pseudo:
{
os->indent (); // start from current indentation
- // constructor taking this type
- *os << bexcp->local_name () << "(const " <<
- bt->nested_type_name (bexcp, "_ptr") <<
- "&); // constructor" << nl;
- *os << bt->nested_type_name (bexcp) << "_var " <<
+ *os << bt->nested_type_name (bexcp, "_var") << " " <<
f->local_name () << ";\n";
}
break;
default:
{
os->indent (); // start from current indentation
- // constructor taking this type
- *os << bexcp->local_name () << "(const " <<
- bt->nested_type_name (bexcp) <<
- "); // constructor" << nl;
*os << bt->nested_type_name (bexcp) << " " << f->local_name
() << ";\n";
}
+ } // end of switch state
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CS:
+ {
+ // assign
+ os->indent (); // start with current indentation
+ *os << "this->" << f->local_name () << " = _tao_excp." <<
+ f->local_name () << ";\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH:
+ {
+ switch (bpd->pt ())
+ {
+ case AST_PredefinedType::PT_pseudo:
+ {
+ *os << "const " << bt->nested_type_name (bexcp, "_ptr") <<
+ "&";
+ }
+ break;
+ default:
+ {
+ *os << "const " << bt->nested_type_name (bexcp);
+ }
}
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CI:
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS:
{
switch (bpd->pt ())
{
- case AST_PredefinedType::PT_any:
case AST_PredefinedType::PT_pseudo:
{
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const " << bt->name () << "_ptr &_tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name
- () << "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
+ *os << "const " << bt->name () << "_ptr &_tao_" <<
+ f->local_name ();
}
break;
default:
{
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const " << bt->name () << " _tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name
- () << "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
+ *os << "const " << bt->name () << " _tao_" <<
+ f->local_name ();
}
}
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CS:
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
{
// assign
os->indent (); // start with current indentation
- *os << "this->" << f->local_name () << " = _tao_excp." <<
+ *os << "this->" << f->local_name () << " = _tao_" <<
f->local_name () << ";\n";
}
break;
+ case TAO_CodeGen::TAO_EXCEPTION_CI:
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -229,67 +233,58 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
os->indent (); // start from current indentation
if (bt->node_type () == AST_Decl::NT_typedef)
{
- // constructor taking this type
- *os << bexcp->local_name () << "(const " <<
- bt->nested_type_name (bexcp) <<
- "); // constructor" << nl;
*os << bt->nested_type_name (bexcp, "_var") << " " <<
f->local_name () << ";\n";
}
else
{
- // constructor taking this type
- *os << bexcp->local_name () <<
- "(const char *); //constructor" << nl;
*os << "CORBA::String_var " << f->local_name () << ";\n";
}
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CI:
+ case TAO_CodeGen::TAO_EXCEPTION_CS:
+ {
+ // assign
+ os->indent (); // start with current indentation
+ *os << "this->" << f->local_name () << " = _tao_excp." <<
+ f->local_name () << ";\n";
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH:
{
- os->indent (); // start from current indentation
if (bt->node_type () == AST_Decl::NT_typedef)
{
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const " << bt->name () << " _tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name
- () << "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
+ *os << "const " << bt->nested_type_name (bexcp);
}
else
{
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const char *_tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name
- () << "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
+ *os << "const char*";
}
}
break;
- case TAO_CodeGen::TAO_EXCEPTION_CS:
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS:
+ {
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ *os << "const " << bt->name () << " _tao_" << f->local_name
+ ();
+ }
+ else
+ {
+ *os << "const char* _tao_" << f->local_name ();
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
{
// assign
os->indent (); // start with current indentation
- *os << "this->" << f->local_name () << " = _tao_excp." <<
+ *os << "this->" << f->local_name () << " = _tao_" <<
f->local_name () << ";\n";
}
break;
+ case TAO_CodeGen::TAO_EXCEPTION_CI:
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -320,9 +315,6 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
-1);
}
os->indent ();
- // constructor taking this type
- *os << bexcp->local_name () << "(const " << bt->nested_type_name
- (bexcp) << "&); // constructor" << nl;
*os << bt->nested_type_name (bexcp) << " " << f->local_name () <<
";\n";
}
@@ -340,19 +332,6 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
"error generating code for type\n"),
-1);
}
- os->indent (); // start from current indentation
- // constructor per member
- *os << "ACE_INLINE" << nl;
- *os << bexcp->name () << "::" << bexcp->local_name () <<
- "(const " << bt->name () << " &_tao_param)" << nl;
- *os << "\t:ACE_CORBA_1 (UserException) (" <<
- "ACE_CORBA_3 (TypeCode, _duplicate) (" << bexcp->tc_name () <<
- "))" << nl;
- *os << "{\n";
- os->incr_indent ();
- *os << "this->" << f->local_name () << " = _tao_param;\n";
- os->decr_indent ();
- *os << "}\n\n";
}
break;
case TAO_CodeGen::TAO_EXCEPTION_CS:
@@ -374,6 +353,24 @@ be_state_exception ::gen_code (be_type *bt, be_decl *d, be_type *type)
f->local_name () << ";\n";
}
break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CH:
+ {
+ *os << "const " << bt->nested_type_name (bexcp) << "&";
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_CS:
+ {
+ *os << "const " << bt->name () << "&_tao_" << f->local_name ();
+ }
+ break;
+ case TAO_CodeGen::TAO_EXCEPTION_CTOR_ASSIGN_CS:
+ {
+ // assign
+ os->indent (); // start with current indentation
+ *os << "this->" << f->local_name () << " = _tao_" <<
+ f->local_name () << ";\n";
+ }
+ break;
default:
{
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_state_sequence.cpp b/TAO/TAO_IDL/be/be_state_sequence.cpp
index 02e4521bfea..3d8344f0c70 100644
--- a/TAO/TAO_IDL/be/be_state_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_state_sequence.cpp
@@ -67,10 +67,10 @@ be_state_sequence::gen_code (be_type *bt, be_decl *d, be_type *type)
// base class of the typedef
ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef);
- // enclosing scope in which the typedef occurs
+ // enclosing scope in which the sequence occurs
be_decl *scope;
if (bt->node_type () == AST_Decl::NT_typedef)
- scope = be_decl::narrow_from_decl (ScopeAsDecl (bt->defined_in ()));
+ scope = be_scope::narrow_from_scope (bt->defined_in ())->decl ();
else // no anonymous data types are allowed here
scope = 0;
diff --git a/TAO/TAO_IDL/be/be_state_structure.cpp b/TAO/TAO_IDL/be/be_state_structure.cpp
index 0b277e4d92a..88ea8992f2f 100644
--- a/TAO/TAO_IDL/be/be_state_structure.cpp
+++ b/TAO/TAO_IDL/be/be_state_structure.cpp
@@ -53,6 +53,7 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
-1);
}
+ // retrieve the enclosing "struct" node
bs = be_structure::narrow_from_scope (f->defined_in ());
if (!bs)
{
@@ -62,10 +63,6 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
-1);
}
- // pass the field node just incase it is needed to generate definition for
- // sequence
- cg->node (f);
-
if (!type) // not a recursive call
type = bt;
else // recursively called thru a typedef. "type" will have the most primitive
@@ -198,7 +195,7 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
// We first need to generate code for this aggregate type. Check
// if we are not called recursively thru a typedef
if (bt->node_type () != AST_Decl::NT_typedef
- && !bt->imported ())
+ && !bt->imported ())
if (bt->gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -206,9 +203,13 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
"error generating code for type\n"),
-1);
}
- os->indent ();
- *os << bt->nested_type_name (bs) << " " << f->local_name () <<
- ";\n";
+ // this is not to be generated for arrays
+ if (bt->node_type () != AST_Decl::NT_array)
+ {
+ os->indent ();
+ *os << bt->nested_type_name (bs) << " " << f->local_name () <<
+ ";\n";
+ }
}
break;
case TAO_CodeGen::TAO_STRUCT_CI:
@@ -216,7 +217,7 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
// We first need to generate code for this aggregate type. Check
// if we are not called recursively thru a typedef
if (bt->node_type () != AST_Decl::NT_typedef
- && !bt->imported ())
+ && !bt->imported ())
if (bt->gen_client_inline () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -231,7 +232,7 @@ be_state_struct ::gen_code (be_type *bt, be_decl *d, be_type *type)
// We first need to generate code for this aggregate type. Check
// if we are not called recursively thru a typedef
if (bt->node_type () != AST_Decl::NT_typedef
- && !bt->imported ())
+ && !bt->imported ())
if (bt->gen_client_stubs () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_state_typedef.cpp b/TAO/TAO_IDL/be/be_state_typedef.cpp
index f1d6879a5f6..7c83bfa758c 100644
--- a/TAO/TAO_IDL/be/be_state_typedef.cpp
+++ b/TAO/TAO_IDL/be/be_state_typedef.cpp
@@ -53,14 +53,12 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
if (!tdef)
return -1;
- // pass the typedef node, just in case it is needed
- cg->node (tdef);
-
- scope = be_decl::narrow_from_decl (ScopeAsDecl (tdef->defined_in ()));
+ scope = be_scope::narrow_from_scope (tdef->defined_in ())->decl ();
if (!type) // not a recursive call
type = bt;
- else // recursively called thru a typedef. "type" will have the most primitive
+ 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);
@@ -199,34 +197,83 @@ be_state_typedef::gen_code (be_type *bt, be_decl *d, be_type *type)
case TAO_CodeGen::TAO_TYPEDEF_CH:
{
// if we are not here recursively, then we need to generate the
- // definition first
+ // definition first i.e., this typedef had its immediate base
+ // class that was an array declaration. The code for arrays will
+ // handle all the code generation. We just prepend the word
+ // "typedef".
if (bt->node_type () != AST_Decl::NT_typedef)
{
+ os->indent ();
+ *os << "typedef ";
if (bt->gen_client_header () == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_state_typedef - array gen failed\n"), -1);
}
}
- os->indent ();
- *os << "typedef " << bt->name () << " " << d->local_name () <<
- ";" << nl;
- *os << "typedef " << bt->name () << "_forany " << d->local_name
- () << "_forany;" << nl;
- // typedefs for the auxiliary methods. If we are nested inside
- // some scope, these methods become static to the enclosing scope
- if (d->is_nested ())
- *os << "static ";
- *os << d->name () << "_slice* " << d->local_name () <<
- "_alloc (void);" << nl;
- if (d->is_nested ())
- *os << "static ";
- *os << d->name () << "_slice* " << d->local_name () << "_dup ("
- << d->name () << "_slice* " << ");" << nl;
- if (d->is_nested ())
- *os << "static ";
- *os << "void " << d->name () << "_free (" << d->name () <<
- "_slice *);\n\n";
+ else
+ {
+ // we are a typedef node whose immediate base class is also a
+ // typedefed node to some array node. We simply output a
+ // number of typedef statements
+ os->indent ();
+ *os << "typedef " << bt->nested_type_name (scope) << " " <<
+ d->local_name () << ";" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_slice") <<
+ " " << d->local_name () << "_slice;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_var") << " "
+ << d->local_name () << "_var;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_out") << " "
+ << d->local_name () << "_out;" << nl;
+ *os << "typedef " << bt->nested_type_name (scope, "_forany") << " "
+ << d->local_name () << "_forany;" << nl;
+
+ // typedefs for the auxiliary methods. If we are nested inside
+ // some scope, these methods become static to the enclosing scope
+ if (d->is_nested ())
+ *os << "static ";
+ *os << bt->nested_type_name (scope) << "_slice* " << d->local_name () <<
+ "_alloc (void);" << nl;
+ if (d->is_nested ())
+ *os << "static ";
+ *os << bt->nested_type_name (scope, "_slice") << " *" <<
+ d->local_name () << "_dup ("
+ << bt->nested_type_name (scope) << "_slice* " << ");" << nl;
+ if (d->is_nested ())
+ *os << "static ";
+ *os << "void " << bt->nested_type_name (scope) << "_free (" <<
+ d->name () << "_slice *);\n\n";
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_CI:
+ {
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - struct/union/seq gen failed\n"),
+ -1);
+ }
+ }
+ }
+ break;
+ case TAO_CodeGen::TAO_TYPEDEF_CS:
+ {
+ // if we are not here recursively, then we need to generate the
+ // definition first
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ {
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "be_state_typedef - struct/union/seq gen failed\n"),
+ -1);
+ }
+ }
}
break;
default:
diff --git a/TAO/TAO_IDL/be/be_state_union.cpp b/TAO/TAO_IDL/be/be_state_union.cpp
index 0cdb3150b95..91b4edd0f2f 100644
--- a/TAO/TAO_IDL/be/be_state_union.cpp
+++ b/TAO/TAO_IDL/be/be_state_union.cpp
@@ -33,7 +33,12 @@ be_state_union_disctypedefn_ch::gen_code (be_type *bt, be_decl *d, be_type *type
bu = be_union::narrow_from_decl (d); // downcast to union type
if (!bu)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_disctypedefn_ch::"
+ "gen_code - "
+ "bad union node\n"), -1);
+ }
if (!type) // not a recursive call
type = bt;
@@ -66,7 +71,12 @@ be_state_union_disctypedefn_ch::gen_code (be_type *bt, be_decl *d, be_type *type
// definition. However, check that we are not inside a recursive call
if (bt->node_type () == AST_Decl::NT_enum)
if (bt->gen_client_header () == -1)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_disctypedefn_ch::"
+ "gen_code - "
+ "codegen for discrim failed\n"), -1);
+ }
os->indent ();
// the set method
@@ -82,11 +92,16 @@ be_state_union_disctypedefn_ch::gen_code (be_type *bt, be_decl *d, be_type *type
be_type *temp; // most primitive base type
be_typedef *t = be_typedef::narrow_from_decl (bt);
if (!t)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_disctypedefn_ch::"
+ "gen_code - "
+ "bad typedef node\n"), -1);
+ }
+
temp = t->primitive_base_type ();
return this->gen_code (t, d, temp);
}
- //break; unreachable statement!
} // end of switch
return 0;
}
@@ -106,7 +121,12 @@ be_state_union_disctypedefn_ci::gen_code (be_type *bt, be_decl *d, be_type *type
bu = be_union::narrow_from_decl (d); // downcast to union type
if (!bu)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_disctypedefn_ci::"
+ "gen_code - "
+ "bad union node\n"), -1);
+ }
if (!type) // not a recursive call
type = bt;
@@ -180,14 +200,21 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
os = cg->client_header (); // get client header stream
ub = be_union_branch::narrow_from_decl (d); // downcast to union branch node
if (!ub)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "bad union member\n"), -1);
+ }
bu = be_union::narrow_from_scope (ub->defined_in ());
if (bu == NULL)
- return -1;
-
- // pass the union branch node just incase it is needed
- cg->node (ub);
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "bad union node\n"), -1);
+ }
if (!type) // not a recursive call
type = bt;
@@ -195,10 +222,7 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
// base class of the typedef
ACE_ASSERT (bt->node_type () == AST_Decl::NT_typedef);
- // generate code based on type. For every case, first downcast to the
- // appropriate type. If the downcast fails, return error, else proceed. In
- // some cases, the type itself may need code generation, e.g., anonymous
- // struct types.
+ // codegen based on node type and the state we are in
switch (type->node_type ())
{
case AST_Decl::NT_interface: // type is an obj reference
@@ -211,12 +235,46 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
}
break;
case AST_Decl::NT_pre_defined: // type is predefined type
+ {
+ be_predefined_type *bpd = be_predefined_type::narrow_from_decl (type);
+ if (!bpd)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "bad predefined type\n"), -1);
+ }
+
+ if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ os->indent (); // start from current indentation
+ *os << "void " << ub->local_name () << " (" << bt->nested_type_name
+ (bu) << "_ptr);// set" << nl;
+ *os << bt->nested_type_name (bu) << "_ptr " << ub->local_name () <<
+ " (void) const; // get method\n\n";
+ }
+ else
+ {
+ os->indent (); // start from current indentation
+ *os << "void " << ub->local_name () << " (" << bt->nested_type_name
+ (bu) << ");// set" << nl;
+ *os << bt->nested_type_name (bu) << " " << ub->local_name () <<
+ " (void) const; // get method\n\n";
+ }
+ }
+ break;
case AST_Decl::NT_enum: // type is an enum
{
+ // XXXASG - TODO - what if we have a pseudo obj?
// if the type is an enum, we generate its defn first
if (bt->node_type () == AST_Decl::NT_enum)
if (bt->gen_client_header () == -1)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "bad union member\n"), -1);
+ }
os->indent (); // start from current indentation
*os << "void " << ub->local_name () << " (" << bt->nested_type_name (bu)
@@ -261,7 +319,12 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
// generation. Check if this is not a recursive call
if (bt->node_type () != AST_Decl::NT_typedef)
if (bt->gen_client_header () == -1)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "codegen for array failed\n"), -1);
+ }
os->indent ();
*os << "void " << ub->local_name () << " (" << bt->nested_type_name
@@ -278,7 +341,13 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
// generate defn for this aggregate unless we are recursively called
if (bt->node_type () != AST_Decl::NT_typedef)
if (bt->gen_client_header () == -1)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ch::"
+ "gen_code - "
+ "codegen for type failed\n"), -1);
+ }
+
os->indent ();
*os << "void " << ub->local_name () << " (const " <<
bt->nested_type_name (bu) << " &);// set" << nl;
@@ -286,7 +355,6 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
() << " (void) const; // get method (read only)" << nl;
*os << bt->nested_type_name (bu) << " &" << ub->local_name () <<
" (void); // get method (read/write only)\n\n";
-
}
break;
case AST_Decl::NT_except: // type is an exception
@@ -306,7 +374,6 @@ be_state_union_public_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
// make a recursive call
return this->gen_code (t, ub, temp);
}
- //break; unreachable statement!
} // end of switch
// enclosing union is variable if the member is variable
@@ -333,11 +400,21 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
os = cg->client_inline (); // get client inline stream
ub = be_union_branch::narrow_from_decl (d); // downcast to union branch node
if (!ub)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ci::"
+ "gen_code - "
+ "bad union member\n"), -1);
+ }
bu = be_union::narrow_from_scope (ub->defined_in ());
if (bu == NULL)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ci::"
+ "gen_code - "
+ "bad union node\n"), -1);
+ }
if (!type) // not a recursive call
type = bt;
@@ -352,6 +429,19 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
case AST_Decl::NT_array: // type is an array
case AST_Decl::NT_interface: // type is an obj reference
{
+ // for array, generate inline methods if any
+ // We first need to generate code for this aggregate type. Check
+ // if we are not called recursively thru a typedef
+ if (bt->node_type () == AST_Decl::NT_array
+ && !bt->imported ())
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ci::"
+ "gen_code - "
+ "codegen for array failed\n"), -1);
+ }
+
// set method
os->indent (); // start from current indentation
*os << "// accessor to set the member" << nl;
@@ -576,10 +666,9 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
os->decr_indent ();
*os << "}" << nl;
- // return const char*
if (bt->node_type () == AST_Decl::NT_typedef)
{
- *os << "ACE_INLINE " << bt->name () << nl;
+ *os << "ACE_INLINE const " << bt->name () << nl;
}
else
{
@@ -597,6 +686,18 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
case AST_Decl::NT_sequence: // type is a sequence
case AST_Decl::NT_union: // type is a union
{
+ // We first need to generate code for this aggregate type. Check
+ // if we are not called recursively thru a typedef
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && !bt->imported ())
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ci::"
+ "gen_code - "
+ "codegen for type failed\n"), -1);
+ }
+
os->indent ();
// This case has to be handled differently from structs because the data
// member is a pointer
@@ -659,6 +760,18 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
break;
case AST_Decl::NT_struct: // type is a struct
{
+ // We first need to generate code for this aggregate type. Check
+ // if we are not called recursively thru a typedef
+ if (bt->node_type () != AST_Decl::NT_typedef
+ && !bt->imported ())
+ if (bt->gen_client_inline () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_ci::"
+ "gen_code - "
+ "codegen for struct failed\n"), -1);
+ }
+
os->indent ();
// (1) set from a const
@@ -734,18 +847,19 @@ be_state_union_public_ci::gen_code (be_type *bt, be_decl *d, be_type *type)
// make a recursive call
return this->gen_code (t, ub, temp);
}
- //break; unreachable statement!
} // end of switch
return 0;
}
-be_state_union_private_ch::be_state_union_private_ch (void)
+be_state_union_public_cs::be_state_union_public_cs (void)
{
}
+// generate code for union branch members in client header. This involves
+// generating the set/get methods corresponding to the members
int
-be_state_union_private_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
+be_state_union_public_cs::gen_code (be_type *bt, be_decl *d, be_type *type)
{
TAO_OutStream *os; // output stream
TAO_NL nl; // end line
@@ -753,17 +867,169 @@ be_state_union_private_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
be_union_branch *ub; // union branch member
be_union *bu; // enclosing union
- // Macro to avoid "warning: unused parameter" type warning.
- ACE_UNUSED_ARG (nl);
+ os = cg->client_stubs (); // get client stubs stream
+ ub = be_union_branch::narrow_from_decl (d); // downcast to union branch node
+ if (!ub)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_cs::"
+ "gen_code - "
+ "bad union member\n"), -1);
+ }
+
+ bu = be_union::narrow_from_scope (ub->defined_in ());
+ if (!bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_cs::"
+ "gen_code - "
+ "bad union member\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);
+
+ switch (cg->state ())
+ {
+ case TAO_CodeGen::TAO_UNION_PUBLIC_CS:
+ {
+ switch (type->node_type ())
+ {
+ case AST_Decl::NT_interface: // type is an obj reference
+ case AST_Decl::NT_pre_defined: // type is predefined type
+ case AST_Decl::NT_string: // type is a string
+ {
+ // nothing
+ }
+ break;
+ case AST_Decl::NT_enum: // type is an enum
+ {
+ if (bt->node_type () == AST_Decl::NT_enum)
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_cs::"
+ "gen_code - "
+ "codegen for type failed\n"), -1);
+ }
+ }
+ break;
+ case AST_Decl::NT_array: // type is an array
+ {
+ // generate code for the array. So let the array handle code
+ // generation. Check if this is not a recursive call
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_cs::"
+ "gen_code - "
+ "codegen for type failed\n"), -1);
+ }
+
+ }
+ 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
+ {
+ // generate defn for this aggregate unless we are recursively called
+ if (bt->node_type () != AST_Decl::NT_typedef)
+ if (bt->gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_public_cs::"
+ "gen_code - "
+ "codegen for type failed\n"), -1);
+ }
+ }
+ break;
+ case AST_Decl::NT_except: // type is an exception
+ {
+ // XXXASG: Is this case valid ???
+ }
+ break;
+ case AST_Decl::NT_typedef: // type is a typedef
+ {
+ be_type *temp; // most primitive base type
+ be_typedef *t = be_typedef::narrow_from_decl (bt);
+
+ if (!t)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_private_cs::"
+ "gen_code - "
+ "bad typedef\n"), -1);
+ }
+
+ temp = t->primitive_base_type ();
+ // make a recursive call
+ return this->gen_code (t, ub, temp);
+ }
+ } // end of switch node type
+ }
+ break;
+ case TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS:
+ {
+ // This state is used when we are generating the copy ctor and
+ // assignment operator for the union.
+ // Individual assignment of the members takes place inside a case
+ // statement because the type of member assigned is based on the value
+ // of the discriminant
+ os->indent ();
+ if (ub->label ()->label_val ()->ec () == AST_Expression::EC_symbol)
+ {
+ *os << "case " << ub->label ()->label_val ()->n () << ":\n";
+ }
+ else
+ {
+ *os << "case " << ub->label ()->label_val () << ":\n";
+ }
+ os->incr_indent ();
+ *os << "this->" << ub->local_name () << "_ = u." << ub->local_name ()
+ << "_;" << nl;
+ *os << "break;\n";
+ os->decr_indent (0);
+ }
+ break;
+ }
+
+ return 0;
+}
+
+be_state_union_private_ch::be_state_union_private_ch (void)
+{
+}
+
+int
+be_state_union_private_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
+{
+ TAO_OutStream *os; // output stream
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ be_union_branch *ub; // union branch member
+ be_union *bu; // enclosing union
os = cg->client_header (); // get client header stream
ub = be_union_branch::narrow_from_decl (d); // downcast to union branch node
if (!ub)
- return -1;
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_private_ch::"
+ "gen_code - "
+ "bad union member\n"), -1);
+ }
bu = be_union::narrow_from_scope (ub->defined_in ());
- if (bu == NULL)
- return -1;
+ if (!bu)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_private_ch::"
+ "gen_code - "
+ "bad union\n"), -1);
+ }
if (!type) // not a recursive call
type = bt;
@@ -787,6 +1053,30 @@ be_state_union_private_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
}
break;
case AST_Decl::NT_pre_defined: // type is predefined type
+ {
+ be_predefined_type *bpd = be_predefined_type::narrow_from_decl (type);
+ if (!bpd)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_state_union_private_ch::"
+ "gen_code - "
+ "bad predefined type\n"), -1);
+ }
+
+ if (bpd->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ os->indent (); // start from current indentation
+ *os << bt->nested_type_name (bu) << "_var " << ub->local_name () <<
+ "_;\n";
+ }
+ else
+ {
+ os->indent (); // start from current indentation
+ *os << bt->nested_type_name (bu) << " " << ub->local_name () <<
+ "_;\n";
+ }
+ }
+ break;
case AST_Decl::NT_enum: // type is an enum
{
os->indent (); // start from current indentation
@@ -849,7 +1139,6 @@ be_state_union_private_ch::gen_code (be_type *bt, be_decl *d, be_type *type)
// make a recursive call
return this->gen_code (t, ub, temp);
}
- //break; unreachable statement!!
} // end of switch
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index a0f88773143..2e87ffaaa56 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -117,7 +117,7 @@ be_type::nested_type_name (be_decl *d, char *suffix)
if (this->is_nested ()) // if we are nested
{
// get our enclosing scope
- t = be_decl::narrow_from_decl (ScopeAsDecl (this->defined_in ()));
+ t = be_scope::narrow_from_scope (this->defined_in ())->decl ();
// now check if the scope in which we were defined is the same
// as the current scope in which we are used or one of its ancestors
@@ -140,7 +140,7 @@ be_type::nested_type_name (be_decl *d, char *suffix)
ACE_OS::strcat (macro, ")");
return macro;
}
- d = be_decl::narrow_from_decl (ScopeAsDecl (d->defined_in ()));
+ d = be_scope::narrow_from_scope (d->defined_in ())->decl ();
} // end of while
} // end of if is_nested
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index 4d232b5ec5a..2e89a1bcd84 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -85,11 +85,11 @@ be_union::compute_default_index (void)
si = new UTL_ScopeActiveIterator (this, UTL_Scope::IK_decls);
while (!(si->is_done ()))
- {
- // get the next AST decl node
- d = si->item ();
- if (!d->imported ())
- {
+ {
+ // get the next AST decl node
+ d = si->item ();
+ if (!d->imported ())
+ {
bub = be_union_branch::narrow_from_decl (d);
if (bub->label ()->label_kind () == AST_UnionLabel::UL_default)
this->default_index_ = i; // zero based indexing
@@ -135,7 +135,6 @@ be_union::gen_client_header (void)
be_type *bt; // type node
be_state *s; // code generation state
-
if (!this->cli_hdr_gen_)
{
// retrieve a singleton instance of the code generator
@@ -143,6 +142,8 @@ be_union::gen_client_header (void)
ch = cg->client_header ();
+ // generate the ifdefined macro for the array type
+ ch->gen_ifdef_macro (this->flatname ());
ch->indent (); // start with the current indentation level
*ch << "class " << local_name () << nl;
*ch << "{" << nl;
@@ -164,25 +165,43 @@ be_union::gen_client_header (void)
cg->push (TAO_CodeGen::TAO_UNION_DISCTYPEDEFN_CH); // set current code gen state
bt = be_type::narrow_from_decl (this->disc_type ());
+ if (!bt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "bad disciminant type\n"), -1);
+ }
s = cg->make_state (); // get the code gen object for the current state
- if (!s || !bt || (s->gen_code (bt, this) == -1))
+ if (!s)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "Discriminant type generation failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "bad state\n"), -1);
}
- cg->pop ();
+
+ if (s->gen_code (bt, this) == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "codegen for discriminant failed\n"), -1);
+ }
+ cg->pop (); // revert to previous state
// now generate the public defn for the union branch members
cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CH); // set current code gen state
-
if (be_scope::gen_client_header () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "member generation failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "codegen for public defn of union members\n"),
+ -1);
}
+
cg->pop ();
// now generate the private data members of the union
@@ -191,7 +210,7 @@ be_union::gen_client_header (void)
*ch << "private:\n";
ch->incr_indent ();
*ch << bt->nested_type_name (this) << " disc_;" << nl; // emit the
- // ACE_NESTED_CLASS macro
+ // ACE_NESTED_CLASS macro
// the members are inside of a union
*ch << "union" << nl;
@@ -199,36 +218,19 @@ be_union::gen_client_header (void)
ch->incr_indent (0);
if (be_scope::gen_client_header () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_header\n"));
- ACE_ERROR ((LM_ERROR, "data member generation failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "codegen for private members of union\n"), -1);
}
+
ch->decr_indent ();
- *ch << "}; // end of union\n\n";
+ *ch << "}; // end of union\n";
ch->decr_indent ();
*ch << "};\n\n";
- // generate var defn
- this->gen_var_defn ();
-
- // a class is generated for an out defn only for a variable length struct
- if (this->size_type () == be_decl::VARIABLE)
- {
- this->gen_out_defn ();
- }
- else
- {
- ch->indent ();
- *ch << "typedef " << this->local_name () << " &" << this->local_name
- () << "_out;\n\n";
- }
-
// Generate the typecode decl
- // All names in the root scope have length 2 (for the root and
- // ourself). The children have length greater than 2. Thus, if our name
- // length is 2 or less, we are outermost and our typecode decl must be
- // extern, else we are defined static inside the enclosing scope.
if (this->is_nested ())
{
// we have a scoped name
@@ -243,6 +245,41 @@ be_union::gen_client_header (void)
*ch << "extern CORBA::TypeCode_ptr " << this->tc_name
()->last_component () << ";\n\n";
}
+ ch->gen_endif ();
+
+ // generate the ifdefined macro for the array type
+ ch->gen_ifdef_macro (this->flatname (), "_var");
+ // generate var defn
+ if (this->gen_var_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "codegen for _var\n"), -1);
+ }
+ ch->gen_endif ();
+
+ // generate the ifdefined macro for the array type
+ ch->gen_ifdef_macro (this->flatname (), "_out");
+ // a class is generated for an out defn only for a variable length struct
+ if (this->size_type () == be_decl::VARIABLE)
+ {
+ if (this->gen_out_defn () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_header - "
+ "codegen for _out\n"), -1);
+ }
+ }
+ else
+ {
+ ch->indent ();
+ *ch << "typedef " << this->local_name () << " &" << this->local_name
+ () << "_out;\n\n";
+ }
+ ch->gen_endif ();
+
cg->pop ();
this->cli_hdr_gen_ = I_TRUE;
}
@@ -254,20 +291,37 @@ be_union::gen_client_stubs (void)
{
TAO_OutStream *cs; // output stream
TAO_NL nl; // end line
+ be_type *bt; // type node
+ be_state *s; // code generation state
if (!this->cli_stub_gen_)
{
// retrieve a singleton instance of the code generator
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ cs = cg->client_stubs ();
+
+ // first generate code for any of the members (if required, e.g.,
+ // anonymous sequences, structs, unions, arrays)
cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CS); // set current code gen state
+ if (be_scope::gen_client_stubs () == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_stubs - "
+ "codegen for scope failed\n"), -1);
+ }
+ cg->pop ();
- cs = cg->client_stubs ();
+ // now generate the operations on the union such as the copy constructor
+ // and the assignment operator
*cs << "// *************************************************************"
<< nl;
*cs << "// Operations for union " << this->name () << nl;
*cs << "// *************************************************************\n\n";
+ cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_ASSIGN_CS);
+
// generate the copy constructor and the assignment operator here
cs->indent ();
*cs << "// copy constructor" << nl;
@@ -283,15 +337,18 @@ be_union::gen_client_stubs (void)
cs->incr_indent (0);
if (be_scope::gen_client_stubs () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_stubs\n"));
- ACE_ERROR ((LM_ERROR, "constructor codegen failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_stubs - "
+ "codegen for scope failed\n"), -1);
}
+
cs->decr_indent ();
*cs << "}\n";
cs->decr_indent ();
*cs << "}\n\n";
+ // assignment operator
cs->indent ();
*cs << "// assignment operator" << nl;
*cs << this->name () << " &" << nl; // return type
@@ -307,10 +364,12 @@ be_union::gen_client_stubs (void)
cs->incr_indent (0);
if (be_scope::gen_client_stubs () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_stubs\n"));
- ACE_ERROR ((LM_ERROR, "assignment op codegen failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_stubs - "
+ "codegen for scope failed\n"), -1);
}
+
cs->decr_indent ();
*cs << "}" << nl;
*cs << "return *this;\n";
@@ -325,9 +384,12 @@ be_union::gen_client_stubs (void)
cs->incr_indent (0);
if (this->gen_encapsulation () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union:Error generating encapsulation\n\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_stubs - "
+ "codegen for encapsulation failed\n"), -1);
}
+
cs->decr_indent ();
*cs << "};" << nl;
@@ -343,18 +405,6 @@ be_union::gen_client_stubs (void)
return 0;
}
-int
-be_union::gen_server_header (void)
-{
- return 0;
-}
-
-int
-be_union::gen_server_skeletons (void)
-{
- return 0;
-}
-
// Generates the client-side inline information
int
be_union::gen_client_inline (void)
@@ -409,27 +459,53 @@ be_union::gen_client_inline (void)
cg->push (TAO_CodeGen::TAO_UNION_PUBLIC_CI); // set current code gen state
if (be_scope::gen_client_inline () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union::gen_client_inline\n"));
- ACE_ERROR ((LM_ERROR, "accessor generation failure\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_inline - "
+ "codegen for scope failed\n"), -1);
}
+
cg->pop ();
+ // generate the ifdefined macro for the array type
+ ci->gen_ifdef_macro (this->flatname (), "_var");
if (this->gen_var_impl () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union: _var impl code gen failed\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_inline - "
+ "codegen for _var failed\n"), -1);
}
+ ci->gen_endif ();
+
+ // generate the ifdefined macro for the array type
+ ci->gen_ifdef_macro (this->flatname (), "_out");
if (this->size_type () == be_decl::VARIABLE && this->gen_out_impl () == -1)
{
- ACE_ERROR ((LM_ERROR, "be_union: _out impl code gen failed\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union::"
+ "gen_client_inline - "
+ "codegen for _out failed\n"), -1);
}
+ ci->gen_endif ();
+
this->cli_inline_gen_ = I_TRUE;
}
return 0;
}
+int
+be_union::gen_server_header (void)
+{
+ return 0;
+}
+
+int
+be_union::gen_server_skeletons (void)
+{
+ return 0;
+}
+
// Generates the server-side inline
int
be_union::gen_server_inline (void)
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index ed47823faf7..241fffab0e1 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -51,11 +51,13 @@ be_union_branch::gen_client_header (void)
TAO_CodeGen *cg = TAO_CODEGEN::instance ();
bt = be_type::narrow_from_decl (this->field_type ());
- s = cg->make_state ();
+ s = cg->make_state ();
if (!s || !bt || (s->gen_code (bt, this) == -1))
{
- ACE_ERROR ((LM_ERROR, "be_union_branch: error generating type\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union_branch::"
+ "gen_client_header - "
+ "state based code gen failed\n"), -1);
}
return 0;
}
@@ -64,48 +66,22 @@ be_union_branch::gen_client_header (void)
int
be_union_branch::gen_client_stubs (void)
{
- TAO_OutStream *cs; // output stream
- TAO_NL nl; // end line
-
- if (!this->cli_stub_gen_)
- {
- // retrieve a singleton instance of the code generator
- TAO_CodeGen *cg = TAO_CODEGEN::instance ();
+ be_type *bt; // the union_branch type
+ be_state *s; // state based code gen object
- cs = cg->client_stubs ();
+ // retrieve a singleton instance of the code generator
+ TAO_CodeGen *cg = TAO_CODEGEN::instance ();
- cs->indent ();
- // generate a case stmt
- if (this->label ()->label_val ()->ec () == AST_Expression::EC_symbol)
- {
- *cs << "case " << this->label ()->label_val ()->n () << ":\n";
- }
- else
- {
- *cs << "case " << this->label ()->label_val () << ":\n";
- }
- cs->incr_indent ();
- *cs << "this->" << this->local_name () << "_ = u." << this->local_name ()
- << "_;" << nl;
- *cs << "break;\n";
- cs->decr_indent (0);
+ bt = be_type::narrow_from_decl (this->field_type ());
+ s = cg->make_state ();
+ if (!s || !bt || (s->gen_code (bt, this) == -1))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union_branch::"
+ "gen_client_stubs - "
+ "state based code gen failed\n"), -1);
}
- return 0;
-}
-
-// Generates the server-side header information for the union_branch
-int
-be_union_branch::gen_server_header (void)
-{
- // nothing to be done
- return 0;
-}
-// Generates the server-side skeletons for the union_branch
-int
-be_union_branch::gen_server_skeletons (void)
-{
- // nothing to be done
return 0;
}
@@ -123,13 +99,30 @@ be_union_branch::gen_client_inline (void)
s = cg->make_state ();
if (!s || !bt || (s->gen_code (bt, this) == -1))
{
- ACE_ERROR ((LM_ERROR,
- "be_union_branch: error generating impl of access methods\n"));
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_union_branch::"
+ "gen_client_inline - "
+ "state based code gen failed\n"), -1);
}
return 0;
}
+// Generates the server-side header information for the union_branch
+int
+be_union_branch::gen_server_header (void)
+{
+ // nothing to be done
+ return 0;
+}
+
+// Generates the server-side skeletons for the union_branch
+int
+be_union_branch::gen_server_skeletons (void)
+{
+ // nothing to be done
+ return 0;
+}
+
// Generates the server-side inline
int
be_union_branch::gen_server_inline (void)
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index a99cc2feb3c..2e256fe95b8 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -20,6 +20,8 @@
#if !defined (BE_ARRAY_H)
#define BE_ARRAY_H
+class TAO_OutStream;
+
/*
* BE_Array
*/
@@ -71,6 +73,10 @@ public:
virtual int gen_forany_impl (void);
// the forany impl
+ virtual int gen_dimensions (TAO_OutStream *os, unsigned short slice=0);
+ // generate dimensions. If slice == 1, generate dimensions for the slice
+ // definition
+
virtual int gen_typecode (void);
// generate the typecode
@@ -91,6 +97,8 @@ protected:
virtual int compute_size_type (void);
// compute the size type if it is unknown
+ virtual int create_name (void);
+ // create a name for us
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 3a9a02ae920..b7b7dda3543 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -104,6 +104,7 @@ public:
TAO_UNION_PUBLIC_CH,
TAO_UNION_PUBLIC_CI,
TAO_UNION_PUBLIC_CS,
+ TAO_UNION_PUBLIC_ASSIGN_CS,
TAO_UNION_PUBLIC_SH,
TAO_UNION_PUBLIC_SI,
TAO_UNION_PUBLIC_SS,
@@ -126,8 +127,11 @@ public:
// emitting code for exceptions
TAO_EXCEPTION_CH,
+ TAO_EXCEPTION_CTOR_CH,
TAO_EXCEPTION_CI,
TAO_EXCEPTION_CS,
+ TAO_EXCEPTION_CTOR_CS,
+ TAO_EXCEPTION_CTOR_ASSIGN_CS,
TAO_EXCEPTION_SH,
TAO_EXCEPTION_SI,
TAO_EXCEPTION_SS,
diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h
index 1e96770c8f7..cc1c2f317ce 100644
--- a/TAO/TAO_IDL/be_include/be_decl.h
+++ b/TAO/TAO_IDL/be_include/be_decl.h
@@ -20,6 +20,8 @@
#if !defined (TAO_BE_DECL_H)
#define TAO_BE_DECL_H
+class be_scope;
+
/*
* BE_Decl
*/
@@ -94,6 +96,9 @@ public:
virtual long tc_encap_len (void);
// return length of encapsulation
+ virtual be_scope *scope (void);
+ // return the scope created by this node (if one exists)
+
// Narrowing
DEF_NARROW_METHODS1 (be_decl, AST_Decl);
DEF_NARROW_FROM_DECL (be_decl);
diff --git a/TAO/TAO_IDL/be_include/be_scope.h b/TAO/TAO_IDL/be_include/be_scope.h
index 45c591db168..bf312c77aad 100644
--- a/TAO/TAO_IDL/be_include/be_scope.h
+++ b/TAO/TAO_IDL/be_include/be_scope.h
@@ -20,6 +20,8 @@
#if !defined (TAO_BE_SCOPE_H)
#define TAO_BE_SCOPE_H
+class be_decl;
+
/*
* BE_Scope
*/
@@ -66,10 +68,19 @@ public:
virtual long tc_encap_len (void);
// return length of encapsulation
+ virtual void comma (unsigned short set);
+ // set the comma producing state
+
+ virtual be_decl *decl (void);
+ // return the be_decl node corresponding to this scope node
+
// Narrowing
DEF_NARROW_METHODS1 (be_scope, UTL_Scope);
DEF_NARROW_FROM_SCOPE (be_scope);
+private:
+ unsigned short comma_;
+ // if set, generate a comma after every element is handled
};
#endif // if !defined
diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h
index 42f92dfa28e..f44a4eb72d6 100644
--- a/TAO/TAO_IDL/be_include/be_sequence.h
+++ b/TAO/TAO_IDL/be_include/be_sequence.h
@@ -108,21 +108,26 @@ public:
virtual MANAGED_TYPE managed_type (void);
// return the managed type
+ // =Scope management functions
+ be_sequence *fe_add_sequence (be_sequence *);
+
+ virtual be_decl *decl (void);
+ // overridden method on the be_scope class
+
// Narrowing
DEF_NARROW_METHODS3 (be_sequence, AST_Sequence, be_scope, be_type);
DEF_NARROW_FROM_DECL (be_sequence);
-private:
- void compute_scoped_name (void);
- // for anonymous sequences, we compute our scoped name
+protected:
+ virtual const char *gen_name (void);
+ // helper to create_name
+private:
idl_bool unbounded_;
// whether we are bounded or unbounded
- be_sequence *seq_node_;
- // if we enclose a sequence node
-
MANAGED_TYPE mt_;
+ // our managed type
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_state.h b/TAO/TAO_IDL/be_include/be_state.h
index 46ca6b730c7..353238bbb09 100644
--- a/TAO/TAO_IDL/be_include/be_state.h
+++ b/TAO/TAO_IDL/be_include/be_state.h
@@ -147,6 +147,24 @@ public:
typedef ACE_Singleton<be_state_union_private_ch, ACE_SYNCH_RECURSIVE_MUTEX>
TAO_BE_STATE_UNION_PRIVATE_CH;
+class be_state_union_public_cs: public be_state
+{
+ // =TITLE
+ // be_state_union_public_cs
+ // =DESCRIPTION
+ // union discriminant defn generation in client stubs file
+public:
+
+ be_state_union_public_cs (void);
+ // constructor
+
+ virtual int gen_code (be_type *bt, be_decl *d, be_type *type=0);
+ // code generation for node "d" whose type is "bt". The third parameter is
+ // used for recursive invocation involving a typedef
+};
+typedef ACE_Singleton<be_state_union_public_cs, ACE_SYNCH_RECURSIVE_MUTEX>
+ TAO_BE_STATE_UNION_PUBLIC_CS;
+
class be_state_operation: public be_state
{
// =TITLE
diff --git a/TAO/TAO_IDL/narrow/narrow.cpp b/TAO/TAO_IDL/narrow/narrow.cpp
index 7b5d9b391cd..786e0f95754 100644
--- a/TAO/TAO_IDL/narrow/narrow.cpp
+++ b/TAO/TAO_IDL/narrow/narrow.cpp
@@ -51,8 +51,8 @@ Technical Data and Computer Software clause at DFARS 252.227-7013 and FAR
Sun, Sun Microsystems and the Sun logo are trademarks or registered
trademarks of Sun Microsystems, Inc.
-SunSoft, Inc.
-2550 Garcia Avenue
+SunSoft, Inc.
+2550 Garcia Avenue
Mountain View, California 94043
NOTE:
diff --git a/TAO/docs/releasenotes/index.html b/TAO/docs/releasenotes/index.html
index 0e74406e6b8..6d89d4fcb8c 100644
--- a/TAO/docs/releasenotes/index.html
+++ b/TAO/docs/releasenotes/index.html
@@ -48,8 +48,14 @@ HREF="http://www.cs.wustl.edu/~schmidt/ACE_wrappers/TAO/VERSION">current release
<H3><A NAME="idl"></A>IDL Compiler</H3>
Point of contact: <A HREF="mailto:gokhale@cs.wustl.edu">Aniruddha Gokhale</A>
- <P> Current status: (As of Dec 16th, 1997.)
+ <P> Current status: (As of Dec 18th, 1997.)
<UL>
+ <LI> Very preliminary support for arrays. Not working yet. </LI>
+
+ <LI> Many bugs associated with stub generation fixed. This
+ included support for return values that are variable sized
+ IDL types. Unions improved. </LI>
+
<LI> Support for sequences of strings and object references
added. However, it is not tested yet so there may be some
bugs. We should have these fixed in a day or so. </LI>
diff --git a/TAO/tao/deep_free.cpp b/TAO/tao/deep_free.cpp
index b932715be69..2a331be6a80 100644
--- a/TAO/tao/deep_free.cpp
+++ b/TAO/tao/deep_free.cpp
@@ -2,7 +2,7 @@
//
// = LIBRARY
// TAO
-//
+//
// = FILENAME
// deep_free.cpp
//
@@ -23,9 +23,9 @@
//
// = AUTHOR
// Copyright 1994-1995 by Sun Microsystems Inc.
-// and
+// and
// Aniruddha Gokhale
-//
+//
// ============================================================================
#include "tao/corba.h"
@@ -114,13 +114,13 @@ TAO_Marshal_Primitive::deep_free (CORBA::TypeCode_ptr tc,
{
CORBA::TCKind my_kind;
- if (tc)
+ if (tc)
{
my_kind = tc->kind (env);
if (env.exception () == 0)
{
- switch (my_kind)
+ switch (my_kind)
{
case CORBA::tk_null:
case CORBA::tk_void:
@@ -151,7 +151,7 @@ TAO_Marshal_Primitive::deep_free (CORBA::TypeCode_ptr tc,
return CORBA::TypeCode::TRAVERSE_STOP;
}
}
- else
+ else
{
env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_MAYBE) );
dmsg ("TAO_Marshal_Primitive::deep_free detected error");
@@ -226,7 +226,7 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
retval = TAO_Marshal_Union::deep_free (param, source, dest, env);
break;
case CORBA::tk_string:
- retval = TAO_Marshal_String::deep_free (param, source, dest, env);
+ retval = TAO_Marshal_String::deep_free (param, &source, dest, env);
break;
case CORBA::tk_sequence:
retval = TAO_Marshal_Sequence::deep_free (param, source, dest, env);
@@ -247,13 +247,13 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
retval = CORBA::TypeCode::TRAVERSE_STOP;
} // end of switch
source = (char *)source + size;
- }
- else // exception computing size
+ }
+ else // exception computing size
{
dmsg ("TAO_Marshal_Struct::deep_free detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
- }
+ }
else // exception computing typecode
{
dmsg ("TAO_Marshal_Struct::deep_free detected error");
@@ -268,8 +268,8 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
dmsg ("TAO_Marshal_Struct::deep_free detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
- }
- else // exception getting member count
+ }
+ else // exception getting member count
{
dmsg ("TAO_Marshal_Struct::deep_free detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
@@ -314,7 +314,7 @@ TAO_Marshal_Union::deep_free (CORBA::TypeCode_ptr tc,
if (env.exception () == 0)
{
discrim_val = data; // save the pointer to the discriminator
- // value
+ // value
// move the pointer to point to the actual value
data = (char *)data + discrim_size_with_pad;
data2 = (char *)data2 + discrim_size_with_pad;
@@ -390,7 +390,7 @@ TAO_Marshal_Union::deep_free (CORBA::TypeCode_ptr tc,
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
return CORBA::TypeCode::TRAVERSE_STOP;
}
-
+
}
else
{
@@ -459,7 +459,7 @@ TAO_Marshal_Sequence::deep_free (CORBA::TypeCode_ptr tc,
src = (CORBA::OctetSeq *) source;
// get element typecode
- tc2 = tc->content_type (env);
+ tc2 = tc->content_type (env);
if (env.exception () == 0)
{
// get the size of the element
@@ -592,7 +592,7 @@ TAO_Marshal_Sequence::deep_free (CORBA::TypeCode_ptr tc,
dmsg ("marshaling TAO_Marshal_Sequence::deep_free detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
- }
+ }
else // exception computing size
{
// CORBA::release (tc2);
@@ -600,7 +600,7 @@ TAO_Marshal_Sequence::deep_free (CORBA::TypeCode_ptr tc,
dmsg ("marshaling TAO_Marshal_Sequence::deep_free detected error");
return CORBA::TypeCode::TRAVERSE_STOP;
}
- }
+ }
else // exception computing content type
{
env.exception (new CORBA::BAD_TYPECODE (CORBA::COMPLETED_MAYBE));
@@ -639,7 +639,7 @@ TAO_Marshal_Array::deep_free (CORBA::TypeCode_ptr tc,
if (env.exception () == 0)
{
// get element typecode
- tc2 = tc->content_type (env);
+ tc2 = tc->content_type (env);
if (env.exception () == 0)
{
// get the size of the element type
@@ -770,10 +770,10 @@ TAO_Marshal_Array::deep_free (CORBA::TypeCode_ptr tc,
else
// CORBA::release (tc2);
return CORBA::TypeCode::TRAVERSE_STOP;
- }
+ }
else // exception computing content type
return CORBA::TypeCode::TRAVERSE_STOP;
- }
+ }
else // exception getting bounds
return CORBA::TypeCode::TRAVERSE_STOP;
}
@@ -795,7 +795,7 @@ TAO_Marshal_Alias::deep_free (CORBA::TypeCode_ptr tc,
CORBA::TypeCode_ptr tc2; // typecode of the aliased type
CDR stream; // to access the marshal object
CORBA::TypeCode::traverse_status retval =
- CORBA::TypeCode::TRAVERSE_CONTINUE; // status of encode operation
+ CORBA::TypeCode::TRAVERSE_CONTINUE; // status of encode operation
if (tc)
{
@@ -866,9 +866,9 @@ TAO_Marshal_Alias::deep_free (CORBA::TypeCode_ptr tc,
retval = CORBA::TypeCode::TRAVERSE_STOP;
}
// CORBA::release (tc2);
- if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
+ if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE)
return CORBA::TypeCode::TRAVERSE_CONTINUE;
- else
+ else
{
env.exception (new CORBA::MARSHAL (CORBA::COMPLETED_MAYBE));
dmsg ("TAO_Marshal_Alias::decode detected error");
@@ -895,7 +895,7 @@ TAO_Marshal_Except::deep_free (CORBA::TypeCode_ptr tc,
{
#if 0
// temporarily commented out to make compiler happy
- CORBA::Long i,
+ CORBA::Long i,
member_count; // number of fields in the struct
CORBA::TypeCode::traverse_status retval = CORBA::TypeCode::TRAVERSE_CONTINUE;
CORBA::TypeCode_ptr param;
diff --git a/TAO/tao/poa.cpp b/TAO/tao/poa.cpp
index 1c4d52bbab4..9fbf124f439 100644
--- a/TAO/tao/poa.cpp
+++ b/TAO/tao/poa.cpp
@@ -341,11 +341,14 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
0, // this is IIOP residue
env);
- svr_req.release ();
+ // svr_req.release ();
// If no reply is necessary (i.e., oneway), then return!
if (hdr.response_expected == 0)
- return;
+ {
+ svr_req.release ();
+ return;
+ }
// Otherwise check for correct parameter handling, and reply as
// appropriate.
@@ -437,6 +440,7 @@ CORBA_POA::handle_request (TAO_GIOP_RequestHeader hdr,
(void) response.encode (tc, value, 0, env);
}
}
+ svr_req.release ();
}
// IUnknown calls
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit.idl b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit.idl
index 303186eb858..3036f9e6910 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit.idl
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit.idl
@@ -65,7 +65,7 @@ interface Cubit
out vector output);
// Cube several longs...
- oneway void please_exit ();
+ void please_exit ();
// shutdown the application.
};