%% ============================================================================
%% 
%% $Revision: 1.1.6.5 $ 
%% 
%%
%% Abstract:
%%   This file calls a number of functions to setup various TLC globals and 
%%   CompiledModel fields. The functions called in this file can be found
%%   in setuplib.tlc.
%%

%% Copyright 1994-2003 The MathWorks, Inc.
%%


%selectfile NULL_FILE

%include "setuplib.tlc"

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

%% ============================================================================
%% Setup basic global defaults
%%
%<SLibSetupBasicDefaults()>

%% =============================================================================
%% Setup defaults that help perform diagnostics of the code generation process.
%% These defaults do not affect the generated code.
%% ----------------------------------------------------------------------
%% Setting             Default-Value
%% ----------------------------------------------------------------------
%% RTWVerbose              1
%% GenerateReport          0
%% ShowObsoleteWarnings    0
%% WarnNonSaturatedBlocks  2
%% ----------------------------------------------------------------------
%%
%<SLibSetupDiagnosticDefaults()>

%% ============================================================================
%% Load all the function libraries
%%
%<SLibSetupPrintStatusMsgs("libload")>
%include "funclib.tlc"

%% ============================================================================
%% Setup ERT related features
%%
%<SLibERTFeatureSetup()>

%% ============================================================================
%% Setup options that determine the layout of the code. These are options that
%% are shared across all code formats
%% ----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% GenerateComments                   1
%% ForceParamTrailComments            0
%% ShowEliminatedStatements           1 (C), 0 (Ada)
%% HaveSeparateSourceFiles            0
%% ProtectCallInitFcnTwice            1
%% GenerateInterfaceAPI               0
%% GenerateASAP2                      0
%% InlineParameters                   0
%% InlineInvariantSignals             1
%% ZeroInternalMemoryAtStartup        1
%% ZeroExternalMemoryAtStartup        1
%% MaxStackSize                       rtInf
%% MaxStackVariableSize               rtInf
%% FullRootOutportVector              0
%% roundingConvention                 (Ada only)
%% EnforceIntegerDowncast             1
%% InitFltsAndDblsToZero              1
%% DoAsserts                          0
%% RateGroupingCode                   0
%% ----------------------------------------------------------------------
%%
%<SLibSetupLayoutOptions()>

%% ============================================================================
%% Setups the code format and associated fields and variables
%% ----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% CodeFormat                         RealTime
%% PreStructPragma                    ""
%% PostStructPragma                   ""
%% ----------------------------------------------------------------------
%%
%<SLibSetupCodeFormat()>

%% ============================================================================
%% Setups root model methods
%% ----------------------------------------------------------------------
%<SLibRootSystemMethodProps()>

%% ============================================================================
%% Setup fields that track the progress of code generation. These are fields
%% that are for internal use of the TLC code
%<SLibSetupCodeGenTrackingFields()>

%% ============================================================================
%% Setup information needed to support the %roll construct
%% ----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% RollThreshold                      5
%% ----------------------------------------------------------------------
%%
%<SLibSetupRollingInfo()>

%% =============================================================================
%% Setup data and state logging info
%%----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% MatFileLogging                  0
%% LogVarNameModifier              rt_
%% ----------------------------------------------------------------------
%%
%<SLibSetupLoggingInfo()>

%% =============================================================================
%% Sets up fields for various Identifiers used in the generated code.
%% Some of these fields are set up on the basis of the specific code format
%%----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% tRealPart                       re
%% tImagPart                       im
%% PrefixModelToStructs            1
%% <Number of vars based on code format>
%% ----------------------------------------------------------------------
%%
%<SLibSetupCodeIdentifiers()>

%% =============================================================================
%% Setup LibSrc function names
%%
%<SLibSetupLibSrcFcnNames()>

%% =============================================================================
%% Perform validation of CompiledModel
%% - Check if there are algebraic loops in model
%%
%<SLibCheckCompiledMdl()>

%% =============================================================================
%% Setup datatype info
%%
%<SLibSetupDatatypeInfo()>

%% =============================================================================
%% Do checks pertaining to particular code formats
%%
%<SLibSetupDoCodeFmtChecks()>


%% =============================================================================
%% Setup special case absolute time instances
%%----------------------------------------------------------------------
%% Setting                         Default-Value
%% ----------------------------------------------------------------------
%% ForceAbsoluteTime               0
%% ----------------------------------------------------------------------
%%
%<SLibSetupAbsoluteTime()>


%% ============================================================================
%% Setup vars for setting up the C APIs for monitoring block IO and tuning prms
%% at run-time
%%
%<SLibSetupCAPI()>
%<SLibSetupBIOAPI()>
%<SLibSetupPrmAPI()>

%% ============================================================================
%% Setup properties for fixed point data types
%%
%if EXISTS("_FIXPTLIB_")
  %<FixPt_GlobalSetup()>
%endif

%<SLibSetupCustomCode()>

%% =============================================================================
%% Include Code Format specific library
%%
%with CompiledModel
  %switch CodeFormat
    %case "RealTime"
      %include "srtlib.tlc"
      %break
    %case "RealTimeMalloc"
      %include "mrtlib.tlc"
      %break
    %case "S-Function"
      %if !Accelerator
      %include "sfcnlib.tlc"
      %else
	%include "accellib.tlc"
      %endif
      %break
    %case "Embedded-C"
      %include "ertlib.tlc"
      %break
    %default
      %assign errTxt = "Unknown CodeFormat: %<CodeFormat>"
      %<LibReportFatalError(errTxt)>
  %endswitch
  %%
  %% universal pass through model to setup code generation and allow
  %% users to cache custom code using the BlockInstanceSetup and 
  %% BlockTypeSetup functions.
  %%
  %include "commonpass.tlc"
%endwith

%% =============================================================================
%% Setup and check custom storage classes
%%
%assign ::BlockFcn = "GlobalMap"
%<SLibSetupAndCheckCustomSC()>
%assign ::BlockFcn = "Unknown"

%% =============================================================================
%% Setup  TLC replacement v-table default function strings
%%
%<SLibSetupTLCvtable()>

%% =============================================================================
%% Setup TLC code profiling  
%%
%<SLibSetupProf()>

%endif %% _COMMONSETUP_

%% [EOF] commonsetup.tlc
