# HG changeset patch # User Ben Abbott # Date 1233159907 18000 # Node ID a2dd2ffc504dd4b7b3322722fc376a4725936f73 # Parent 930a8114197b1c23321004d841fd1debf631582a __gnuplot_has_feature__.m: New file, checks for supported feature. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -23,6 +23,10 @@ * path/savepath.m: Call command_line_path instead of commandlinepath. +2009-01-28 Ben Abbott + + * plot/__gnuplot_has_feature__.m: New file, checks for supported feature. + 2009-01-27 Jason Riedy * miscellaneous/orderfields.m: Really fix the indexing for struct diff --git a/scripts/plot/Makefile.in b/scripts/plot/Makefile.in --- a/scripts/plot/Makefile.in +++ b/scripts/plot/Makefile.in @@ -46,6 +46,7 @@ __errcomm__.m \ __errplot__.m \ __ezplot__.m \ + __gnuplot_has_feature__.m \ __go_close_all__.m \ __go_draw_axes__.m \ __go_draw_figure__.m \ diff --git a/scripts/plot/__gnuplot_has_feature__.m b/scripts/plot/__gnuplot_has_feature__.m new file mode 100644 --- /dev/null +++ b/scripts/plot/__gnuplot_has_feature__.m @@ -0,0 +1,49 @@ +## Copyright (C) 2009 Ben Abbott +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, see +## . + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{has_feature} = } __gnuplot_has_feature__ (@var{feature}) +## Undocumented internal function. +## @end deftypefn + +## Author: Ben Abbott +## Created: 2009-01-27 + +function res = __gnuplot_has_feature__ (feature) + persistent features has_features + features = {"x11_figure_position", + "transparent_patches", + "epslatex_implies_eps_filesuffix", + "epslatexstandalone_terminal"}; + + if (isempty (has_features)) + gnuplot_version = __gnuplot_version__ (); + versions = {"4.2.4", "4.2.4", "4.2", "4.2"}; + operators = {">", ">", ">=", ">="}; + have_features = logical (zeros (size (features))); + for n = 1 : numel (have_features) + has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n}); + endfor + endif + + n = find (strcmpi (feature, features)); + if (isempty (n)) + res = NaN; + else + res = has_features(n); + endif +endfunction +