⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example_file_process.tlc

📁 由MATLAB生成的SCI的源代码
💻 TLC
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% $RCSfile: example_file_process.tlc,v $
%% $Revision: 1.1.6.1 $
%% $Date: 2003/12/31 19:42:59 $
%%
%% Abstract:
%%   Example Real-Time Workshop Embedded Coder custom file processing template.
%%
%%   Note: This file can contain any valid TLC code, which Real-Time Workshop
%%   calls just prior to writing files to disk.  From here, you are able to
%%   augment the generated source code and create additional files.  Some of
%%   the more notable TLC functions to reference are documented in TLC file
%%   MATLAB/rtw/c/tlc/mw/codetemplatelib.tlc.
%%
%% Copyright 1994-2003 The MathWorks, Inc.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%selectfile NULL_FILE

%%  Uncomment this TLC line to execute the example
%%   ||   ||
%%   ||   ||
%%   \/   \/
%%  %assign ERTCustomFileTest = TLC_TRUE

%if EXISTS("ERTCustomFileTest") && ERTCustomFileTest == TLC_TRUE
  
  %% Need to set the template compliance flag before you can use the API
  %<LibSetCodeTemplateComplianceLevel(1)>

  %% Add a new C file timestwo.c and put a simple function in it
  
  %assign cFile = LibCreateSourceFile("Source", "Custom", "timestwo")
  
  %openfile tmwtypesBuf
  
  #include "tmwtypes.h"
  
  %closefile tmwtypesBuf
  
  %<LibSetSourceFileSection(cFile,"Includes",tmwtypesBuf)>

  %openfile tmpBuf

  /* Times two function */
  real_T timestwofcn(real_T input) {
    return (input * 2.0);
  }

  %closefile tmpBuf
  
  %<LibSetSourceFileSection(cFile,"Functions",tmpBuf)>
  
  %% Add a corresponding H file timestwo.h
  
  %assign hFile = LibCreateSourceFile("Header", "Custom", "timestwo")
  
  %openfile tmpBuf
  
  /* Times two function */
  extern real_T timestwofcn(real_T input);
  
  %closefile tmpBuf
  
  %<LibSetSourceFileSection(hFile,"Includes",tmwtypesBuf)>
  %<LibSetSourceFileSection(hFile,"Declarations",tmpBuf)>
  
  %% Add a #define to the model's public header file model.h
  
  %assign pubName = LibGetMdlPubHdrBaseName()
  %assign modelH  = LibCreateSourceFile("Header", "Simulink", pubName)
  
  %openfile tmpBuf

  #define ACCELERATION 9.81

  %closefile tmpBuf
  
  %<LibSetSourceFileSection(modelH,"Defines",tmpBuf)>
  
  %% Add a #define to the model's private header file model_private.h
  
  %assign prvName  = LibGetMdlPrvHdrBaseName()
  %assign privateH = LibCreateSourceFile("Header", "Simulink", prvName)
  
  %openfile tmpBuf

  #define STARTING_POINT 100.0

  %closefile tmpBuf
  
  %<LibSetSourceFileSection(privateH,"Defines",tmpBuf)>
  
  %% Add a #include to the model's C file model.c
  
  %assign srcName = LibGetMdlSrcBaseName()
  %assign modelC  = LibCreateSourceFile("Source", "Simulink", srcName)
  
  %openfile tmpBuf
  /* #include "mytables.h" */
  %closefile tmpBuf
  
  %<LibSetSourceFileSection(modelC,"Includes",tmpBuf)>
  
  %% Create a simple main.  Files are located in MATLAB/rtw/c/tlc/mw.
  
  %if LibIsSingleRateModel() || LibIsSingleTasking()
    %include "bareboard_srmain.tlc"
    %<FcnSingleTaskingMain()>
  %else
    %include "bareboard_mrmain.tlc"
    %<FcnMultiTaskingMain()>
  %endif
  
%endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -