Mercurial > hg > octave-avbm
diff src/ov-struct.cc @ 4994:48d0defe9445
[project @ 2004-09-15 20:31:31 by jwe]
author | jwe |
---|---|
date | Wed, 15 Sep 2004 20:31:31 +0000 (2004-09-15) |
parents | 44046bbaa52c |
children | 4e4062bb9807 |
line wrap: on
line diff
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -97,11 +97,12 @@ error ("assignment to structure element failed"); } -octave_value +octave_value_list octave_struct::subsref (const std::string& type, - const std::list<octave_value_list>& idx) + const std::list<octave_value_list>& idx, + int nargout) { - octave_value retval; + octave_value_list retval; int skip = 1; @@ -120,7 +121,7 @@ { Cell t = tmp.index (idx.front ()); - retval = (t.length () == 1) ? t(0) : octave_value (t, true); + retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true); // We handled two index elements, so tell // next_subsref to skip both of them. @@ -129,7 +130,7 @@ } } else - retval = map.index (idx.front ()); + retval(0) = map.index (idx.front ()); } break; @@ -137,7 +138,7 @@ { Cell t = dotref (idx.front ()); - retval = (t.length () == 1) ? t(0) : octave_value (t, true); + retval(0) = (t.length () == 1) ? t(0) : octave_value (t, true); } break; @@ -149,8 +150,12 @@ panic_impossible (); } - if (! error_state) - retval = retval.next_subsref (type, idx, skip); + // XXX FIXME XXX -- perhaps there should be an + // octave_value_list::next_subsref member function? See also + // octave_user_function::subsref. + + if (idx.size () > 1) + retval = retval(0).next_subsref (nargout, type, idx); return retval; }