changeset 86:723cc7235104

[project @ 1993-09-06 04:56:50 by jwe] (tree_subplot_list::print): If the plot data is a string and it names a file, plot the data in the file.
author jwe
date Mon, 06 Sep 1993 04:56:50 +0000
parents 3abd838cc4b3
children 8248ec41f677
files src/pt-plot.cc
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-plot.cc
+++ b/src/pt-plot.cc
@@ -26,6 +26,7 @@
 #endif
 
 #include <iostream.h>
+#include <fstream.h>
 #include <strstream.h>
 
 #include "error.h"
@@ -235,8 +236,21 @@
       tree_constant data = plot_data->eval (0);
       if (data.is_defined ())
 	{
+	  char *file = (char *) NULL;
+	  if (data.is_string_type ())
+	    {
+	      file = data.string_value ();
+	      ifstream ftmp (file);
+	      if (ftmp)
+		{
+		  plot_buf << " \"" << file << '"';
+		  goto have_existing_file;
+		}
+	      else
+		file = (char *) NULL;
+	    }
+
 	  nc = data.columns ();
-	  char *file = (char *) NULL;
 	  switch (ndim)
 	    {
 	    case 2:
@@ -262,6 +276,8 @@
   else
     return -1;
 
+ have_existing_file:
+
   if (using != (tree_subplot_using *) NULL)
     {
       int status = using->print (ndim, nc, plot_buf);