annotate scripts/plot/__gnuplot_version__.m @ 6390:334499d75c5c

[project @ 2007-03-07 18:11:28 by jwe]
author jwe
date Wed, 07 Mar 2007 18:11:29 +0000
parents 700e121edb94
children 98ee80702bca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6087
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 2006 Daniel Sebald
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
2 ##
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
3 ## Octave is free software; you can redistribute it and/or modify it
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
4 ## under the terms of the GNU General Public License as published by
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
5 ## the Free Software Foundation; either version 2, or (at your option)
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
6 ## any later version.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
7 ##
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
8 ## Octave is distributed in the hope that it will be useful, but
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
11 ## General Public License for more details.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
12 ##
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
13 ## You should have received a copy of the GNU General Public License
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
14 ## along with Octave; see the file COPYING. If not, write to the Free
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
15 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
16 ## 02111-1307, USA.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
17
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
18 ## -*- texinfo -*-
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
19 ## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ (@var{gplt_exe})
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
20 ## Return the version of gnuplot we are using. Note that we do not
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
21 ## attempt to handle the case of the user switching to different
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
22 ## versions of gnuplot during the same session.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
23 ## @end deftypefn
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
24
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
25 function version = __gnuplot_version__ ()
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
26
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
27 persistent __version__ = "";
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
28
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
29 if (isempty (__version__))
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
30 [status, output] = system (sprintf ("%s --version", gnuplot_binary ()));
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
31 pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
32 [d1, d2, d3, d4, matches] = regexp (output, pattern);
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
33 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1}))
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
34 __version__ = matches{1}{1};
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
35 endif
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
36 endif
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
37
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
38 version = __version__;
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
39
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
40 endfunction
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
41