changeset 3810:f19f00339363

[project @ 2001-03-29 21:03:01 by jwe]
author jwe
date Thu, 29 Mar 2001 21:03:02 +0000
parents ec80db02d436
children 855bf76e1fe1
files src/ChangeLog src/DLD-FUNCTIONS/besselj.cc src/file-io.cc src/oct-stream.cc src/oct-stream.h
diffstat 5 files changed, 39 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Mar 28 14:03:17 2001 +0000
+++ b/src/ChangeLog	Thu Mar 29 21:03:02 2001 +0000
@@ -1,3 +1,14 @@
+2001-03-29  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* DLD-FUNCTIONS/besselj.cc (besselh): Use K arg.
+	From: Thomas Stuart <tstuart@ing.sun.ac.za>.
+
+	* oct-stream.cc (get_size): Don't allow [Inf, N] as a size
+	specification for the read and scanf functions.
+	(get_size): SIZE is now an Array<double> instead of a Matrix object.
+	(read): Likewise.  Change all callers.
+	(scanf): Likewise.  Change all callers.
+
 2001-03-26  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* DLD-FUNCTIONS/det.cc (Fdet): Only return rcond if nargout > 1.
--- a/src/DLD-FUNCTIONS/besselj.cc	Wed Mar 28 14:03:17 2001 +0000
+++ b/src/DLD-FUNCTIONS/besselj.cc	Thu Mar 29 21:03:02 2001 +0000
@@ -332,17 +332,15 @@
 
   int nargin = args.length ();
 
-  int kind = 1;
-
   if (nargin == 2)
     {
       retval = do_bessel (BESSEL_H1, "besselh", args, nargout);
     }
   else if (nargin == 3 || nargin == 4)
     {
-      double d_kind = args(1).double_value ();
+      int kind = args(1).int_value ();
 
-      if (! error_state && D_NINT (d_kind) == d_kind)
+      if (! error_state)
 	{
 	  octave_value_list tmp_args;
 
--- a/src/file-io.cc	Wed Mar 28 14:03:17 2001 +0000
+++ b/src/file-io.cc	Thu Mar 29 21:03:02 2001 +0000
@@ -855,8 +855,8 @@
 
 		  int count = 0;
 
-		  Matrix size = (nargin == 3)
-		    ? args(2).matrix_value () : Matrix (1, 1, octave_Inf);
+		  Array<double> size = (nargin == 3)
+		    ? args(2).vector_value () : Array<double> (1, octave_Inf);
 
 		  if (! error_state)
 		    {
@@ -938,8 +938,9 @@
 
 		      int count = 0;
 
-		      Matrix size = (nargin == 3)
-			? args(2).matrix_value () : Matrix (1, 1, octave_Inf);
+		      Array<double> size = (nargin == 3)
+			? args(2).vector_value ()
+			: Array<double> (1, octave_Inf);
 
 		      octave_value tmp = os.scanf (fmt, size, count);
 
@@ -999,7 +1000,7 @@
 
   count = -1;
 
-  Matrix size = size_arg.matrix_value ();
+  Array<double> size = size_arg.vector_value ();
 
   if (! error_state)
     {
--- 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;
 
--- a/src/oct-stream.h	Wed Mar 28 14:03:17 2001 +0000
+++ b/src/oct-stream.h	Thu Mar 29 21:03:02 2001 +0000
@@ -431,7 +431,7 @@
 			int skip, oct_mach_info::float_format flt_fmt,
 			int& count);
 
-  octave_value read (const Matrix& size, oct_data_conv::data_type dt,
+  octave_value read (const Array<double>& size, oct_data_conv::data_type dt,
 		     int skip, oct_mach_info::float_format flt_fmt,
 		     int& count);
 
@@ -444,7 +444,7 @@
   octave_value do_scanf (scanf_format_list& fmt_list, int nr, int nc,
 			 bool one_elt_size_spec, int& count);
 
-  octave_value scanf (const std::string& fmt, const Matrix& size, int& count);
+  octave_value scanf (const std::string& fmt, const Array<double>& size, int& count);
 
   bool do_oscanf (const scanf_format_elt *elt, octave_value&);
 
@@ -455,9 +455,6 @@
 
   int flush (void);
 
-  int do_write (const Matrix& m, oct_data_conv::data_type dt, int skip,
-		oct_mach_info::float_format flt_fmt);
-
   int write (const octave_value& data, oct_data_conv::data_type dt,
 	     int skip, oct_mach_info::float_format flt_fmt);
 
@@ -513,14 +510,14 @@
 
   void close (void);
 
-  octave_value read (const Matrix& size, oct_data_conv::data_type dt,
+  octave_value read (const Array<double>& size, oct_data_conv::data_type dt,
 		     int skip, oct_mach_info::float_format flt_fmt,
 		     int& count);
 
   int write (const octave_value& data, oct_data_conv::data_type dt,
 	     int skip, oct_mach_info::float_format flt_fmt);
 
-  octave_value scanf (const std::string& fmt, const Matrix& size, int& count);
+  octave_value scanf (const std::string& fmt, const Array<double>& size, int& count);
 
   octave_value_list oscanf (const std::string& fmt);