changeset 9008:7a7cf569528d

gnuplot_drawnow.m: Check that gnuplot has internal variable "GPVAL_TERMINALS".
author Ben Abbott <bpabbott@mac.com>
date Mon, 23 Mar 2009 18:21:25 -0400
parents 7e31df9a0334
children da58ec8f62e8
files scripts/ChangeLog scripts/plot/__gnuplot_has_feature__.m scripts/plot/gnuplot_drawnow.m
diffstat 3 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Mar 23 14:23:48 2009 +0100
+++ b/scripts/ChangeLog	Mon Mar 23 18:21:25 2009 -0400
@@ -1,3 +1,9 @@
+2009-03-23  Ben Abbott <bpabbott@mac.com>
+
+	* plot/gnuplot_drawnow.m: Check that gnuplot has internal variable
+	"GPVAL_TERMINALS".
+	* plot/__gnuplot_has_feature__.m: Add "variable_GPVAL_TERMINALS".
+
 2009-03-21  Ben Abbott <bpabbott@mac.com>
 
 	* plot/gnuplot_drawnow.m: Verify the gnuplot terminal is supported.
--- a/scripts/plot/__gnuplot_has_feature__.m	Mon Mar 23 14:23:48 2009 +0100
+++ b/scripts/plot/__gnuplot_has_feature__.m	Mon Mar 23 18:21:25 2009 -0400
@@ -29,12 +29,13 @@
               "transparent_surface",
               "epslatex_implies_eps_filesuffix",
               "epslatexstandalone_terminal",
-              "screen_coordinates_for_{lrtb}margin",};
+              "screen_coordinates_for_{lrtb}margin",
+              "variable_GPVAL_TERMINALS"};
 
   if (isempty (has_features))
     gnuplot_version = __gnuplot_version__ ();
-    versions = {"4.2.4", "4.3", "4.3", "4.2", "4.2", "4.3"};
-    operators = {">", ">=", ">=", ">=", ">=", ">="};
+    versions = {"4.2.4", "4.3", "4.3", "4.2", "4.2", "4.3", "4.3"};
+    operators = {">", ">=", ">=", ">=", ">=", ">=", ">="};
     have_features = logical (zeros (size (features)));
     for n = 1 : numel (have_features)
       has_features(n) = compare_versions (gnuplot_version, versions{n}, operators{n});
--- a/scripts/plot/gnuplot_drawnow.m	Mon Mar 23 14:23:48 2009 +0100
+++ b/scripts/plot/gnuplot_drawnow.m	Mon Mar 23 18:21:25 2009 -0400
@@ -41,10 +41,17 @@
     printing = ! output_to_screen (gnuplot_trim_term (term));
     unwind_protect
       plot_stream = open_gnuplot_stream (2, []);
-      available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
-      available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match");
-      if (any (strcmpi (available_terminals, gnuplot_trim_term (term))))
-        [enhanced, implicit_margin] = gnuplot_set_term (plot_stream (1), true, h, term, file);
+      if (__gnuplot_has_feature__ ("variable_GPVAL_TERMINALS"))
+        available_terminals = __gnuplot_get_var__ (plot_stream, "GPVAL_TERMINALS");
+        available_terminals = regexp (available_terminals, "\\b\\w+\\b", "match");
+        gnuplot_supports_term = any (strcmpi (available_terminals,
+                                              gnuplot_trim_term (term)));
+      else
+        gnuplot_supports_term = true;
+      endif
+      if (gnuplot_supports_term)
+        [enhanced, implicit_margin] = gnuplot_set_term (plot_stream (1), true,
+                                                        h, term, file);
         __go_draw_figure__ (h, plot_stream, enhanced, mono, printing, implicit_margin);
         if (nargin == 5)
           fid = fopen (debug_file, "wb");