changeset 9774:fbf15a0f30f0

Call user-defined subsref/subsasgn with 1xN structs instead of Nx1
author David Grundberg <davidg@cs.umu.se>
date Tue, 03 Nov 2009 08:52:00 +0100
parents 01f897d8a130
children 9d9f858849c7
files scripts/miscellaneous/substruct.m src/ChangeLog src/ov-class.cc
diffstat 3 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/substruct.m
+++ b/scripts/miscellaneous/substruct.m
@@ -31,8 +31,8 @@
 
   if (nargs > 1 && mod (nargs, 2) == 0)
     narg_pairs = nargs / 2;
-    typ = cell (narg_pairs, 1);
-    sub = cell (narg_pairs, 1);
+    typ = cell (1, narg_pairs);
+    sub = cell (1, narg_pairs);
     k = 1;
     for i = 1:2:nargs
       t = varargin{i};
@@ -66,11 +66,11 @@
 
 %!test
 %! x(1,1).type = "()";
-%! x(2,1).type = "{}";
-%! x(3,1).type = ".";
+%! x(1,2).type = "{}";
+%! x(1,3).type = ".";
 %! x(1,1).subs = {1,2,3};
-%! x(2,1).subs = ":";
-%! x(3,1).subs = "foo";
+%! x(1,2).subs = ":";
+%! x(1,3).subs = "foo";
 %! y = substruct ("()", {1,2,3}, "{}", ":", ".", "foo");
 %! assert(x,y);
 %!error assert(substruct);
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-03  David Grundberg  <davidg@cs.umu.se>
+
+	* ov-class.cc (make_idx_args): Call user-defined subsref/subsasgn
+	with 1xN structs instead of Nx1.
+
 2009-11-02  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-class.cc (octave_class::unique_parent_class): New method.
--- a/src/ov-class.cc
+++ b/src/ov-class.cc
@@ -178,8 +178,8 @@
 
   if (len == idx.size ())
     {
-      Cell type_field (len, 1);
-      Cell subs_field (len, 1);
+      Cell type_field (1, len);
+      Cell subs_field (1, len);
 
       std::list<octave_value_list>::const_iterator p = idx.begin ();