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