Mercurial > hg > octave-avbm
changeset 4121:a0c710c20da5
[project @ 2002-10-23 03:34:11 by jwe]
author | jwe |
---|---|
date | Wed, 23 Oct 2002 03:34:11 +0000 |
parents | 29f648e1cd46 |
children | 19a1626b8d57 |
files | src/ChangeLog src/oct-map.cc src/ov-struct.cc src/pt-loop.cc |
diffstat | 4 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2002-10-22 John W. Eaton <jwe@bevo.che.wisc.edu> + * oct-map.cc (Octave_map::assign): Fix typo in resizing. + + * pt-loop.cc (tree_complex_for_command::eval): Only return list + for val if struct array has more than one element. + (tree_simple_for_command::eval): Likewise. + + * ov-struct.cc (octave_struct::print_raw): Don't create + octave_list directly, use octave_value (const octave_value_list&) + constructor instead. + Call print_with_name for tmp, not val(0). + * version.h (OCTAVE_VERSION): Now 2.1.37. (OCTAVE_CONTRIB_STATEMENT): New macro. (OCTAVE_STARTUP_MESSAGE): Use it.
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -56,6 +56,7 @@ Pix p = first (); array_len = contents(p).length (); } + return array_len; } @@ -82,9 +83,9 @@ else if (rhs_len > len) { for (Pix p = first (); p != 0; next (p)) - contents(p).resize (len, fill_value); + contents(p).resize (rhs_len, fill_value); - array_len = len; + array_len = rhs_len; } map[key] = tmp;
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -402,7 +402,7 @@ std::string key = map.key (p); octave_value_list val = map.contents (p); - octave_value tmp = (n == 1) ? val(0) : octave_list (val); + octave_value tmp = (n == 1) ? val(0) : octave_value (val); if (print_keys_only) { @@ -411,7 +411,7 @@ newline (os); } else - val(0).print_with_name (os, key); + tmp.print_with_name (os, key); } decrement_indent_level ();
--- a/src/pt-loop.cc +++ b/src/pt-loop.cc @@ -373,7 +373,10 @@ { MAYBE_DO_BREAKPOINT; - octave_value val = tmp_val.contents (p); + octave_value_list val_lst = tmp_val.contents (p); + + octave_value val + = (val_lst.length () == 1) ? val_lst(0) : octave_value (val_lst); bool quit = false; @@ -482,7 +485,12 @@ for (p = tmp_val.first (); p != 0; tmp_val.next (p)) { octave_value key = tmp_val.key (p); - octave_value val = tmp_val.contents (p); + + octave_value_list val_lst = tmp_val.contents (p); + + int n = tmp_val.array_length (); + + octave_value val = (n == 1) ? val_lst(0) : octave_value (val_lst); MAYBE_DO_BREAKPOINT;