%% 
%% $Revision: 1.1.6.7.2.1 $
%% 
%%
%% Copyright 1994-2004 The MathWorks, Inc.
%%
%% Abstract:
%%      Library with support for logging
%%

%if EXISTS("_LOGSUP_") == 0
%assign _LOGSUP_ = 1

%% Function: SLibGenLogVarCreate ===============================================
%% Abstract:
%%   Generate code for creating a log variable
%%
%function SLibGenLogVarCreate(lv, name, dType, log, cmplx, frame, nCols, ...
  nDims, dims, maxRows, decim, ts, appendToLogVarsList) Output
  %%
  %assert(!IsModelReferenceTarget())
  
  %assign stepSize = 0.0
  %if !isRSimWithSolverModule %% assert !IsModelReferenceTarget
    %if CodeFormat == "Embedded-C"
      %assign stepSize = RTMGet("StepSize0")
    %else
      %assign stepSize = RTMGet("StepSize")
    %endif
  %endif
  %%
  %<lv> = %<tCreateLogVar>(
             %<RTMGetLoggingObject()>,
             %<RTMGet("TFinal")>,
             %<stepSize>,
             &(%<RTMGetErrStat()>),
             "%<name>",
             %<dType>,
             %<log>,
             %<cmplx>,
             %<frame>,
             %<nCols>,
             %<nDims>,
             %<dims>,
             %<maxRows>,
             %<decim>,
             %<ts>,
             %<appendToLogVarsList>);
  %%
%endfunction %% SLibGenLogVarCreate


%% Function: SLibGenStructLogVarCreate =========================================
%% Abstract:
%%   Generate code for creating a struct log variable
%%
%function SLibGenStructLogVarCreate(lv, name, logTime, maxRows, decim, ts, ...
  sigInfo, bName) Output
  %%
  %assert(!IsModelReferenceTarget())
  %assign stepSize = 0.0
  %if !isRSimWithSolverModule  %% assert !IsModelReferenceTarget
    %if CodeFormat == "Embedded-C"
      %assign stepSize = RTMGet("StepSize0")
    %else
      %assign stepSize = RTMGet("StepSize")
    %endif
  %endif
  %%
  %<lv> = %<tCreateStructLogVar>(
             %<RTMGetLoggingObject()>,
               %<RTMGet("TFinal")>, 
               %<stepSize>, 
               &(%<RTMGetErrStat()>), 
               "%<name>", 
               %<logTime>, 
               %<maxRows>, 
               %<decim>, 
               %<ts>,
               %<sigInfo>, 
               %<bName>);
  %%
%endfunction %% SLibGenStructLogVarCreate


%% Function: SLibGenLogVarUpdate ===============================================
%% Abstract:
%%   Generate code for updating an log variable
%%
%function SLibGenLogVarUpdate(logVar, inpPtr) Output
  %%
  %<tUpdateLogVar>((LogVar *)%<logVar>, %<inpPtr>);
  %%
%endfunction %% SLibGenLogVarUpdate


%% Function: SLibGenStructLogVarUpdate =========================================
%% Abstract:
%%   Generate code for updating an log variable
%%
%function SLibGenStructLogVarUpdate(logVar, tPtr, inpPtr) Output
  %%
  %<tUpdateStructLogVar>((StructLogVar *)%<logVar>, %<tPtr>, %<inpPtr>);
  %%
%endfunction %% SLibGenStructLogVarUpdate


%% Function: SLibGenTXYLogVarUpdate ============================================
%% Abstract:
%%   Generate code for updating an log variable
%%
%function SLibGenTXYLogVarUpdate() Output
  %%
  rt_UpdateTXYLogVars(%<RTMGetLoggingObject()>, %<RTMGet("TPtr")>);
  %%
%endfunction %% SLibGenTXYLogVarUpdate


%% Function: SLibGenSigLogVarUpdate ============================================
%% Abstract:
%%   Generate code for updating an log variable
%%
%function SLibGenSigLogVarUpdate() Output
  %%
  %if MatFileSignalLogging
    rt_UpdateSigLogVars(%<RTMGetLoggingObject()>, %<RTMGet("TPtr")>);
  %endif
  %%
%endfunction %% SLibGenSigLogVarUpdate


%% Function: SLibGenLoggingStart ===============================================
%% Abstract:
%%   Generate code for starting logging
%%
%function SLibGenLoggingStart() Output
  %%
  %if RTWCAPIStates
    rt_FillStateSigInfoFromMMI(%<RTMGetLoggingObject()>,&(%<RTMGetErrStat()>));
  %endif
  %if MatFileSignalLogging
    rt_FillSigLogInfoFromMMI(%<RTMGetLoggingObject()>,&(%<RTMGetErrStat()>));
  %endif
  rt_StartDataLogging(%<RTMGetLoggingObject()>, ...
    %<RTMGet("TFinal")>, %<RTMGet("StepSize0")>, &(%<RTMGetErrStat()>));
  %%
%endfunction %% SLibGenLoggingStart


%% Function: SLibGenLoggingStop ================================================
%% Abstract:
%%   Generate code for stopping logging
%%
%function SLibGenLoggingStop(file) Output
  %%
  %if RTWCAPIStates
    rt_CleanUpForStateLogWithMMI(%<RTMGetLoggingObject()>);
  %endif
  %if MatFileSignalLogging
    rt_CleanUpForSigLogWithMMI(%<RTMGetLoggingObject()>);
  %endif
  rt_StopDataLogging(%<file>, %<RTMGetLoggingObject()>);
  %%
%endfunction %% SLibGenLoggingStop

%endif %% _LOGSUP_

%% [EOF] logsup.tlc
