| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
<html> |
| 16 |
<head> |
| 17 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 18 |
<meta http-equiv="Content-Language" content="en-us"> |
| 19 |
<title>with</title> |
| 20 |
</head> |
| 21 |
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258"> |
| 22 |
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top> |
| 23 |
<tr> |
| 24 |
<td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td> |
| 25 |
</tr> |
| 26 |
</table> |
| 27 |
<table border="0" align="right" cellpadding="0" cellspacing="0"> |
| 28 |
<tr> |
| 29 |
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td> |
| 30 |
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td> |
| 31 |
<td><a href="while.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td> |
| 32 |
<td><a href="with_pwtc.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td> |
| 33 |
</tr> |
| 34 |
</table> |
| 35 |
<p><br clear="all"> |
| 36 |
</p> |
| 37 |
<hr> |
| 38 |
<h1>with</h1> |
| 39 |
<hr align="left" width="75%"> |
| 40 |
<p>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. |
| 41 |
<p>There are four kinds of attributes: |
| 42 |
<ul> |
| 43 |
<li><b><font face="Courier New" color="#003258" size="4">display</font></b>: allows the specification of display attributes related to specific presentation formats; </li> |
| 44 |
<li><b><font face="Courier New" color="#003258" size="4">encode</font></b>: allows references to specific encoding rules; </li> |
| 45 |
<li><b><font face="Courier New" color="#003258" size="4">variant</font></b>: allows references to specific encoding variants; </li> |
| 46 |
<li><b><font face="Courier New" color="#003258" size="4">extension</font></b>: allows the specification of user-defined attributes.</li> |
| 47 |
</ul> |
| 48 |
<p>Related keywords:</p> |
| 49 |
<ul> |
| 50 |
<li><a href="display.html"><b><font face="Courier New" color="#003258" size="4">display</font></b></a></li> |
| 51 |
<li><a href="encode.html"><b><font face="Courier New" color="#003258" size="4">encode</font></b></a></li> |
| 52 |
<li><a href="extension.html"><b><font face="Courier New" color="#003258" size="4">extension</font></b></a></li> |
| 53 |
<li><a href="override.html"><b><font face="Courier New" color="#003258" size="4">override</font></b></a></li> |
| 54 |
<li><a href="variant.html"><b><font face="Courier New" color="#003258" size="4">variant</font></b></a>:</li> |
| 55 |
</ul> |
| 56 |
<hr align="left" width="50%"> |
| 57 |
<div align="center"> |
| 58 |
<center> |
| 59 |
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4"> |
| 60 |
<tr> |
| 61 |
<td width="100%"> |
| 62 |
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>with { display</b></font> | <font face="Courier New" color="#003258" size="5"><b>encode</b></font> | <font |
| 63 |
face="Courier New" color="#003258" size="5"><b>variant</b></font> | <font face="Courier New" color="#003258" size="5"><b>extension</b></font> [ <font face="Courier New" color="#003258" size="5"><b>override</b></font> |
| 64 |
] [ <font face="Courier New" color="#003258" size="5"><b>(</b></font><i>qualifier</i><font face="Courier New" color="#003258" size="5"><b>)</b></font> ] <font face="Courier New" color="#003258" |
| 65 |
size="5"><b>"</b></font><i>argument</i><b><font face="Courier New" color="#003258" size="5">"};</font></b></h3> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
</table> |
| 69 |
</center> |
| 70 |
</div> |
| 71 |
<ul> |
| 72 |
<li> |
| 73 |
<p>the optional <b><font face="Courier New">override</font></b> directive forces all contained types at all lower scopes to be forced to the specified attribute.</p> |
| 74 |
</li> |
| 75 |
<li> |
| 76 |
<p>the optional <i>qualifier</i> points out the entity for which the argument is valid.</p> |
| 77 |
</li> |
| 78 |
<li> |
| 79 |
<p><i>argument</i> is a free-text string specifying the actual attribute.</p> |
| 80 |
</li> |
| 81 |
</ul> |
| 82 |
<p>It is possible to specify several arguments in one <b><font face="Courier New">with</font></b> statement by using semicolons to separate the groups of the attribute keyword, qualifier and |
| 83 |
argument. <br> |
| 84 |
When an attribute has more than one arguments, the arguments are separated by commas.</p> |
| 85 |
<hr align="left" width="50%"> |
| 86 |
<p>Example 1: |
| 87 |
<p><font face="Courier New">type record SinlgeRecord { <br> |
| 88 |
bitstring fram,<br> |
| 89 |
bitstring till<br> |
| 90 |
} with { variant (fram) "FIELDLENGTH(2)" }</font> |
| 91 |
<p>The first field of the record (fram) will be coded on 2 bits.</p> |
| 92 |
<hr align="left" width="25%"> |
| 93 |
<p>Example 2: |
| 94 |
<p><font face="Courier New">type octetstring OCT10 with { variant "ALIGN(left)"; variant "FIELDLENGTH(10)" }</font> |
| 95 |
<p>The octetstring OCT10 will be coded left-aligned on ten bits.</p> |
| 96 |
<hr align="left" width="25%"> |
| 97 |
<p>Example 3: |
| 98 |
<p><font face="Courier New">type integer NewInt with { variant "FIELDLENGTH(8), BITORDERINFIELD(msb)" }</font> |
| 99 |
<p>The type NewInt will be coded on eight bit and the most significant bit will be sent first.</p> |
| 100 |
<hr align="left" width="25%"> |
| 101 |
<hr align="left" width="25%"> |
| 102 |
<p><a HREF="BNF.html#withstatement">BNF definition</a> of <font face="Courier New"> with</font></p> |
| 103 |
</body> |
| 104 |
</html> |