summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorgokhale <asgokhale@users.noreply.github.com>1998-01-21 18:37:06 +0000
committergokhale <asgokhale@users.noreply.github.com>1998-01-21 18:37:06 +0000
commit7273071a4a8b77365923697ad2fef4db19ed5c35 (patch)
tree34deaa08a82a557f25def0af537fb00384ba7456 /TAO
parent1dca60ef86735f5bd7ac15b28b9f585973b47982 (diff)
downloadATCD-7273071a4a8b77365923697ad2fef4db19ed5c35.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog-98c30
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp49
-rw-r--r--TAO/TAO_IDL/be/be_state_attribute.cpp5
-rw-r--r--TAO/tao/encode.cpp7
-rw-r--r--TAO/tests/Param_Test/param_test.idl2
-rw-r--r--TAO/tests/Param_Test/tests.cpp120
-rw-r--r--TAO/tests/Param_Test/tests.h7
7 files changed, 165 insertions, 55 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 7cd83aec0d1..7b142440d76 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,22 +1,34 @@
+Wed Jan 21 11:48:19 1998 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
+
+ * tao/encode.cpp: Updated the ObjRef::encode routine to encode NUL
+ object references
+
+ * tests/Param_Test: Further improvements.
+
+ * TAO_IDL/be/{be_state_attribute, be_attribute}.cpp: Solved the
+ problem of return types. The stubs explicitly allocate the top
+ level storage. A similar fix was made for "operations" mentioned
+ in a previous ChangeLof entry.
+
Wed Jan 21 12:23:29 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tests/Cubit/TAO/MT_Cubit/Makefile:
+ * tests/Cubit/TAO/MT_Cubit/Makefile:
Fixed typo in object list for server and client.
Wed Jan 21 11:25:36 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tests/Param_Test/tmplinst.cpp:
+ * tests/Param_Test/tmplinst.cpp:
Removed extra ';' in instantiation pragma.
Wed Jan 21 11:13:56 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tests/Cubit/TAO/MT_Cubit/Makefile:
- * tests/Cubit/TAO/MT_Cubit/tmplinst.cpp:
- * tao/giop.cpp:
+ * tests/Cubit/TAO/MT_Cubit/Makefile:
+ * tests/Cubit/TAO/MT_Cubit/tmplinst.cpp:
+ * tao/giop.cpp:
Added missing template instantiations.
- * tao/sequence_T.h:
- * tao/sequence_T.i:
+ * tao/sequence_T.h:
+ * tao/sequence_T.i:
No need to return const reference to pointer, a simple return
by value (of the pointer) is OK.
@@ -36,8 +48,8 @@ Wed Jan 21 10:38:22 1998 Chris Cleeland <cleeland@tango.cs.wustl.edu>
Wed Jan 21 09:40:27 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
- * tao/sequence.cpp:
- * tao/sequence_T.cpp:
+ * tao/sequence.cpp:
+ * tao/sequence_T.cpp:
Fixed allocation problem for operator= in sequences, the new
buffer should have size "rhs.maximum_", not "this->maximum_"
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index db325652c55..47cac837d05 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -158,12 +158,24 @@ be_attribute::gen_client_stubs (void)
*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)
+ be_type *prim;
+ if (bt->node_type () == AST_Decl::NT_typedef)
{
- switch (bt->node_type ())
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+ prim = tdef->primitive_base_type ();
+ }
+ else
+ prim = bt;
+ if (prim->size_type () == be_decl::VARIABLE)
+ {
+ switch (prim->node_type ())
{
case AST_Decl::NT_interface:
case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_sequence:
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_union:
// no need of size here
*cs << "0}";
break;
@@ -263,7 +275,38 @@ be_attribute::gen_client_stubs (void)
// call do_call with appropriate number of arguments
*cs << "istub->do_call (env, &_get_" << this->flatname () <<
- "_calldata, &retval);" << nl;
+ "_calldata";
+
+ if (bt->node_type () == AST_Decl::NT_typedef)
+ {
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+ prim = tdef->primitive_base_type ();
+ }
+ else
+ prim = bt;
+
+ if (prim->size_type () == be_decl::VARIABLE)
+ {
+ switch (prim->node_type ())
+ {
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ case AST_Decl::NT_string:
+ *cs << ", &retval";
+ break;
+ case AST_Decl::NT_sequence:
+ case AST_Decl::NT_struct:
+ case AST_Decl::NT_union:
+ *cs << ", retval";
+ break;
+ default:
+ *cs << ", &retval";
+ }
+ }
+ else
+ *cs << ", &retval";
+
+ *cs << ");" << nl;
// return the retval
cg->push (TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_RETURN_CS);
diff --git a/TAO/TAO_IDL/be/be_state_attribute.cpp b/TAO/TAO_IDL/be/be_state_attribute.cpp
index 315503929cf..94cf9500bae 100644
--- a/TAO/TAO_IDL/be/be_state_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_state_attribute.cpp
@@ -930,11 +930,12 @@ be_state_attribute::gen_code (be_type *bt, be_decl *d, be_type *type)
{
// nothing
}
- break;
+ break;
break;
case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_DECL_CS:
{
- *os << bt->name () << " *retval = 0;" << nl;
+ *os << bt->name () << " *retval = new " << bt->name () << ";" <<
+ nl;
}
break;
case TAO_CodeGen::TAO_ATTRIBUTE_RETVAL_EXCEPTION_CS:
diff --git a/TAO/tao/encode.cpp b/TAO/tao/encode.cpp
index 6ea62a79bf1..fe916f09271 100644
--- a/TAO/tao/encode.cpp
+++ b/TAO/tao/encode.cpp
@@ -318,6 +318,13 @@ TAO_Marshal_ObjRef::encode (CORBA::TypeCode_ptr,
if (CORBA::is_nil (obj))
{
+ // encode an empty type_id i.e., an empty string
+ stream->put_ulong (1);
+ stream->put_char (0);
+
+ // Number of profiles = 0
+ stream->put_ulong (0);
+
return CORBA::TypeCode::TRAVERSE_CONTINUE;
}
else
diff --git a/TAO/tests/Param_Test/param_test.idl b/TAO/tests/Param_Test/param_test.idl
index d4068422246..57f186cb577 100644
--- a/TAO/tests/Param_Test/param_test.idl
+++ b/TAO/tests/Param_Test/param_test.idl
@@ -29,7 +29,7 @@ interface Coffee
attribute Desc description; // provides us the coffee object type
};
-typedef sequence<Coffee> ObjSeq;
+//typedef sequence<Coffee> ObjSeq;
interface Param_Test
{
diff --git a/TAO/tests/Param_Test/tests.cpp b/TAO/tests/Param_Test/tests.cpp
index 53038dac75e..3fb2ba18f30 100644
--- a/TAO/tests/Param_Test/tests.cpp
+++ b/TAO/tests/Param_Test/tests.cpp
@@ -1115,8 +1115,12 @@ Test_Struct_Sequence::add_args (CORBA::NVList_ptr &param_list,
CORBA::Boolean
Test_Struct_Sequence::check_validity (void)
{
- CORBA::Boolean flag = 0;
- return flag;
+ if (this->compare (this->in_, this->inout_.in ()) &&
+ this->compare (this->in_, this->out_.in ()) &&
+ this->compare (this->in_, this->ret_.in ()))
+ return 1;
+ else
+ return 0;
}
CORBA::Boolean
@@ -1133,54 +1137,90 @@ Test_Struct_Sequence::check_validity (CORBA::Request_ptr req)
return this->check_validity ();
}
-static void print_var_struct (const Param_Test::Var_Struct& vs)
+void
+Test_Struct_Sequence::print_values (void)
{
ACE_DEBUG ((LM_DEBUG,
- " dummy1 = <%s>\n"
- " dummy2 = <%s>\n"
- " seq length: %d\n",
- vs.dummy1.in ()?(const char*)vs.dummy1.in ():"",
- vs.dummy2.in ()?(const char*)vs.dummy2.in ():"",
- vs.seq.length ()));
- for (CORBA::ULong i = 0; i < vs.seq.length (); ++i)
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "IN sequence\n"));
+ this->print_sequence (this->in_);
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "INOUT sequence\n"));
+ this->print_sequence (this->inout_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "OUT sequence\n"));
+ this->print_sequence (this->out_.in ());
+ ACE_DEBUG ((LM_DEBUG,
+ "*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*\n"
+ "RET sequence\n"));
+ this->print_sequence (this->ret_.in ());
+}
+
+CORBA::Boolean
+Test_Struct_Sequence::compare (const Param_Test::StructSeq &s1,
+ const Param_Test::StructSeq &s2)
+{
+ if (s1.maximum () != s2.maximum ())
+ return 0;
+ if (s1.length () != s2.length ())
+ return 0;
+
+ for (CORBA::ULong i=0; i < s1.length (); i++)
{
- ACE_DEBUG ((LM_DEBUG,
- " seq[%d] = <%s>\n",
- i, (const char*)vs.seq[i]));
+ Param_Test::Var_Struct vs1, vs2;
+ vs1 = s1[i];
+ vs2 = s2[i];
+
+ if (ACE_OS::strcmp (vs1.dummy1.in (), vs2.dummy1.in ()))
+ return 0;
+ if (ACE_OS::strcmp (vs1.dummy2.in (), vs2.dummy2.in ()))
+ return 0;
+ // now check if the string sequence is correct
+
+ if (vs1.seq.maximum () != vs2.seq.maximum ())
+ return 0;
+ if (vs1.seq.length () != vs2.seq.length ())
+ return 0;
+ for (CORBA::ULong j=0; j < vs1.seq.length (); j++)
+ {
+ if (ACE_OS::strcmp (vs1.seq[j], vs2.seq[j]))
+ return 0;
+ }
}
+
+ return 1; // success
}
void
-Test_Struct_Sequence::print_values (void)
+Test_Struct_Sequence::print_sequence (const Param_Test::StructSeq &s)
{
- CORBA::ULong i;
- for (i = 0; i < this->in_.length (); i++)
- {
- ACE_DEBUG ((LM_DEBUG,
- "\n*=*=*=*=*=*=*=*=*=*=\n"
- "IN Element # %d\n"));
- print_var_struct (this->in_[i]);
- }
- for (i = 0; i < this->inout_->length (); i++)
- {
- ACE_DEBUG ((LM_DEBUG,
- "\n*=*=*=*=*=*=*=*=*=*=\n"
- "INOUT Element # %d\n"));
- print_var_struct (this->inout_[i]);
- }
- for (i = 0; i < this->out_->length (); i++)
- {
- ACE_DEBUG ((LM_DEBUG,
- "\n*=*=*=*=*=*=*=*=*=*=\n"
- "OUT Element # %d\n"));
- print_var_struct (this->out_[i]);
- }
- for (i = 0; i < this->ret_->length (); i++)
+ ACE_DEBUG ((LM_DEBUG,
+ "maximum = %d\n"
+ "length = %d\n",
+ s.maximum (),
+ s.length ()));
+ ACE_DEBUG ((LM_DEBUG, "Elements -\n"));
+ for (CORBA::ULong i=0; i < s.length (); i++)
{
+ Param_Test::Var_Struct vs = s[i];
+
ACE_DEBUG ((LM_DEBUG,
- "\n*=*=*=*=*=*=*=*=*=*=\n"
- "RET Element # %d\n"));
- print_var_struct (this->ret_[i]);
+ "Element #%d\n"
+ "\t dummy1 = <%s>\n"
+ "\t dummy2 = <%s>\n"
+ "\t seq length: %d\n",
+ i,
+ vs.dummy1.in ()?(const char*)vs.dummy1.in ():"",
+ vs.dummy2.in ()?(const char*)vs.dummy2.in ():"",
+ vs.seq.length ()));
+ for (CORBA::ULong j = 0; j < vs.seq.length (); j++)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "\t\t seq[%d] = <%s>\n",
+ j, (const char*)vs.seq[j]));
+ }
}
}
diff --git a/TAO/tests/Param_Test/tests.h b/TAO/tests/Param_Test/tests.h
index 7f9e957fd18..931e596ee21 100644
--- a/TAO/tests/Param_Test/tests.h
+++ b/TAO/tests/Param_Test/tests.h
@@ -410,6 +410,13 @@ public:
void print_values (void);
// print all the values
+protected:
+ CORBA::Boolean compare (const Param_Test::StructSeq &s1,
+ const Param_Test::StructSeq &s2);
+ // compare
+
+ void print_sequence (const Param_Test::StructSeq &s);
+ // print individual sequence
private:
char *opname_;
// operation name