Mercurial > hg > octave-nkf
annotate scripts/plot/private/__gnuplot_has_feature__.m @ 13782:bebd3ae908cb
2nd attempt to fix bugs introduced by changeset bda7b080f205.
(first attempt was 8cd08124cb59).
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 01 Nov 2011 16:50:38 -0400 |
parents | 6f91ca83d2be |
children | 72c96de7a403 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2009-2011 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 ## | |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
18 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
8812
7d48766c21a5
use consistent format for doc strings of internal functions
John W. Eaton <jwe@octave.org>
parents:
8645
diff
changeset
|
20 ## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature}) |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
21 ## Undocumented internal function. |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
22 ## @end deftypefn |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
23 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
24 ## Author: Ben Abbott <bpabbott@mac.com> |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
25 ## Created: 2009-01-27 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
26 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
27 function res = __gnuplot_has_feature__ (feature) |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
28 persistent features has_features |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
29 features = {"x11_figure_position", |
9398
684312a5291c
Add feature 'wxt_has_size' to __gnuplot_has_feature__.m & apply in gnuplot_drawnow.m.
Ben Abbott <bpabbott@mac.com>
parents:
9296
diff
changeset
|
30 "wxt_figure_size", |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
31 "transparent_patches", |
8645 | 32 "transparent_surface", |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
33 "epslatex_implies_eps_filesuffix", |
8889
665b264b6a50
Compatible support of figure paper properties and resolution for the gnuplot backend.
Ben Abbott <bpabbott@mac.com>
parents:
8812
diff
changeset
|
34 "epslatexstandalone_terminal", |
9008
7a7cf569528d
gnuplot_drawnow.m: Check that gnuplot has internal variable "GPVAL_TERMINALS".
Ben Abbott <bpabbott@mac.com>
parents:
8889
diff
changeset
|
35 "screen_coordinates_for_{lrtb}margin", |
9191
ad33527d2e51
Have 'legend' inherit font properties from the parent axis.
Ben Abbott <bpabbott@mac.com>
parents:
9162
diff
changeset
|
36 "variable_GPVAL_TERMINALS", |
ad33527d2e51
Have 'legend' inherit font properties from the parent axis.
Ben Abbott <bpabbott@mac.com>
parents:
9162
diff
changeset
|
37 "key_has_font_properties"}; |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
38 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
39 if (isempty (has_features)) |
12325
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
40 try |
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
41 gnuplot_version = __gnuplot_version__ (); |
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
42 catch |
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
43 ## Don't throw an error if gnuplot isn't installed |
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
44 gnuplot_version = "0.0.0"; |
5d68277d4496
__gnuplot_has_feature__.m: Don't throw an error if gnuplot isn't installed.
Ben Abbott <bpabbott@mac.com>
parents:
11587
diff
changeset
|
45 end_try_catch |
11279
301c5aff54ee
__gnuplot_has_feature__.m: Since there is not gnuplot 4.3.x release, replace reference to version 4.3 with 4.4.
Ben Abbott <bpabbott@mac.com>
parents:
11104
diff
changeset
|
46 versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4"}; |
9398
684312a5291c
Add feature 'wxt_has_size' to __gnuplot_has_feature__.m & apply in gnuplot_drawnow.m.
Ben Abbott <bpabbott@mac.com>
parents:
9296
diff
changeset
|
47 operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="}; |
8620
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
48 have_features = logical (zeros (size (features))); |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
49 for n = 1 : numel (have_features) |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
50 has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n}); |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
51 endfor |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
52 endif |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
53 |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
54 n = find (strcmpi (feature, features)); |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
55 if (isempty (n)) |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
56 res = NaN; |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
57 else |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
58 res = has_features(n); |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
59 endif |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
60 endfunction |
a2dd2ffc504d
__gnuplot_has_feature__.m: New file, checks for supported feature.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
61 |