diff src/oct-stream.cc @ 3810:f19f00339363

[project @ 2001-03-29 21:03:01 by jwe]
author jwe
date Thu, 29 Mar 2001 21:03:02 +0000
parents 3001e15555e9
children faeca8a063ae
line wrap: on
line diff
--- a/src/oct-stream.cc	Wed Mar 28 14:03:17 2001 +0000
+++ b/src/oct-stream.cc	Thu Mar 29 21:03:02 2001 +0000
@@ -104,7 +104,7 @@
 }
 
 static void
-get_size (const Matrix& size, int& nr, int& nc, bool& one_elt_size_spec,
+get_size (const Array<double>& size, int& nr, int& nc, bool& one_elt_size_spec,
 	  const char *warn_for)
 {
   nr = -1;
@@ -115,32 +115,22 @@
   double dnr = -1.0;
   double dnc = -1.0;
 
-  int sz_nr = size.rows ();
-  int sz_nc = size.cols ();
-
-  if (sz_nr == 1 && sz_nc == 1)
+  int sz_len = size.length ();
+
+  if (sz_len == 1)
     {
       one_elt_size_spec = true;
 
-      dnr = size (0, 0);
+      dnr = size (0);
       dnc = 1.0;
     }
-  else if (sz_nr == 1 && sz_nc > 0)
+  else if (sz_len == 2)
     {
-      dnr = size (0, 0);
-
-      if (sz_nc == 2)
-	dnc = size (0, 1);
-      else if (sz_nc > 2)
-	::error ("%s: invalid size specification", warn_for);
-    }
-  else if (sz_nc == 1 && sz_nr > 0)
-    {
-      dnr = size (0, 0);
-
-      if (sz_nr == 2)
-	dnc = size (1, 0);
-      else if (sz_nr > 2)
+      dnr = size (0);
+
+      if (! xisinf (dnr))
+	dnc = size (1);
+      else
 	::error ("%s: invalid size specification", warn_for);
     }
   else
@@ -1023,7 +1013,7 @@
 }
 
 octave_value
-octave_base_stream::read (const Matrix& size,
+octave_base_stream::read (const Array<double>& size,
 			  oct_data_conv::data_type dt, int skip,
 			  oct_mach_info::float_format ffmt,
 			  int& char_count)
@@ -1658,7 +1648,7 @@
 }
 
 octave_value
-octave_base_stream::scanf (const std::string& fmt, const Matrix& size,
+octave_base_stream::scanf (const std::string& fmt, const Array<double>& size,
 			   int& conversion_count)
 {
   octave_value retval = Matrix ();
@@ -2614,7 +2604,7 @@
 }
 
 octave_value
-octave_stream::read (const Matrix& size,
+octave_stream::read (const Array<double>& size,
 		     oct_data_conv::data_type dt, int skip,
 		     oct_mach_info::float_format flt_fmt, int& count)
 {
@@ -2640,7 +2630,8 @@
 }
 
 octave_value
-octave_stream::scanf (const std::string& fmt, const Matrix& size, int& count)
+octave_stream::scanf (const std::string& fmt, const Array<double>& size,
+		      int& count)
 {
   octave_value retval;