The keyword is used to specify default behavior or to structure the alternatives of an alt statement. Altsteps are similar to functions but the altstep body defines a set of alternatives (cf. alt).
Related keywords:
altstep altstep_identifier ( [
altstep_parameter ... ] )[ runs on component_reference ] {
|
The altstep keyword introduces the altstep definition.
altstep_identifier is the name used to refer to the altstep. Must begin with a letter, may contain letters, numbers and underscore characters. According to the Naming convention, the prefix as_ is recommended.
altstep_parameter defines a formal parameter. The expression begins with an optional keyword indicating the parameter passing method (in, out or inout), continues with a reference to a built-in type (cf. their list) or a referenced type and ends by a parameter identifier. ... indicates that several parameters may be specified; they are separated by commas.
The optional keywords runs on makes component constants, variables, timers and ports visible inside the altstep
component_reference refers to the component. It is composed of two parts: the module identifier (may be omitted) and the component tpye identifier. The two parts are linked by a dot.
The optional local_definitions may include constants, variables and timers visible inside the altstep. It is not recommended to use them.
Each alternative begins with an optional guard_expression with the following options:
else keyword. The statement_block will always be executed. No condition may appear in the branch.
condition may be a communication or a timer event or the termination of a parallel test component. The following operations may be written here: receive, trigger, getcall, getreply, catch, check, timeout and done.
The optional statement_block contains one or more statements separated by semicolons. When empty, the curly brackets must be written.
... indicates that several branches may occur in the altstep body. There is no separator between them.
Example:
altstep as_AltSet_A(in integer pl_MyPar1) runs on MyComponentType_ct {
[] L1_PCO.receive { setverdict(pass) }
[x<=1] L2_PCO.receive { setverdict(inconc) }
[else] { setverdict(fail); stop }
};
The altstep called as_AltSet_A is defined. It has a read/only parameter called pl_MyPar1. The definitions made in the component MyComponentType_ct are visible to the altstep. The first branch is activated if a message has been received on port L1_PCO. The verdict is set to pass. The second branch is activated if a message has been received on port L2_PCO and the variable x is not grater then one. In this case the verdict is set to inconclusive. The last branch is activated if none of the ports has received a messages. The verdict is set to fail and test execution is stopped.
BNF definition of altstep