Previous Topic

Next Topic

Book Contents

Book Index

Create textual MSCs

In this exercise we create the text representation of the MSC specification for our example. The specification consists of two text files: an MSC describing the desired sequence of events for the example, and an HMSC describing the infinite repetition of this sequence.

  1. Create a new directory, which will be used as a working directory for this example. This working directory must contain source files of the model. Enter the working directory.
  2. Create a text file called ask.mpr in the working directory. It contains a single MSC Ask in the Phrase Representation (MSC PR) format. The file should be as follows:
  3. File ask.mpr

    mscdocument Ask;

    msc Ask;

    S: instance;

    A: instance;

    all: condition start;

    A: out Question to S;

    S: in Question from A;

    S: out Answer to A;

    A: in Answer from S;

    all: condition start;

    S: endinstance;

    A: endinstance;

    endmsc;

    The corresponding Graphical Representation (MSC GR format) looks like this:

    Embedded JPEG 75%

    The MSC Ask specifies two instances (A and S). This MSC has two shared conditions with the same name start at the beginning and at the end of the sequence of events. Between the two conditions there is an interchange with messages between the two instances.

  4. Create a text file called dialog.mpr in the working directory. It contains a single HMSC Dialog in the Phrase Representation (MSC PR) format.
  5. File dialog.mpr

    mscdocument Dialog;

    msc Dialog;

    expr L1;

    L1: condition start seq (L2);

    L2: (Ask) seq (L1);

    endmsc;

  6. The corresponding Graphical Representation (MSC GR format) looks like this:
  7. Embedded JPEG 75%

    This HMSC contains a start symbol at the top followed by symbol of condition start followed by an MSC reference symbol Ask and a flowline back to the start condition. Condition start in HMSC Dialog stands for both initial and final conditions in MSC Ask. This HMSC describes an infinite loop in which events from the MSC Ask are performed.

Summary

We have completed the textual specification of our model.

The next exercise will describe how to use the command-line interface to the KLOCwork MSC to SDL Synthesizer to produce an executable state machine model for our model.

See Also

Model: Simple dialog

Run the KLOCwork MSC to SDL Synthesizer

Inspect the synthesized SDL model