changeset 5958:85c7dc4afe6b

[project @ 2006-08-23 18:35:38 by jwe]
author jwe
date Wed, 23 Aug 2006 18:35:39 +0000
parents 370f785718be
children dcd376102ac1
files liboctave/CMatrix.cc liboctave/CMatrix.h liboctave/ChangeLog liboctave/dMatrix.cc liboctave/dMatrix.h scripts/ChangeLog scripts/plot/__plt__.m src/ChangeLog src/DLD-FUNCTIONS/__gnuplot_raw__.l src/load-save.cc src/load-save.h src/ls-oct-ascii.cc src/ls-oct-ascii.h src/ov-base-int.cc src/ov-base-int.h src/ov-base-sparse.cc src/ov-base-sparse.h src/ov-base.cc src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-bool.cc src/ov-bool.h src/ov-cell.cc src/ov-cell.h src/ov-complex.cc src/ov-complex.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-fcn-handle.cc src/ov-fcn-handle.h src/ov-fcn-inline.cc src/ov-fcn-inline.h src/ov-list.cc src/ov-list.h src/ov-range.cc src/ov-range.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-scalar.cc src/ov-scalar.h src/ov-str-mat.cc src/ov-str-mat.h src/ov-struct.cc src/ov-struct.h src/ov.h
diffstat 46 files changed, 164 insertions(+), 328 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/CMatrix.cc
+++ b/liboctave/CMatrix.cc
@@ -3464,82 +3464,6 @@
 
 // i/o
 
-// Used when converting Inf to something that gnuplot can read.
-
-#ifndef OCT_RBV
-#define OCT_RBV DBL_MAX / 100.0
-#endif
-
-std::ostream&
-ComplexMatrix::save_ascii (std::ostream& os, bool& infnan_warned,
-			   int strip_nan_and_inf)
-{
-  if (strip_nan_and_inf)
-    {
-      octave_idx_type nr = rows ();
-      octave_idx_type nc = columns ();
-
-      for (octave_idx_type i = 0; i < nr; i++)
-	{
-	  if (strip_nan_and_inf)
-	    {
-	      for (octave_idx_type j = 0; j < nc; j++)
-		{
-		  Complex c = elem (i, j);
-
-		  if (xisnan (c))
-		    {
-		      if (strip_nan_and_inf == 1)
-			goto next_row;
-		      else if (strip_nan_and_inf == 2)
-			goto next_row_with_newline;
-		    }
-		}
-	    }
-
-	  for (octave_idx_type j = 0; j < nc; j++)
-	    {
-	      Complex c = elem (i, j);
-
-	      if (strip_nan_and_inf)
-		{
-		  double re = std::real (c);
-		  double im = std::imag (c);
-
-		  if (xisinf (re))
-		    re = re > 0 ? OCT_RBV : -OCT_RBV;
-
-		  if (xisinf (im))
-		    im = im > 0 ? OCT_RBV : -OCT_RBV;
-
-		  c = Complex (re, im);
-		}
-	      else if (! infnan_warned && (xisnan (c) || xisinf (c)))
-		{
-		  (*current_liboctave_warning_handler)
-		    ("save: Inf or NaN values may not be reloadable");
-
-		  infnan_warned = true;
-		}
-
-	      octave_write_complex (os, c);
-
-	      os << " ";
-	    }
-
-	next_row_with_newline:
-	  os << "\n";
-
-	next_row:
-	  continue;
-	}
-    }
-  else
-    os << *this;
-
-  return os;
-}
-
 std::ostream&
 operator << (std::ostream& os, const ComplexMatrix& a)
 {
--- a/liboctave/CMatrix.h
+++ b/liboctave/CMatrix.h
@@ -319,9 +319,6 @@
 
   // i/o
 
-  std::ostream& save_ascii (std::ostream& os, bool& infnan_warned,
-			    int strip_nan_and_inf);
-
   friend std::ostream& operator << (std::ostream& os, const ComplexMatrix& a);
   friend std::istream& operator >> (std::istream& is, ComplexMatrix& a);
 
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-23  John W. Eaton  <jwe@octave.org>
+
+	* dMatrix.cc, dMatrix.h (Matrix::save_ascii): Delete function and decl.
+	* CMatrix.cc, CMatrix.h (ComplexMatrix::save_ascii): Likewise.
+
 2006-08-22  John W. Eaton  <jwe@octave.org>
 
 	* CMatrix.cc (ComplexMatrix::save_ascii): New function.
--- a/liboctave/dMatrix.cc
+++ b/liboctave/dMatrix.cc
@@ -2851,74 +2851,6 @@
   return result;
 }
 
-// Used when converting Inf to something that gnuplot can read.
-
-#ifndef OCT_RBV
-#define OCT_RBV DBL_MAX / 100.0
-#endif
-
-std::ostream&
-Matrix::save_ascii (std::ostream& os, bool& infnan_warned,
-		    int strip_nan_and_inf)
-{
-  if (strip_nan_and_inf)
-    {
-      octave_idx_type nr = rows ();
-      octave_idx_type nc = columns ();
-
-      for (octave_idx_type i = 0; i < nr; i++)
-	{
-	  if (strip_nan_and_inf)
-	    {
-	      for (octave_idx_type j = 0; j < nc; j++)
-		{
-		  double d = elem (i, j);
-
-		  if (xisnan (d))
-		    {
-		      if (strip_nan_and_inf == 1)
-			goto next_row;
-		      else if (strip_nan_and_inf == 2)
-			goto next_row_with_newline;
-		    }
-		}
-	    }
-
-	  for (octave_idx_type j = 0; j < nc; j++)
-	    {
-	      double d = elem (i, j);
-
-	      if (strip_nan_and_inf)
-		{
-		  if (xisinf (d))
-		    d = d > 0 ? OCT_RBV : -OCT_RBV;
-		}
-	      else if (! infnan_warned && (xisnan (d) || xisinf (d)))
-		{
-		  (*current_liboctave_warning_handler)
-		    ("save: Inf or NaN values may not be reloadable");
-
-		  infnan_warned = true;
-		}
-
-	      octave_write_double (os, d);
-
-	      os << " ";
-	    }
-
-	next_row_with_newline:
-	  os << "\n";
-
-	next_row:
-	  continue;
-	}
-    }
-  else
-    os << *this;
-
-  return os;
-}
-
 std::ostream&
 operator << (std::ostream& os, const Matrix& a)
 {
--- a/liboctave/dMatrix.h
+++ b/liboctave/dMatrix.h
@@ -274,9 +274,6 @@
 
   // i/o
 
-  std::ostream& save_ascii (std::ostream& os, bool& infnan_warned,
-			    int strip_nan_and_inf);
-
   friend std::ostream& operator << (std::ostream& os, const Matrix& a);
   friend std::istream& operator >> (std::istream& is, Matrix& a);
 
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@
+2006-08-23  John W. Eaton  <jwe@octave.org>
+
+	* plot/__plt__.m: Insert using clauses for all plots.
+
 2006-08-23  A S Hodel  <hodelas@auburn.edu>
 
 	* control/system/sysscale.m: Call tf and zp with correct number of
--- a/scripts/plot/__plt__.m
+++ b/scripts/plot/__plt__.m
@@ -93,17 +93,19 @@
       if (have_data)
 	if (iscell (__plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{j}))
 	  for i = 1:length (__plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{j})
+	    usingstr = make_using_clause (__plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{j}{i});
 	    __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} \
-		= sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{%d}{%d} %s",
+		= sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{%d}{%d} %s %s",
 			   __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__},
-			   __plot_command_sep__, j, i, fmtstr{i});
+			   __plot_command_sep__, j, i, usingstr, fmtstr{i});
 	    __plot_command_sep__ = ",\\\n";
 	  endfor
 	else
+	  usingstr = make_using_clause (__plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{j});
 	  __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__} \
-	    = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{%d} %s",
+	    = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__,__multiplot_yi__}{%d} %s %s",
 		       __plot_command__{__current_figure__}{__multiplot_xi__,__multiplot_yi__},
-		       __plot_command_sep__, j, fmtstr);
+		       __plot_command_sep__, j, usingstr, fmtstr);
 	  __plot_command_sep__ = ",\\\n";
 	endif
 	j++;
@@ -127,4 +129,16 @@
     usage (msg);
   endif
 
-endfunction
+## endfunction
+
+function usingstr = make_using_clause (x)
+  cols = columns (x);
+  if (cols > 0)
+    usingstr = strcat (gnuplot_command_using, " ($1)");
+    for k = 2:cols
+      usingstr = sprintf ("%s:($%d)", usingstr, k);
+    endfor
+  else
+    usingstr = "";
+  endif
+## endfunction
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,50 @@
+2006-08-23  John W. Eaton  <jwe@octave.org>
+
+	* ov.h (octave_value::save_ascii): Delete strip_nan_and_inf arg.
+	* ov-base.h, ov-base.cc (octave_base_value::save_ascii): Likewise.
+	* ov-base-int.h, ov-base-int.cc	(octave_base_int_matrix<T>::save_ascii,
+	octave_base_int_scalar<T>::save_ascii, ): Likewise.
+	* ov-base-sparse.cc, ov-base-sparse.h
+	(octave_base_sparse<T>::save_ascii): Likewise.
+	* ov-bool-mat.cc, ov-bool-mat.h (octave_bool_matrix::save_ascii):
+	Likewise.
+	* ov-bool.cc, ov-bool.h (octave_bool::save_ascii): Likewise.
+	* ov-cell.cc, ov-cell.h (octave_cell::save_ascii): Likewise.
+	* ov-complex.cc, ov-complex.h (octave_complex::save_ascii): Likewise.
+	* ov-fcn-handle.cc, ov-fcn-handle.h (octave_fcn_handle::save_ascii):
+	Likewise.
+	* ov-fcn-inline.cc, ov-fcn-inline.h (octave_fcn_inline::save_ascii):
+	Likewise.
+	* ov-list.cc, ov-list.h (octave_list::save_ascii): Likewise.
+	* ov-range.cc, ov-range.h (octave_range::save_ascii): Likewise.
+	* ov-scalar.cc, ov-scalar.h (octave_scalar::save_ascii): Likewise.
+	* ov-str-mat.cc, ov-str-mat.h (octave_char_matrix_str::save_ascii):
+	Likewise.
+	* ov-struct.cc, ov-struct.h (octave_struct::save_ascii): Likewise.
+	* ov-re-mat.cc, ov-re-mat.cc (octave_matrix::save_ascii): Likewise.
+	* ov-cx-mat.cc, ov-cx-mat.cc (octave_complex_matrix::save_ascii):
+	Likewise.
+	* ov-cx-mat.cc, ov-cx-mat.cc (octave_complex_matrix::save_ascii):
+	Likewise.
+	* ov-re-mat.cc, ov-re-mat.cc (octave_matrix::save_ascii): Likewise.
+
+	* ls-oct-ascii.cc, ls-oct-ascii.h (save_ascii_data):
+	Delete strip_nan_and_inf arg.
+	(save_ascii_data_for_plotting): Delete strip_nan_and_inf arg from
+	call to save_ascii_data.
+
+	* DLD-FUNCTIONS/__gnuplot_raw__.l (handle_using): Accept "(EXPR)"
+	as components of using clauses.
+	(enum _toktype): New element DOLLAR.
+	Accept "$" in lexer.
+
+	* ls-oct-ascii.cc (save_ascii_data): Delete arg strip_nan_and_inf.
+	Change all uses.
+
+	* ls-oct-ascii.h (save_three_d): Provide decl.
+	* load-save.h (save_ascii_data_for_plotting, save_three_d):
+	Delete decls.
+
 2006-08-22  John W. Eaton  <jwe@octave.org>
 
 	* ov.h (octave_value::save_ascii): strip_nan_and_inf is now int,
@@ -23,7 +70,8 @@
 	Likewise.
 	* ov-struct.cc, ov-struct.h (octave_struct::save_ascii): Likewise.
 	* ov-re-mat.cc, ov-re-mat.cc (octave_matrix::save_ascii): Likewise.
-	* ov-cx-mat.cc, ov-cx-mat.cc (octave_complex_matrix::save_ascii): Likewise.
+	* ov-cx-mat.cc, ov-cx-mat.cc (octave_complex_matrix::save_ascii):
+	Likewise.
 
 	* ov-cx-mat.cc, ov-cx-mat.cc (octave_complex_matrix::save_ascii):
 	Don't strip Inf and NaN here.  Call ComplexMatrix::save_ascii to
--- a/src/DLD-FUNCTIONS/__gnuplot_raw__.l
+++ b/src/DLD-FUNCTIONS/__gnuplot_raw__.l
@@ -57,7 +57,7 @@
 #include "defun-dld.h"
 #include "file-io.h"
 #include "gripes.h"
-#include "load-save.h"
+#include "ls-oct-ascii.h"
 #include "parse.h"
 #include "procstream.h"
 #include "sighandlers.h"
@@ -76,6 +76,7 @@
     SEMICOLON,
     COMMA,
     QUOTE,
+    DOLLAR,
     IDENT,
     NUMBER,
     BINOP,
@@ -194,6 +195,12 @@
       }
     }
 
+"$" {
+    gpt_quote_is_transpose = false;
+    return DOLLAR;
+    }
+
+
 "\"" {
     return handle_string ('"');
     }
@@ -577,13 +584,18 @@
     {
       expr_str = read_until (colon_plottok_or_end_p, tok);
 
-      tmp_data = eval_string (expr_str, true, status);
-      if (status != 0 || ! tmp_data.is_real_scalar ())
-	throw gpt_parse_error ();
+      if (! expr_str.empty () &&  expr_str[0] == '(')
+	retstr += expr_str;
+      else
+	{
+	  tmp_data = eval_string (expr_str, true, status);
+	  if (status != 0 || ! tmp_data.is_real_scalar ())
+	    throw gpt_parse_error ();
 
-      std::ostringstream tmp_buf;
-      tmp_data.print_raw (tmp_buf);
-      retstr += tmp_buf.str ();
+	  std::ostringstream tmp_buf;
+	  tmp_data.print_raw (tmp_buf);
+	  retstr += tmp_buf.str ();
+	}
 
       if (tok == COLON)
 	retstr += ":";
--- a/src/load-save.cc
+++ b/src/load-save.cc
@@ -993,7 +993,7 @@
   switch (fmt)
     {
     case LS_ASCII:
-      save_ascii_data (os, tc, name, infnan_warned, false, global, 0);
+      save_ascii_data (os, tc, name, infnan_warned, global, 0);
       break;
 
     case LS_BINARY:
--- a/src/load-save.h
+++ b/src/load-save.h
@@ -45,14 +45,6 @@
     LS_UNKNOWN
   };
 
-extern bool
-save_ascii_data_for_plotting (std::ostream& os, const octave_value& t,
-			      const std::string& name = std::string ());
-
-extern bool
-save_three_d (std::ostream& os, const octave_value& t,
-	      bool parametric = false);
-
 extern void dump_octave_core (void);
 
 extern int
--- a/src/ls-oct-ascii.cc
+++ b/src/ls-oct-ascii.cc
@@ -307,12 +307,6 @@
 // flag MARK_AS_GLOBAL on stream OS in the plain text format described
 // above for load_ascii_data.  If NAME is empty, the name: line is not
 // generated.  PRECISION specifies the number of decimal digits to print. 
-// If STRIP_NAN_AND_INF is 1, rows containing NaNs are deleted,
-// and Infinite values are converted to +/-OCT_RBV (A Real Big Value,
-// but not so big that gnuplot can't handle it when trying to compute
-// axis ranges, etc.).  If STRIP_NAN_AND_INF is 2, rows containing
-// NaNs are converted to blank lines in the output file and infinite
-// values are converted to +/-OCT_RBV.
 //
 // Assumes ranges and strings cannot contain Inf or NaN values.
 //
@@ -323,8 +317,7 @@
 bool
 save_ascii_data (std::ostream& os, const octave_value& val_arg,
 		 const std::string& name, bool& infnan_warned,
-		 int strip_nan_and_inf, bool mark_as_global,
-		 int precision)
+		 bool mark_as_global, int precision)
 {
   bool success = true;
 
@@ -344,7 +337,7 @@
   long old_precision = os.precision ();
   os.precision (precision);
 
-  success = val . save_ascii (os, infnan_warned, strip_nan_and_inf);
+  success = val . save_ascii (os, infnan_warned);
 
   os.precision (old_precision);
 
@@ -357,7 +350,7 @@
 {
   bool infnan_warned = true;
 
-  return save_ascii_data (os, t, name, infnan_warned, 2, false, 0);
+  return save_ascii_data (os, t, name, infnan_warned, false, 0);
 }
 
 // Maybe this should be a static function in tree-plot.cc?
--- a/src/ls-oct-ascii.h
+++ b/src/ls-oct-ascii.h
@@ -51,13 +51,16 @@
 extern bool
 save_ascii_data (std::ostream& os, const octave_value& val_arg,
 		 const std::string& name, bool& infnan_warned,
-		 int strip_nan_and_inf, bool mark_as_global,
-		 int precision);
+		 bool mark_as_global, int precision);
 
 extern bool
 save_ascii_data_for_plotting (std::ostream& os, const octave_value& t,
 			      const std::string& name);
 
+extern bool
+save_three_d (std::ostream& os, const octave_value& t,
+	      bool parametric = false);
+
 // Match KEYWORD on stream IS, placing the associated value in VALUE,
 // returning TRUE if successful and FALSE otherwise.
 //
--- a/src/ov-base-int.cc
+++ b/src/ov-base-int.cc
@@ -70,7 +70,7 @@
 
 template <class T>
 bool
-octave_base_int_matrix<T>::save_ascii (std::ostream& os, bool&, int)
+octave_base_int_matrix<T>::save_ascii (std::ostream& os, bool&)
 {
   dim_vector d = this->dims ();
 
@@ -331,7 +331,7 @@
 
 template <class T>
 bool
-octave_base_int_scalar<T>::save_ascii (std::ostream& os, bool& , int)
+octave_base_int_scalar<T>::save_ascii (std::ostream& os, bool&)
 {
   os << this->scalar << "\n";
   return true;
--- a/src/ov-base-int.h
+++ b/src/ov-base-int.h
@@ -67,8 +67,7 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
@@ -109,7 +108,7 @@
 
   //  void decrement (void) { scalar -= 1; }
 
-  bool save_ascii (std::ostream& os, bool&, int);
+  bool save_ascii (std::ostream& os, bool&);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-base-sparse.cc
+++ b/src/ov-base-sparse.cc
@@ -295,7 +295,7 @@
 
 template <class T>
 bool
-octave_base_sparse<T>::save_ascii (std::ostream& os, bool&, int)
+octave_base_sparse<T>::save_ascii (std::ostream& os, bool&)
 {
   dim_vector dv = this->dims ();
 
--- a/src/ov-base-sparse.h
+++ b/src/ov-base-sparse.h
@@ -141,8 +141,7 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-base.cc
+++ b/src/ov-base.cc
@@ -815,7 +815,7 @@
 }
 
 bool 
-octave_base_value::save_ascii (std::ostream&, bool&, int)
+octave_base_value::save_ascii (std::ostream&, bool&)
 {
   gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
   return false;
--- a/src/ov-base.h
+++ b/src/ov-base.h
@@ -414,8 +414,7 @@
 
   virtual void print_info (std::ostream& os, const std::string& prefix) const;
 
-  virtual bool save_ascii (std::ostream& os, bool& infnan_warned,
-			   int strip_nan_and_inf);
+  virtual bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   virtual bool load_ascii (std::istream& is);
 
--- a/src/ov-bool-mat.cc
+++ b/src/ov-bool-mat.cc
@@ -149,8 +149,7 @@
 }
 
 bool 
-octave_bool_matrix::save_ascii (std::ostream& os, bool& /* infnan_warned */,
-				int /* strip_nan_and_inf */)
+octave_bool_matrix::save_ascii (std::ostream& os, bool& /* infnan_warned */)
 {
   dim_vector d = dims ();
   if (d.length () > 2)
--- a/src/ov-bool-mat.h
+++ b/src/ov-bool-mat.h
@@ -164,8 +164,7 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-bool.cc
+++ b/src/ov-bool.cc
@@ -133,8 +133,7 @@
 }
 
 bool 
-octave_bool::save_ascii (std::ostream& os, bool& /* infnan_warned */,
-			 int /* strip_nan_and_inf */)
+octave_bool::save_ascii (std::ostream& os, bool& /* infnan_warned */)
 {
   double d = double_value ();
 
--- a/src/ov-bool.h
+++ b/src/ov-bool.h
@@ -156,8 +156,7 @@
 
   octave_value convert_to_str_internal (bool pad, bool force, char type) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-cell.cc
+++ b/src/ov-cell.cc
@@ -433,8 +433,7 @@
 #define CELL_ELT_TAG "<cell-element>"
 
 bool 
-octave_cell::save_ascii (std::ostream& os, bool& infnan_warned, 
-			 int strip_nan_and_inf)
+octave_cell::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   dim_vector d = dims ();
   if (d.length () > 2)
@@ -453,7 +452,7 @@
 
 	  // Recurse to print sub-value.
 	  bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, infnan_warned, 
-				    strip_nan_and_inf, 0, 0);
+				    false, 0);
 	      
 	  if (! b)
 	    return os;
@@ -476,8 +475,7 @@
 
 	      // Recurse to print sub-value.
 	      bool b = save_ascii_data (os, o_val, CELL_ELT_TAG, 
-					infnan_warned, 
-					strip_nan_and_inf, 0, 0);
+					infnan_warned, false, 0);
 	      
 	      if (! b)
 		return os;
--- a/src/ov-cell.h
+++ b/src/ov-cell.h
@@ -113,8 +113,7 @@
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-complex.cc
+++ b/src/ov-complex.cc
@@ -176,43 +176,19 @@
 }
 
 bool 
-octave_complex::save_ascii (std::ostream& os, bool& infnan_warned, 
-			    int strip_nan_and_inf)
+octave_complex::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   Complex c = complex_value ();
 
-  if (strip_nan_and_inf)
+  if (! infnan_warned && (xisnan (c) || xisinf (c)))
     {
-      if (xisnan (c))
-	{
-	  error ("only value to plot is NaN");
-	  return false;
-	}
-      else
-	{
-	  double re = real (c);
-	  double im = imag (c);
-
-	  re = xisinf (re) ? (re > 0 ? OCT_RBV : -OCT_RBV) : re;
-	  im = xisinf (im) ? (im > 0 ? OCT_RBV : -OCT_RBV) : im;
+      warning ("save: Inf or NaN values may not be reloadable");
+      infnan_warned = true;
+    }
+      
+  octave_write_complex (os, c);
 
-	  c = Complex (re, im);
-
-	  octave_write_complex (os, c);
-	  os << "\n";
-	}
-    }
-  else
-    {
-      if (! infnan_warned && (xisnan (c) || xisinf (c)))
-	{
-	  warning ("save: Inf or NaN values may not be reloadable");
-	  infnan_warned = true;
-	}
-      
-      octave_write_complex (os, c);
-      os << "\n";
-    }
+  os << "\n";
 
   return true;
 }
--- a/src/ov-complex.h
+++ b/src/ov-complex.h
@@ -116,8 +116,7 @@
 
   void decrement (void) { scalar -= 1.0; }
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-cx-mat.cc
+++ b/src/ov-cx-mat.cc
@@ -201,21 +201,14 @@
 }
 
 bool 
-octave_complex_matrix::save_ascii (std::ostream& os, bool& infnan_warned, 
-				   int strip_nan_and_inf)
+octave_complex_matrix::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   dim_vector d = dims ();
   if (d.length () > 2)
     {
       ComplexNDArray tmp = complex_array_value ();
 
-      if (strip_nan_and_inf)
-	{
-	  warning ("save: Can not strip Inf or NaN values");
-	  warning ("save: Inf or NaN values may not be reloadable");
-	  infnan_warned = true;
-	}
-      else if (! infnan_warned && tmp.any_element_is_inf_or_nan ())
+      if (! infnan_warned && tmp.any_element_is_inf_or_nan ())
 	{
 	  warning ("save: Inf or NaN values may not be reloadable");
 	  infnan_warned = true;
@@ -235,9 +228,7 @@
       os << "# rows: " << rows () << "\n"
 	 << "# columns: " << columns () << "\n";
 
-      ComplexMatrix tmp = complex_matrix_value ();
-
-      tmp.save_ascii (os, infnan_warned, strip_nan_and_inf);
+      os << complex_matrix_value ();
     }
 
   return true;
--- a/src/ov-cx-mat.h
+++ b/src/ov-cx-mat.h
@@ -120,8 +120,7 @@
 
   void decrement (void) { matrix -= Complex (1.0); }
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-fcn-handle.cc
+++ b/src/ov-fcn-handle.cc
@@ -144,7 +144,7 @@
 }
 
 bool
-octave_fcn_handle::save_ascii (std::ostream& os, bool&, int)
+octave_fcn_handle::save_ascii (std::ostream& os, bool&)
 {
   os << nm << "\n";
 
--- a/src/ov-fcn-handle.h
+++ b/src/ov-fcn-handle.h
@@ -84,8 +84,7 @@
 
   std::string fcn_name (void) const { return nm; }
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-fcn-inline.cc
+++ b/src/ov-fcn-inline.cc
@@ -90,7 +90,7 @@
 }
 
 bool
-octave_fcn_inline::save_ascii (std::ostream& os, bool&, int)
+octave_fcn_inline::save_ascii (std::ostream& os, bool&)
 {
   os << "# nargs: " <<  ifargs.length () << "\n";
   for (int i = 0; i < ifargs.length (); i++)
--- a/src/ov-fcn-inline.h
+++ b/src/ov-fcn-inline.h
@@ -65,8 +65,7 @@
 
   octave_value convert_to_str_internal (bool, bool, char) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-list.cc
+++ b/src/ov-list.cc
@@ -538,8 +538,7 @@
 }
 
 bool 
-octave_list::save_ascii (std::ostream& os, bool& infnan_warned, 
-			 int strip_nan_and_inf)
+octave_list::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   octave_value_list lst = list_value ();
   os << "# length: " << lst.length () << "\n";
@@ -552,8 +551,8 @@
       buf << "_" << i;
       std::string s = buf.str ();
 
-      bool b = save_ascii_data (os, lst (i), s.c_str (), infnan_warned, 
-				strip_nan_and_inf, 0, 0);
+      bool b = save_ascii_data (os, lst (i), s.c_str (), infnan_warned,
+				false, 0);
       
       if (! b)
 	return false;
--- a/src/ov-list.h
+++ b/src/ov-list.h
@@ -99,8 +99,7 @@
 
   bool print_name_tag (std::ostream& os, const std::string& name) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-range.cc
+++ b/src/ov-range.cc
@@ -285,8 +285,7 @@
 }
 
 bool 
-octave_range::save_ascii (std::ostream& os, bool& /* infnan_warned */,
-			  int /* strip_nan_and_inf */)
+octave_range::save_ascii (std::ostream& os, bool& /* infnan_warned */)
 {
   Range r = range_value ();
   double base = r.base ();
--- a/src/ov-range.h
+++ b/src/ov-range.h
@@ -186,8 +186,7 @@
 
   bool print_name_tag (std::ostream& os, const std::string& name) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-re-mat.cc
+++ b/src/ov-re-mat.cc
@@ -255,21 +255,15 @@
 }
 
 bool 
-octave_matrix::save_ascii (std::ostream& os, bool& infnan_warned, 
-			   int strip_nan_and_inf)
+octave_matrix::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   dim_vector d = dims ();
+
   if (d.length () > 2)
     {
       NDArray tmp = array_value ();
 
-      if (strip_nan_and_inf)
-	{
-	  warning ("save: Can not strip Inf or NaN values");
-	  warning ("save: Inf or NaN values may not be reloadable");
-	  infnan_warned = true;
-	}
-      else if (! infnan_warned && tmp.any_element_is_inf_or_nan ())
+      if (! infnan_warned && tmp.any_element_is_inf_or_nan ())
 	{
 	  warning ("save: Inf or NaN values may not be reloadable");
 	  infnan_warned = true;
@@ -289,9 +283,7 @@
       os << "# rows: " << rows () << "\n"
 	 << "# columns: " << columns () << "\n";
 
-      Matrix tmp = matrix_value ();
-
-      tmp.save_ascii (os, infnan_warned, strip_nan_and_inf);
+      os << matrix_value ();
     }
 
   return true;
--- a/src/ov-re-mat.h
+++ b/src/ov-re-mat.h
@@ -155,8 +155,7 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-scalar.cc
+++ b/src/ov-scalar.cc
@@ -156,36 +156,19 @@
 }
 
 bool 
-octave_scalar::save_ascii (std::ostream& os, bool& infnan_warned, 
-			   int strip_nan_and_inf)
+octave_scalar::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   double d = double_value ();
 
-  if (strip_nan_and_inf)
+  if (! infnan_warned && (xisnan (d) || xisinf (d)))
     {
-      if (xisnan (d))
-	{
-	  error ("only value to plot is NaN");
-	  return false;
-	}
-      else
-	{
-	  d = xisinf (d) ? (d > 0 ? OCT_RBV : -OCT_RBV) : d;
-	  octave_write_double (os, d);
-	  os << "\n";
-	}
+      warning ("save: Inf or NaN values may not be reloadable");
+      infnan_warned = true;
     }
-  else
-    {
-      if (! infnan_warned && (xisnan (d) || xisinf (d)))
-	{
-	  warning ("save: Inf or NaN values may not be reloadable");
-	  infnan_warned = true;
-	}
 
-      octave_write_double (os, d);
-      os << "\n";
-    }
+  octave_write_double (os, d);
+
+  os << "\n";
 
   return true;
 }
--- a/src/ov-scalar.h
+++ b/src/ov-scalar.h
@@ -186,8 +186,7 @@
 
   void decrement (void) { --scalar; }
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-str-mat.cc
+++ b/src/ov-str-mat.cc
@@ -269,9 +269,7 @@
 }
 
 bool 
-octave_char_matrix_str::save_ascii (std::ostream& os,
-				    bool& /* infnan_warned */, 
-				    int /* strip_nan_and_inf */)
+octave_char_matrix_str::save_ascii (std::ostream& os, bool& /* infnan_warned */)
 {
   dim_vector d = dims ();
   if (d.length () > 2)
--- a/src/ov-str-mat.h
+++ b/src/ov-str-mat.h
@@ -129,8 +129,7 @@
 
   void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov-struct.cc
+++ b/src/ov-struct.cc
@@ -1016,8 +1016,7 @@
 }
 
 bool
-octave_struct::save_ascii (std::ostream& os, bool& infnan_warned, 
-			   int strip_nan_and_inf)
+octave_struct::save_ascii (std::ostream& os, bool& infnan_warned)
 {
   Octave_map m = map_value ();
   os << "# length: " << m.length () << "\n";
@@ -1027,8 +1026,7 @@
     {
       octave_value val = map.contents (i);
 
-      bool b = save_ascii_data (os, val, m.key (i), infnan_warned, 
-				strip_nan_and_inf, 0, 0);
+      bool b = save_ascii_data (os, val, m.key (i), infnan_warned, false, 0);
       
       if (! b)
 	return os;
--- a/src/ov-struct.h
+++ b/src/ov-struct.h
@@ -117,8 +117,7 @@
 
   bool print_name_tag (std::ostream& os, const std::string& name) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf);
+  bool save_ascii (std::ostream& os, bool& infnan_warned);
 
   bool load_ascii (std::istream& is);
 
--- a/src/ov.h
+++ b/src/ov.h
@@ -778,9 +778,8 @@
   void print_info (std::ostream& os,
 			   const std::string& prefix = std::string ()) const;
 
-  bool save_ascii (std::ostream& os, bool& infnan_warned,
-		   int strip_nan_and_inf) 
-    { return rep->save_ascii (os, infnan_warned, strip_nan_and_inf); }
+  bool save_ascii (std::ostream& os, bool& infnan_warned)
+    { return rep->save_ascii (os, infnan_warned); }
 
   bool load_ascii (std::istream& is)
     { return rep->load_ascii (is); }