# with

The statement is used to associate attributes with TTCN-3 language elements. The syntax for the argument of the statement (i.e. the actual attributes) is defined as a free text string.

There are four kinds of attributes:

- display: allows the specification of display attributes related to specific presentation formats;
- encode: allows references to specific encoding rules;
- variant: allows references to specific encoding variants;
- extension: allows the specification of user-defined attributes.

Related keywords:

- display
- encode
- extension
- override
- variant:

### with { display | encode | variant | extension [ override ] [ (qualifier) ] "argument"};

- the optional override directive forces all contained types at all lower scopes to be forced to the specified attribute.

- the optional qualifier points out the entity for which the argument is valid.

- argument is a free-text string specifying the actual attribute.

It is possible to specify several arguments in one with statement by using semicolons to separate the groups of the attribute keyword, qualifier and argument.
When an attribute has more than one arguments, the arguments are separated by commas.

Example 1:

type record SinlgeRecord {
bitstring fram,
bitstring till
} with { variant (fram) "FIELDLENGTH(2)" }

The first field of the record (fram) will be coded on 2 bits.

Example 2:

type octetstring OCT10 with { variant "ALIGN(left)"; variant "FIELDLENGTH(10)" }

The octetstring OCT10 will be coded left-aligned on ten bits.

Example 3:

type integer NewInt with { variant "FIELDLENGTH(8), BITORDERINFIELD(msb)" }

The type NewInt will be coded on eight bit and the most significant bit will be sent first.

BNF definition of with