# HG changeset patch # User jwe # Date 1023128147 0 # Node ID 635209a37bf4972668adaaae557f193c896271c6 # Parent b2133db551dd60fbc5c226c63c0c2bbe7e8356a4 [project @ 2002-06-03 18:15:47 by jwe] diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -379,8 +379,12 @@ unwind_protect_int (Vstruct_levels_to_print); - if (Vstruct_levels_to_print-- > 0) + if (Vstruct_levels_to_print >= 0) { + bool print_keys_only = (Vstruct_levels_to_print == 0); + + Vstruct_levels_to_print--; + indent (os); os << "{"; newline (os); @@ -394,13 +398,16 @@ std::string key = map.key (p); octave_value_list val = map.contents (p); - if (n == 1) - val(0).print_with_name (os, key); - else + octave_value tmp = (n == 1) ? val(0) : octave_list (val); + + if (print_keys_only) { - octave_list tmp (val); - tmp.print_with_name (os, key); + indent (os); + os << key << ": " << tmp.type_name (); + newline (os); } + else + val(0).print_with_name (os, key); } decrement_indent_level (); @@ -411,7 +418,8 @@ } else { - os << " "; + indent (os); + os << ""; newline (os); } @@ -421,10 +429,20 @@ bool octave_struct::print_name_tag (std::ostream& os, const std::string& name) const { + bool retval = false; + indent (os); - os << name << " ="; - newline (os); - return false; + + if (Vstruct_levels_to_print < 0) + os << name << " = "; + else + { + os << name << " ="; + newline (os); + retval = true; + } + + return retval; } /* diff --git a/src/ov.cc b/src/ov.cc --- a/src/ov.cc +++ b/src/ov.cc @@ -1608,7 +1608,7 @@ && ! xisnan (val)) { int ival = NINT (val); - if (ival >= 0 && ival == val) + if (ival == val) { Vstruct_levels_to_print = ival; return 0;