%if EXISTS("_EXTMODETASKLIB_") == 0
%assign _EXTMODETASKLIB_ = 1
%function SLibWriteExtModeTaskInfoFile() void
%selectfile STDOUT
%if RTWVerbose
### Creating extmode_task_info.m.
%endif
%selectfile NULL_FILE
%openfile ExtModeTaskInfoDotM = "extmode_task_info.m"
function [taskInfo, numtask, isDeploymentDiagram]=extmode_task_info()
%assign stOneBased = 1
%assign isDeploymentDiagram = LibIsDeploymentDiagram()
%assert !isDeploymentDiagram
%foreach st = NumSampleTimes
%if !ISINF(SampleTime[st].PeriodAndOffset[0])
taskInfo(%<stOneBased>).samplePeriod = %;
taskInfo(%<stOneBased>).sampleOffset = %;
%if EXISTS(SampleTime[st].Priority)
taskInfo(%<stOneBased>).taskPrio = %;
%else
taskInfo(%<stOneBased>).taskPrio = 0;
%endif
%if ISEQUAL(1, %<stOneBased>)
taskInfo(%<stOneBased>).taskName = 'BaseRate';
%else
%assign tmprate = stOneBased - 1
taskInfo(%<stOneBased>).taskName = ['SubRate' '%<tmprate>'];
%endif
taskInfo(%<stOneBased>).entryPoints = {};
%assign stOneBased = stOneBased + 1
%endif
%endforeach
%assign ntask = stOneBased - 1
%if ISEQUAL(0, ntask)
taskInfo(1).samplePeriod = %;
taskInfo(1).sampleOffset = %;
taskInfo(1).taskPrio = 0;
taskInfo(1).taskName = 'BaseRate';
taskInfo(1).entryPoints = {};
%assign ntask = 1
%endif
numtask = %<ntask>;
for i = 1:numtask
if ( 0 == isnumeric(taskInfo(i).samplePeriod) )
taskInfo(i).samplePeriod = evalin('base', 'str2double(taskInfo(i).samplePeriod)');
end
if ( isempty(taskInfo(i).taskName) )
taskInfo(i).taskName = ['AutoGen' i ];
end
end
isDeploymentDiagram = %<isDeploymentDiagram>;
end
%closefile ExtModeTaskInfoDotM
%selectfile NULL_FILE
%endfunction
%endif