diff src/oct-stream.cc @ 5659:960f4b9a26af

[project @ 2006-03-10 15:35:20 by jwe]
author jwe
date Fri, 10 Mar 2006 15:35:21 +0000
parents d24b97246b9b
children 8d7162924bd3
line wrap: on
line diff
--- a/src/oct-stream.cc
+++ b/src/oct-stream.cc
@@ -2791,7 +2791,7 @@
 {
   int retval = -1;
 
-  if (stream_ok ("fflush"))
+  if (stream_ok ())
     retval = rep->flush ();
 
   return retval;
@@ -2802,7 +2802,7 @@
 {
   std::string retval;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->getl (max_len, err, who);
 
   return retval;
@@ -2836,7 +2836,7 @@
 {
   std::string retval;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->gets (max_len, err, who);
 
   return retval;
@@ -2870,7 +2870,7 @@
 {
   int status = -1;
 
-  if (stream_ok ("fseek"))
+  if (stream_ok ())
     {
       clearerr ();
 
@@ -2977,7 +2977,7 @@
 {
   long retval = -1;
 
-  if (stream_ok ("tell"))
+  if (stream_ok ())
     retval = rep->tell ();
 
   return retval;
@@ -2988,7 +2988,7 @@
 {
   int retval = -1;
 
-  if (stream_ok ("frewind"))
+  if (stream_ok ())
     retval = rep->rewind ();
 
   return retval;
@@ -2999,7 +2999,7 @@
 {
   bool retval = false;
 
-  if (stream_ok ("is_open"))
+  if (stream_ok ())
     retval = rep->is_open ();
 
   return retval;
@@ -3008,7 +3008,7 @@
 void
 octave_stream::close (void)
 {
-  if (stream_ok ("close"))
+  if (stream_ok ())
     rep->close ();
 }
 
@@ -3266,7 +3266,7 @@
 
   octave_value retval;
 
-  if (stream_ok ("fread"))
+  if (stream_ok ())
     {
       // XXX FIXME XXX -- we may eventually want to make this extensible.
 
@@ -3329,7 +3329,7 @@
 {
   octave_idx_type retval = -1;
 
-  if (stream_ok ("fwrite"))
+  if (stream_ok ())
     {
       if (! error_state)
 	{
@@ -3604,7 +3604,7 @@
 {
   octave_value retval;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->scanf (fmt, size, count, who);
 
   return retval;
@@ -3640,7 +3640,7 @@
 {
   octave_value_list retval;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->oscanf (fmt, who);
 
   return retval;
@@ -3676,7 +3676,7 @@
 {
   int retval = -1;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->printf (fmt, args, who);
 
   return retval;
@@ -3712,7 +3712,7 @@
 {
   int retval = -1;
 
-  if (stream_ok (who))
+  if (stream_ok ())
     retval = rep->puts (s, who);
 
   return retval;
@@ -3745,7 +3745,7 @@
 {
   int retval = -1;
 
-  if (stream_ok ("feof"))
+  if (stream_ok ())
     retval = rep->eof ();
 
   return retval;
@@ -3756,7 +3756,7 @@
 {
   std::string retval = "invalid stream object";
 
-  if (stream_ok ("ferror", false, false))
+  if (stream_ok (false))
     retval = rep->error (clear, err_num);
 
   return retval;
@@ -3767,7 +3767,7 @@
 {
   std::string retval;
 
-  if (stream_ok ("name"))
+  if (stream_ok ())
     retval = rep->name ();
 
   return retval;
@@ -3778,7 +3778,7 @@
 {
   int retval = 0;
 
-  if (stream_ok ("mode"))
+  if (stream_ok ())
     retval = rep->mode ();
 
   return retval;
@@ -3789,7 +3789,7 @@
 {
   oct_mach_info::float_format retval = oct_mach_info::flt_fmt_unknown;
 
-  if (stream_ok ("float_format"))
+  if (stream_ok ())
     retval = rep->float_format ();
 
   return retval;
@@ -3833,27 +3833,6 @@
   return retval;
 }
 
-bool
-octave_stream::stream_ok (const std::string& who, bool clear, bool warn) const
-{
-  bool retval = true;
-
-  if (rep)
-    {
-      if (clear)
-	rep->clear ();
-    }
-  else
-    {
-      if (warn)
-	::warning ("%s: attempt to use invalid I/O stream", who.c_str ());
-
-      retval = false;
-    }
-
-  return retval;
-}
-
 octave_stream_list *octave_stream_list::instance = 0;
 
 bool