diff src/pt-plot.cc @ 191:b6b4d8c513fe

[project @ 1993-10-29 23:41:39 by jwe]
author jwe
date Fri, 29 Oct 1993 23:41:39 +0000
parents 7849db4b6dbc
children a99f28f5e351
line wrap: on
line diff
--- a/src/pt-plot.cc	Fri Oct 29 20:32:05 1993 +0000
+++ b/src/pt-plot.cc	Fri Oct 29 23:41:39 1993 +0000
@@ -102,6 +102,9 @@
   if (range != (tree_plot_limits *) NULL)
     range->print (ndim, plot_buf);
 
+  if (error_state)
+    return retval;
+
   plot_line_count = 0;
   tree_subplot_list *ptr = plot_list;
   for ( ; ptr != NULL_TREE ; ptr = ptr->next_elem ())
@@ -238,7 +241,7 @@
   if (plot_data != NULL_TREE)
     {
       tree_constant data = plot_data->eval (0);
-      if (data.is_defined ())
+      if (! error_state && data.is_defined ())
 	{
 	  char *file = (char *) NULL;
 	  if (data.is_string_type ())
@@ -301,7 +304,7 @@
   if (title != NULL_TREE)
     {
       tree_constant tmp = title->eval (0);
-      if (tmp.is_string_type ())
+      if (! error_state && tmp.is_string_type ())
 	plot_buf << " title " << '"' << tmp.string_value () << '"';
       else
 	{
@@ -420,8 +423,16 @@
   if (lower != NULL_TREE)
     {
       tree_constant lower_val = lower->eval (0);
-      double lo = lower_val.to_scalar ();
-      plot_buf << lo;
+      if (error_state)
+	{
+	  error ("evaluating lower bound of plot range");
+	  return;
+	}
+      else
+	{
+	  double lo = lower_val.to_scalar ();
+	  plot_buf << lo;
+	}
     }
 
   plot_buf << ":";
@@ -429,8 +440,16 @@
   if (upper != NULL_TREE)
     {
       tree_constant upper_val = upper->eval (0);
-      double hi = upper_val.to_scalar ();
-      plot_buf << hi;
+      if (error_state)
+	{
+	  error ("evaluating upper bound of plot range");
+	  return;
+	}
+      else
+	{
+	  double hi = upper_val.to_scalar ();
+	  plot_buf << hi;
+	}
     }
 
   plot_buf << "]";
@@ -498,6 +517,12 @@
       if (x[i] != NULL_TREE)
 	{
 	  tree_constant tmp = x[i]->eval (0);
+	  if (error_state)
+	    {
+	      error ("evaluating plot using command");
+	      return -1;
+	    }
+
 	  double val;
 	  if (tmp.is_defined ())
 	    {
@@ -582,25 +607,31 @@
       if (linetype != NULL_TREE)
 	{
 	  tree_constant tmp = linetype->eval (0);
-	  if (tmp.is_defined ())
+	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.to_scalar ();
 	      plot_buf << " " << NINT (val);
 	    }
 	  else
-	    return -1;
+	    {
+	      error ("evaluating plot style command");
+	      return -1;
+	    }
 	}
 
       if (pointtype != NULL_TREE)
 	{
 	  tree_constant tmp = pointtype->eval (0);
-	  if (tmp.is_defined ())
+	  if (! error_state && tmp.is_defined ())
 	    {
 	      double val = tmp.to_scalar ();
 	      plot_buf << " " << NINT (val);
 	    }
 	  else
-	    return -1;
+	    {
+	      error ("evaluating plot style command");
+	      return -1;
+	    }
 	}
     }
   else