Mercurial > octave
changeset 22418:08aa03dfb00e
Allow switching gnuplot_binary value during a session.
* gnuplot_binary.in.m: Call __gnuplot_has_feature__ ("__reset__") after
updating name of new gnuplot binary.
* __gnuplot_has_feature__.m: If feature is "__reset__" then re-calculate
gnuplot_version and list of available features.
* __gnuplot_version__.m: Accept new input do_reset. If input is logically
true then re-calculate cached gnuplot version __version__.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Sep 2016 13:22:03 -0700 |
parents | 48c00363dc74 |
children | be969d43d95f |
files | scripts/plot/util/gnuplot_binary.in.m scripts/plot/util/private/__gnuplot_has_feature__.m scripts/plot/util/private/__gnuplot_version__.m |
diffstat | 3 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/gnuplot_binary.in.m Thu Sep 01 09:33:55 2016 -0700 +++ b/scripts/plot/util/gnuplot_binary.in.m Thu Sep 01 13:22:03 2016 -0700 @@ -46,6 +46,7 @@ error ("gnuplot_binary: NEW_PROG must be a non-empty string"); endif gp_binary = new_prog; + __gnuplot_has_feature__ ("__reset__"); endif if (nargin > 1)
--- a/scripts/plot/util/private/__gnuplot_has_feature__.m Thu Sep 01 09:33:55 2016 -0700 +++ b/scripts/plot/util/private/__gnuplot_has_feature__.m Thu Sep 01 13:22:03 2016 -0700 @@ -42,9 +42,9 @@ "dashtype"}; persistent has_features; - if (isempty (has_features)) + if (isempty (has_features) || strcmp (feature, "__reset__")) try - gnuplot_version = __gnuplot_version__ (); + gnuplot_version = __gnuplot_version__ ("__reset__"); catch ## Don't throw an error if gnuplot isn't installed gnuplot_version = "0.0.0";
--- a/scripts/plot/util/private/__gnuplot_version__.m Thu Sep 01 09:33:55 2016 -0700 +++ b/scripts/plot/util/private/__gnuplot_version__.m Thu Sep 01 13:22:03 2016 -0700 @@ -21,15 +21,11 @@ ## Undocumented internal function. ## @end deftypefn -## Return the version of gnuplot we are using. Note that we do not -## attempt to handle the case of the user switching to different -## versions of gnuplot during the same session. - -function version = __gnuplot_version__ () +function version = __gnuplot_version__ (do_reset = false) persistent __version__ = ""; - if (isempty (__version__)) + if (isempty (__version__) || do_reset) [status, output] = system (sprintf ('"%s" --version', gnuplot_binary ())); if (status != 0) ## This message ends in a newline so that the traceback messages