summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-23 17:00:44 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-23 17:00:44 +0000
commit8818d1e3af604c003be972d896356661414f669a (patch)
treeb895c5aaa6f71d2066dca06ea0facc740f2f5185
parent5eedc2872ff2f06b7f355299a56afcdeff22c1ef (diff)
downloadATCD-8818d1e3af604c003be972d896356661414f669a.tar.gz
bunch of bug fixes
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp134
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp17
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp8
5 files changed, 149 insertions, 48 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
index 49df957f765..16ffac1a7a1 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_ci.cpp
@@ -509,7 +509,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
// generate a loop for each dimension
- *os << "for (CORBA::ULong i" << i << " = 0; i" << i << " < "
+ *os << be_nl << "for (CORBA::ULong i" << i << " = 0; i" << i << " < "
<< expr->ev ()->u.ulval << " && _tao_marshal_flag; i" << i
<< "++)" << be_idt_nl;
}
@@ -528,55 +528,104 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
switch (this->ctx_->sub_state ())
{
case TAO_CodeGen::TAO_CDR_INPUT:
- *os << "_tao_marshal_flag = (strm >> ";
+ *os << "{" << be_idt_nl;
+
// handle the array of array case in which case, we need to pass the
// forany type
if (bt->node_type () == AST_Decl::NT_array)
{
- *os << bt->name () << "_forany ((" << bt->name ()
- << "_slice *) ";
- }
- *os << "_tao_array ";
- for (i = 0; i < node->n_dims (); i++)
- {
- *os << "[i" << i << "]";
- }
- switch (bt->node_type ())
- {
- // the following have a _var type and must be handled in a special way
- case AST_Decl::NT_string:
- case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
- *os << ".out ()";
- break;
- case AST_Decl::NT_pre_defined:
- {
- // we need to separately handle this case of pseudo objects because
- // they have a _var type
- be_predefined_type *pt = be_predefined_type::narrow_from_decl (bt);
- if (!pt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_array_cdr_op_ci::"
- "visit_node - "
- "bad predefined type node\n"),
- -1);
- }
- if (pt->pt () == AST_PredefinedType::PT_pseudo)
- {
+ *os << bt->name () << "_forany tmp (ACE_const_cast (" << bt->name ()
+ << "_slice *, _tao_array ";
+ for (i = 0; i < node->n_dims (); i++)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // the following have a _var type and must be
+ // handled in a special way
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
*os << ".out ()";
- }
- }
- default:
- break;
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ // we need to separately handle this case of pseudo
+ // objects because they have a _var type
+ be_predefined_type *pt =
+ be_predefined_type::narrow_from_decl (bt);
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_ci::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+ if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ *os << ".out ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << "));" << be_nl;
+ *os << "_tao_marshal_flag = (strm >> tmp);" << be_uidt_nl;
}
- if (bt->node_type () == AST_Decl::NT_array)
+ else
{
- *os << ")";
+ *os << "_tao_marshal_flag = (strm >> ";
+ *os << "_tao_array ";
+ for (i = 0; i < node->n_dims (); i++)
+ {
+ *os << "[i" << i << "]";
+ }
+
+ switch (bt->node_type ())
+ {
+ // the following have a _var type and must be
+ // handled in a special way
+ case AST_Decl::NT_string:
+ case AST_Decl::NT_interface:
+ case AST_Decl::NT_interface_fwd:
+ *os << ".out ()";
+ break;
+ case AST_Decl::NT_pre_defined:
+ {
+ // we need to separately handle this case of pseudo
+ // objects because they have a _var type
+ be_predefined_type *pt =
+ be_predefined_type::narrow_from_decl (bt);
+ if (!pt)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_cdr_op_ci::"
+ "visit_node - "
+ "bad predefined type node\n"),
+ -1);
+ }
+ if (pt->pt () == AST_PredefinedType::PT_pseudo)
+ {
+ *os << ".out ()";
+ }
+ }
+ default:
+ break;
+ }
+
+ *os << ");" << be_uidt_nl;
}
- *os << ");";
+
+ *os << "}" << be_nl;
+
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
+ *os << "{" << be_idt_nl;
+
*os << "_tao_marshal_flag = (strm << ";
// handle the array of array case in which case, we need to pass the
// forany type
@@ -624,7 +673,9 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
// array of array case
*os << ")";
}
- *os << ");";
+ *os << ");" << be_uidt_nl
+ << "}" << be_nl;
+
break;
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -639,6 +690,7 @@ be_visitor_array_cdr_op_ci::visit_node (be_type *bt)
// decrement indentation as many times as the number of dimensions
*os << be_uidt;
}
+
*os << be_nl;
*os << "return _tao_marshal_flag;" << be_uidt_nl;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
index b78d64c9d7f..fd72bd07aa9 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp
@@ -50,7 +50,19 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node)
TAO_OutStream *os = this->ctx_->stream ();
// generate the CDR << and >> operator declarations
- os->indent ();
+
+ be_type *bt = be_type::narrow_from_decl (node);
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ // If we're an anonymous sequence, we must protect against
+ // being declared more than once.
+ if (!tdef)
+ {
+ *os << "\n#if !defined _TAO_CDR_OP_"
+ << node->flatname () << "_H_" << be_nl
+ << "#define _TAO_CDR_OP_" << node->flatname () << "_H_\n\n";
+ }
+
*os << "CORBA::Boolean " << idl_global->stub_export_macro ()
<< " operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &," << be_nl
@@ -62,6 +74,11 @@ be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node)
<< node->name () << " &" << be_uidt_nl
<< ");" << be_uidt << "\n\n";
+ if (!tdef)
+ {
+ *os << "#endif /* _TAO_CDR_OP_"
+ << node->flatname () << "_H_ */\n\n";
+ }
node->cli_hdr_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
index dec49f1517a..2cc13a9f049 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp
@@ -55,7 +55,18 @@ be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node)
// save all that time to generate them inline and this breaks
// the dependencies for recursive types.
- os->indent ();
+ be_type *bt = be_type::narrow_from_decl (node);
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ // If we're an anonymous sequence, we must protect against
+ // being declared more than once.
+ if (!tdef)
+ {
+ *os << "\n#if !defined _TAO_CDR_OP_"
+ << node->flatname () << "_I_" << be_nl
+ << "#define _TAO_CDR_OP_" << node->flatname () << "_I_\n\n";
+ }
+
*os << "CORBA::Boolean " << idl_global->stub_export_macro ()
<< " operator<< (" << be_idt << be_idt_nl
<< "TAO_OutputCDR &," << be_nl
@@ -67,6 +78,12 @@ be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node)
<< node->name () << " &" << be_uidt_nl
<< ");" << be_uidt << "\n\n";
+ if (!tdef)
+ {
+ *os << "#endif /* _TAO_CDR_OP_"
+ << node->flatname () << "_I_ */\n\n";
+ }
+
node->cli_inline_cdr_op_gen (1);
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
index 63a7cde5c2c..f5baff48ba0 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp
@@ -75,6 +75,17 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
// save the sequence node for further use
this->ctx_->node (node);
+ be_typedef *tdef = be_typedef::narrow_from_decl (bt);
+
+ // If we're an anonymous sequence, we must protect against
+ // being declared more than once.
+ if (!tdef)
+ {
+ *os << "\n#if !defined _TAO_CDR_OP_"
+ << node->flatname () << "_CPP_" << be_nl
+ << "#define _TAO_CDR_OP_" << node->flatname () << "_CPP_\n\n";
+ }
+
// set the sub state as generating code for the output operator
this->ctx_->sub_state (TAO_CodeGen::TAO_CDR_OUTPUT);
*os << "CORBA::Boolean operator<< (" << be_idt << be_idt_nl
@@ -164,6 +175,12 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node)
<< "return 0; // error" << be_uidt_nl
<< "}\n\n";
+ if (!tdef)
+ {
+ *os << "#endif /* _TAO_CDR_OP_"
+ << node->flatname () << "_CPP_ */\n\n";
+ }
+
node->cli_stub_cdr_op_gen (1);
}
return 0;
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index bd5c9e081aa..12711646731 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -1006,14 +1006,12 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// If we have popped up to a parent scope, we
// must check the other children, if we haven't
// had any luck so far.
- while (d == NULL && scope_offset > 1)
+ if (d == NULL && scope_offset > 1)
{
UTL_ScopeActiveIterator *iter =
new UTL_ScopeActiveIterator (this,
UTL_Scope::IK_both);
- scope_offset--;
-
while (!iter->is_done ())
{
d = iter->item ();
@@ -1032,7 +1030,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
treat_as_ref,
0,
0,
- scope_offset);
+ scope_offset - 1);
}
else
{
@@ -1083,7 +1081,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
treat_as_ref,
in_parent,
0,
- ++scope_offset);
+ scope_offset + 1);
}
}
}