changeset 20324:13ede127ec9a

graphics_toolkit.m: Check for minimum gnuplot version (bug #44978). * graphics_toolkit.m: Special exception checking for gnuplot version before switching toolkit. Call __gnuplot_has_feature__ with feature "minimum_version". * __gnuplot_has_feature__.m: Add new feature "minimum_version" with value >= 4.2.5.
author Rik <rik@octave.org>
date Sun, 28 Jun 2015 19:42:44 -0700
parents 494a5ed628b5
children b6a59cc96bfa
files scripts/plot/util/graphics_toolkit.m scripts/plot/util/private/__gnuplot_has_feature__.m
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/graphics_toolkit.m	Fri Jun 26 08:37:45 2015 -0700
+++ b/scripts/plot/util/graphics_toolkit.m	Sun Jun 28 19:42:44 2015 -0700
@@ -82,6 +82,14 @@
   endif
 
   if (! any (strcmp (loaded_graphics_toolkits (), name)))
+    ## FIXME: Special gnuplot handling for versions < 4.2.5 (bug #44978).
+    ## This can probably be deleted in the future once RHEL upgrades gnuplot.
+    if (strcmp (name, "gnuplot"))
+      valid_version = __gnuplot_has_feature__ ("minimum_version");
+      if (valid_version != 1)
+        error ("graphics_toolkit: gnuplot version to old.");
+      endif
+    endif
     feval (["__init_", name, "__"]);
     if (! any (strcmp (loaded_graphics_toolkits (), name)))
       error ("graphics_toolkit: %s toolkit was not correctly loaded", name);
--- a/scripts/plot/util/private/__gnuplot_has_feature__.m	Fri Jun 26 08:37:45 2015 -0700
+++ b/scripts/plot/util/private/__gnuplot_has_feature__.m	Sun Jun 28 19:42:44 2015 -0700
@@ -25,7 +25,8 @@
 ## Created: 2009-01-27
 
 function res = __gnuplot_has_feature__ (feature)
-  persistent features = {"x11_figure_position",
+  persistent features = {"minimum_version",
+                         "x11_figure_position",
                          "wxt_figure_size",
                          "transparent_patches",
                          "transparent_surface",
@@ -45,8 +46,8 @@
       ## Don't throw an error if gnuplot isn't installed
       gnuplot_version = "0.0.0";
     end_try_catch
-    versions = {"4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
-    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
+    versions = {"4.2.5", "4.2.5", "4.4", "4.4", "4.4", "4.2", "4.2", "4.4", "4.4", "4.4", "4.4", "4.3"};
+    operators = {">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">=", ">="};
     have_features = false (size (features));
     for n = 1 : numel (have_features)
       has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});