Mercurial > hg > octave-lyh
diff src/ov-struct.cc @ 2901:e6d25bc478dd
[project @ 1997-04-30 03:41:26 by jwe]
author | jwe |
---|---|
date | Wed, 30 Apr 1997 03:43:29 +0000 |
parents | 8b262e771614 |
children | 4c8dd4d79558 |
line wrap: on
line diff
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -65,7 +65,13 @@ } void -octave_struct::print (ostream& os, bool) +octave_struct::print (ostream& os, bool) const +{ + print_raw (os); +} + +void +octave_struct::print_raw (ostream& os, bool) const { // XXX FIXME XXX -- would be nice to print the output in some // standard order. Maybe all substructures first, maybe @@ -73,59 +79,49 @@ begin_unwind_frame ("octave_struct_print"); - unwind_protect_int (struct_indent); unwind_protect_int (Vstruct_levels_to_print); if (Vstruct_levels_to_print-- > 0) { - os.form ("\n%*s{\n", struct_indent, ""); - - increment_struct_indent (); + newline (os); + indent (os); + os << "{"; + newline (os); - Pix p = map.first (); + increment_indent_level (); - while (p) + for (Pix p = map.first (); p; map.next (p)) { - bool pad_after = false; - string key = map.key (p); octave_value val = map.contents (p); - map.next (p); - - os.form ("%*s%s =", struct_indent, "", key.c_str ()); - - if (val.print_as_scalar ()) - os << " "; - else if (val.is_map ()) - { - if (p) - pad_after = true; - } - else - { - if (p) - pad_after = true; - - os << "\n\n"; - } - - val.print (os); - - if (pad_after) - os << "\n"; + val.print_with_name (os, key); } - decrement_struct_indent (); + decrement_indent_level (); - os.form ("%*s%s", struct_indent, "", "}\n"); + indent (os); + os << "}"; + newline (os); } else - os << " <structure>\n"; + { + os << " <structure>"; + newline (os); + } run_unwind_frame ("octave_struct_print"); } +bool +octave_struct::print_name_tag (ostream& os, const string& name) const +{ + indent (os); + os << name << " ="; + newline (os); + return false; +} + /* ;;; Local Variables: *** ;;; mode: C++ ***