Fix to allow 'compare_versions.m' handle version numbers ending with period
Muthiah Annamalai
muthuspost at gmail.com
Mon Jan 26 14:47:55 CST 2009
John W. Eaton wrote:
> On 26-Jan-2009, Ben Abbott wrote:
>
> | On Monday, January 26, 2009, at 01:42PM, "Muthiah Annamalai" <muthuspost at gmail.com> wrote:
> | >Hello there,
> | >
> | >I built Octave from sources (3.1.51+) and my gnuplot interface failed,
> | >for the following
> | >reason: __gnuplot_version__() returns 4.2. in my computer, and
> | >compare_versions.m
> | >script doesnt recognize version numbers ending with a "." as you can see
> | >from the
> | >runs below.
> | >
> | >__gnuplot_version__()
> | >ans = 4.2.
> |
> | We should look more closely at __gnuplot_version__ as well. There may be a bug here.
> |
> | What do you get when you type the following?
> |
> | [status, output] = system (sprintf ("%s --version", gnuplot_binary ()))
> |
> | I get
> |
> | status = 0
> | output = gnuplot 4.2 patchlevel 4
> |
> | __gnuplot_version__ replies "4.2"
> |
> | I would have expected to get 4.2.4.
>
> What does
>
> pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
> [d1, d2, d3, d4, matches] = regexp ("gnuplot 4.2 patchlevel 4", pattern)
>
> return on your system? I see
>
> d1 = 1
> d2 = 24
> d3 =
> {
> [1,1] =
>
> 9 11
> 24 24
> }
>
> d4 =
> {
> [1,1] = gnuplot 4.2 patchlevel 4
> }
>
> matches =
> {
> [1,1] =
>
> {
> [1,1] = 4.2
> [1,2] = 4
> }
>
> }
>
> If you see something different, what regexp library are you using?
>
> Maybe the pattern should be written differently.
>
> jwe
>
>
My regexp library is : libpcre3.0 . I think this is what
you ask for.
The code returns the following :
pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
octave:5> [d1, d2, d3, d4, matches] = regexp ("gnuplot 4.2 patchlevel
4", pattern)
d1 = 1
d2 = 24
d3 =
{
[1,1] =
9 11
25 24
}
d4 =
{
[1,1] = gnuplot 4.2 patchlevel 4
}
matches =
{
[1,1] =
{
[1,1] = 4.2
[1,2] =
}
}
-Muthu
More information about the Bug-octave
mailing list