From 11c0e3d51b1ad999b203970d5d9bd60d37489a68 Mon Sep 17 00:00:00 2001 From: parsons Date: Tue, 22 Apr 2003 15:43:46 +0000 Subject: ChangeLogTag: Tue Apr 22 10:37:40 2003 Jeff Parsons --- TAO/ChangeLog_ref | 12 ++ TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp | 3 +- TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp | 3 +- TAO/TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp | 141 +++++++++++++---------- 4 files changed, 93 insertions(+), 66 deletions(-) diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref index 114dc574504..f6410a99358 100644 --- a/TAO/ChangeLog_ref +++ b/TAO/ChangeLog_ref @@ -1,3 +1,15 @@ +Tue Apr 22 10:37:40 2003 Jeff Parsons + + * TAO_IDL/be/be_visitor_sequence/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_sequence/cdr_op_ci.cpp: + * TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp: + + Turned on CDR operator generation for sequences that have an + element type easily detectable as local by the IDL compiler. + For the insertion operator, the error will be detected at + a lower level, via the generated virtual marshal() method + for interfaces. For the extraction operator, 0 is returned. + Tue Apr 22 09:28:36 2003 Jeff Parsons * TAO_IDL/be/be_visitor_sequence/cdr_op_cs.cpp: 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 6d3e7c3f5fa..d74372c6f8c 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 @@ -42,8 +42,7 @@ int be_visitor_sequence_cdr_op_ch::visit_sequence (be_sequence *node) { if (node->cli_hdr_cdr_op_gen () - || node->imported () - || node->is_local ()) + || node->imported ()) { 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 8464d60bc03..fb55cd594c0 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 @@ -43,8 +43,7 @@ int be_visitor_sequence_cdr_op_ci::visit_sequence (be_sequence *node) { if (node->cli_inline_cdr_op_gen () - || node->imported () - || node->is_local ()) + || node->imported ()) { 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 db125159a5c..b022b6f0cb7 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 @@ -39,8 +39,7 @@ int be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node) { if (node->cli_stub_cdr_op_gen () - || node->imported () - || node->is_local ()) + || node->imported ()) { return 0; } @@ -113,79 +112,98 @@ be_visitor_sequence_cdr_op_cs::visit_sequence (be_sequence *node) this->ctx_->sub_state(TAO_CodeGen::TAO_CDR_INPUT); *os << "CORBA::Boolean operator>> (" << be_idt << be_idt_nl - << "TAO_InputCDR &strm," << be_nl - << node->name () << " &_tao_sequence" << be_uidt_nl + << "TAO_InputCDR &"; + + if (! bt->is_local ()) + { + *os << "strm"; + } + + *os << "," << be_nl + << node->name () << " &"; + + if (! bt->is_local ()) + { + *os << "_tao_sequence"; + } + + *os << be_uidt_nl << ")" << be_uidt_nl << "{" << be_idt_nl; - // First retrieve the length and adjust the sequence length accordingly. - *os << "CORBA::ULong _tao_seq_len;" << be_nl << be_nl; - *os << "if (strm >> _tao_seq_len)" << be_idt_nl - << "{" << be_idt_nl; - // Add a sanity check for the length of a sequence. - *os << "// Add a check to the length of the sequence" << be_nl; - *os << "// to make sure it does not exceed the length" << be_nl; - *os << "// of the stream. (See bug 58.)" << be_nl; - *os << "if (_tao_seq_len > strm.length ())" << be_idt_nl - << "{" << be_idt_nl; - *os << "return 0;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; + if (! bt->is_local ()) + { + // First retrieve the length and adjust the sequence length accordingly. + *os << "CORBA::ULong _tao_seq_len;" << be_nl << be_nl; + *os << "if (strm >> _tao_seq_len)" << be_idt_nl + << "{" << be_idt_nl; - // Now check if the length does not exceed the maximum. We do this only - // for bounded sequences - AST_Expression *expr = node->max_size (); + // Add a sanity check for the length of a sequence. + *os << "// Add a check to the length of the sequence" << be_nl; + *os << "// to make sure it does not exceed the length" << be_nl; + *os << "// of the stream. (See bug 58.)" << be_nl; + *os << "if (_tao_seq_len > strm.length ())" << be_idt_nl + << "{" << be_idt_nl; + *os << "return 0;" << be_uidt_nl + << "}" << be_uidt_nl << be_nl; - if (expr == 0 || (expr != 0 && expr->ev () == 0)) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_cdr_op_cs::" - "visit_sequence - " - "bad sequence dimension\n"), - -1); - } + // Now check if the length does not exceed the maximum. We do this only + // for bounded sequences + AST_Expression *expr = node->max_size (); - if (expr->ev ()->et == AST_Expression::EV_ulong) - { - if (expr->ev ()->u.ulval > 0) + if (expr == 0 || (expr != 0 && expr->ev () == 0)) { - // We are dealing with a bounded sequence. Check if we are within - // bounds. - *os << "if (_tao_seq_len <= _tao_sequence.maximum ())" << be_idt_nl - << "{" << be_idt_nl; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cdr_op_cs::" + "visit_sequence - " + "bad sequence dimension\n"), + -1); + } + + if (expr->ev ()->et == AST_Expression::EV_ulong) + { + if (expr->ev ()->u.ulval > 0) + { + // We are dealing with a bounded sequence. Check if we are within + // bounds. + *os << "if (_tao_seq_len <= _tao_sequence.maximum ())" << be_idt_nl + << "{" << be_idt_nl; + } + } + else + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_sequence_cdr_op_cs::" + "visit_sequence - " + "bad sequence dimension value\n"), + -1); } - } - else - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_sequence_cdr_op_cs::" - "visit_sequence - " - "bad sequence dimension value\n"), - -1); - } - *os << "// Set the length of the sequence." << be_nl - << "_tao_sequence.length (_tao_seq_len);" << be_nl << be_nl; + *os << "// Set the length of the sequence." << be_nl + << "_tao_sequence.length (_tao_seq_len);" << be_nl << be_nl; - // Now we do a check for the sequence length to be non zero. - // If length is 0 we return true. - *os << "// If length is 0 we return true." << be_nl; - *os << "if (0 >= _tao_seq_len) " << be_idt_nl - << "{" << be_idt_nl; - *os << "return 1;" << be_uidt_nl - << "}" << be_uidt_nl << be_nl; + // Now we do a check for the sequence length to be non zero. + // If length is 0 we return true. + *os << "// If length is 0 we return true." << be_nl; + *os << "if (0 >= _tao_seq_len) " << be_idt_nl + << "{" << be_idt_nl; + *os << "return 1;" << be_uidt_nl + << "}" << be_uidt_nl << be_nl; - *os << "// Retrieve all the elements." << be_nl; + *os << "// Retrieve all the elements." << be_nl; - this->visit_node (bt); + this->visit_node (bt); - if (expr->ev ()->u.ulval > 0) - { - // We are dealing with a bounded sequence. - *os << be_nl << "}" << be_uidt << be_uidt; + if (expr->ev ()->u.ulval > 0) + { + // We are dealing with a bounded sequence. + *os << be_nl << "}" << be_uidt << be_uidt; + } + + *os << be_nl << "}" << be_uidt_nl << be_nl; } - *os << be_nl << "}" << be_uidt_nl << be_nl - << "return 0;" << be_uidt_nl + *os << "return 0;" << be_uidt_nl << "}"; *os << be_nl << be_nl @@ -636,8 +654,7 @@ be_visitor_sequence_cdr_op_cs::visit_node (be_type *bt) case AST_Decl::NT_interface_fwd: case AST_Decl::NT_valuetype: case AST_Decl::NT_valuetype_fwd: - *os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());" - << be_uidt_nl; + *os << "_tao_marshal_flag = (strm >> _tao_sequence[i].out ());"; break; case AST_Decl::NT_pre_defined: -- cgit v1.2.1