Mercurial > hg > octave-avbm
changeset 5757:958e365b875e
[project @ 2006-04-12 18:54:25 by jwe]
author | jwe |
---|---|
date | Wed, 12 Apr 2006 18:54:25 +0000 |
parents | 493849caf7e9 |
children | 65208d959bf1 |
files | src/ChangeLog src/ov-list.cc |
diffstat | 2 files changed, 22 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,17 @@ 2006-04-12 John W. Eaton <jwe@octave.org> + * ov-struct.cc (octave_struct::load_ascii): Pass loop counter, not + count, to read_ascii. + * ov-list.cc (octave_list::load_ascii): Likewise. + + * ov-list.cc (octave_list::do_index_op): Allow index to extract + multiple items. Result is always a list. + * ov-struct.cc (struct_levels_to_print): Move here from ov.cc. (Vstruct-levels_to_print): Likewise. Now static. (symbols_of_ov_struct): New function. Move DEFVAR for struct_levels_to_print here from symbols_of_ov in ov.cc. + * ov.h (Vstruct-levels_to_print): Delete decl. * gripes.cc (warn_divide_by_zero): Move here from ov.cc.
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -133,10 +133,21 @@ { idx_vector i = idx (0).index_vector (); - retval = octave_list (data.index (i, resize_ok)); + Cell tcell = data.index (i, resize_ok); + + octave_value_list result; + + octave_idx_type n = tcell.numel (); + + result.resize (n); + + for (octave_idx_type i = 0; i < n; i++) + result(i) = tcell(i); + + retval = result; } else - error ("lists may only be indexed by a single scalar"); + error ("only one index allowed for lists"); return retval; } @@ -571,7 +582,7 @@ // recurse to read list elements std::string nm - = read_ascii_data (is, std::string (), dummy, t2, count); + = read_ascii_data (is, std::string (), dummy, t2, j); if (!is) break;