%selectfile NULL_FILE
%if EXISTS("_ERTREG_") == 0
%assign _ERTREG_ = 1
%realformat "CONCISE"
%assign rootSystem = ::CompiledModel.System[::CompiledModel.NumSystems-1]
%assign S = ::tSimStruct
%if GenerateClassInterface
%assign backUpCPPObjectName = ::CPPObjectName
%assign ::CPPObjectName = "this"
%endif
%openfile regCodeOnlyBuffer
%assign emitReg = !UsingMalloc
%with System[GetBaseSystemIdx()]
%<LibDumpERTAndModelrefRegExecution(emitReg, TLC_TRUE)>/
%endwith
%<LibDumpBlockInstanceData()>/
%if !LibIsDeploymentDiagram() && ...
!SLibIsCPPEncapMdlRefBuild()
%<LibDumpSFunctionRegistration()>/
%endif
%if !LibRegFcnUserDeclarationIsEmpty()
%<"{">
%<LibDumpRegFcnUserDeclarationCode()>
%endif
%<LibDumpRegFcnUserEntryCode()>/
%<LibDumpRegFcnUserExitCode()>/
%if !LibRegFcnUserDeclarationIsEmpty()
%<"}">
%endif
%closefile regCodeOnlyBuffer
%if !WHITE_SPACE(regCodeOnlyBuffer) && SLibGetDoesSelfExist()
%assign regCodeOnlyBuffer = "{/n" + regCodeOnlyBuffer + "/n}/n"
%endif
%openfile nonfiniteBuf
%if SLibERTNeedNonFiniteInit()
/* initialize non-finites */
%<LibGenMathFcnCall("initnonfinite", FcnGetDataTypeIdFromName("double"), ...
"sizeof(real_T)", "")>;/
%endif
%closefile nonfiniteBuf
%openfile nonfiniteBufAssignment
%<LibDumpNonFiniteAssignmentCache()>/
%closefile nonfiniteBufAssignment
%openfile regCodeBuffer
%if GenerateClassInterface && IsModelReferenceTarget()
%<nonfiniteBuf>
%<regCodeOnlyBuffer>
%<nonfiniteBufAssignment>
%else
%<nonfiniteBuf>
%<nonfiniteBufAssignment>
%<regCodeOnlyBuffer>
%endif
%closefile regCodeBuffer
%assign haveRegCode = !WHITE_SPACE(regCodeBuffer)
%addtorecord ::CompiledModel RegCodeBuffer regCodeBuffer
%undef regCodeBuffer
%undef nonfiniteBuf
%undef regCodeOnlyBuffer
%assign mdlInitCodeBuffer = ""
%assign localVars = ...
LibGetSystemLocalVars(rootSystem, "ModelInitialize", "") + ...
SLibGetFcnLocalVars(rootSystem, "ModelInitialize", "")
%openfile mdlInitCodeBuffer
%if !ISEMPTY(localVars)
{
%<localVars>
%<LibDumpSystemFcn(rootSystem, "ModelInitialize")>
}
%else
%<LibDumpSystemFcn(rootSystem, "ModelInitialize")>
%endif
%closefile mdlInitCodeBuffer
%assign hasMdlInitCode = !WHITE_SPACE(mdlInitCodeBuffer)
%assign startCodeBuffer = ""
%if hasMdlInitCode
%assign haveStartCode = TLC_FALSE
%else
%openfile startCodeBuffer
%assign localVars = IsModelReferenceTarget() ? "" : ...
LibGetSystemLocalVars(rootSystem, "Start", "") + ...
SLibGetFcnLocalVars(rootSystem, "Start", "")
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Start", "Header")
%<"{">
%<localVars>
%endif
%if !IsModelReferenceTarget()
%<LibDumpSystemUserCode(rootSystem, "Start", "Header")>/
%<LibDumpSystemUserCode(rootSystem, "Start", "Body")>/
%<LibDumpSystemFcn(rootSystem, "Start")>/
%<LibDumpSystemUserCode(rootSystem, "Start", "Trailer")>/
%endif
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Start", "Header")
%<"}">
%endif
%closefile startCodeBuffer
%assign haveStartCode = !WHITE_SPACE(startCodeBuffer)
%endif
%assign codeBuf = ""
%openfile codeBuf
%assign localVars = IsModelReferenceTarget() ? "" : ...
LibGetSystemLocalVars(rootSystem, "Enable", "") + ...
SLibGetFcnLocalVars(rootSystem, "Enable", "")
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Enable", "Header")
%<"{">
%<localVars>
%endif
%<LibDumpSystemUserCode(rootSystem, "Enable", "Header")>/
%<LibDumpSystemUserCode(rootSystem, "Enable", "Body")>/
%if !IsModelReferenceTarget()
%<LibDumpSystemFcn(rootSystem, "Enable")>/
%endif
%<LibDumpSystemUserCode(rootSystem, "Enable", "Trailer")>/
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Enable", "Header")
%<"}">
%endif
%closefile codeBuf
%assign haveEnableCode = !WHITE_SPACE(codeBuf)
%assign enabCodeBuffer = codeBuf
%assign codeBuf = ""
%openfile codeBuf
%assign localVars = IsModelReferenceTarget() ? "" : ...
LibGetSystemLocalVars(rootSystem, "Initialize", "") + ...
SLibGetFcnLocalVars(rootSystem, "Initialize", "")
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Initialize", "Header")
%<"{">
%<localVars>
%endif
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Header")>/
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Body")>/
%if !IsModelReferenceTarget()
%<LibDumpSystemFcn(rootSystem, "Initialize")>/
%endif
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Trailer")>/
%if !IsModelReferenceTarget()
%<CachedCodeBuffsForRootSys.FirstInitCondition>/
%endif
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Initialize", "Header")
%<"}">
%endif
%closefile codeBuf
%assign haveInitCode = !WHITE_SPACE(codeBuf)
%assign initCodeBuffer = codeBuf
%assign codeBuf = ""
%openfile codeBuf
%assign localVars = IsModelReferenceTarget() ? "" : ...
LibGetSystemLocalVars(rootSystem, "SystemInitialize", "") + ...
SLibGetFcnLocalVars(rootSystem, "SystemInitialize", "")
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Initialize", "Header")
%<"{">
%<localVars>
%endif
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Header")>/
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Body")>/
%if !IsModelReferenceTarget()
%<LibDumpSystemFcn(rootSystem, "SystemInitialize")>/
%endif
%<LibDumpSystemUserCode(rootSystem, "Initialize", "Trailer")>/
%if !IsModelReferenceTarget()
%<CachedCodeBuffsForRootSys.FirstInitCondition>/
%endif
%if !ISEMPTY(localVars) || ...
!LibSystemUserCodeIsEmpty(rootSystem, "Initialize", "Header")
%<"}">
%endif
%closefile codeBuf
%assign haveSystemInitCode = !WHITE_SPACE(codeBuf)
%assign systemInitCodeBuffer = codeBuf
%assign codeBuf = FncGenInitStatesInRootStart()
%assign InitStatesBuffer = codeBuf
%if GenerateGRTWrapper
%openfile GRTBuffer
%if UsingMalloc
%assign arg = "%<::tSimStructType>* %<::tSimStruct>"
%assign farg = ::tSimStruct
%else
%assign arg = "void"
%assign farg = ""
%endif
%if !UsingMalloc
%assign fcnName = "MdlInitialize"
%assign fcnReturns = "%<SLibGetGRTWrapperLinkage()> void"
%assign fcnParams = arg
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract ""; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Initialize"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<addToBackupCodeMetrics(rootSystem, "ModelInitialize", fcnName, "")>
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Pre")>/
%<fcnReturns> %<fcnName>(%<fcnParams>) {
}
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Post")>/
%endif
%assign fcnName = "MdlStart"
%assign fcnReturns = "%<SLibGetGRTWrapperLinkage()> void"
%assign fcnParams = arg
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract ""; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Start"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<addToBackupCodeMetrics(rootSystem, "ModelInitialize", fcnName, "")>
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Pre")>/
%<fcnReturns> %<fcnName>(%<fcnParams>) {
%<GenerateModelInitFcnName()>(%<SLibModelFcnArgs("Initialize",TLC_TRUE,"")>);
}
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Post")>/
%closefile GRTBuffer
%assign ::CompiledModel.GRTWrapper = ::CompiledModel.GRTWrapper + GRTBuffer
%if UsingMalloc
%assign hasMdlInitCode = TLC_FALSE
%assign haveStartCode = TLC_FALSE
%assign haveInitCode = TLC_FALSE
%assign haveSystemInitCode = TLC_FALSE
%assign haveEnableCode = TLC_FALSE
%endif
%endif
%assign childCoderDataGroupAssignmentForRegistration = ""
%assign childCoderDataGroupAssignmentForRegistration = ...
::CompiledModel.ChildCoderDataGroupAssignmentForRegistration
%assign haveChildCoderDataGroupAssignmentForRegistration = ...
!WHITE_SPACE(childCoderDataGroupAssignmentForRegistration)
%assign childCoderDataGroupMemcpy = ""
%assign childCoderDataGroupMemcpy = ::CompiledModel.ChildCoderDataGroupMemcpy
%assign haveChildCoderDataGroupMemcpy = !WHITE_SPACE(childCoderDataGroupMemcpy)
%assign modelrefBuffer = ""
%assign modelrefTermBuffer = ""
%assign mdlRefBlks = ISFIELD(::CompiledModel,"ModelReferenceBlocks") ? ...
::CompiledModel.ModelReferenceBlocks : []
%assign tmpBlkFcn = ::BlockFcn
%assign ::BlockFcn = "Registration"
%assign modelrefBuffer = CallModelrefBlockRegFcns(mdlRefBlks)
%assign ::BlockFcn = tmpBlkFcn
%assign haveModelRefCode = !WHITE_SPACE(modelrefBuffer)
%if ISFIELD(::CompiledModel,"ModelReferenceBlocks")
%assign tmpBlkFcn = ::BlockFcn
%assign ::BlockFcn = "Terminate"
%assign modelrefTermBuffer = ...
CallModelrefBlockFreeFullPaths(::CompiledModel.ModelReferenceBlocks)
%assign ::BlockFcn = tmpBlkFcn
%endif
%assign haveModelRefTermCode = !WHITE_SPACE(modelrefTermBuffer)
%openfile includesBuffer
%if (ExtMode == 1) && !ExtModeXCP
%assign DataTypeTransHdr = LibGetDataTypeTransHdrBaseName()
%if !UsingMalloc
#include "%<DataTypeTransHdr>.h"
%else
%endif
%endif
%closefile includesBuffer
%<SLibCacheCodeToFile("baseMdl_src_incl", includesBuffer)>
%openfile UserCodeTopBuffer
%<LibDumpTopOfRegFileUserCode()>/
%closefile UserCodeTopBuffer
%<SLibCacheCodeToFile("custom_code_topOfSrc", UserCodeTopBuffer)>
%assign prevZCStateBuffer = SLibInitPrevZCSignalStates()
%if ::CompiledModel.StandaloneSubsystemTesting == 2
%addtorecord ::CompiledModel PrevZCStateBuffer prevZCStateBuffer
%endif
%assign havePrevZCBuffer = !WHITE_SPACE(prevZCStateBuffer)
%assign sysRegCall = GenStandaloneRegistrationFunction()
%addtorecord ::CompiledModel SystemRegistrationBuffer sysRegCall
%assign hasSSRegFcn = !WHITE_SPACE(sysRegCall)
%undef sysRegCall
%openfile fcnsBuffer
%if NumChildSFunctions && IsModelReferenceSimTarget()
%<SLibNoninlinedSfcnStaticFcn()>/
%endif
%if GenerateGRTWrapper
%<::CompiledModel.GRTWrapperFcnDef>
%endif
%assign fcnAbstract = "Model initialize function"
%assign mdlRegFcnHasBody = haveRegCode || MatFileLogging || haveStartCode || ...
haveSystemInitCode || ...
haveEnableCode || ExtMode || haveModelRefCode || ...
haveChildCoderDataGroupAssignmentForRegistration || ...
havePrevZCBuffer || hasSSRegFcn || hasMdlInitCode
%if mdlRegFcnHasBody
%openfile ModelInitializeBodyBuffer
%if CPPEncapNeedsLocalVars(TLC_FALSE)
%assign cppEncapLocalVars = SLibGetCPPEncapInitLocalVars(TLC_FALSE)
%if !WHITE_SPACE(cppEncapLocalVars)
%<cppEncapLocalVars>
%endif
%endif
%if IsModelReferenceTarget() && !GenerateClassInterface
%assign mrRootSys = System[GetBaseSystemIdx()]
%<FcnCacheMRRegFcnLocalVars(mrRootSys)>
%assign initVars = FcnDumpMRLocalVars(mrRootSys, "Registration", "")
%if !WHITE_SPACE(initVars)
%<initVars>
%endif
%endif
%openfile moreRegBuffer
%if haveChildCoderDataGroupAssignmentForRegistration
%<childCoderDataGroupAssignmentForRegistration>
%endif
%if haveModelRefCode
%<modelrefBuffer>/
%endif
%if !WHITE_SPACE(::CompiledModel.SystemRegistrationBuffer)
%<::CompiledModel.SystemRegistrationBuffer>/
%endif
%if MatFileLogging && !SeparateRegistrationFcn
/* Matfile logging */
%<SLibGenLoggingStart()>
%endif
%if ::GenerateGRTWrapper
/* Initialize Sizes */
%<LibDumpModelInitializeSizes()>
%endif
%closefile moreRegBuffer
%openfile tmpBuffer
%if IsModelReferenceTarget()
%if IsModelReferenceForASimstructBasedTarget() && RTMIsVarStepSolver()
%<FcnInitializeNoncontSignals()>
%endif
%assign baseSysIdx = GetBaseSystemIdx()
%assign tmpBlkFcn = ::BlockFcn
%assign ::BlockFcn = "Registration"
%assign globalVars = LibInitializeGlobalVars(System[baseSysIdx], "Registration")
%<globalVars>
%assign ::BlockFcn = tmpBlkFcn
%endif
%if CPPEncapNeedsLocalVars(TLC_FALSE)
%assign cppEncapCopyCode = SLibGetCPPEncapInitCopyCode(TLC_TRUE, TLC_FALSE)
%if !WHITE_SPACE(cppEncapCopyCode)
%<cppEncapCopyCode>
%endif
%endif
%if !::SeparateRegistrationFcn
%if !WHITE_SPACE(::CompiledModel.RegCodeBuffer)
/* Registration code */
%<::CompiledModel.RegCodeBuffer>/
%endif
%<moreRegBuffer>
%else
%assign ::CompiledModel.RegCodeBuffer = ::CompiledModel.RegCodeBuffer ...
+ moreRegBuffer
%endif
%if EXISTS(CompiledModel.SupportSimEventsRegistration)
/* Initialize Discrete Event Systems*/
sldeInitialize();
%endif
%if haveChildCoderDataGroupMemcpy
%<childCoderDataGroupMemcpy>
%endif
%if hasMdlInitCode
%<mdlInitCodeBuffer>/
%else
%if haveStartCode
%<startCodeBuffer>/
%endif
%endif
%if havePrevZCBuffer
%<prevZCStateBuffer>/
%endif
%if haveSystemInitCode
%<systemInitCodeBuffer>/
%endif
%if haveEnableCode && ExportFunctionsMode != 1
%<enabCodeBuffer>/
%endif
%<InitStatesBuffer>/
%closefile tmpBuffer
%if !SLibGetNeedFirstTime() && ...
!IsModelReferenceForASimstructBasedTarget() && SLibIncludeERTFirstTime()
(void)%<SLibFirstTime()>;
%elseif SLibGetNeedFirstTime()
boolean_T firstTime = true;
%endif
%<tmpBuffer>
%if ExportFunctionsMode == 1 && ...
RTMFirstInitCondFlagIsReqFcn()
/* End of first time initialization. */
%<RTMSet("FirstInitCond", 0)>;
%endif
%closefile ModelInitializeBodyBuffer
%elseif IsModelReferenceTarget() && GenerateClassInterface && ...
!LibGetSystemField(rootSystem, "ReqRootPrmHdrDataInsts").ParamsInst && ...
!SLibPrmBufferIsEmpty("SimulinkGlobal", "Instance")
%openfile ModelInitializeBodyBuffer
static const %<::tParametersType> %<::tParameters>_temp = {
%<SLibGetPrmBuffer("SimulinkGlobal", "Instance")>
}; /* Modifiable parameters */
/* Initialize tunable parameters */
%<::tParameters> = %<tParameters>_temp;
%closefile ModelInitializeBodyBuffer
%else
%openfile ModelInitializeBodyBuffer
%if !::CompiledModel.MultiInstanceERTCode && SLibIncludeERTFirstTime()
(void)%<SLibFirstTime()>;
%endif
%if ::CompiledModel.ModelRefSimpInterface && SLibGetDoesSelfExist()
(void) (%<tSimStruct>);
%endif
/* (no initialization code required) */
%if IsModelReferenceTarget()
%if ::CompiledModel.SLCI == "off"
%<SLibSetEmptyModelRefInitializeFcn()>
%endif
%endif
%closefile ModelInitializeBodyBuffer
%endif
%if GenerateClassInterface
%assign ::CPPObjectName = backUpCPPObjectName
%endif
%assign initNonEmpty = TLC_TRUE
%if IsModelReferenceTarget()
%assign fcnName = "%<GetModelRefRegistrationFcnName()>"
%assign fcnReturns = "void"
%if GenerateClassInterface
%assign tmpfcnName = "%<::CPPClassName>::initialize"
%assign fcnParams = ""
%else
%assign tmpfcnName = fcnName
%assign fcnParams = SLibModelReferenceRegFcnArgs()
%endif
%assign initNonEmpty = !SLibGetEmptyModelRefInitializeFcn()
%if initNonEmpty
%createrecord fcnRec {Name tmpfcnName; Returns fcnReturns; Params fcnParams; Abstract fcnAbstract; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Initialize"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<addToBackupCodeMetrics(rootSystem, "ModelInitialize", tmpfcnName, "")>
%if CGMODEL_ACCESS("CGModel.isIndividualFunctionMappingEnabled")
%<SLibGetFcnMemSecPragmaForFunction(fcnName, "Initialize", "", "Pre")>/
%else
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Pre")>/
%endif
%<fcnReturns> %<tmpfcnName>(%<fcnParams>)
{
%<ModelInitializeBodyBuffer>
}/
%endif
%else
%assign fcnName = GenerateModelInitFcnName()
%if GenerateClassInterface
%assign fcnName = "%<::CPPClassName>::initialize"
%endif
%assign fcnReturns = "void"
%if SLibIsERTFunctionStatic()
%assign fcnReturns = "static %<fcnReturns>"
%endif
%assign fcnParams = SLibModelFcnArgs("Initialize",TLC_FALSE,"")
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract fcnAbstract; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Initialize"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<addToBackupCodeMetrics(rootSystem, "ModelInitialize", fcnName, "")>
%if CGMODEL_ACCESS("CGModel.isIndividualFunctionMappingEnabled") || SLibAutosarActive()
%<SLibGetFcnMemSecPragmaForFunction(fcnName, "Initialize", "", "Pre")>/
%else
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Pre")>/
%endif
%<GenerateModelInitFcnHeader(fcnName)>
{
%if ::UsingMalloc == 1
%assign fcns = ["ModelInitialize", "Start", "Enable", "SystemInitialize"]
%openfile localVariables
%<SLibDumpLocalVariablesForBlockFcn(rootSystem, fcns)>
%closefile localVariables
%if !WHITE_SPACE(localVariables)
%<localVariables>
%endif
%<mdlInitCodeBuffer>/
%<startCodeBuffer>/
%<systemInitCodeBuffer>/
%<enabCodeBuffer>/
%<InitStatesBuffer>/
%if SLibAutosarActive()
%<SLibDumpUnusedParameterForInstanceHandle(fcns)>
%else
%<SLibDumpUnusedParameterForRTM(fcns)>
%endif
%else
%<GenerateModelInitFcnBody(rootSystem, fcnName, fcnReturns, fcnParams)>
%endif
}/
%endif
%if initNonEmpty
%if CGMODEL_ACCESS("CGModel.isIndividualFunctionMappingEnabled") || SLibAutosarActive()
%<SLibGetFcnMemSecPragmaForFunction(fcnName, "Initialize", "", "Post")>/
%else
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Post")>/
%endif
%endif
%assign ::DisableGenerated = 0
%if SLibMdlEnableDisablePermitted() && ...
!LibSystemFcnIsEmpty(rootSystem,"Disable")
%assign ::DisableGenerated = 1
%if !GenerateClassInterface
%assign fcnName = "%<Name>_disable"
%assign fcnParams = SLibModelFcnArgs("Disable",TLC_FALSE,"")
%else
%assign fcnName = "%<::CPPClassName>::disable"
%assign fcnParams = "void"
%endif
%assign fcnReturns = "void"
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract ""; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Disable"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%openfile localVariables
%if MultiInstanceERTCode && !GenerateClassInterface
%<SLibDumpLocalVariablesForBlockFcn(rootSystem,"Disable")>
%endif
%closefile localVariables
%<fcnReturns> %<fcnName>(%<fcnParams>)
{
%if !WHITE_SPACE(localVariables)
%<localVariables>
%endif
%<LibDumpSystemSSVars(rootSystem,"Disable")>/
%<LibGetSystemLocalVars(rootSystem,"Disable","")>
%<SLibGetFcnLocalVars(rootSystem,"Disable","")>
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Disable","Header")>/
%<LibDumpGlobalVars(rootSystem, "Disable")>/
%<LibDumpFcnBegin(rootSystem,"Disable")>/
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Disable","Body")>/
%<LibDumpSystemFcn(rootSystem,"Disable")>/
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Disable","Trailer")>/
%<SLibDumpUnusedParameterForRTM("Disable")>
}
%endif
%assign ::EnableGenerated = 0
%if SLibMdlEnableDisablePermitted() && ...
!LibSystemFcnIsEmpty(rootSystem,"Enable")
%assign ::EnableGenerated = 1
%if !GenerateClassInterface
%assign fcnName = "%<Name>_enable"
%assign fcnParams = SLibModelFcnArgs("Enable",TLC_FALSE,"")
%else
%assign fcnName = "%<::CPPClassName>::enable"
%assign fcnParams = "void"
%endif
%assign fcnReturns = "void"
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract ""; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Enable"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%openfile localVariables
%if MultiInstanceERTCode && !GenerateClassInterface
%<SLibDumpLocalVariablesForBlockFcn(rootSystem,"Enable")>
%endif
%closefile localVariables
%<fcnReturns> %<fcnName>(%<fcnParams>)
{
%if !WHITE_SPACE(localVariables)
%<localVariables>
%endif
%<LibDumpSystemSSVars(rootSystem,"Enable")>/
%<LibGetSystemLocalVars(rootSystem,"Enable","")>
%<SLibGetFcnLocalVars(rootSystem,"Enable","")>
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Enable","Header")>/
%<LibDumpGlobalVars(rootSystem, "Enable")>/
%<LibDumpFcnBegin(rootSystem,"Enable")>/
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Enable","Body")>/
%<LibDumpSystemFcn(rootSystem,"Enable")>/
%<LibDumpSystemUserCodeNoCheck(rootSystem,"Enable","Trailer")>/
%<SLibDumpUnusedParameterForRTM("Enable")>
}
%endif
%if !IsModelReferenceTarget()
%if !GenerateClassInterface
%assign fcnName = GenerateNonClassicInterfaceModelTermFcnName()
%else
%assign fcnName = "%<::CPPClassName>::terminate"
%endif
%<GenerateModelTermFcnBody(rootSystem, fcnName)>
%endif
%openfile RegBuffer
%if ::SeparateRegistrationFcn
%assign fcnName = Name
%assign fcnReturns = ::tSimStructType
%assign fcnParams = SLibModelFcnArgs("Registration",TLC_FALSE,"")
%if GenerateGRTWrapper
%assign fcnAbstract = "Registration function"
%else
%assign fcnAbstract = "Model data allocation function"
%endif
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract fcnAbstract; ...
Category "model"; GeneratedBy "ertreg.tlc"; ...
Type "Registration"; GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<SLibGetFcnMemSecPragma(Name, "MemSecFuncInitTerm", "Pre")>/
%if GenerateGRTWrapper
%<::ExternCPrefix> %<::tSimStructType> *%<Name>(%<fcnParams>) {
%else
%<::tSimStructType> *%<Name>(%<fcnParams>) {
%endif
%if UsingMalloc
%assign tmpBlkFcn = ::BlockFcn
%assign ::BlockFcn = "Registration"
%assign modelrefRefExecution = LibDumpERTAndModelrefRegExecution(TLC_TRUE, TLC_FALSE)
%if !ISEMPTY(modelrefRefExecution)
%<modelrefRefExecution>
%endif
%assign ::BlockFcn = tmpBlkFcn
%openfile localVariables
%<SLibDumpLocalVariablesForBlockFcn(rootSystem,"Registration")>
%closefile localVariables
%if !WHITE_SPACE(localVariables)
{
%<localVariables>
%endif
%<::CompiledModel.RegCodeBuffer>/
%if !WHITE_SPACE(localVariables)
}
%endif
%else
%if !WHITE_SPACE(::CompiledModel.RegCodeBuffer)
/* Registration code */
%<::CompiledModel.RegCodeBuffer>/
%endif
%endif
return %<S>;
}
%<SLibGetFcnMemSecPragma(Name, "MemSecFuncInitTerm", "Post")>/
%endif
%closefile RegBuffer
%if GenerateGRTWrapper
%assign ::SystemFcnsForArgAccess = "WrapperFcn"
%openfile GRTTerminateBuffer
%assign fcnName = "MdlTerminate"
%assign fcnReturns = "%<SLibGetGRTWrapperLinkage()> void"
%assign fcnParams = arg
%createrecord fcnRec {Name fcnName; Returns fcnReturns; Params fcnParams; Abstract ""; ...
Category "model"; GeneratedBy "ertreg.tlc"; Type "Terminate"; ...
GeneratedFor FcnGeneratedFor(rootSystem)}
%<SLibDumpFunctionBanner(fcnRec)>
%undef fcnRec
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Pre")>/
%<fcnReturns> %<fcnName>(%<fcnParams>) {
%if IncludeMdlTerminateFcn == 1
%<GenerateNonClassicInterfaceModelTermFcnName()>(%<SLibModelFcnArgs("Terminate",TLC_TRUE,"")>);
%endif
}
%<SLibGetFcnMemSecPragma(fcnName, "MemSecFuncInitTerm", "Post")>/
%closefile GRTTerminateBuffer
%assign ::CompiledModel.GRTWrapper = ::CompiledModel.GRTWrapper + GRTTerminateBuffer
%assign ::CompiledModel.GRTWrapper = ::CompiledModel.GRTWrapper + RegBuffer
/*========================================================================*
* Start of Classic call interface *
*========================================================================*/
%<::CompiledModel.GRTWrapper>
/*========================================================================*
* End of Classic call interface *
*========================================================================*/
%assign ::SystemFcnsForArgAccess = []
%else
%<RegBuffer>
%endif
%closefile fcnsBuffer
%<SLibCacheCodeToFile("baseMdl_fcn_defn", fcnsBuffer)>
%openfile UserCodeBottomBuffer
%<LibDumpBottomOfRegFileUserCode()>/
%closefile UserCodeBottomBuffer
%<SLibCacheCodeToFile("custom_code_userBottom", UserCodeBottomBuffer)>
%selectfile NULL_FILE
%endif