Mercurial > hg > octave-nkf
changeset 7057:c344920f9e9d
[project @ 2007-10-24 04:39:57 by jwe]
author | jwe |
---|---|
date | Wed, 24 Oct 2007 04:39:57 +0000 |
parents | 2002804df782 |
children | ad2aaf824128 |
files | src/ChangeLog src/pt-idx.cc |
diffstat | 2 files changed, 46 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-10-24 John W. Eaton <jwe@octave.org> + + * pt-idx.cc (tree_index_expression::lvalue): Correctly compute + number of elements in lvalue expression when last indexing + element is ".". + 2007-10-23 John W. Eaton <jwe@octave.org> * graphics.cc (is_handle (const graphics_handle&)): New function.
--- a/src/pt-idx.cc +++ b/src/pt-idx.cc @@ -480,16 +480,53 @@ if (! error_state) { - idx.push_back (tidx); - if (i == n-1) { // Last indexing element. Will this result in a // comma-separated list? if (first_retval_object.is_map ()) - retval.numel (first_retval_object.numel ()); + { + if (i > 0) + { + octave_value_list xidx = idx.back (); + + if (xidx.has_magic_colon ()) + { + std::string ttype = type.substr (0, i); + + octave_value_list tmp_list + = first_retval_object.subsref (ttype, idx, 1); + + if (! error_state) + { + octave_value val = tmp_list(0); + + retval.numel (val.numel ()); + } + } + else + { + octave_idx_type nel = 1; + + octave_idx_type nidx = xidx.length (); + + for (octave_idx_type j = 0; j < nidx; j++) + { + octave_value val = xidx(j); + + nel *= val.numel (); + } + + retval.numel (nel); + } + } + else + retval.numel (first_retval_object.numel ()); + } } + + idx.push_back (octave_value (tidx)); } else eval_error ();