From: Michal Sojka Date: Thu, 4 Jul 2013 21:47:25 +0000 (+0200) Subject: Copy default file processing template X-Git-Url: http://rtime.felk.cvut.cz/gitweb/ert_linux.git/commitdiff_plain/e64004b01ca1280acec0ddb8ce6d21d51cc8efeb?hp=8f90f30d7be0af2c82e51608ea08e07529e49496 Copy default file processing template --- diff --git a/ert_linux/ert_linux_file_process.tlc b/ert_linux/ert_linux_file_process.tlc new file mode 100644 index 0000000..1faad2e --- /dev/null +++ b/ert_linux/ert_linux_file_process.tlc @@ -0,0 +1,114 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% $RCSfile: example_file_process.tlc,v $ +%% $Revision: 1.1.6.5 $ +%% $Date: 2010/09/13 16:20:21 $ +%% +%% Abstract: +%% Example Embedded Coder custom file processing template. +%% +%% Note: This file can contain any valid TLC code, which Embedded Coder +%% executes just prior to writing the generated source files to disk. +%% Using this template "hook" file, you are able to augment the generated +%% source code and create additional files. +%% +%% Copyright 1994-2010 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 + % + + %% 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 + + % + + %openfile tmpBuf + + /* Times two function */ + real_T timestwofcn(real_T input) { + return (input * 2.0); + } + + %closefile 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 + + % + % + + %% 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 + + % + + %% 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 + + % + + %% 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 + + % + + %% Create a simple main. Files are located in MATLAB/rtw/c/tlc/mw. + + %if LibIsSingleRateModel() || LibIsSingleTasking() + %include "bareboard_srmain.tlc" + % + %else + %include "bareboard_mrmain.tlc" + % + %endif + +%endif