Due to the former tutorials you should be familiar with the steps to create the model with protocols, actors and state machines.
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.
Remember the logical steps: - create the model by the help of content assist (CTRL Space) - name the model, subsystem and top level actor - define the protocol (in this case it should be able to send a char, and to request the next char from the file reader) - create the structure (file reader and parser with an appropriate port, create the references and connect the ports) - create the state machines
Try to create the model by yourself and take the following solution as an example.
Structure:
File reader FSM:
Parser FSM:
The complete model can be found in org.eclipse.etrice.tutorials.c
Take a look at the file attribute of the file reader.
Attribute f:file ref
fopen expects a FILE *. f:file ref declares a variable f from type reference to file, which is a pointer to FILE.