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