I got an issue with promela language when trying to compare an attribute, that is not the first one, of my structure.
Here is an example:
typedef Msg {
byte header;
byte content;
}
chan pipe = [5] of { Msg };
active proctype Receive () {
Msg r;
do
:: atomic { (pipe?[1,2]) -> printf("Receive"); pipe?r; }
// doesnt compile: :: atomic { (pipe?[-,2]) -> printf("Receive2"); pipe?r; }
// doesn't compile: :: atomic { (pipe?[, 2]) -> printf("Receive3"); pipe?r; }
// doesn't works: :: atomic { (pipe?[skip, 2]) -> printf("Receive4"); pipe?r; }
od
}
active proctype Emit () {
Msg m;
m.header=1; m.content=2;
// doesn't compile: m = { 1,2 };
do
:: atomic { printf ("emit\n"); pipe!m; }
od
}
The problem is very easy: i would like to compare only the content
attribute. Not the previous one (header
).
I tried some syntax, take a look at the grammar (http://spinroot.com/spin/Man/grammar.html#recv_args ... btw, i'm not an expert).
But i'm still stuck with this issue.
I use ispin to simulate and test.
Any helps would be great.
Thanks!