changeset 4223:5ebaf7eee36e

[project @ 2002-12-17 23:54:34 by jwe]
author jwe
date Tue, 17 Dec 2002 23:54:34 +0000
parents 1363b7e9bf3a
children 0179e6309248
files src/ChangeLog src/oct-stream.cc src/pt-select.cc
diffstat 3 files changed, 68 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Dec 13 14:13:42 2002 +0000
+++ b/src/ChangeLog	Tue Dec 17 23:54:34 2002 +0000
@@ -1,3 +1,11 @@
+2002-12-17  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* pt-select.cc (equal): Don't look up == op, just try it and see
+	whether it works.
+
+	* oct-stream.cc (printf_format_list::printf_format_list):
+	Handle empty format string.
+
 2002-12-06  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* pt-mat.cc (class tm_row_const::tm_row_const_rep): Derive from
--- a/src/oct-stream.cc	Fri Dec 13 14:13:42 2002 +0000
+++ b/src/oct-stream.cc	Tue Dec 17 23:54:34 2002 +0000
@@ -586,60 +586,72 @@
   bool have_more = true;
   bool empty_buf = true;
 
-  while (i < n)
+  if (n == 0)
     {
-      have_more = true;
-
-      if (! buf)
+      printf_format_elt *elt
+	= new printf_format_elt ("", args, fw, prec, flags, type, modifier);
+
+      list(num_elts++) = elt;
+
+      list.resize (num_elts);
+    }
+  else
+    {
+      while (i < n)
 	{
-	  buf = new OSSTREAM ();
-	  empty_buf = true;
-	}
-
-      switch (s[i])
-	{
-	case '%':
-	  {
-	    if (empty_buf)
+	  have_more = true;
+
+	  if (! buf)
+	    {
+	      buf = new OSSTREAM ();
+	      empty_buf = true;
+	    }
+
+	  switch (s[i])
+	    {
+	    case '%':
 	      {
-		process_conversion (s, i, n, args, flags, fw, prec,
-				    type, modifier, num_elts);
-
-		have_more = (buf != 0);
+		if (empty_buf)
+		  {
+		    process_conversion (s, i, n, args, flags, fw, prec,
+					type, modifier, num_elts);
+
+		    have_more = (buf != 0);
+		  }
+		else
+		  add_elt_to_list (args, flags, fw, prec, type, modifier,
+				   num_elts);
 	      }
-	    else
-	      add_elt_to_list (args, flags, fw, prec, type, modifier,
-			       num_elts);
-	  }
-	  break;
-
-	default:
-	  {
-	    args = 0;
-	    flags = "";
-	    fw = 0;
-	    prec = 0;
-	    modifier = '\0';
-	    type = '\0';
-	    *buf << s[i++];
-	    empty_buf = false;
-	  }
-	  break;
+	      break;
+
+	    default:
+	      {
+		args = 0;
+		flags = "";
+		fw = 0;
+		prec = 0;
+		modifier = '\0';
+		type = '\0';
+		*buf << s[i++];
+		empty_buf = false;
+	      }
+	      break;
+	    }
+
+	  if (nconv < 0)
+	    {
+	      have_more = false;
+	      break;
+	    }
 	}
 
-      if (nconv < 0)
-	{
-	  have_more = false;
-	  break;
-	}
+      if (have_more)
+	add_elt_to_list (args, flags, fw, prec, type, modifier, num_elts);
+
+      list.resize (num_elts);
+
+      delete buf;
     }
-
-  if (have_more)
-    add_elt_to_list (args, flags, fw, prec, type, modifier, num_elts);
-
-  list.resize (num_elts);
-
-  delete buf;
 }
 
 printf_format_list::~printf_format_list (void)
--- a/src/pt-select.cc	Fri Dec 13 14:13:42 2002 +0000
+++ b/src/pt-select.cc	Tue Dec 17 23:54:34 2002 +0000
@@ -135,12 +135,9 @@
   int t1 = val.type_id ();
   int t2 = test.type_id ();
 
-  binary_op_fcn f
-    = octave_value_typeinfo::lookup_binary_op (octave_value::op_eq, t1, t2);
-
   // If there is no op_eq for these types, we can't compare values.
 
-  if (f && val.rows () == test.rows () && val.columns () == test.columns ())
+  if (val.rows () == test.rows () && val.columns () == test.columns ())
     {
       octave_value tmp = do_binary_op (octave_value::op_eq, val, test);