Technical data
Compiler Directives
2-21
identifier2 specifies the identifier to be used for testing whether the loop was
rolled within the body. For example,
%for Index = <NumNonVirtualSubsystems>3, rollvar="i"
{
int i;
for (i=0; i< %<NumNonVirtualSubsystems>; i++)
{
%body
x[%<rollvar>] = system_name[%<rollvar>];
%endbody
}
}
%endfor
If the number of nonvirtual subsystems (NumNonVirtualSubsystems) is greater
than or equal to 3, the loop is rolled, causing all of the code within the loop to
be generated exactly once. In this case,
Index = 0.
If the loop is not rolled, the text before and after the body of the loop is ignored
and the body is generated
NumNonVirtualSubsystems times.
This mechanism gives each individual loop control over whether or not it
should be rolled.
Note: The %for directive is functional, but it is not recommended. Rather, use
%roll, which provides the same capability in a more open way. RTW does not
make use of the %for construct.