changeset 7285:c8d362c69013

[project @ 2007-12-11 01:54:19 by jwe]
author jwe
date Tue, 11 Dec 2007 01:54:19 +0000
parents a239de118fa6
children c0c6aa5afff4
files scripts/ChangeLog scripts/general/Makefile.in src/ChangeLog src/ov-cell.cc
diffstat 4 files changed, 28 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Dec 10 23:27:18 2007 +0000
+++ b/scripts/ChangeLog	Tue Dec 11 01:54:19 2007 +0000
@@ -5,6 +5,7 @@
 	* general/issymmetric.m: Use ' instead of .' for compatibility
 	with previous versions of Octave.
 	* general/ishermitian.m: Delete.
+	* general/Makefile.in (SOURCES): Remove ishermitian.m from the list.
 
 	* plot/fplot.m: In N is not specified, increase initial number of
 	points from 3 and 5 to 5 and 8.
--- a/scripts/general/Makefile.in	Mon Dec 10 23:27:18 2007 +0000
+++ b/scripts/general/Makefile.in	Tue Dec 11 01:54:19 2007 +0000
@@ -38,7 +38,7 @@
   celldisp.m circshift.m common_size.m cplxpair.m cumtrapz.m deal.m del2.m \
   diff.m flipdim.m fliplr.m flipud.m gradient.m ind2sub.m int2str.m interp1.m \
   interp2.m interp3.m interpn.m interpft.m is_duplicate_entry.m isa.m \
-  isdefinite.m isdir.m isequal.m isequalwithequalnans.m ishermitian.m \
+  isdefinite.m isdir.m isequal.m isequalwithequalnans.m \
   isscalar.m issquare.m issymmetric.m isvector.m logical.m logspace.m \
   lookup.m mod.m nargchk.m nextpow2.m nthroot.m num2str.m perror.m \
   pol2cart.m polyarea.m postpad.m prepad.m quadl.m randperm.m rat.m rem.m \
--- a/src/ChangeLog	Mon Dec 10 23:27:18 2007 +0000
+++ b/src/ChangeLog	Tue Dec 11 01:54:19 2007 +0000
@@ -1,5 +1,8 @@
 2007-12-10  John W. Eaton  <jwe@octave.org>
 
+	* ov-cell.cc (octave_cell::all_strings): Handle empty elements.
+	Handle N-d cell arrays.
+
 	* DLD-FUNCTIONS/fsolve.cc (Ffsolve):
 	For compatibility, return [x, fval, info] instead of [x, info, msg].
  	Move tests here from test/test_nonlin.m.
--- a/src/ov-cell.cc	Mon Dec 10 23:27:18 2007 +0000
+++ b/src/ov-cell.cc	Tue Dec 11 01:54:19 2007 +0000
@@ -342,46 +342,44 @@
 {
   string_vector retval;
 
-  octave_idx_type nr = rows ();
-  octave_idx_type nc = columns ();
+  octave_idx_type nel = numel ();
 
   int n_elts = 0;
 
   octave_idx_type max_len = 0;
 
-  for (octave_idx_type j = 0; j < nc; j++)
+  for (octave_idx_type i = 0; i < nel; i++)
     {
-      for (octave_idx_type i = 0; i < nr; i++)
-	{
-	  string_vector s = matrix(i,j).all_strings ();
+      string_vector s = matrix(i).all_strings ();
+
+      if (error_state)
+	return retval;
 
-	  if (error_state)
-	    return retval;
+      octave_idx_type s_len = s.length ();
 
-	  n_elts += s.length ();
+      n_elts += s_len ? s_len : 1;
 
-	  octave_idx_type s_max_len = s.max_length ();
+      octave_idx_type s_max_len = s.max_length ();
 
-	  if (s_max_len > max_len)
-	    max_len = s_max_len;
-	}
+      if (s_max_len > max_len)
+	max_len = s_max_len;
     }
 
   retval.resize (n_elts);
 
   octave_idx_type k = 0;
 
-  for (octave_idx_type j = 0; j < nc; j++)
+  for (octave_idx_type i = 0; i < nel; i++)
     {
-      for (octave_idx_type i = 0; i < nr; i++)
-	{
-	  string_vector s = matrix(i,j).all_strings ();
+      string_vector s = matrix(i).all_strings ();
+
+      octave_idx_type s_len = s.length ();
 
-	  int n = s.length ();
-
-	  for (octave_idx_type ii = 0; ii < n; ii++)
+      if (s_len)
+	{
+	  for (octave_idx_type j = 0; j < s_len; j++)
 	    {
-	      std::string t = s[ii];
+	      std::string t = s[j];
 	      int t_len = t.length ();
 
 	      if (pad && max_len > t_len)
@@ -390,6 +388,10 @@
 	      retval[k++] = t;
 	    }
 	}
+      else if (pad)
+	retval[k++] = std::string (max_len, ' ');
+      else
+	retval[k++] = std::string ();
     }
 
   return retval;