]> rtime.felk.cvut.cz Git - ert_linux.git/blob - ert_linux/ert_linux_file_process.tlc
Clean up generation of ert_main.c
[ert_linux.git] / ert_linux / ert_linux_file_process.tlc
1 %%
2 %% linux_ert_target_generate_main.tlc
3 %%
4 %% description:
5 %%  TLC script which generates ert_main function according
6 %%  to the number of model tasks and bitrates.
7 %%
8 %% date: 2nd Feb 2009
9 %%
10 %% author: Lukas Hamacek
11 %% e-mail: hamacl1@fel.cvut.cz
12 %% Department of Control Engineering
13 %% Faculty of Electrical Engineering
14 %% Czech Technical University in Prague
15 %%
16 %% modifications:
17 %%  2009/2/2 - Lukas Hamacek
18 %%      creation of the file
19 %%
20 %%  2009/4/18 - Lukas Hamacek
21 %%      asynchronous sample times checked and removed from generation
22 %%
23
24 %assign ert_mainC = LibCreateSourceFile("Source", "Custom", "ert_main")
25
26 %assign ::modelName = CompiledModel.Name
27 %assign ::solverMode = CompiledModel.FixedStepOpts.SolverMode
28 %assign ::fundamentalStepSize = CompiledModel.FundamentalStepSize
29 %assign ::numSampleTimes = CompiledModel.NumSynchronousSampleTimes
30 %assign ::extMode = CompiledModel.ConfigSet.ExtMode
31
32 %% parse sample times and offsets
33 %assign j = 0
34 %foreach i = CompiledModel.NumSampleTimes
35     %if CompiledModel.SampleTime[i].Asynchronous == "no"
36         %assign ::sampleTime%<j> = CompiledModel.SampleTime[i].PeriodAndOffset[0]
37         %assign ::offset%<j> = CompiledModel.SampleTime[i].PeriodAndOffset[1]
38         %assign j = j+1
39     %endif
40 %endforeach
41
42 %% Generate ert_main.c
43 %include "ert_linux_main.tlc"
44
45 %openfile buff
46 %<generateDeclarations()>
47 %closefile buff
48 %<LibSetSourceFileSection(ert_mainC, "Declarations", buff)>
49
50 %openfile buff
51 %<generateRtOneStep()>
52 %<generateMain()>
53 %closefile buff
54 %<LibSetSourceFileSection(ert_mainC, "Functions", buff)>