Mercurial > hg > octave-lyh
comparison scripts/plot/__gnuplot_version__.m @ 8794:f16aafdd99ca
__gnuplot_version__.m: don't use regexp to extract version number
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 18 Feb 2009 01:10:43 -0500 |
parents | 7d6e659acc1a |
children | 7d48766c21a5 |
comparison
equal
deleted
inserted
replaced
8793:4c989d52f35c | 8794:f16aafdd99ca |
---|---|
33 ## are skipped and people might actually see the message, read it, | 33 ## are skipped and people might actually see the message, read it, |
34 ## comprehend it, actually take the advice it gives, and stop | 34 ## comprehend it, actually take the advice it gives, and stop |
35 ## asking us why plotting fails when gnuplot is not found. | 35 ## asking us why plotting fails when gnuplot is not found. |
36 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n"); | 36 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n"); |
37 endif | 37 endif |
38 pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)"; | 38 output = strrep (output, "gnuplot", ""); |
39 [d1, d2, d3, d4, matches] = regexp (output, pattern); | 39 output = strrep (output, "patchlevel", "."); |
40 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1})) | 40 output = strrep (output, "\n", ""); |
41 if (numel (matches{1}) == 2) | 41 output = strrep (output, "\r", ""); |
42 __version__ = sprintf ("%s.%s", matches{1}{:}); | 42 __version__ = strrep (output, " ", ""); |
43 else | |
44 __version__ = matches{1}{1}; | |
45 endif | |
46 endif | |
47 endif | 43 endif |
48 | 44 |
49 version = __version__; | 45 version = __version__; |
50 | 46 |
51 endfunction | 47 endfunction |