%% $RCSfile: fcncallconfig.tlc,v $
%% $Revision: 1.11 $ 
%% $Date: 2002/01/06 04:20:29 $
%%
%% Pete Szpak
%% November 24, 1997
%% Copyright 1994-2002 The MathWorks, Inc.
%%
%% Abstract:
%%   Target file for the function-call configuration block

%implements fcncallconfig "C"
 
%% Function: ProcessRTWData ===================================================
%% Abstract:
%%      Configure the function-call subsystem
%%
%function ProcessRTWdata(rtwData, system) void
  %if system.Type != "function-call"
    %if system.Type == "root"
      %assign sysName = CompiledModel.Name
    %else
      %assign sysName = LibUnmangledPathName(Name)
    %endif
    %openfile errTxt
    
    
    Invalid use of the function-call configuration block.
    
    The Function-call Configuration block is only valid inside
    function-call subsystems.
    
    See system: %<sysName>
    %closefile errTxt
    %<LibReportError(errTxt)>
  %endif

  %%
  %% Public:  FcnVisibility == "1"
  %% Private: FcnVisibility == "2"
  %%
  %if FcnVisibility == "2"
    %<LibAddToSystem(system, "MakeFcnLocal", TLC_TRUE)>
  %endif

  %%
  %% Use Block Name:    FcnName == "1"
  %% Keep Mangled Name: FcnName == "2"
  %%
  %if FcnName == "1" && !Accelerator
    %assign sysIdx = system.CallSites[0][2]
    %assign blkIdx = system.CallSites[0][3]
    %assign ssBlock = System[sysIdx].Block[blkIdx]
    %assign sysName = SYSNAME(ssBlock.Name)
    %assign name = sysName[1]
    %%
    %% Block name is not valid C
    %%
    %if !LibIsValidCVariable(name)
      %openfile errTxt
      
      
      Invalid function name specified.
      
      You have specified a function-call subsystem to use
      the name of the block as the name of the function,
      however, the block name is not valid C
      
      Attempted Name: %<name>
      
      Rename Block: %<LibUnmangledPathName(ssBlock.Name)>
      %closefile errTxt
      %<LibReportError(errTxt)>
    %else
    %endif
    %%
    %% Rename function name
    %%
    %assign system.OutputUpdateFcn = name
  %endif
    
%endfunction

%% [EOF] fcncallconfig.tlc
