annotate scripts/plot/__gnuplot_version__.m @ 6440:98ee80702bca

[project @ 2007-03-23 15:13:19 by jwe]
author jwe
date Fri, 23 Mar 2007 15:13:19 +0000
parents 700e121edb94
children 76e3d985ae56
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 ##
6440
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6087
diff changeset
3 ## This file is part of Octave.
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6087
diff changeset
4 ##
6087
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
5 ## 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
6 ## 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
7 ## 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
8 ## any later version.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
9 ##
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
10 ## 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
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
14 ##
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
15 ## 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
16 ## along with Octave; see the file COPYING. If not, write to the Free
6440
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6087
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
98ee80702bca [project @ 2007-03-23 15:13:19 by jwe]
jwe
parents: 6087
diff changeset
18 ## 02110-1301, USA.
6087
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
19
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefn {Function File} {@var{version} =} __gnuplot_version__ (@var{gplt_exe})
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
22 ## 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
23 ## 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
24 ## versions of gnuplot during the same session.
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
25 ## @end deftypefn
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 function version = __gnuplot_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 persistent __version__ = "";
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
30
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
31 if (isempty (__version__))
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
32 [status, output] = system (sprintf ("%s --version", gnuplot_binary ()));
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
33 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
34 [d1, d2, d3, d4, matches] = regexp (output, pattern);
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
35 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1}))
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
36 __version__ = matches{1}{1};
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
37 endif
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
38 endif
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 version = __version__;
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
41
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
42 endfunction
700e121edb94 [project @ 2006-10-25 19:03:12 by jwe]
jwe
parents:
diff changeset
43