diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-16 03:41:17 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-16 03:41:17 +0000 |
commit | 01ee8dbeac38ee409443a912c422f175e9dccd84 (patch) | |
tree | 0319e8333677c429b8a5acd137bb16e805e163bb /TAO/TAO_IDL | |
parent | d756775958b09a20d401ed239247be1e1768d7f6 (diff) | |
download | ATCD-01ee8dbeac38ee409443a912c422f175e9dccd84.tar.gz |
Sat Nov 15 21:38:48 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'TAO/TAO_IDL')
-rw-r--r-- | TAO/TAO_IDL/be/be_constant.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_sequence.cpp | 63 |
2 files changed, 54 insertions, 11 deletions
diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp index 4ca500d34d5..efe50f9f355 100644 --- a/TAO/TAO_IDL/be/be_constant.cpp +++ b/TAO/TAO_IDL/be/be_constant.cpp @@ -58,7 +58,7 @@ be_constant::gen_client_header (void) ch->indent (); // start from whatever indentation level we were at *ch << "static const " << this->exprtype_to_string () << " " << local_name (); - if (this->is_nested ()) + if (!this->is_nested ()) { // We were defined at the outermost scope. So we put the value in the // header itself diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index 62abff2520c..1dc05ea2bcb 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -408,6 +408,59 @@ be_sequence::gen_client_stubs (void) cs->decr_indent (); *cs << "}\n\n"; + // set the length + cs->indent (); + *cs << "ACE_INLINE void" << nl; + *cs << this->name () << "::length (CORBA::ULong length)" << nl; + *cs << "{\n"; + cs->incr_indent (); + if (this->max_size () == 0) + { + // The sequence has a maximum length, check that the new + // length is valid before changing anything. + *cs << "if (length > this->maximum_)" << nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "// @@ throw something?" << nl; + *cs << "return;" << nl; + cs->decr_indent (); + *cs << "}" << nl; + *cs << "this->length_ = length;\n"; + } + else + { + // Reallocate the buffer. + *cs << "if (length > this->maximum_)" << nl; + *cs << "{\n"; + cs->incr_indent (); + if (s->gen_code (bt, this) == -1) + return -1; + *cs << " *tmp = " << this->name () + << "::allocbuf (length);" << nl; + *cs << "if (tmp == 0)" << nl; + cs->incr_indent (); + *cs << "return;\n"; + cs->decr_indent (); + + *cs << "for (int i = 0; i < this->length_; ++i)" << nl; + *cs << "{\n"; + cs->incr_indent (); + *cs << "tmp[i] = this->buffer_[i];\n"; + cs->decr_indent (); + *cs << "}" << nl; + *cs << "if (this->release_)\n"; + cs->incr_indent (); + *cs << this->name () << "::freebuf (this->buffer_);\n"; + cs->decr_indent (); + *cs << "this->buffer_ = tmp;" << nl; + *cs << "this->release_ = 1;\n" << nl; + *cs << "this->length_ = length;\n"; + cs->decr_indent (); + *cs << "}\n"; + } + cs->decr_indent (); + *cs << "}\n\n"; + // generate the typecode information here cs->indent (); // start from current indentation level *cs << "static const CORBA::Long _oc_" << this->flatname () << "[] =" << @@ -608,16 +661,6 @@ be_sequence::gen_client_inline (void) ci->decr_indent (); *ci << "}\n\n"; - // set the length - ci->indent (); - *ci << "ACE_INLINE void" << nl; - *ci << this->name () << "::length (CORBA::ULong length)" << nl; - *ci << "{\n"; - ci->incr_indent (); - *ci << "this->length_ = length;\n"; - ci->decr_indent (); - *ci << "}\n\n"; - // subscript operators (1) read-only, (2) read/write ci->indent (); *ci << "ACE_INLINE "; |