annotate scripts/plot/gnuplot_drawnow.m @ 7680:a0ec02774303

Use popen2 for communication with gnuplot
author David Bateman <dbateman@free.fr>
date Wed, 02 Apr 2008 13:29:19 -0400
parents 246f905cb984
children 1f429086565c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2005, 2006, 2007 John W. Eaton
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
2 ##
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
4 ##
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
8 ## your option) any later version.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
9 ##
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
14 ##
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
18
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
19 ## -*- texinfo -*-
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
20 ## @deftypefn {Function File} {} drawnow ()
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
21 ## Update and display the current graphics.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
22 ##
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
23 ## Octave automatically calls drawnow just before printing a prompt,
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
24 ## when @code{sleep} or @code{pause} is called, or while waiting for
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
25 ## command-line input.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
26 ## @end deftypefn
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
27
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
28 ## Author: jwe
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
29
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
30 function gnuplot_drawnow (h, term, file, mono, debug_file)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
31
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
32 if (nargin < 4)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
33 mono = false;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
34 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
35
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
36 if (nargin >= 3 && nargin <= 5)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
37 f = __get__ (h);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
38 plot_stream = [];
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
39 fid = [];
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
40 unwind_protect
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
41 [plot_stream, enhanced] = open_gnuplot_stream (1, [], term, file);
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
42 __go_draw_figure__ (f, plot_stream, enhanced, mono);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
43 if (nargin == 5)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
44 fid = fopen (debug_file, "wb");
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
45 enhanced = init_plot_stream (fid, [], term, file);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
46 __go_draw_figure__ (f, fid, enhanced, mono);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
47 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
48 unwind_protect_cleanup
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
49 if (! isempty (plot_stream))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
50 pclose (plot_stream);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
51 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
52 if (! isempty (fid))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
53 fclose (fid);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
54 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
55 end_unwind_protect
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
56 elseif (nargin == 1)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
57 f = __get__ (h);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
58 plot_stream = f.__plot_stream__;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
59 if (isempty (plot_stream))
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
60 [plot_stream, enhanced] = open_gnuplot_stream (2, h);
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
61 set (h, "__enhanced__", enhanced);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
62 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
63 enhanced = f.__enhanced__;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
64 endif
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
65 __go_draw_figure__ (f, plot_stream (1), enhanced, mono);
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
66 fflush (plot_stream (1));
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
67 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
68 print_usage ();
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
69 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
70
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
71 endfunction
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
72
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
73 function [plot_stream, enhanced] = open_gnuplot_stream (npipes, h, varargin)
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
74
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
75 cmd = gnuplot_binary ();
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
76
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
77 if (npipes > 1)
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
78 [plot_stream(1), plot_stream(2), pid] = popen2 (cmd);
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
79 if (pid < 0)
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
80 error ("drawnow: failed to open connection to gnuplot");
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
81 endif
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
82 else
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
83 plot_stream = popen (cmd, "w");
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
84 if (plot_stream < 0)
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
85 error ("drawnow: failed to open connection to gnuplot");
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
86 endif
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
87 endif
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
88
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
89 if (! isempty (h))
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
90 set (h, "__plot_stream__", plot_stream);
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
91 endif
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
92
7680
a0ec02774303 Use popen2 for communication with gnuplot
David Bateman <dbateman@free.fr>
parents: 7408
diff changeset
93 enhanced = init_plot_stream (plot_stream (1), h, varargin{:});
7408
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
94
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
95 endfunction
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
96
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
97 function enhanced = init_plot_stream (plot_stream, h, term, file)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
98
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
99 if (nargin == 4)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
100 enhanced = enhanced_term (term);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
101 if (! isempty (term))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
102 if (enhanced)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
103 fprintf (plot_stream, "set terminal %s enhanced;\n", term);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
104 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
105 fprintf (plot_stream, "set terminal %s;\n", term);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
106 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
107 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
108 if (! isempty (file))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
109 fprintf (plot_stream, "set output \"%s\";\n", file);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
110 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
111 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
112
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
113 ## Guess the terminal type.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
114 term = getenv ("GNUTERM");
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
115 if (isempty (term))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
116 if (! isempty (getenv ("DISPLAY")))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
117 term = "x11";
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
118 elseif (! isunix ())
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
119 term = "windows";
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
120 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
121 ## This should really be checking for os x before setting
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
122 ## the terminal type to aqua, but nobody will notice because
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
123 ## every other unix will be using x11 and windows will be
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
124 ## using windows. Those diehards still running octave from
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
125 ## a linux console know how to set the GNUTERM variable.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
126 term = "aqua";
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
127 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
128 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
129
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
130 enhanced = enhanced_term (term);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
131 if (enhanced)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
132 enh_str = "enhanced";
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
133 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
134 enh_str = "";
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
135 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
136
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
137 ## If no 'h' (why not?) then open the terminal as Figure 0.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
138 if (isempty (h))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
139 h = 0;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
140 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
141
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
142 if (strcmp (term, "x11"))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
143 fprintf (plot_stream, "set terminal x11 %s title \"Figure %d\"\n",
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
144 enh_str, h);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
145 elseif (strcmp (term, "aqua"))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
146 ## Aqua doesn't understand the 'title' option despite what the
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
147 ## gnuplot 4.2 documentation says.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
148 fprintf (plot_stream, "set terminal aqua %d %s\n", h, enh_str);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
149 elseif (strcmp (term, "wxt"))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
150 fprintf (plot_stream, "set terminal wxt %s title \"Figure %d\"\n",
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
151 enh_str, h);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
152
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
153 elseif (enhanced)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
154 fprintf (plot_stream, "set terminal %s %s\n", term, enh_str);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
155 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
156 ## gnuplot will pick up the GNUTERM environment variable itself
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
157 ## so no need to set the terminal type if not also setting the
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
158 ## figure title or enhanced mode.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
159
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
160 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
161
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
162 endfunction
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
163
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
164 function have_enhanced = enhanced_term (term)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
165 persistent enhanced_terminals;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
166
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
167 if (isempty (enhanced_terminals))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
168 ## Don't include pstex, pslatex or epslatex here as the TeX commands
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
169 ## should not be interpreted in that case.
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
170 if (compare_versions (__gnuplot_version__ (), "4.0", ">"))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
171 enhanced_terminals = {"aqua", "dumb", "png", "jpeg", "gif", "pm", ...
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
172 "windows", "wxt", "svg", "postscript", "x11", "pdf"};
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
173 else
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
174 enhanced_terminals = {"x11", "postscript"};
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
175 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
176 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
177
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
178 term = tolower (term);
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
179
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
180 have_enhanced = false;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
181 for i = 1 : length (enhanced_terminals)
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
182 t = enhanced_terminals{i};
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
183 if (strncmp (term, t, min (length (term), length (t))))
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
184 have_enhanced = true;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
185 break;
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
186 endif
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
187 endfor
246f905cb984 [project @ 2008-01-22 19:42:47 by jwe]
jwe
parents:
diff changeset
188 endfunction