%if EXISTS("_HOOKSLIB_") == 0
%assign _HOOKSLIB_ = 1
%include "sysbodlib.tlc"
%with ::CompiledModel
%addtorecord ::CompiledModel CustomCode /
{/
BeginGuard "";/
EndGuard "";/
HeaderFileHeader "";/
HeaderFileTrailer "";/
ExportFileHeader "";/
ExportFileTrailer "";/
PrmFileHeader "";/
PrmFileTrailer "";/
SourceFileHeader "";/
SourceFileTrailer "";/
RegFileHeader "";/
RegFileTrailer "";/
RegFcnHeader "";/
RegFcnBody "";/
RegFcnTrailer ""/
}
%if !EXISTS(Accelerator)
%assign Accelerator = 0
%endif
%if !EXISTS(AlwaysIncludeCustomSrc)
%assign AlwaysIncludeCustomSrc = 0
%endif
%if !Accelerator && EXISTS(CodeFormat)
%if !AlwaysIncludeCustomSrc && CodeFormat == "S-Function"
%assign CustomCode.BeginGuard = "#ifndef MATLAB_MEX_FILE" + "/n"
%assign CustomCode.EndGuard = "/n" + "#endif" + "/n"
%endif
%endif
%function (buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%if !WHITE_SPACE(cc.HeaderFileHeader)
%assign cc.HeaderFileHeader = cc.HeaderFileHeader + "/n" + buffer
%else
%assign cc.HeaderFileHeader = buffer
%endif
%break
%case "trailer"
%assign cc.HeaderFileTrailer = cc.HeaderFileTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibExportFileCustomCode(buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%assign cc.ExportFileHeader = cc.ExportFileHeader + buffer
%break
%case "trailer"
%assign cc.ExportFileTrailer = cc.ExportFileTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibPrmFileCustomCode(buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%assign cc.PrmFileHeader = cc.PrmFileHeader + buffer
%break
%case "trailer"
%assign cc.PrmFileTrailer = cc.PrmFileTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibSourceFileCustomCode(buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%if !WHITE_SPACE(cc.SourceFileHeader)
%assign cc.SourceFileHeader = cc.SourceFileHeader + "/n" + buffer
%else
%assign cc.SourceFileHeader = buffer
%endif
%break
%case "trailer"
%assign cc.SourceFileTrailer = cc.SourceFileTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibRegFileCustomCode(buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%assign cc.RegFileHeader = cc.RegFileHeader + buffer
%break
%case "trailer"
%assign cc.RegFileTrailer = cc.RegFileTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibMdlStartCustomCode(buffer, location) void
%assign ss = System[NumSystems-1]
%if IsModelReferenceTarget()
%assign ss = ::CompiledModel.System[GetBaseSystemIdx()]
%if !ISEMPTY(buffer)
%if !ISFIELD(ss, "StartMethodHasUserData")
%<SETFIELD(ss, "StartMethodHasUserData", TLC_TRUE)>
%else
%assign ss.StartMethodHasUserData = TLC_TRUE
%endif
%endif
%endif
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(ss, "StartHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(ss, "StartBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(ss, "StartTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibMdlTerminateCustomCode(buffer, location) void
%assign ss = System[GetBaseSystemIdx()]
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(ss, "TerminateHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(ss, "TerminateBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(ss, "TerminateTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibMdlRegCustomCode(buffer, location) void
%assign cc = ::CompiledModel.CustomCode
%switch location
%case "header"
%case "declaration"
%assign cc.RegFcnHeader = cc.RegFcnHeader + buffer
%break
%case "execution"
%assign cc.RegFcnBody = cc.RegFcnBody + buffer
%break
%case "trailer"
%assign cc.RegFcnTrailer = cc.RegFcnTrailer + buffer
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function FcnSystemHooksCacheAssert(system, func, tid) void
%if (LibGetSystemField(system, func + "CacheAssert" + tid))
%assign errTxt = "/n/nAttempt to place a user hook after a function has " ...
"been created: %<func> of %<system.Type> %<system.Name>./n/n" ...
"Note: This may be a result of function inlining."
%<LibReportError(errTxt)>
%endif
%endfunction
%function FcnErrorOutIfMethodHasNoUserData(system, fcnName, buffer) void
%if !WHITE_SPACE(buffer)
%if fcnName == "OutputUpdate"
%assign fcnName = "Output"
%endif
%if (system.RTWSystemCode == 0)
%assign fieldname = "%<fcnName>MethodHasUserData"
%if (ISFIELD(system,"HasRTWUserData") && GETFIELD(system, "HasRTWUserData")) || ...
(ISFIELD(system, fieldname) && GETFIELD(system, fieldname))
%else
%if EXISTS(Type) && EXISTS(Name)
%assign errTxt = "Block TLC file indirectly calls "...
"LibSystem%<fcnName>CustomCode to insert custom code. "...
"To ensure the custom code is inserted, "...
"the block TLC file must directly call this "...
"TLC function at least once or include the string "...
"'LibSystem%<fcnName>CustomCode()' in a TLC comment line "...
"at least once."
%<LibBlockReportError([], errTxt)>
%else
%assign errTxt = "LibSystem%<fcnName>CustomCode is called "...
"to insert custom code in system %<system.Name>. "...
"To ensure the custom code is inserted, "...
"this function must : /n"...
"1. be called from a block, or; /n"...
"2. be called to insert custom code for an non-inlined subsystem, or; /n" ...
"3. be called to insert custom code for a virtual subsystem that has RTWData."
%<LibReportError(errTxt)>
%endif
%endif
%endif
%if SLibSystemFcnPeriodicRateGrouping(system, fcnName)
%assign systemTid = LibGetSubsystemTID(system, TLC_FALSE)
%if TYPE(systemTid) == "Vector"
%assign callSites = system.CallSites
%assign graphParentSys = ::CompiledModel.System[callSites[0][2]]
%assign ssBlock = graphParentSys.Block[callSites[0][3]]
%assign customCodeTid = ssBlock.CustomCodeTID
%if ssBlock.firstEntryOfTsMapIsGCD == "no" && ...
!LibAsynchronousTriggeredTID(customCodeTid)
%assign errTxt = "LibSystem%<fcnName>CustomCode is called "...
"to insert custom code in system %<system.Name> for "...
"subsystem fundamental tid %<customCodeTid>. "...
"However, no block in the subsystem running at the rate of that tid. "...
"Consider putting a block running at subsystem fundamental rate in "...
"the system."
%<LibReportError(errTxt)>
%endif
%endif
%endif
%endif
%endfunction
%function LibSystemInitializeCustomCode(system, buffer, location) void
%<FcnSystemHooksCacheAssert(system, "Initialize", "")>
%<FcnErrorOutIfMethodHasNoUserData(system, "Initialize",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "InitializeHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "InitializeBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "InitializeTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibSystemOutputCustomCode(system, buffer, location) void
%assign fcnType = EXISTS(::BlockFcn) ? ::BlockFcn : "Unknown"
%assign tid = "%<SLibSystemTidUsedByRateGroup(system, fcnType)>"
%<FcnSystemHooksCacheAssert(system, "Output", tid)>
%<FcnErrorOutIfMethodHasNoUserData(system, "Output",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "OutputHeader" + tid, buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "OutputBody" + tid, buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "OutputTrailer" + tid, buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%if ::CompiledModel.NeedTID && !ISFIELD(system,"OutputCutomCodeNeedTid")
%addtorecord system OutputCutomCodeNeedTid TLC_TRUE
%endif
%endfunction
%function LibSystemUpdateCustomCode(system, buffer, location) void
%assign fcnType = EXISTS(::BlockFcn) ? ::BlockFcn : "Unknown"
%assign tid = "%<SLibSystemTidUsedByRateGroup(system, fcnType)>"
%<FcnSystemHooksCacheAssert(system, "Update", tid)>
%<FcnErrorOutIfMethodHasNoUserData(system, "Update",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "UpdateHeader" + tid, buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "UpdateBody" + tid, buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "UpdateTrailer" + tid, buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%if ::CompiledModel.NeedTID && !ISFIELD(system,"UpdateCutomCodeNeedTid")
%addtorecord system UpdateCutomCodeNeedTid TLC_TRUE
%endif
%endfunction
%function LibSystemDerivativeCustomCode(system, buffer, location) void
%if !ISFIELD(system, "DerivativeFcn") && system.Type != "root"
%assign errTxt = "System %<system.Name> does not have Derivatives function"
%<LibReportError(errTxt)>
%endif
%<FcnSystemHooksCacheAssert(system, "Derivative", "")>
%<FcnErrorOutIfMethodHasNoUserData(system, "Derivative",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "DerivativeHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "DerivativeBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "DerivativeTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibSystemEnableCustomCode(system, buffer, location) void
%if !ISFIELD(system, "EnableFcn") && system.Type != "root"
%assign errTxt = "System %<system.Name> does not have Enable function"
%<LibReportError(errTxt)>
%endif
%<FcnSystemHooksCacheAssert(system, "Enable", "")>
%<FcnErrorOutIfMethodHasNoUserData(system, "Enable",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "EnableHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "EnableBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "EnableTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function LibSystemDisableCustomCode(system, buffer, location) void
%if !ISFIELD(system, "DisableFcn") && system.Type != "root"
%assign errTxt = "System %<system.Name> does not have Disable function"
%<LibReportError(errTxt)>
%endif
%<FcnSystemHooksCacheAssert(system, "Disable", "")>
%<FcnErrorOutIfMethodHasNoUserData(system, "Disable",buffer)>
%switch location
%case "header"
%case "declaration"
%<LibAddToSystemField(system, "DisableHeader", buffer)>
%break
%case "execution"
%<LibAddToSystemField(system, "DisableBody", buffer)>
%break
%case "trailer"
%<LibAddToSystemField(system, "DisableTrailer", buffer)>
%break
%default
%assign errTxt = "Invalid location: %<location>"
%<LibReportError(errTxt)>
%endswitch
%endfunction
%function FcnSysNeedDumpUserCode(system) void
%if LibAsynchronousTriggeredTID(system.CurrentTID)
%assign subsysTid = FcnGetSubsystemCodeBufTID(system)
%return (SIZE(subsysTid,1) == 1) && (system.CurrentTID == subsysTid)
%else
%return 1
%endif
%endfunction
%function LibDumpSystemUserCode(system, function, location) Output
%assign fcnName = function
%if fcnName == "OutputUpdate"
%assign fcnName = "Output"
%endif
%assign fieldname = "%<fcnName>UserDataTLCInserted"
%assign codeEmittedThroughIR = TLC_TRUE
%if ISFIELD(system, fieldname)
%assign codeEmittedThroughIR = (GETFIELD(system, fieldname) ? TLC_TRUE : TLC_FALSE)
%endif
%if !codeEmittedThroughIR
%return LibDumpSystemUserCodeNoCheck(system, function, location)
%endif
%endfunction
%function FcnGetChilsSystemParamStructName(namePrefix, sysIdx) void
%assign childsysTypedefs = ""
%with ::CompiledModel.System[sysIdx]
%if NumChildSystems > 0
%assign childSystems = ChildPrmStructs
%openfile childsysTypedefs
%foreach childIdx = NumChildSystems
%assign chIdx = childSystems[childIdx]
%if chIdx[1] == 0 && chIdx[3] > -1
%assign blk = System[chIdx[2]].Block[chIdx[3]]
%with blk
%assign childSys = System[CallSiteInfo.SystemIdx]
%if childSys.StandaloneSubsystem
%continue
%endif
%if !SLibSystemHasOwnDataScope(childSys)
%<SLibLegacySymbolInSystem(namePrefix + ".", childSys.SystemIdx)>
%elseif childSys.HasParametersArg
%assign varGroupIdx = ...
FcnSysVarGroupIndex(childSys, "Parameter", blk.CallSiteIdx)
%assign indenti = SLibVarGroupName(varGroupIdx)
%<SLibLegacySymbolInSystem(namePrefix + indenti + ".", ...
childSys.SystemIdx)>
%endif
%endwith
%endif
%endforeach
%closefile childsysTypedefs
%endif
%endwith
%return childsysTypedefs
%endfunction
%function SLibLegacySymbolInSystem(namePrefix, sysIdx) void
%assign sysParams = ""
%openfile sysParams
%assign paramArg = System[sysIdx].Interface.ParameterArgDef
%if paramArg.NumFlatFields > 0
%with ::CompiledModel.ModelParameters
%foreach prmIdx = paramArg.NumFlatFields
%assign prm = Parameter[paramArg.FirstLocation + prmIdx]
%if (SLibGetWidthOfValueFromParamRec(prm) > 0) && !SLibOmitRecord(prm) && (prm.DefinedInLegacyCode == 1)
%assign prmWidth = LibGetRecordWidth(prm)
%if prmWidth > 0
%assign dataType = SLibGetRecordDataTypeName(prm, "")
%assign id = LibGetRecordIdentifier(prm)
%if prm.LegacyDimensions > 1
%assign legacyId = ""
%foreach i = prm.LegacyDimensions
%assign legacyId = legacyId + "[0]"
%endforeach
%assign legacyId = prm.LegacySymbolName + legacyId
%if prmWidth == 1
%<namePrefix>%<id> = (%<dataType>) %<legacyId>;
%else
%assign fakeBlk = BLOCK { Name "" }
%roll idx=[0:%], lcv=RollThreshold, fakeBlk, "Roller", ""
%assign locIdx = (lcv == "") ? idx : lcv
%<namePrefix>%<id>[%<locIdx>] = (%<dataType>) (&%<legacyId>)[%<locIdx>];
%endroll
%endif
%else
%if prmWidth == 1
%if prm.LegacyDimensions == 1
%<namePrefix>%<id> = (%<dataType>) %<prm.LegacySymbolName>[0];
%else
%<namePrefix>%<id> = (%<dataType>) %<prm.LegacySymbolName>;
%endif
%else
%assert prm.LegacyDimensions == 1
%assign fakeBlk = BLOCK { Name "" }
%roll idx=[0:%], lcv=RollThreshold, fakeBlk, "Roller", ""
%assign locIdx = (lcv == "") ? idx : lcv
%<namePrefix>%<id>[%<locIdx>] = (%<dataType>) %<prm.LegacySymbolName>[%<locIdx>];
%endroll
%endif
%endif
%endif
%endif
%endforeach
%endwith
%endif
%<FcnGetChilsSystemParamStructName(namePrefix, sysIdx)>
%closefile sysParams
%return sysParams
%endfunction
%function LibDumpLegacySymbolValueIntoRTP() void
%assign rootSystem = System[NumSystems-1]
%assign isPeriodicRateGrouping = SLibSystemFcnPeriodicRateGrouping(rootSystem, "Initialize")
%assign reqInsts = LibGetSystemField(rootSystem, "ReqRootPrmHdrDataInsts")
%with rootSystem.Interface
%assign tmpBlockFcn = ::BlockFcn
%assign ::BlockFcn = "Output"
%if !reqInsts.ParamsInst && FcnArgNeeded(ParameterArgDef,...
rootSystem.CurrentTID,isPeriodicRateGrouping) && !GenerateClassInterface
%assign rootPrmName = SLibGetParametersStruct(0) + "->"
%else
%assign oldStrNames = SLibGetOldStrNames()
%assign rootPrmName = SLibGetPrmsName(oldStrNames) + "."
%endif
%assign ::BlockFcn = tmpBlockFcn
%endwith
%return SLibLegacySymbolInSystem(rootPrmName, NumSystems-1)
%endfunction
%function LibDumpSystemUserCodeNoCheck(system, function, location) Output
%if !FcnSysNeedDumpUserCode(system)
%return
%endif
%if function == "OutputUpdate"
%assign function = "Output"
%endif
%assign tid = "%<SLibSystemTidUsedByRateGroup(system, function)>"
%if WHITE_SPACE(tid)
%assign code = LibGetSystemField(system, function + location)
%else
%assign code = LibGetSystemField(system, function + location) + ...
LibGetSystemField(system, function + location + tid)
%endif
%if !Accelerator
%if !WHITE_SPACE(code)
%if !ISEMPTY(tid)
/* user code (%<function> function %<location> for TID%<tid>) */
%else
/* user code (%<function> function %<location>) */
%endif
%endif
%if ISEQUAL(function, "Output") && ISEQUAL(location, "Trailer")
%if !WHITE_SPACE(code)
%<code>
%endif
%else
%if !WHITE_SPACE(code)
%<CustomCode.BeginGuard>%<code>%<CustomCode.EndGuard>
%endif
%if (system.SystemIdx == (NumSystems-1)) && InlineParameters == 0 && ...
ISEQUAL(function, "Initialize") && ISEQUAL(location, "Body")
%assign initrtp = LibDumpLegacySymbolValueIntoRTP()
%if !WHITE_SPACE(initrtp)
/* Copy legacy symbol value into global parameter structure */
%<initrtp>
%endif
%endif
%endif
%endif
%if (function == "Output" || function == "Update") && ...
ISFIELD(system, "%<function>CutomCodeNeedTid")
%<LibNeedTID()>
%endif
%<LibSetSystemField(system, function + "CacheAssert", TLC_TRUE)>/
%<LibSetSystemField(system, function + "CacheAssert" + tid, TLC_TRUE)>/
%endfunction
%function LibSystemUserCodeIsEmpty(system, function, location) Output
%if function == "OutputUpdate"
%assign function = "Output"
%endif
%if (function == "Output" || function == "Update") && ...
!FcnSysNeedDumpUserCode(system)
%return 1
%else
%assign tid = "%<SLibSystemTidUsedByRateGroup(system, function)>"
%if !WHITE_SPACE(tid)
%return WHITE_SPACE(LibGetSystemField(system, function + location)) && ...
WHITE_SPACE(LibGetSystemField(system, function + location + tid))
%else
%return WHITE_SPACE(LibGetSystemField(system, function + location))
%endif
%endif
%endfunction
%function LibDumpTopOfPrmFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.PrmFileHeader)
/* user code (top of parameter file) */
%<CustomCode.BeginGuard>%<CustomCode.PrmFileHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpBottomOfPrmFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.PrmFileTrailer)
/* user code (bottom of parameter file) */
%<CustomCode.BeginGuard>%<CustomCode.PrmFileTrailer>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpTopOfHdrFileUserCode() Output
%assert(!Accelerator)
%if !WHITE_SPACE(CustomCode.HeaderFileHeader)
/* user code (top of header file) */
%<CustomCode.BeginGuard>%<CustomCode.HeaderFileHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpBottomOfHdrFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.HeaderFileTrailer)
/* user code (bottom of header file) */
%<CustomCode.BeginGuard>%<CustomCode.HeaderFileTrailer>%<CustomCode.EndGuard>/
%endif
%endfunction
%function SLibDumpTopOfExportFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.ExportFileHeader)
/* user code (top of export header file) */
%<CustomCode.BeginGuard>%<CustomCode.ExportFileHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function SLibDumpBottomOfExportFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.ExportFileTrailer)
/* user code (bottom of export header file) */
%<CustomCode.BeginGuard>%<CustomCode.ExportFileTrailer>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpRegFcnUserDeclarationCode() Output
%if !WHITE_SPACE(CustomCode.RegFcnHeader) && ...
!Accelerator && !IsModelReferenceSimTarget()
/* user code (registration function declaration) */
%<CustomCode.BeginGuard>%<CustomCode.RegFcnHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibRegFcnUserDeclarationIsEmpty() Output
%return WHITE_SPACE(CustomCode.RegFcnHeader)
%endfunction
%function LibDumpRegFcnUserEntryCode() Output
%if !WHITE_SPACE(CustomCode.RegFcnBody) && ...
!Accelerator && !IsModelReferenceSimTarget()
/* user code (registration function entry) */
%<CustomCode.RegFcnBody>/
%endif
%endfunction
%function LibDumpRegFcnUserExitCode() Output
%if !WHITE_SPACE(CustomCode.RegFcnTrailer) && ...
!Accelerator && !IsModelReferenceSimTarget()
/* user code (registration function exit) */
%<CustomCode.RegFcnTrailer>/
%endif
%endfunction
%function LibDumpTopOfRegFileUserCode() Output
%if !WHITE_SPACE(CustomCode.RegFileHeader) && ...
!Accelerator && !IsModelReferenceSimTarget()
/* user code (top of registration file) */
%<CustomCode.BeginGuard>%<CustomCode.RegFileHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpBottomOfRegFileUserCode() Output
%if !WHITE_SPACE(CustomCode.RegFileTrailer) && ...
!Accelerator && !IsModelReferenceSimTarget()
/* user code (bottom of registration file) */
%<CustomCode.RegFileTrailer>/
%endif
%endfunction
%function LibDumpTopOfSourceFileUserCode() Output
%assert(!Accelerator)
%if !WHITE_SPACE(CustomCode.SourceFileHeader)
/* user code (top of source file) */
%<CustomCode.BeginGuard>%<CustomCode.SourceFileHeader>%<CustomCode.EndGuard>/
%endif
%endfunction
%function LibDumpBottomOfSourceFileUserCode() Output
%assert(!Accelerator && !IsModelReferenceSimTarget())
%if !WHITE_SPACE(CustomCode.SourceFileTrailer)
/* user code (bottom of source file) */
%<CustomCode.SourceFileTrailer>/
%endif
%endfunction
%endwith
%endif