%%
%%
%%
%%
%%Copyright1994-2003TheMathWorks,Inc.
%%
%%Abstract:generalrollertargetfile
 
%implements Roller "C"
  
%%
%%RollHeader
%%
%%Clanguage:
%%{
%%int_Ti;
%%
 
%function RollHeader(block, rollVars) Output
  %assign ::CompiledModel.LoopControlIdx = ::CompiledModel.LoopControlIdx + 1
  %assign loopVariable = "i%<LoopControlIdx>"
    {
      int_T %<loopVariable>;
  %return loopVariable
%endfunction %% Outputs
 
%%
%%LoopHeader
%%
%%real_Tnon-scalarU's;
%%real_Tnon-scalarP's;
%%real_Tnon-scalarY's;
%%
%%Clanguage:
%%for(i=0;i<numIterations;i++){
%%
 
%function LoopHeader(block, sigOffset, numIterations, rolledCount, rollVars) Output
  %assign loopVariable = "i%<LoopControlIdx>"
  %if 1 == block.HasSymbolicDims
    %assign numIterations = ...
      "(" + LibCGTypeSymbolicWidth(RollRegionTypes[rolledCount]) + ")"
    %assign symLoopOffset = ""
    %foreach rollIdx = rolledCount
      %if 0 == rollIdx
        %assign symLoopOffset = ...
          "(" + LibCGTypeSymbolicWidth(RollRegionTypes[rollIdx]) + ")"
      %else
        %assign symLoopOffset = symLoopOffset + ...
          "+(" + LibCGTypeSymbolicWidth(RollRegionTypes[rollIdx]) + ")"
      %endif
    %endforeach
    %assign ::CompiledModel.CurrentSymbolicLoopOffset = symLoopOffset
  %else
    %assign ::CompiledModel.CurrentSymbolicLoopOffset = ""
  %endif
  %assign ::CompiledModel.CurrentLoopOffset = sigOffset
  %<LibDeclareRollVariables(block, sigOffset, numIterations, rolledCount, rollVars)>
  for (%<loopVariable>=0; %<loopVariable> < %<numIterations>; %<loopVariable>++) {
%endfunction
 
%%
%%LoopTrailer
%%
%%Clanguage:
%%}
%%
 
%function LoopTrailer(block, sigOffset, numIterations, rolledCount, rollVars) Output
    }
%endfunction
 
%%
%%RollTrailer
%%
%%Clanguage:
%%}
%%
 
%function RollTrailer(block, rollVars) Output
    }
  %assign ::CompiledModel.LoopControlIdx = ::CompiledModel.LoopControlIdx - 1
  %if LoopControlIdx < 0
    %assign errTxt = "Something is wrong with loop rolling. " ...
      "LoopControlIdx = %<LoopControlIdx>"
    %<LibReportFatalError(errTxt)>
  %endif
%endfunction