Technical data
Compiler Directives
2-23
LoopTrailer(block, Startidx, Niterations, Nrolled, …). This function is called once for 
each section that will roll after the body of the 
%roll statement.
RollTrailer(block, …). This function is called once at the end of the %roll 
statement if any of the ranges caused loop rolling.
These functions should output any language-specific declarations, loop code, 
and so on as required to generate correct code for the loop. An example of a 
Roller.tlc file is:
%implements Roller "C"
%function RollHeader(block) Output
{
int i;
%return ("i")
%endfunction
%function LoopHeader(block,StartIdx,Niterations,Nrolled) Output
  for (i = %<StartIdx>; i < %<Niterations+StartIdx>; i++)
{
%endfunction
%function LoopTrailer(block,StartIdx,Niterations,Nrolled) Output
}
%endfunction
%function RollTrailer(block) Output
}
%endfunction
Note:  The Target Language Compiler function library provided with RTW 
has the capability to extract references to the Block I/O and other 
RTW-specific vectors that vastly simplify the body of the 
%roll statement. 
These functions include 
LibBlockInputSignal, LibBlockOutputSignal, 
LibBlockParameter, LibBlockRWork, LibBlockIWork, LibBlockPWork, and 
LibDeclareRollVars. For more details on these functions and other Simulink 
functions, see the section on Loop Rolling beginning on page 3-44 along with 
the “Target Language Compiler Function Library Reference” chapter. This 
library also includes a default implementation of Roller.tlc.










