annotate scripts/plot/private/__gnuplot_has_terminal__.m @ 14138:72c96de7a403 stable

maint: update copyright notices for 2012
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2012 14:25:41 -0500
parents 5cb9a7e08f66
children 3cce6b4e0f7c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 12315
diff changeset
1 ## Copyright (C) 2010-2012 Ben Abbott
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
3 ## This file is part of Octave.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
4 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
6 ## under the terms of the GNU General Public License as published by
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
8 ## your option) any later version.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
9 ##
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
13 ## General Public License for more details.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 11032
diff changeset
14 ##
10967
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
18
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
19 ## -*- texinfo -*-
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{has_terminal} =} __gnuplot_has_terminal__ (@var{terminal})
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
21 ## Undocumented internal function.
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
22 ## @end deftypefn
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
23
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
24 ## Author: Ben Abbott <bpabbott@mac.com>
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
25 ## Created: 2010-09-13
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
26
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
27 function gnuplot_supports_term = __gnuplot_has_terminal__ (term, plot_stream)
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
28 term = deblank (term);
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
29 n = find (term == " ", 1);
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
30 if (! isempty (n))
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
31 term = term(1:n-1);
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
32 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
33 if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
34 if (nargin < 2)
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
35 plot_stream = __gnuplot_open_stream__ (2);
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
36 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
37 available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
12315
5cb9a7e08f66 Simplify regexp to make it POSIX compliant.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
38 available_terminals = regexp (available_terminals, '\w+', "match");
10967
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
39 if (nargin < 2 && ! isempty (plot_stream))
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
40 pclose (plot_stream(1));
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
41 if (numel (plot_stream) > 1)
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
42 pclose (plot_stream(2));
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
43 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
44 if (numel (plot_stream) > 2)
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
45 waitpid (plot_stream(3));
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
46 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
47 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
48 else
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
49 ## Gnuplot 4.0 terminals. No new terminals were added until 4.4 which
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
50 ## allows the list of terminals to be obtained from GPVAL_TERMINALS.
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
51 available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
52 "dumb", "dxf", "eepic", "emf", "epslatex", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
53 "epson_180dpi", "fig", "gif", "gnugraph", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
54 "gpic", "hp2623A", "hp2648", "hp500c", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
55 "hpgl", "hpljii", "hppj", "imagen", "jpeg", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
56 "latex", "mf", "mif", "mp", "pbm", "pdf", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
57 "pm", "png", "postscript", "pslatex", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
58 "pstex", "pstricks", "qms", "regis", "rgip", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
59 "svg", "texdraw", "tgif", "tkcanvas", ...
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
60 "tpic", "windows", "x11", "xlib", "xterm"};
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
61 endif
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
62 gnuplot_supports_term = any (strcmpi (available_terminals, term));
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
63 endfunction
2470b1bf191a __gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
64