Mercurial > hg > octave-lyh
annotate scripts/plot/private/__gnuplot_has_terminal__.m @ 17320:088d014a7fe2
Use semicolon after "return" statement in core m-files.
* scripts/general/accumdim.m, scripts/image/imformats.m, scripts/io/textread.m,
scripts/io/textscan.m, scripts/linear-algebra/expm.m,
scripts/miscellaneous/edit.m, scripts/optimization/lsqnonneg.m,
scripts/optimization/pqpnonneg.m, scripts/pkg/private/dirempty.m,
scripts/plot/findobj.m, scripts/plot/graphics_toolkit.m,
scripts/plot/private/__errplot__.m, scripts/plot/private/__interp_cube__.m,
scripts/plot/private/__marching_cube__.m, scripts/plot/subplot.m,
scripts/polynomial/residue.m, scripts/sparse/sprandsym.m,
scripts/special-matrix/gallery.m, scripts/strings/strjoin.m:
Use semicolon after "return" statement in core m-files.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 21 Aug 2013 19:53:42 -0700 |
parents | 3cce6b4e0f7c |
children |
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 | 3 ## This file is part of Octave. |
4 ## | |
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. | |
9 ## | |
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. | |
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) |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
28 |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
29 term = strtrim (term); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
30 term = lower (strtok (term, " ")); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
31 |
10967
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
32 if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS")) |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
33 if (nargin < 2) |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
34 plot_stream = __gnuplot_open_stream__ (2); |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
35 endif |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
36 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
|
37 available_terminals = regexp (available_terminals, '\w+', "match"); |
10967
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
38 if (nargin < 2 && ! isempty (plot_stream)) |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
39 pclose (plot_stream(1)); |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
40 if (numel (plot_stream) > 1) |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
41 pclose (plot_stream(2)); |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
42 endif |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
43 if (numel (plot_stream) > 2) |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
44 waitpid (plot_stream(3)); |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
45 endif |
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 else |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
48 ## 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
|
49 ## 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
|
50 available_terminals = {"aifm", "aqua", "canvas", "cgm", "corel", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
51 "dumb", "dxf", "eepic", "emf", "epslatex", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
52 "epson_180dpi", "fig", "gif", "gnugraph", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
53 "gpic", "hp2623A", "hp2648", "hp500c", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
54 "hpgl", "hpljii", "hppj", "imagen", "jpeg", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
55 "latex", "mf", "mif", "mp", "pbm", "pdf", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
56 "pm", "png", "postscript", "pslatex", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
57 "pstex", "pstricks", "qms", "regis", "rgip", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
58 "svg", "texdraw", "tgif", "tkcanvas", ... |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
59 "tpic", "windows", "x11", "xlib", "xterm"}; |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
60 endif |
16108
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
61 |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
62 gnuplot_supports_term = any (strcmp (term, available_terminals)); |
3cce6b4e0f7c
Update gnuplot plotting scripts for faster or more modern synta
Rik <rik@octave.org>
parents:
14138
diff
changeset
|
63 |
10967
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
64 endfunction |
2470b1bf191a
__gnuplot_has_terminal__.m: New function.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
65 |