Salut Jean-Marc,
>If I understand well the standard when the default mechanism is invoked it
>should check first "MyAltstep1" and then "MyAltstep2".
>
>But in my case, it never check my second default because my first default is
>matching with all the possible events.
>
Which is the intent. Defaults are executed in the order in which they are found
in the list of active defaults.
The order in which defaults are verified is dependent on the order in which you
have activated and deactivated your defaults.
Newly added defaults are always appended to the list of active defaults. When
you deactivate a default, it is simply removed from the active list of defaults.
Activating a previously deactivated default always causes it to be appended to
the end of the default list, irrespective of where it might have existed before.
The list of defaults is dynamically updated as you activate and deactivate
defaults.
code default list
activate (def1) def1 .
activate (def2) def1, def2 .
activate (def3) def1, def2, def3 .
deactivate( def1) def2, def3 .
activate (def1) def2, def3, def1 .
Which defaults you activate first will depend on the purpose of your default.
The behaviour you specify in one default, may very well cause any other defaults
coming after it to become
decode, as in your case. So you have judge carefully the order
in which you activate your defaults.
>altstep MyAltstep1() runs on MyComponentType {
>
> [] any port.receive { // Do something }
>
> [] any timer.timeout { // Do something }
>
>}
The above default is a catch all. Any default activated after
this is basically dead code. These defaults will never be
executed... Like I said, you need to be aware of what is
inside the various defaults. Sometimes, you get unexpected,
or unwanted behaviour.
You pose two questions which are unclear.
>How I should write my TTCN3 to describe such behavior.
Which behaviour do you wish to describe?
>I would like understand why the list is not check in the other way.
In which other way? Do you mean, first verify the last activated default? If
so, the standard does not speficy the order of evaluation to be as such. Then
again, you could modify the run time behaviour in your tool to implement such a
behaviour... However, I think it is better if you rethink the activation order
of your defaults to achieve the needed behaviour. Just switch the activation
order of MyAltstep1()
and MyAltstep2().
Hope this helps.
Ciao,
Claude.
--
Claude Desroches email:CDesroche@aol.com
Conformance Technologies Ltd. phone: +49 30 9606 7986
685 Cedar Point Road fax: +49 30 9606 7987
Penetanguishene Ontario, mobile 0174 701 6792
Canada
Solonplatz 3/2
13088 Berlin
Germany