%% %% Function-Call Code Generation for the DSP Blockset %% %% dsp_cache.tlc - Cache buffer/file management functions %% %% Author: D. Orofino %% Copyright (c) 1995-2000 The MathWorks, Inc. %% $Revision: 1.12 $ % $Date: 2000/05/09 19:17:00 $ %% Function: DSPCacheCGInlineFcnQuery ========================================= %% Abstract: %% Determine whether the block will inline the generated code %% and cache the decision into the block record %% %function DSPCacheCGInlineFcnQuery(block) void %if !EXISTS("CGInlineFcn") %assign CGInlineFcn = !FEVAL("dsp_cgfc",block,"need2GenerateFcnCall") %assign block = block + CGInlineFcn %endif %endfunction %% DSPCacheCGInlineFcnQuery %% Function: DSPCacheFcnCode ================================================== %% Abstract: %% Cache the generated function code for outputs, updates, etc. %% %function DSPCacheFcnCode(buffer) void %if !EXISTS("DSPFcnCode") %assign DSPFcnCode = buffer %assign ::CompiledModel = ::CompiledModel + DSPFcnCode %else %assign ::CompiledModel.DSPFcnCode = ... ::CompiledModel.DSPFcnCode + buffer %endif %endfunction %% DSPCacheFcnCode %% Function: DSPCacheFcnExtern ================================================== %% Abstract: %% Cache the extern function prototype %% %function DSPCacheFcnExtern(buffer) void %if !EXISTS("DSPFcnExtern") %assign DSPFcnExtern = buffer %assign ::CompiledModel = ::CompiledModel + DSPFcnExtern %else %assign ::CompiledModel.DSPFcnExtern = ... ::CompiledModel.DSPFcnExtern + buffer %endif %endfunction %% DSPCacheFcnExtern %% Function: DisplayBuildMsg ================================================== %% Abstract: %% Display a message to the user during the RTW-build process %% %function DisplayBuildMsg(msg) void %% Visible feedback to the user: %if RTWVerbose %selectfile STDOUT ### % %selectfile NULL_FILE %endif %endfunction %% DisplayBuildMsg %% Function: ExportHeaderFile ================================================== %% Abstract: %% %function ExportHeaderFile() void %return "%<::CompiledModel.Name>" + "_export.h" %endfunction %% ExportHeaderFile %% Function: DSPWriteFcnCode ================================================== %% Abstract: %% Write out the function code cache for outputs, updates, etc. %% %function DSPWriteFcnCode() void %if !WHITE_SPACE(::CompiledModel.DSPFcnCode) %openfile buffer %% Write out any extern function declarations needed %<::CompiledModel.DSPFcnExtern> %% Write out the function code: %<::CompiledModel.DSPFcnCode> %closefile buffer % %endif %% WHITE_SPACE %endfunction %% DSPWriteFcnCode %% Function: DSPCacheFcnProto ================================================= %% Abstract: %% Cache the generated function code prototypes for outputs, updates, etc. %% %function DSPCacheFcnProto(buffer) void %if !EXISTS("DSPFcnProto") %openfile header /* * DSP Blockset external definition prototypes * for automatically-generated function calls: */ %closefile header %assign DSPFcnProto = header %assign ::CompiledModel = ::CompiledModel + DSPFcnProto %endif %assign ::CompiledModel.DSPFcnProto = ... ::CompiledModel.DSPFcnProto + buffer %endfunction %% DSPCacheFcnProto %% Function: DSPWriteFcnProto ================================================= %% Abstract: %% Write out the function code prototypes cache for outputs, updates, etc. %% %function DSPWriteFcnProto() void %% Add a trailing comment to prototype definition section: %% %openfile buffer /* (end of DSP Blockset function definitions) */ %closefile buffer % %% Send the prototypes to the model.h file: %% % %endfunction %% DSPWriteFcnProto %% Function: DSPAnyFcnsGenerated ============================================== %% Abstract: %% Determine if any function code was generated for outputs, updates, etc. %% %function DSPAnyFcnsGenerated() void %if EXISTS("::CompiledModel.DSPFcnCode") %return !WHITE_SPACE(::CompiledModel.DSPFcnCode) %else %return 0 %endif %endfunction %% DSPAnyFcnsGenerated %% Function: DSPWriteFcns ===================================================== %% Abstract: %% Write out the function code and prototypes, and %% add the DSP function file to the RTW's source list, %% if any DSP functions were generated. %% %function DSPWriteFcns() void %if DSPAnyFcnsGenerated() % % %endif %endfunction %% DSPWriteFcns %% [EOF] dsp_cache.tlc