Technical data
2 
Working with the Target Language
2-22
%roll
The syntax of the %roll multiple inclusion directive is:
%roll ident1 = roll-vector-exp, ident2 = threshold-exp, ...
block-exp [, type-string [,exp-list] ]
%break
%continue
%endroll
This statement uses the roll-vector-exp to expand the body of the %roll 
statement multiple times as in the 
%foreach statement. If a range is provided 
in the 
roll-vector-exp and that range is larger than the threshold-exp 
expression, the loop will roll. When a loop rolls, the body of the loop is expanded 
once and the identifier (
ident2) provided for the threshold expression is set to 
the name of the loop control variable. If no range is larger than the specified 
rolling threshold, this statement is identical in all respects to the 
%foreach 
statement.
For example:
%roll Idx = [ 1 2 3:5, 6, 7:10 ], lcv = 10, ablock
%endroll
In this case, the body of the %roll statement expands 10 times as in the 
%foreach statement since there are no regions greater than or equal to 10. Idx 
counts from 1 to 10, and 
lcv is set to the null string, "".
When the Target Language Compiler determines that a given block will roll, it 
performs a 
GENERATE_TYPE function call to output the various pieces of the loop 
(other than the body). The default type used is 
Roller; you can override this 
type with a string that you specify. Any extra arguments passed on the 
%roll 
statement are provided as arguments to these special-purpose functions. The 
called function is one of these four functions:
RollHeader(block, …). This function is called once on the first section of this roll 
vector that will actually roll. It should return a string that is assigned to the 
lcv within the body of the %roll statement.
LoopHeader(block, StartIdx, Niterations, Nrolled, …). This function is called once for 
each section that will roll prior to the body of the 
%roll statement.










