changeset 8620:a2dd2ffc504d

__gnuplot_has_feature__.m: New file, checks for supported feature.
author Ben Abbott <bpabbott@mac.com>
date Wed, 28 Jan 2009 11:25:07 -0500
parents 930a8114197b
children f1534e248260
files scripts/ChangeLog scripts/plot/Makefile.in scripts/plot/__gnuplot_has_feature__.m
diffstat 3 files changed, 54 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 <bpabbott@mac.com>
+
+	* plot/__gnuplot_has_feature__.m: New file, checks for supported feature.
+
 2009-01-27  Jason Riedy  <jason@acm.org>
 
 	* miscellaneous/orderfields.m: Really fix the indexing for struct
--- 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 \
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
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{has_feature} = } __gnuplot_has_feature__ (@var{feature})
+## Undocumented internal function.
+## @end deftypefn
+
+## Author: Ben Abbott <bpabbott@mac.com>
+## 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
+