%selectfile NULL_FILE
%if EXISTS("_FORMATRTM_") == 0
%assign _FORMATRTM_ = 1
%function SLibGenRTMCompatibleMacros() void
%openfile tmpBuf
%if isRSim && !IsModelReferenceTarget()
%if RTWCAPI
#ifndef rtmGetDataMapInfo
# define rtmGetDataMapInfo(rtm) (*%<RSimRTWCAPIVarPtr>)
#endif
#ifndef rtmSetDataMapInfo
# define rtmSetDataMapInfo(rtm, val) (%<RSimRTWCAPIVarPtr> = &val)
#endif
%else
#ifndef rtmGetDataMapInfo
# define rtmGetDataMapInfo(rtm) %<SLibGetNullDefinitionFromTfl()>
#endif
#ifndef rtmSetDataMapInfo
# define rtmSetDataMapInfo(rtm, val)
#endif
%endif
%endif
%closefile tmpBuf
%return tmpBuf
%endfunction
%function SLibGenRTMTypedefAndMacros() void
%assign ret = ["", "", ""]
%openfile bufTypes
%openfile bufMacros
%openfile bufDecls
%if GenRTModel
%selectfile bufTypes
%<RTMGenRtMdlTypedef()>/
%assign ::CompiledModel.EmptyRealTimeObject = ...
::CompiledModel.EmptyRealTimeObject || SLibSuppressRTMDeclaration()
%if !::CompiledModel.EmptyRealTimeObject
%if SLibIsERTCodeFormat()
%if !MultiInstanceERTCode && !IsModelReferenceTarget()
%selectfile bufDecls
/* Real-time Model object */
%if ::GenCPP
#ifdef __cplusplus
%<::ExternCPrefix> {
#endif
%endif
%openfile decls
%if SLibAutosarCompilerAbstractionRequired()
%<SLibAutosarCompilerAbstractionForDataDecl(TLC_FALSE, ::tSimStructType, TLC_TRUE, TLC_TRUE,RTMGetModelSS(), "DataGlobal")>;
%else
%<::tSimStructType> *const %<RTMGetModelSS()>;
%endif
%closefile decls
%<SLibApplyMemSecToDataDecl(decls, "MemSecDataConstants", RTMGetModelSS())>
%if ::GenCPP
#ifdef __cplusplus
}
#endif
%endif
%endif
%else
%assign rtModelObjType = ::tSimStructType
%selectfile bufDecls
/* Simulation structure */
extern %<rtModelObjType> *const %<RTMGetModelSS()>;
%endif
%endif
%selectfile bufMacros
/* Macros for accessing real-time model data structure */
%assign macroLocation = (SLibIsERTCodeFormat()) ? "PUBLIC" : ""
%<RTMGenMacroDefines(macroLocation)>/
%if ::CompiledModel.RTWStatesLogging==1 && MatFileLogging
#define UseMMIDataLogging
%endif
%if (!GenerateGRTWrapper && !GenerateSampleERTMain && !EmptyRealTimeObject)
%if !UsingMalloc
%if ("%<::CompiledModel.Name>_M" != "%<::tSimStruct>")
#define %<::CompiledModel.Name>_M (%<::tSimStruct>)
%endif
%else
%if ("%<::CompiledModel.Name>_M_TYPE" != "%<::tSimStructType>")
#define %<::CompiledModel.Name>_M_TYPE %<::tSimStructType>
%endif
%endif
%endif
%if (xPC == 1)
%if ("rtModel_%<::CompiledModel.Name>" != "%<::tSimStructType>")
#define rtModel_%<::CompiledModel.Name> %<::tSimStructType>
%endif
%endif
%if (!SLibIsERTCodeFormat() || GenerateGRTWrapper) && GenRTModel
/* Definition for use in the target main file */
#define %<::CompiledModel.Name>_rtModel %<::tSimStructType>
%endif
%else
%assign rootSystem = System[NumSystems-1]
%assign reqInsts = LibGetSystemField(rootSystem, "ReqRootPrmHdrDataInsts")
%selectfile bufMacros
%if (::CompiledModel.RTWStatesLogging==1) && MatFileLogging
#define UseMMIDataLogging
%endif
%<SLibGenRTMCompatibleMacros()>
%if reqInsts.SimStructInst
%selectfile bufDecls
%if ::GenCPP
#ifdef __cplusplus
%<::ExternCPrefix> {
#endif
%endif
/* Simulation Structure */
extern %<rtModelObjType> *const %<RTMGetModelSS()>;
%if ::GenCPP
#ifdef __cplusplus
}
#endif
%endif
%endif
%endif
%closefile bufDecls
%closefile bufMacros
%closefile bufTypes
%assign ret[0] = bufTypes
%assign ret[1] = bufMacros
%assign ret[2] = bufDecls
%return ret
%endfunction
%function SLibGenRTModelHFile() void
%if (!SLibIsERTCodeFormat() || ...
(GRTInterface && !GenerateSampleERTMain) || ...
!SLibIsERTTarget()) && ...
!IsModelReferenceTarget()
%if GenRTModel || isRSim
%openfile tmpBuf
/*
* rtmodel.h:
*
%<SLibCommonHeaderInfo()>/
*/
%closefile tmpBuf
%<SLibCacheCodeToFile("rtmodel_hdr_ban", tmpBuf)>
%openfile tmpBuf
/*
* Includes the appropriate headers when we are using rtModel
*/
#include "%<Name>.h"
#define GRTINTERFACE %<::GRTInterface>
%if SLibFcnProtoCtrlActive()
#define MODEL_STEP_FCN_CONTROL_USED 1
%endif
%if MultiInstanceERTCode && !::GRTInterface
%if SLibIsERTTarget()
%if ::CompiledModel.RootIOFormat == "Individual arguments"
%assign rootLevelIO = 0
%elseif ::CompiledModel.RootIOFormat == "Structure reference"
%assign rootLevelIO = 1
%else
%assign rootLevelIO = 2
%endif
%else
%assign rootLevelIO = 2
%endif
/*
* ROOT_IO_FORMAT: 0 (Individual arguments)
* ROOT_IO_FORMAT: 1 (Structure reference)
* ROOT_IO_FORMAT: 2 (Part of model data structure)
*/
# define ROOT_IO_FORMAT %<rootLevelIO>
%endif
%assign macroComment = "/* Macros generated for backwards compatibility */"
%if !RTMMdlStopReqIsReqFcn()
%assign macros = ""
%assign macName = "rtmGetStopRequested"
%assign macros = macros + "#ifndef %<macName>/n"
%assign macros = macros + "# define %<macName>(rtm) "
%assign macros = macros + "((void*) 0)/n"
%assign macros = macros + "#endif/n/n"
%<macroComment>
%<macros>
%endif
%closefile tmpBuf
%<SLibCacheCodeToFile("rtmodel_hdr_incl", tmpBuf)>
%endif
%endif
%endfunction
%function SLibGenRTModelSrcFile() void
%if !SLibIsERTTarget() && SLibNeedWrapperStepFcn()==2
%openfile tmpBuf
/*
* rtmodel.%<::LangFileExt>:
*
%<SLibCommonHeaderInfo()>/
*/
%closefile tmpBuf
%<SLibCacheCodeToFile("rtmodel_src_ban", tmpBuf)>
%openfile tmpBuf
#include "rtmodel.h"
%closefile tmpBuf
%<SLibCacheCodeToFile("rtmodel_src_incl", tmpBuf)>
%endif
%endfunction
%endif