### 9.15 Mscgen Backwards Compatibility

Msc-generator was forked (and completely re-written) from mscgen version 0.08 and is a superset of the language of that version even today. During the years the original tool has developed quite a lot and now contains features that are not present or not compatible with that of Msc-generator. From version 4.5 Msc-generator aims to support all the features and syntax of mscgen to provide a true superset of features. Since there are conflicts in the syntax, full support is possible only in a special mscgen compatibility mode of Msc-generator.

By default, Msc-generator enters this mode, if the chart text starts with `msc {`. This is because mscgen requires you to start your chart like this, but Msc-generator does not59. You can force or prevent mscgen compatibility mode using appropriate command-line switches (`--force-mscgen` and `--prevent-mscgen`, respecively) or preference settings in the GUI. Also, on the GUI, the `mscgen-compat` indicator of the status bar turns to red in compatibility mode.

Msc-generator attempts to be liberal in what it accepts in both modes. That is, Msc-generator attributes are available also in mscgen mode (So you can, for example, use vertical constructs, hide or show entities, let entities be defined later or use the style mechanism.) Similar, mscgen attribute names and chart options are understood even when not in mscgen compatibility mode. This includes the hashmark syntax for color specifications, like `text.color="#c0ffff"`. For attributes or other syntax I intend to deprecate a warning is given.

A major tool for backwards compatibility with mscgen is the `mscgen` partial design, which contains new styles for arrowhead symbols. E.g., the symbol `->` represents a filled triangle arrowhead in Msc-generator, while it represents a half line arrowhead in mscgen. Using the `mscgen` design via the `msc+=mscgen;` command sets (when not in mscgen compatibility mode) the styles as used by mscgen. In mscgen compatibility mode, such styles are automatically applied.

Some mscgen attributes are interpreted by Msc-generator not exactly the same way as in the mscgen tool due to the different internal workings. The below hold for both the compatibility and regular modes of Msc-generator.

- The `textbgcolor` attribute of mscgen in empty boxes is interpreted as `fill.color`, as in mscgen. It is not possible to have a different fill color and text background for an empty box.
- The `wordwraparcs` chart option is interpreted as `text.wrap`, resulting in word wrapping for all text. Since in mscgen boxes are word wrapped by default, the `mscgen` design sets word wrappin in the `emptybox` style. This command sets it everywhere (as intended in mscgen).
- The `arcskip` attribute of mscgen makes an arrow slant down to the vertical position of the next arrow. This is approximated with a fixed `slant_depth`.
- Line breaks in quoted strings are accepted by mscgen (and by Msc-generator in mscgen mode). This is not the case when not in mscgen mode. In general I think it is a bad idea. Use the `\n` text formatting escape or use colon labels.

There are a few conflicting syntax though that must be interpreted differently in the two modes.

- The arrows symbols `::` and `:>` exist only in mscgen mode. These conflict with colon label syntax. You can use `==>` instead of the latter one in both mscgen mode and outside (to represent a double line arrow with a filled triangle arrowhead).
- The `-x` arrow symbol is used to indicate loss in mscgen mode. This arrowsymbol is not understood outside the mscgen mode. Replace it with `->*` instead.
- The `->*` broadcast arrow construct is interpreted in mscgen mode only, since in Msc-generator it means a lost arrow. Even in mscgen mode it is interpreted as a broadcast arrow only if there is no target entity after the asterisk. If there is one (which is not valid mscgen syntax), it is interpreted as a lost arrow according to Msc-generator syntax.
- The `hscale` attribute in mscgen mode is interpreted as setting the width of the chart to 600 pixels times the specified value. In Msc-generator it is interpreted as setting the inter-entity distance to 130 pixels times the specified value (and can of course be set to `auto` to automatically select the spacing between the entities). Due to user feedback the `hscale` attribute is interpreted the Msc-generator way even in compatibility mode60.
- Since `--`, `..` and `==` are arrow symbols (representing headless arrows, essentially just lines), they cannot be used to define empty boxes in mscgen mode using syntax like this: `a==b [label="label"];`, because in mscgen this is a line, not an empty box. So you need to prepend the `box` keyword to indicate that this is supposed to be a box.

#### Footnotes

##### (59)

If you specify a design, like `msc=qsd {` Msc-generator will NOT enter compatibility mode.

##### (60)

After all the point of the compatibility mode is to enable migration towards Msc-generator features.