comparison src/pt-plot.cc @ 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 78fd87e624cb
children 8248ec41f677
comparison
equal deleted inserted replaced
85:3abd838cc4b3 86:723cc7235104
24 #ifdef __GNUG__ 24 #ifdef __GNUG__
25 #pragma implementation 25 #pragma implementation
26 #endif 26 #endif
27 27
28 #include <iostream.h> 28 #include <iostream.h>
29 #include <fstream.h>
29 #include <strstream.h> 30 #include <strstream.h>
30 31
31 #include "error.h" 32 #include "error.h"
32 #include "utils.h" 33 #include "utils.h"
33 #include "tree.h" 34 #include "tree.h"
233 if (plot_data != NULL_TREE) 234 if (plot_data != NULL_TREE)
234 { 235 {
235 tree_constant data = plot_data->eval (0); 236 tree_constant data = plot_data->eval (0);
236 if (data.is_defined ()) 237 if (data.is_defined ())
237 { 238 {
239 char *file = (char *) NULL;
240 if (data.is_string_type ())
241 {
242 file = data.string_value ();
243 ifstream ftmp (file);
244 if (ftmp)
245 {
246 plot_buf << " \"" << file << '"';
247 goto have_existing_file;
248 }
249 else
250 file = (char *) NULL;
251 }
252
238 nc = data.columns (); 253 nc = data.columns ();
239 char *file = (char *) NULL;
240 switch (ndim) 254 switch (ndim)
241 { 255 {
242 case 2: 256 case 2:
243 file = save_in_tmp_file (data, ndim); 257 file = save_in_tmp_file (data, ndim);
244 break; 258 break;
259 else 273 else
260 return -1; 274 return -1;
261 } 275 }
262 else 276 else
263 return -1; 277 return -1;
278
279 have_existing_file:
264 280
265 if (using != (tree_subplot_using *) NULL) 281 if (using != (tree_subplot_using *) NULL)
266 { 282 {
267 int status = using->print (ndim, nc, plot_buf); 283 int status = using->print (ndim, nc, plot_buf);
268 if (status < 0) 284 if (status < 0)