Spinroot

A forum for Spin users

You are not logged in.

#1 2012-05-14 12:34:54

lz
Member
Registered: 2012-05-14
Posts: 9

select

Hello,

the select statement is inconsistent
with syntax version 6.2
from manual:
i = 8;
    do
    :: i < 17 -> i++
    :: break
    od

Could it be fixed?
With my thanks, best regards.

  LZ

Offline

#2 2012-05-15 02:12:24

jacques
Member
Registered: 2012-05-15
Posts: 1

Re: select

Maybe this is related, I get the following error when I run the following code.

active proctype P() {
  int i;
  select (i : 1..10);
  printf("%d\n", i)
}
spin: foo.pml:3, Error: misplaced break statement

This worked with 6.1.0.

Offline

#3 2012-05-15 03:10:55

spinroot
forum
Registered: 2010-11-18
Posts: 695
Website

Re: select

apologies -- i broke the select statement in 6.2.0
will be fixed in 6.2.1 --

version 6.2.1, 14 May 2012, is now in the distribution -- with this bug-fix

thanks for the quick report!

Offline

#4 2017-08-10 11:41:17

DavidFarago
Member
Registered: 2011-10-17
Posts: 21

Re: select

Is the following a bug? If so, is there a workaround, so I can still use the concise select statement for 2-dimensional arrays?

2-dimensional array:

    
typedef solt
{
	byte 	Id;
	bool  Valid;
};

typedef ds 
{
	solt y[dimy];
};

ds x[dimx];

   

Now I want to use a simple select for one Id:

    
            select (x[0].y[0].Id : 0..2);

However, the syntax check of Spin Version 6.4.6 -- 2 December 2016 says:
[quote]Error: bad index in for-construct sector[/quote]

This error does not occur if I do the translation by hand as described at http://spinroot.com/spin/Man/select.html:

	  x[0].y[0].BlkId = 0;
	  do
	  :: (x[0].y[0].Id < 3) -> x[0].y[0].Id++
	  :: break
	  od

Now the syntax check of Spin Version 6.4.6 -- 2 December 2016 says:
[quote]No Syntax Error.[/quote]

Offline

#5 2017-08-10 22:21:30

spinroot
forum
Registered: 2010-11-18
Posts: 695
Website

Re: select

yes, that's a weakness in the parser
i'll see if i can fix that -- but for the time being just use the explicit version

Offline

Board footer

Powered by FluxBB