blob: fd3fadb023424d1f5f94d157a193524c08503f8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->
<html xmlns="http://www.w3.org/1999/xhtml"
>
<head><title>Create the model</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" />
<!-- xhtml,3,next,html -->
<meta name="src" content="etrice-doc.tex" />
<meta name="date" content="2013-03-25 22:23:00" />
<link rel="stylesheet" type="text/css" href="etrice-doc.css" />
</head><body
>
<!--l. 73--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse36.html" >next</a>] [<a
href="etrice-docse34.html" >prev</a>] [<a
href="etrice-docse34.html#tailetrice-docse34.html" >prev-tail</a>] [<a
href="#tailetrice-docse35.html">tail</a>] [<a
href="etrice-docch9.html#etrice-docse35.html" >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">9.4 </span> <a
id="x46-620009.4"></a>Create the model</h3>
<!--l. 75--><p class="noindent" >Due to the former tutorials you should be familiar with the steps to create the model
with protocols, actors and state machines.
</p><!--l. 77--><p class="noindent" >The basic idea of the exercise is to create a file reader actor, which is responsible to
open, close and read characters from the source file. Another actor receives the
characters and filters the comments (parser). The remaining characters (pure source
code) should be print out.
</p><!--l. 79--><p class="noindent" >Remember the logical steps: </p>
<ul class="itemize1">
<li class="itemize">create the model by the help of content assist (CTRL Space)
</li>
<li class="itemize">name the model, subsystem and top level actor
</li>
<li class="itemize">define the protocol (in this case it should be able to send a char, and to
request the next char from the file reader)
</li>
<li class="itemize">create the structure (file reader and parser with an appropriate port, create
the references and connect the ports)
</li>
<li class="itemize">create the state machines</li></ul>
<!--l. 88--><p class="noindent" >Try to create the model by yourself and take the following solution as an
example.
</p><!--l. 90--><p class="noindent" >Structure:
</p><!--l. 92--><p class="noindent" ><img
src="images/036-RemoveCommentC04.png" alt="PIC"
/>
</p><!--l. 95--><p class="noindent" >File reader FSM:
</p><!--l. 97--><p class="noindent" ><img
src="images/036-RemoveCommentC05.png" alt="PIC"
/>
</p><!--l. 100--><p class="noindent" >Parser FSM:
</p><!--l. 102--><p class="noindent" ><img
src="images/036-RemoveCommentC06.png" alt="PIC"
/>
</p><!--l. 105--><p class="noindent" >The complete model can be found in <span
class="ecti-1000">org.eclipse.etrice.tutorials.c</span>
</p><!--l. 107--><p class="noindent" >Take a look at the file attribute of the file reader.
</p>
<div class="verbatim" id="verbatim-20">
Attribute f:file ref
</div>
<!--l. 111--><p class="nopar" >
</p><!--l. 113--><p class="noindent" ><span
class="ecti-1000">fopen </span>expects a <span
class="ecti-1000">FILE *</span>. <span
class="ecti-1000">f:file ref </span>declares a variable <span
class="ecti-1000">f </span>from type reference to <span
class="ecti-1000">file</span>,
which is a pointer to <span
class="ecti-1000">FILE</span>.
</p>
<!--l. 116--><div class="crosslinks"><p class="noindent">[<a
href="etrice-docse36.html" >next</a>] [<a
href="etrice-docse34.html" >prev</a>] [<a
href="etrice-docse34.html#tailetrice-docse34.html" >prev-tail</a>] [<a
href="etrice-docse35.html" >front</a>] [<a
href="etrice-docch9.html#etrice-docse35.html" >up</a>] </p></div>
<!--l. 116--><p class="noindent" ><a
id="tailetrice-docse35.html"></a> </p>
</body></html>
|