1
|
1 // tree-plot.cc -*- C++ -*- |
|
2 /* |
|
3 |
322
|
4 Copyright (C) 1992, 1993, 1994 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
240
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include "config.h" |
1
|
26 #endif |
|
27 |
524
|
28 #if defined (__GNUG__) |
|
29 #pragma implementation |
|
30 #endif |
|
31 |
|
32 #include <sys/types.h> |
|
33 #ifdef HAVE_UNISTD_H |
|
34 #include <unistd.h> |
|
35 #endif |
1
|
36 #include <iostream.h> |
86
|
37 #include <fstream.h> |
1
|
38 #include <strstream.h> |
|
39 |
524
|
40 #include "SLStack.h" |
|
41 #include "procstream.h" |
|
42 |
|
43 #include "user-prefs.h" |
584
|
44 #include "tree-base.h" |
|
45 #include "tree-expr.h" |
|
46 #include "tree-cmd.h" |
524
|
47 #include "tree-const.h" |
|
48 #include "tree-plot.h" |
543
|
49 #include "help.h" |
1
|
50 #include "error.h" |
|
51 #include "utils.h" |
524
|
52 #include "defun.h" |
1
|
53 |
87
|
54 extern "C" |
|
55 { |
581
|
56 #include <readline/tilde.h> |
87
|
57 } |
|
58 |
1
|
59 // The number of lines we\'ve plotted so far. |
478
|
60 int plot_line_count; |
1
|
61 |
|
62 // Is this a parametric plot? Makes a difference for 3D plotting. |
|
63 int parametric_plot = 0; |
|
64 |
478
|
65 // Should the graph window be cleared before plotting the next line? |
|
66 int clear_before_plotting = 1; |
|
67 |
524
|
68 // List of files to delete when we exit or crash. |
|
69 static SLStack <char *> tmp_files; |
|
70 |
|
71 // Pipe to gnuplot. |
|
72 static oprocstream plot_stream; |
|
73 |
581
|
74 // Plotting, eh? |
1
|
75 |
581
|
76 tree_plot_command::tree_plot_command (void) : tree_command () |
1
|
77 { |
524
|
78 range = 0; |
|
79 plot_list = 0; |
1
|
80 ndim = 0; |
|
81 } |
|
82 |
578
|
83 tree_plot_command::tree_plot_command (subplot_list *plt, int nd) |
581
|
84 : tree_command () |
1
|
85 { |
524
|
86 range = 0; |
1
|
87 plot_list = plt; |
|
88 ndim = nd; |
|
89 } |
|
90 |
578
|
91 tree_plot_command::tree_plot_command (subplot_list *plt, |
|
92 plot_limits *rng, int nd) |
581
|
93 : tree_command () |
1
|
94 { |
|
95 range = rng; |
|
96 plot_list = plt; |
|
97 ndim = nd; |
|
98 } |
|
99 |
|
100 tree_plot_command::~tree_plot_command (void) |
|
101 { |
|
102 delete range; |
|
103 delete plot_list; |
|
104 } |
|
105 |
578
|
106 void |
|
107 tree_plot_command::eval (void) |
1
|
108 { |
143
|
109 if (error_state) |
578
|
110 return; |
143
|
111 |
1
|
112 ostrstream plot_buf; |
|
113 |
|
114 switch (ndim) |
|
115 { |
476
|
116 case 1: |
478
|
117 if (plot_line_count == 0) |
|
118 { |
|
119 if (plot_list) |
|
120 plot_buf << "plot"; |
|
121 else |
|
122 { |
|
123 ::error ("replot: must have something to plot"); |
578
|
124 return; |
478
|
125 } |
|
126 } |
|
127 else |
|
128 plot_buf << "replot"; |
476
|
129 break; |
1
|
130 case 2: |
478
|
131 if (clear_before_plotting || plot_line_count == 0) |
|
132 { |
|
133 plot_line_count = 0; |
|
134 plot_buf << "plot"; |
|
135 } |
|
136 else |
|
137 plot_buf << "replot"; |
1
|
138 break; |
|
139 case 3: |
478
|
140 { |
|
141 plot_line_count = 0; |
|
142 plot_buf << "splot"; |
|
143 } |
1
|
144 break; |
|
145 default: |
|
146 panic_impossible (); |
|
147 break; |
|
148 } |
|
149 |
524
|
150 if (range) |
478
|
151 { |
|
152 if (plot_line_count == 0) |
|
153 range->print (ndim, plot_buf); |
|
154 else |
|
155 warning ("can't specify new plot ranges with `replot' or while\ |
|
156 hold is on"); |
|
157 } |
1
|
158 |
191
|
159 if (error_state) |
578
|
160 return; |
191
|
161 |
578
|
162 for (Pix p = plot_list->first () ; p != 0; plot_list->next (p)) |
1
|
163 { |
578
|
164 subplot *ptr = plot_list->operator () (p); |
|
165 |
1
|
166 plot_line_count++; |
|
167 |
578
|
168 if (p != plot_list->first ()) |
1
|
169 plot_buf << ",\\\n "; |
|
170 |
|
171 int status = ptr->print (ndim, plot_buf); |
|
172 if (status < 0) |
578
|
173 return; |
1
|
174 } |
|
175 |
|
176 plot_buf << "\n" << ends; |
|
177 |
|
178 // Just testing... |
|
179 // char *message = plot_buf.str (); |
|
180 // cout << "[*]" << message << "[*]\n"; |
|
181 |
|
182 if (parametric_plot && ndim == 2) |
|
183 { |
|
184 warning ("can't make 2D parametric plot -- setting noparametric..."); |
|
185 send_to_plot_stream ("set noparametric\n"); |
|
186 char *message = plot_buf.str (); |
|
187 send_to_plot_stream (message); |
|
188 delete [] message; |
|
189 send_to_plot_stream ("set parametric\n"); |
|
190 } |
|
191 else |
|
192 { |
|
193 char *message = plot_buf.str (); |
|
194 send_to_plot_stream (message); |
|
195 delete [] message; |
|
196 } |
|
197 } |
|
198 |
|
199 int |
578
|
200 subplot::print (int ndim, ostrstream& plot_buf) |
1
|
201 { |
|
202 int nc = 0; |
524
|
203 if (plot_data) |
1
|
204 { |
|
205 tree_constant data = plot_data->eval (0); |
191
|
206 if (! error_state && data.is_defined ()) |
1
|
207 { |
524
|
208 char *file = 0; |
86
|
209 if (data.is_string_type ()) |
|
210 { |
87
|
211 file = tilde_expand (data.string_value ()); |
86
|
212 ifstream ftmp (file); |
|
213 if (ftmp) |
|
214 { |
|
215 plot_buf << " \"" << file << '"'; |
87
|
216 free (file); |
134
|
217 goto have_existing_file_or_command; |
86
|
218 } |
|
219 else |
87
|
220 { |
|
221 free (file); |
524
|
222 file = 0; |
134
|
223 |
|
224 // Opening as a file failed. Let's try passing it along as a plot |
|
225 // command. |
|
226 plot_buf << " " << data.string_value (); |
|
227 goto have_existing_file_or_command; |
87
|
228 } |
86
|
229 } |
|
230 |
1
|
231 nc = data.columns (); |
|
232 switch (ndim) |
|
233 { |
|
234 case 2: |
|
235 file = save_in_tmp_file (data, ndim); |
|
236 break; |
|
237 case 3: |
|
238 file = save_in_tmp_file (data, ndim, parametric_plot); |
|
239 break; |
|
240 default: |
|
241 panic_impossible (); |
|
242 break; |
|
243 } |
|
244 |
|
245 if (file) |
|
246 { |
|
247 mark_for_deletion (file); |
|
248 plot_buf << " \"" << file << '"'; |
|
249 } |
|
250 } |
|
251 else |
|
252 return -1; |
|
253 } |
|
254 else |
|
255 return -1; |
|
256 |
134
|
257 have_existing_file_or_command: |
86
|
258 |
524
|
259 if (using) |
1
|
260 { |
|
261 int status = using->print (ndim, nc, plot_buf); |
|
262 if (status < 0) |
|
263 return -1; |
|
264 } |
|
265 |
524
|
266 if (title) |
1
|
267 { |
|
268 tree_constant tmp = title->eval (0); |
191
|
269 if (! error_state && tmp.is_string_type ()) |
1
|
270 plot_buf << " title " << '"' << tmp.string_value () << '"'; |
|
271 else |
|
272 { |
|
273 warning ("line title must be a string"); |
|
274 plot_buf << " title " << '"' << "line " << plot_line_count << '"'; |
|
275 } |
|
276 } |
|
277 else |
|
278 plot_buf << " title " << '"' << "line " << plot_line_count << '"'; |
|
279 |
524
|
280 if (style) |
1
|
281 { |
|
282 int status = style->print (plot_buf); |
|
283 if (status < 0) |
|
284 return -1; |
|
285 } |
|
286 |
|
287 return 0; |
|
288 } |
|
289 |
578
|
290 plot_limits::plot_limits (void) |
1
|
291 { |
524
|
292 x_range = 0; |
|
293 y_range = 0; |
|
294 z_range = 0; |
1
|
295 } |
|
296 |
578
|
297 plot_limits::plot_limits (plot_range *xlim) |
1
|
298 { |
|
299 x_range = xlim; |
524
|
300 y_range = 0; |
|
301 z_range = 0; |
1
|
302 } |
|
303 |
578
|
304 plot_limits::plot_limits (plot_range *xlim, |
|
305 plot_range *ylim) |
1
|
306 { |
|
307 x_range = xlim; |
|
308 y_range = ylim; |
524
|
309 z_range = 0; |
1
|
310 } |
|
311 |
578
|
312 plot_limits::plot_limits (plot_range *xlim, |
|
313 plot_range *ylim, |
|
314 plot_range *zlim) |
1
|
315 { |
|
316 x_range = xlim; |
|
317 y_range = ylim; |
|
318 z_range = zlim; |
|
319 } |
|
320 |
578
|
321 plot_limits::~plot_limits (void) |
1
|
322 { |
|
323 delete x_range; |
|
324 delete y_range; |
|
325 delete z_range; |
|
326 } |
|
327 |
|
328 void |
578
|
329 plot_limits::print (int ndim, ostrstream& plot_buf) |
1
|
330 { |
|
331 if (ndim == 2 || ndim == 3) |
|
332 { |
524
|
333 if (x_range) |
1
|
334 x_range->print (plot_buf); |
|
335 else |
|
336 return; |
|
337 |
524
|
338 if (y_range) |
1
|
339 y_range->print (plot_buf); |
|
340 else |
|
341 return; |
|
342 } |
|
343 |
524
|
344 if (ndim == 3 && z_range) |
1
|
345 z_range->print (plot_buf); |
|
346 } |
|
347 |
578
|
348 plot_range::plot_range (void) |
1
|
349 { |
524
|
350 lower = 0; |
|
351 upper = 0; |
1
|
352 } |
|
353 |
578
|
354 plot_range::plot_range (tree_expression *l, tree_expression *u) |
1
|
355 { |
|
356 lower = l; |
|
357 upper = u; |
|
358 } |
|
359 |
578
|
360 plot_range::~plot_range (void) |
1
|
361 { |
|
362 delete lower; |
|
363 delete upper; |
|
364 } |
|
365 |
|
366 void |
578
|
367 plot_range::print (ostrstream& plot_buf) |
1
|
368 { |
|
369 plot_buf << " ["; |
|
370 |
524
|
371 if (lower) |
1
|
372 { |
|
373 tree_constant lower_val = lower->eval (0); |
191
|
374 if (error_state) |
|
375 { |
240
|
376 ::error ("evaluating lower bound of plot range"); |
191
|
377 return; |
|
378 } |
|
379 else |
|
380 { |
|
381 double lo = lower_val.to_scalar (); |
|
382 plot_buf << lo; |
|
383 } |
1
|
384 } |
|
385 |
|
386 plot_buf << ":"; |
|
387 |
524
|
388 if (upper) |
1
|
389 { |
|
390 tree_constant upper_val = upper->eval (0); |
191
|
391 if (error_state) |
|
392 { |
240
|
393 ::error ("evaluating upper bound of plot range"); |
191
|
394 return; |
|
395 } |
|
396 else |
|
397 { |
|
398 double hi = upper_val.to_scalar (); |
|
399 plot_buf << hi; |
|
400 } |
1
|
401 } |
|
402 |
|
403 plot_buf << "]"; |
|
404 } |
|
405 |
578
|
406 subplot_using::subplot_using (void) |
1
|
407 { |
|
408 qualifier_count = 0; |
524
|
409 x[0] = 0; |
|
410 x[1] = 0; |
|
411 x[2] = 0; |
|
412 x[3] = 0; |
|
413 scanf_fmt = 0; |
1
|
414 } |
|
415 |
578
|
416 subplot_using::subplot_using (tree_expression *fmt) |
1
|
417 { |
|
418 qualifier_count = 0; |
524
|
419 x[0] = 0; |
|
420 x[1] = 0; |
|
421 x[2] = 0; |
|
422 x[3] = 0; |
1
|
423 scanf_fmt = fmt; |
|
424 } |
|
425 |
578
|
426 subplot_using::~subplot_using (void) |
1
|
427 { |
|
428 delete scanf_fmt; |
|
429 } |
|
430 |
578
|
431 subplot_using * |
|
432 subplot_using::set_format (tree_expression *fmt) |
1
|
433 { |
|
434 scanf_fmt = fmt; |
|
435 return this; |
|
436 } |
|
437 |
578
|
438 subplot_using * |
|
439 subplot_using::add_qualifier (tree_expression *t) |
1
|
440 { |
|
441 if (qualifier_count < 4) |
|
442 x[qualifier_count] = t; |
|
443 |
|
444 qualifier_count++; |
|
445 |
|
446 return this; |
|
447 } |
|
448 |
|
449 int |
578
|
450 subplot_using::print (int ndim, int n_max, ostrstream& plot_buf) |
1
|
451 { |
|
452 if ((ndim == 2 && qualifier_count > 4) |
|
453 || (ndim == 3 && qualifier_count > 3)) |
|
454 return -1; |
|
455 |
|
456 for (int i = 0; i < qualifier_count; i++) |
|
457 { |
524
|
458 if (x[i]) |
1
|
459 { |
|
460 tree_constant tmp = x[i]->eval (0); |
191
|
461 if (error_state) |
|
462 { |
240
|
463 ::error ("evaluating plot using command"); |
191
|
464 return -1; |
|
465 } |
|
466 |
1
|
467 double val; |
|
468 if (tmp.is_defined ()) |
|
469 { |
|
470 val = tmp.to_scalar (); |
|
471 if (i == 0) |
|
472 plot_buf << " using "; |
|
473 else |
|
474 plot_buf << ":"; |
|
475 |
|
476 int n = NINT (val); |
|
477 |
322
|
478 if (n < 1 || n_max > 0 && n > n_max) |
1
|
479 { |
240
|
480 ::error ("using: column %d out of range", n); |
1
|
481 return -1; |
|
482 } |
|
483 else |
|
484 plot_buf << n; |
|
485 } |
|
486 else |
|
487 return -1; |
|
488 } |
|
489 else |
|
490 return -1; |
|
491 } |
|
492 |
524
|
493 if (scanf_fmt) |
1
|
494 warning ("ignoring scanf format in plot command"); |
|
495 |
|
496 return 0; |
|
497 } |
|
498 |
578
|
499 subplot_style::subplot_style (void) |
1
|
500 { |
524
|
501 style = 0; |
|
502 linetype = 0; |
|
503 pointtype = 0; |
1
|
504 } |
|
505 |
578
|
506 subplot_style::subplot_style (char *s) |
1
|
507 { |
|
508 style = strsave (s); |
524
|
509 linetype = 0; |
|
510 pointtype = 0; |
1
|
511 } |
|
512 |
578
|
513 subplot_style::subplot_style (char *s, tree_expression *lt) |
1
|
514 { |
|
515 style = strsave (s); |
|
516 linetype = lt; |
524
|
517 pointtype = 0; |
1
|
518 } |
|
519 |
578
|
520 subplot_style::subplot_style (char *s, tree_expression *lt, |
491
|
521 tree_expression *pt) |
1
|
522 { |
|
523 style = strsave (s); |
|
524 linetype = lt; |
|
525 pointtype = pt; |
|
526 } |
|
527 |
578
|
528 subplot_style::~subplot_style (void) |
1
|
529 { |
|
530 delete [] style; |
|
531 delete linetype; |
|
532 delete pointtype; |
|
533 } |
|
534 |
|
535 int |
578
|
536 subplot_style::print (ostrstream& plot_buf) |
1
|
537 { |
524
|
538 if (style) |
1
|
539 { |
|
540 plot_buf << " with " << style; |
|
541 |
524
|
542 if (linetype) |
1
|
543 { |
|
544 tree_constant tmp = linetype->eval (0); |
191
|
545 if (! error_state && tmp.is_defined ()) |
1
|
546 { |
|
547 double val = tmp.to_scalar (); |
|
548 plot_buf << " " << NINT (val); |
|
549 } |
|
550 else |
191
|
551 { |
240
|
552 ::error ("evaluating plot style command"); |
191
|
553 return -1; |
|
554 } |
1
|
555 } |
|
556 |
524
|
557 if (pointtype) |
1
|
558 { |
|
559 tree_constant tmp = pointtype->eval (0); |
191
|
560 if (! error_state && tmp.is_defined ()) |
1
|
561 { |
|
562 double val = tmp.to_scalar (); |
|
563 plot_buf << " " << NINT (val); |
|
564 } |
|
565 else |
191
|
566 { |
240
|
567 ::error ("evaluating plot style command"); |
191
|
568 return -1; |
|
569 } |
1
|
570 } |
|
571 } |
|
572 else |
|
573 return -1; |
|
574 |
|
575 return 0; |
|
576 } |
|
577 |
524
|
578 char * |
|
579 save_in_tmp_file (tree_constant& t, int ndim, int parametric) |
|
580 { |
|
581 char *name = strsave (tmpnam (0)); |
|
582 if (name) |
|
583 { |
|
584 ofstream file (name); |
|
585 if (file) |
|
586 { |
|
587 switch (ndim) |
|
588 { |
|
589 case 2: |
|
590 t.save (file); |
|
591 break; |
|
592 case 3: |
|
593 t.save_three_d (file, parametric); |
|
594 break; |
|
595 default: |
|
596 panic_impossible (); |
|
597 break; |
|
598 } |
|
599 } |
|
600 else |
|
601 { |
|
602 error ("couldn't open temporary output file `%s'", name); |
|
603 delete [] name; |
|
604 name = 0; |
|
605 } |
|
606 } |
|
607 return name; |
|
608 } |
|
609 |
|
610 void |
|
611 mark_for_deletion (const char *filename) |
|
612 { |
|
613 char *tmp = strsave (filename); |
|
614 tmp_files.push (tmp); |
|
615 } |
|
616 |
|
617 void |
|
618 cleanup_tmp_files (void) |
|
619 { |
|
620 while (! tmp_files.empty ()) |
|
621 { |
|
622 char *filename = tmp_files.pop (); |
|
623 unlink (filename); |
|
624 delete [] filename; |
|
625 } |
|
626 } |
|
627 |
|
628 int |
|
629 send_to_plot_stream (const char *cmd) |
|
630 { |
|
631 // From sighandlers.cc: |
|
632 extern int pipe_handler_error_count; |
|
633 |
|
634 static int initialized = 0; |
|
635 |
|
636 if (! plot_stream.is_open ()) |
|
637 { |
|
638 plot_line_count = 0; |
|
639 |
|
640 char *plot_prog = user_pref.gnuplot_binary; |
|
641 if (plot_prog) |
|
642 { |
|
643 plot_stream.open (plot_prog); |
|
644 if (! plot_stream.is_open ()) |
|
645 { |
|
646 warning ("plot: unable to open pipe to `%s'", |
|
647 plot_prog); |
|
648 |
|
649 if (strcmp (plot_prog, "gnuplot") != 0) |
|
650 { |
|
651 warning ("having trouble finding plotting program."); |
|
652 warning ("trying again with `gnuplot'"); |
|
653 goto last_chance; |
|
654 } |
|
655 } |
|
656 } |
|
657 else |
|
658 { |
|
659 last_chance: |
|
660 |
|
661 plot_stream.open ("gnuplot"); |
|
662 |
|
663 if (! plot_stream.is_open ()) |
|
664 { |
|
665 error ("plot: unable to open pipe to `%s'", plot_prog); |
|
666 return -1; |
|
667 } |
|
668 } |
|
669 } |
|
670 |
|
671 if (! initialized) |
|
672 { |
|
673 initialized = 1; |
|
674 plot_stream << "set data style lines\n"; |
|
675 } |
|
676 |
|
677 plot_stream << cmd; |
|
678 plot_stream.flush (); |
|
679 pipe_handler_error_count = 0; |
|
680 |
|
681 return 0; |
|
682 } |
|
683 |
|
684 void |
|
685 close_plot_stream (void) |
|
686 { |
|
687 if (plot_stream.is_open ()) |
|
688 plot_stream.close (); |
|
689 |
|
690 plot_line_count = 0; |
|
691 } |
|
692 |
|
693 DEFUN ("closeplot", Fcloseplot, Scloseplot, 1, 0, |
|
694 "closeplot (): close the stream to plotter") |
|
695 { |
|
696 Octave_object retval; |
|
697 close_plot_stream (); |
|
698 return retval; |
|
699 } |
|
700 |
|
701 DEFUN_TEXT ("hold", Fhold, Shold, -1, 1, |
|
702 "hold [on|off]\n\ |
|
703 \n\ |
|
704 determine whether the plot window is cleared before the next line is\n\ |
|
705 drawn. With no argument, toggle the current state.") |
|
706 { |
|
707 Octave_object retval; |
|
708 |
|
709 DEFINE_ARGV("hold"); |
|
710 |
|
711 switch (argc) |
|
712 { |
|
713 case 1: |
|
714 clear_before_plotting = ! clear_before_plotting; |
|
715 break; |
|
716 case 2: |
|
717 if (strcasecmp (argv[1], "on") == 0) |
|
718 clear_before_plotting = 0; |
|
719 else if (strcasecmp (argv[1], "off") == 0) |
|
720 clear_before_plotting = 1; |
|
721 else |
|
722 print_usage ("hold"); |
|
723 break; |
|
724 default: |
|
725 print_usage ("hold"); |
|
726 break; |
|
727 } |
|
728 |
|
729 DELETE_ARGV; |
|
730 |
|
731 return retval; |
|
732 } |
|
733 |
|
734 DEFUN ("purge_tmp_files", Fpurge_tmp_files, Spurge_tmp_files, 5, 1, |
|
735 "delete temporary data files used for plotting") |
|
736 { |
|
737 Octave_object retval; |
|
738 cleanup_tmp_files (); |
|
739 return retval; |
|
740 } |
|
741 |
|
742 DEFUN_TEXT ("set", Fset, Sset, -1, 1, |
|
743 "set [options]\n\ |
|
744 \n\ |
|
745 set plotting options") |
|
746 { |
|
747 Octave_object retval; |
|
748 |
|
749 DEFINE_ARGV("set"); |
|
750 |
|
751 ostrstream plot_buf; |
|
752 |
|
753 if (argc > 1) |
|
754 { |
|
755 if (almost_match ("parametric", argv[1], 3)) |
|
756 parametric_plot = 1; |
|
757 else if (almost_match ("noparametric", argv[1], 5)) |
|
758 parametric_plot = 0; |
|
759 } |
|
760 |
|
761 for (int i = 0; i < argc; i++) |
|
762 plot_buf << argv[i] << " "; |
|
763 |
|
764 plot_buf << "\n" << ends; |
|
765 |
|
766 char *plot_command = plot_buf.str (); |
|
767 send_to_plot_stream (plot_command); |
|
768 |
|
769 delete [] plot_command; |
|
770 |
|
771 DELETE_ARGV; |
|
772 |
|
773 return retval; |
|
774 } |
|
775 |
|
776 DEFUN_TEXT ("show", Fshow, Sshow, -1, 1, |
|
777 "show [options]\n\ |
|
778 \n\ |
|
779 show plotting options") |
|
780 { |
|
781 Octave_object retval; |
|
782 |
|
783 DEFINE_ARGV("show"); |
|
784 |
|
785 ostrstream plot_buf; |
|
786 |
|
787 for (int i = 0; i < argc; i++) |
|
788 plot_buf << argv[i] << " "; |
|
789 |
|
790 plot_buf << "\n" << ends; |
|
791 |
|
792 char *plot_command = plot_buf.str (); |
|
793 send_to_plot_stream (plot_command); |
|
794 |
|
795 delete [] plot_command; |
|
796 |
|
797 DELETE_ARGV; |
|
798 |
|
799 return retval; |
|
800 } |
|
801 |
1
|
802 /* |
|
803 ;;; Local Variables: *** |
|
804 ;;; mode: C++ *** |
|
805 ;;; page-delimiter: "^/\\*" *** |
|
806 ;;; End: *** |
|
807 */ |