changeset 4059:db58c1a1e6ce

[project @ 2002-09-18 07:21:12 by jwe]
author jwe
date Wed, 18 Sep 2002 07:21:12 +0000
parents 980308741392
children 9bfab09231c6
files src/ChangeLog src/ov-builtin.cc src/ov-struct.cc src/ov-usr-fcn.cc
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Sep 09 02:08:28 2002 +0000
+++ b/src/ChangeLog	Wed Sep 18 07:21:12 2002 +0000
@@ -1,3 +1,8 @@
+2002-09-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* ov-struct.cc (octave_struct::subsasgn): Ensure that indexed
+	object is not shared before calling subsasgn.
+
 2002-09-04  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* load-save.cc: Use % instead of # as comment character in ascii
--- a/src/ov-builtin.cc	Mon Sep 09 02:08:28 2002 +0000
+++ b/src/ov-builtin.cc	Wed Sep 18 07:21:12 2002 +0000
@@ -76,10 +76,20 @@
       panic_impossible ();
     }
 
-  return retval;
+  // XXX FIXME XXX -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_user_function::subsref.
+  //
+  // XXX FIXME XXX -- Note that if a function call returns multiple
+  // values, and there is further indexing to perform, then we are
+  // ignoring all but the first value.  Is this really what we want to
+  // do?  If it is not, then what should happen for stat("file").size,
+  // for exmaple?
 
-  // XXX FIXME XXX
-  //  return retval.next_subsref (type, idx);
+  if (idx.length () > 1)
+    retval = retval(0).next_subsref (type, idx);
+
+  return retval;
 }
 
 octave_value_list
--- a/src/ov-struct.cc	Mon Sep 09 02:08:28 2002 +0000
+++ b/src/ov-struct.cc	Wed Sep 18 07:21:12 2002 +0000
@@ -239,6 +239,8 @@
 			next_idx.remove_front ();
 			next_idx.remove_front ();
 
+			u.make_unique ();
+
 			t_rhs = u.subsasgn (type.substr (2), next_idx, rhs);
 		      }
 		  }
@@ -275,6 +277,8 @@
 
 		next_idx.remove_front ();
 
+		u.make_unique ();
+
 		t_rhs = u.subsasgn (type.substr (1), next_idx, rhs);
 	      }
 	  }
--- a/src/ov-usr-fcn.cc	Mon Sep 09 02:08:28 2002 +0000
+++ b/src/ov-usr-fcn.cc	Wed Sep 18 07:21:12 2002 +0000
@@ -328,10 +328,14 @@
       panic_impossible ();
     }
 
-  return retval;
+  // XXX FIXME XXX -- perhaps there should be an
+  // octave_value_list::next_subsref member function?  See also
+  // octave_builtin::subsref.
 
-  // XXX FIXME XXX
-  //  return retval.next_subsref (type, idx);
+  if (idx.length () > 1)
+    retval = retval(0).next_subsref (type, idx);
+
+  return retval;
 }
 
 octave_value_list