]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/private/__gnuplot_has_feature__.m
update packages
[CreaPhase.git] / octave_packages / m / plot / private / __gnuplot_has_feature__.m
1 ## Copyright (C) 2009-2012 Ben Abbott
2 ##
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 ##
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/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{has_feature} =} __gnuplot_has_feature__ (@var{feature})
21 ## Undocumented internal function.
22 ## @end deftypefn
23
24 ## Author: Ben Abbott <bpabbott@mac.com>
25 ## Created: 2009-01-27
26
27 function res = __gnuplot_has_feature__ (feature)
28   persistent features has_features
29   features = {"x11_figure_position",
30               "wxt_figure_size",
31               "transparent_patches",
32               "transparent_surface",
33               "epslatex_implies_eps_filesuffix",
34               "epslatexstandalone_terminal",
35               "screen_coordinates_for_{lrtb}margin",
36               "variable_GPVAL_TERMINALS",
37               "key_has_font_properties"};
38
39   if (isempty (has_features))
40     try
41       gnuplot_version = __gnuplot_version__ ();
42     catch
43       ## Don't throw an error if gnuplot isn't installed
44       gnuplot_version = "0.0.0";
45     end_try_catch
46     versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4"};
47     operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
48     have_features = logical (zeros (size (features)));
49     for n = 1 : numel (have_features)
50       has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
51     endfor
52   endif
53
54   n = find (strcmpi (feature, features));
55   if (isempty (n))
56     res = NaN;
57   else
58     res = has_features(n);
59   endif
60 endfunction
61