1 ## Copyright (C) 2010-2012 Ben Abbott
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
21 ## Undocumented internal function.
24 ## Author: Ben Abbott <bpabbott@mac.com>
25 ## Created: 2010-09-13
27 function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
28 term = deblank (term);
29 n = find (term == " ", 1);
33 if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
35 plot_stream = __gnuplot_open_stream__ (2);
37 available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
38 available_terminals = regexp (available_terminals, '\w+', "match");
39 if (nargin < 2 && ! isempty (plot_stream))
40 pclose (plot_stream(1));
41 if (numel (plot_stream) > 1)
42 pclose (plot_stream(2));
44 if (numel (plot_stream) > 2)
45 waitpid (plot_stream(3));
49 ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
50 ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
51 available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
52 "dumb", "dxf", "eepic", "emf", "epslatex", ...
53 "epson_180dpi", "fig", "gif", "gnugraph", ...
54 "gpic", "hp2623A", "hp2648", "hp500c", ...
55 "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
56 "latex", "mf", "mif", "mp", "pbm", "pdf", ...
57 "pm", "png", "postscript", "pslatex", ...
58 "pstex", "pstricks", "qms", "regis", "rgip", ...
59 "svg", "texdraw", "tgif", "tkcanvas", ...
60 "tpic", "windows", "x11", "xlib", "xterm"};
62 gnuplot_supports_term = any (strcmpi (available_terminals, term));