%if !EXISTS("::_BLOCK_PRIVATE_API_")
%assign ::_BLOCK_PRIVATE_API_ = 1
%%
%%Copyright2019TheMathWorks,Inc.
%%
 
%%Function{BlockFunctions}:SLibInBlockScope
%%Abstract:
%%Returnstrueifthisfunctioniscalledwithinthescopeofablockrecord
%%
%function SLibInBlockScope() void
  %return EXISTS("BlockIdx")
%endfunction
 
 
%%Function{BlockFunctions}:SLibGetCurrentBlock
%%Abstract:
%%Returnsthecurrentblockrecordifthisfunctioniuscalledwithinthe
%%scopeofthisblockrecord.
%%
%function SLibGetCurrentBlock() void
  %assert SLibInBlockScope()
  %assign self = ::CompiledModel.System[BlockIdx[0]].Block[BlockIdx[2]]
  %if self.BlockIdx[0] != BlockIdx[0] || self.BlockIdx[2] != BlockIdx[2]
    %error "Incoherent BlockIdx in record."
  %endif
  %return self
%endfunction
 
%%Function{BlockFunctions}:SLibBlockIsExpressionCompliant
%%Abstract:
%%Returnstrueifthisblock'sTLCfileiscompliantwithexpressionfolding.
%%TobecalledinBlockSetupAndCompatiblityCheckfunction.
%%
%function SLibBlockIsExpressionCompliant(block) void
  %% TLCExprCompliant
  %return CGMODEL_ACCESS("Block.GetTLCExpressionCompliance", ...
    block.BlockIdx[0], block.BlockIdx[2])
%endfunction
 
%%Function{BlockFunctions}:SLibBlockIntegerDowncastRequired
%%Abstract:
%%Returnstrueifthisblockneedstoenforceintegerdowncastsforits
%%outputexpression.
%%
%function SLibBlockIntegerDowncastRequired(block) void
  %% EnforceIntegerDowncast
  %return CGMODEL_ACCESS("Block.GetEnforceIntegerDowncast", ...
    block.BlockIdx[0], block.BlockIdx[2])
%endfunction
 
%%Function{BlockFunctions}:SLibBlockGetCustomStorageComplianceLevel
%%Abstract:
%%Returnsthecustomstoragecompliancelevelofablock
%%
%function SLibBlockGetCustomStorageComplianceLevel(block) void
  %% CustomStorageClassCompliant
  %return CGMODEL_ACCESS("Block.GetCSCComplianceLevel", ...
    block.BlockIdx[0], block.BlockIdx[2])
%endfunction
 
%endif %% _BLOCK_PRIVATE_API_