changeset 12106:11f9c592b035 release-3-2-x

Call user-defined subsref/subsasgn with 1xN structs instead of Nx1
author David Grundberg <davidg@cs.umu.se>
date Wed, 25 Nov 2009 11:47:49 +0100
parents 2641c6febd46
children 1fc9fd052f0c
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-09-30  John W. Eaton  <jwe@octave.org>
 
 	* error.cc (error_1, pr_where_2, handle_message):
--- a/src/ov-class.cc
+++ b/src/ov-class.cc
@@ -160,8 +160,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 ();