9.4 Create the model

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:

Try to create the model by yourself and take the following solution as an example.

Structure:

PIC

File reader FSM:

PIC

Parser FSM:

PIC

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.