diff src/ov-struct.cc @ 3932:2e2e32198722

[project @ 2002-05-07 18:10:44 by jwe]
author jwe
date Tue, 07 May 2002 18:10:44 +0000
parents ab7fa5a8f23f
children f9ea3dcf58ee
line wrap: on
line diff
--- a/src/ov-struct.cc	Tue May 07 04:49:53 2002 +0000
+++ b/src/ov-struct.cc	Tue May 07 18:10:44 2002 +0000
@@ -32,6 +32,7 @@
 
 #include "error.h"
 #include "oct-lvalue.h"
+#include "ov-list.h"
 #include "ov-struct.h"
 #include "unwind-prot.h"
 #include "variables.h"
@@ -67,7 +68,8 @@
 octave_lvalue
 octave_struct::struct_elt_ref (octave_value *, const std::string& nm)
 {
-  return octave_lvalue (&map [nm]);
+  // XXX FIXME XXX -- struct array
+  return octave_lvalue (&map[nm](0));
 }
 
 void
@@ -95,12 +97,20 @@
 
       increment_indent_level ();
 
+      int n = map.array_length ();
+
       for (Pix p = map.first (); p; map.next (p))
 	{
 	  std::string key = map.key (p);
-	  octave_value val = map.contents (p);
+	  octave_value_list val = map.contents (p);
 
-	  val.print_with_name (os, key);
+	  if (n == 1)
+	    val(0).print_with_name (os, key);
+	  else
+	    {
+	      octave_list tmp (val);
+	      tmp.print_with_name (os, key);
+	    }
 	}
 
       decrement_indent_level ();