# HG changeset patch # User Ben Abbott # Date 1237655083 14400 # Node ID 5cc15e4b4e5c499672c66697d04eb766b98cfb62 # Parent b3268a0458f23fa19ec384773bee12b4724305c1 gnuplot_drawnow.m: Verify the gnuplot terminal is supported. diff -r b3268a0458f2 -r 5cc15e4b4e5c scripts/ChangeLog --- a/scripts/ChangeLog Sat Mar 21 12:49:58 2009 -0400 +++ b/scripts/ChangeLog Sat Mar 21 13:04:43 2009 -0400 @@ -1,5 +1,6 @@ 2009-03-21 Ben Abbott + * plot/gnuplot_drawnow.m: Verify the gnuplot terminal is supported. * plot/__gnuplot_get_var__.m: Add function to get gnuplot variables. * plot/print.m: Restore the behavior for option -S,. diff -r b3268a0458f2 -r 5cc15e4b4e5c scripts/plot/gnuplot_drawnow.m --- a/scripts/plot/gnuplot_drawnow.m Sat Mar 21 12:49:58 2009 -0400 +++ b/scripts/plot/gnuplot_drawnow.m Sat Mar 21 13:04:43 2009 -0400 @@ -40,13 +40,20 @@ fid = []; printing = ! output_to_screen (gnuplot_trim_term (term)); unwind_protect - plot_stream = open_gnuplot_stream (1, []); - [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"); - enhanced = gnuplot_set_term (fid, true, h, term, file); - __go_draw_figure__ (h, fid, enhanced, mono, printing, implicit_margin); + 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); + __go_draw_figure__ (h, plot_stream, enhanced, mono, printing, implicit_margin); + if (nargin == 5) + fid = fopen (debug_file, "wb"); + [enhanced, implicit_margin] = gnuplot_set_term (fid, true, h, term, file); + __go_draw_figure__ (h, fid, enhanced, mono, printing, implicit_margin); + endif + else + error ("gnuplot_drawnow: the gnuplot terminal, \"%s\", is not available.", + gnuplot_trim_term (term)) endif unwind_protect_cleanup if (! isempty (plot_stream))