comparison src/pt-plot.cc @ 134:4e753587fac1

[project @ 1993-09-29 16:15:02 by jwe] (tree_subplot_list::print (int, ostrstream&)): If the data to be plotted is a string but it doesn't name a file, try sending it to gnuplot directly.
author jwe
date Wed, 29 Sep 1993 16:15:02 +0000
parents 8248ec41f677
children 7849db4b6dbc
comparison
equal deleted inserted replaced
133:f8e230ec7745 134:4e753587fac1
110 110
111 int status = ptr->print (ndim, plot_buf); 111 int status = ptr->print (ndim, plot_buf);
112 if (status < 0) 112 if (status < 0)
113 return retval; 113 return retval;
114 } 114 }
115
116 // We need to make sure the buffer is null-terminated because it seems
117 // that the libg++-2.3 ostrstream::str() function doesn\'t guarantee
118 // that it will be...
119 115
120 plot_buf << "\n" << ends; 116 plot_buf << "\n" << ends;
121 117
122 // Just testing... 118 // Just testing...
123 // char *message = plot_buf.str (); 119 // char *message = plot_buf.str ();
248 ifstream ftmp (file); 244 ifstream ftmp (file);
249 if (ftmp) 245 if (ftmp)
250 { 246 {
251 plot_buf << " \"" << file << '"'; 247 plot_buf << " \"" << file << '"';
252 free (file); 248 free (file);
253 goto have_existing_file; 249 goto have_existing_file_or_command;
254 } 250 }
255 else 251 else
256 { 252 {
257 free (file); 253 free (file);
258 file = (char *) NULL; 254 file = (char *) NULL;
255
256 // Opening as a file failed. Let's try passing it along as a plot
257 // command.
258 plot_buf << " " << data.string_value ();
259 goto have_existing_file_or_command;
259 } 260 }
260 } 261 }
261 262
262 nc = data.columns (); 263 nc = data.columns ();
263 switch (ndim) 264 switch (ndim)
283 return -1; 284 return -1;
284 } 285 }
285 else 286 else
286 return -1; 287 return -1;
287 288
288 have_existing_file: 289 have_existing_file_or_command:
289 290
290 if (using != (tree_subplot_using *) NULL) 291 if (using != (tree_subplot_using *) NULL)
291 { 292 {
292 int status = using->print (ndim, nc, plot_buf); 293 int status = using->print (ndim, nc, plot_buf);
293 if (status < 0) 294 if (status < 0)