/usr/share/titan/help/info/var.html is in eclipse-titan 6.3.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | <!--
Copyright (c) 2000-2017 Ericsson Telecom AB
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Baji, Laszlo
Balasko, Jeno
Farkas, Laszlo
Szabados, Kristof
Szabo, Janos Zoltan – initial implementation
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>var</title>
</head>
<body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
<table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
<tr>
<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>
</tr>
</table>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
<td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
<td><a href="valueof.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
<td><a href="variant.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr>
<h1>var</h1>
<blockquote>
<p>1. <a href="#1."> Declaring a variable of built-in type</a></p>
<p>2. <a href="#2."> Declaring a variable of referenced type</a></p>
<p>3. <a href="#3."> Multiple declaration of variables of the same type</a></p>
<p>4. <a href="#4.">Declaring a variable array</a></p>
</blockquote>
<hr align="left" width="75%">
<h4><a name="1.">1. Declaring a variable of built-in type</a></h4>
<hr align="left" width="50%">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>var </b></font> ( <font face="Courier New" color="#003258" size="5"><b>bitstring</b></font> | <font face="Courier New"
color="#003258" size="5"><b>boolean</b></font> | <font face="Courier New" color="#003258" size="5"><b>charstring</b></font> | <font face="Courier New" color="#003258" size="5"><b>universal
charstring</b></font> | <font face="Courier New" color="#003258" size="5"> <b>integer</b></font> | <font face="Courier New" color="#003258" size="5"> <b>octetstring</b></font> | <font face="Courier New"
color="#003258" size="5"><b>objid</b></font> | <font face="Courier New" color="#003258" size="5"><b>hexstring</b></font> | <font face="Courier New" color="#003258" size="5"><b>verdicttype</b></font>
| <font face="Courier New" color="#003258" size="5"><b>float</b></font> | <font face="Courier New" color="#003258" size="5"><b>address</b></font> | <font face="Courier New" color="#003258"
size="5"><b>default</b></font> | <font face="Courier New" color="#003258" size="5"><b>anytype</b></font> ) <i>var_identifier </i> [<font face="Courier New" color="#003258" size="5"><b>:=</b></font>
<i> single_variable_expression</i> ]<font face="Courier New" color="#003258" size="5"> <b>;</b></font></h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>var</b></font> keyword introduces the variable definition.</p>
</li>
<li>
<p><a href="bitstring.html" name="par1"><font face="Courier New" color="#003258" size="4"><b>bitstring</b></font></a> denotes an a type whose distinguished values are the ordered sequences of
zero, one, or more bits.</p>
</li>
<li>
<p><a href="boolean.html"><font face="Courier New" color="#003258" size="4"><b>boolean</b></font></a> is a simple basic type consisting of two distinguished values (namely true or false).</p>
</li>
<li>
<p><a href="charstring.html"><font face="Courier New" color="#003258" size="4"><b>charstring</b></font></a> denotes a type whose distinguished values are the ordered sequences of characters of
ISO/IEC 646 as described in ITU-T Recommendation T.50.</p>
</li>
<li>
<p><a href="universal.html"><font face="Courier New" color="#003258" size="4"><b>universal charstring</b></font></a> denotes a type whose distinguished values are the ordered sequences of UCS-4
coded representation of ISO/IEC 10646 characters.</p>
</li>
<li>
<p><a href="integer.html"><font face="Courier New" color="#003258" size="4"><b>integer</b></font></a> denotes a a type with distinguished values which are the positive and negative whole
numbers, including zero.</p>
</li>
<li>
<p><a href="octetstring.html"><font face="Courier New" color="#003258" size="4"><b>octetstring</b></font></a> stands for a a type whose distinguished values are the ordered sequences of zero or
a positive even number of hexadecimal digits (every pair of digits corresponding to an ordered sequence of eight bits).</p>
</li>
<li>
<p><a href="objid.html"><font face="Courier New" color="#003258" size="4"><b>objid</b></font></a> defines a type whose distinguished values are the set of all object identifiers conforming to
clause 6.2 of ITU-T Recommendation X.660.</p>
</li>
<li>
<p><a href="hexstring.html"><font face="Courier New" color="#003258" size="4"><b>hexstring</b></font></a> defines a type whose distinguished values are the ordered sequences of zero, one, or
more hexadecimal digits, each corresponding to an ordered sequence of four bits.</p>
</li>
<li>
<p><a href="verdicttype.html"><font face="Courier New" color="#003258" size="4"><b>verdicttype</b></font></a> defines a type for use with test verdicts consisting of 5 distinguished values.</p>
</li>
<li>
<p><a href="float.html"><font face="Courier New" color="#003258" size="4"><b>float</b></font></a> defines a type to describe floating-point numbers.</p>
</li>
<li>
<p><a href="address.html"><font face="Courier New" color="#003258" size="4"><b>address</b></font></a> denotes a user defined type to allow addressing specific entities inside the system under
test.</p>
</li>
<li>
<p><a href="default.html"><font face="Courier New" color="#003258" size="4"><b>default</b></font></a> is a reference to an activated default resulting from an activate operation.</p>
</li>
</ul>
<div align="center">
<center>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
<tr>
<td width="100%">
<blockquote> <u>TITAN specific restriction compared to the standard</u>: anytype is not implemented yet.</blockquote>
<ul>
<li>
<p><a href="anytype.html"><font face="Courier New" color="#003258" size="4"><b>anytype</b></font></a> defines as a shorthand for the union of all defined types, imported ASN.1 and other
imported external types.</p>
</li>
</ul>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p><i>var_identifier</i> is the name used to refer to the variable. Must begin with a letter, may contain letters, numbers and underscore characters. <br>
According to the Naming convention, the following prefixes are recommended: </p>
<ul>
<li><b>v_</b> for variables declared in the test component type definition,</li>
<li><b>vc_</b> for variables defined within a component type and used to store component instance references (returned by a <b><font face="Courier New">create</font></b> operation),</li>
<li><b>vd_</b> for variables defined within a component type used to store references to activated defaults (returned by an <b><font face="Courier New">activate</font></b> statement),;</li>
<li><b>vl_</b> for variables declared in testcases, functions, altsteps, block of statements or in the control part,</li>
<li><b>vlc_</b> for variables defined in testcases or functions and used to store component instance references (returned by a <b><font face="Courier New">create</font></b> operation),</li>
<li>
<p><b>vld_</b> for variables defined in testcases or functions used to store references to activated defaults (returned by an <b><font face="Courier New">activate</font></b> statement),</p>
</li>
</ul>
</li>
<li>
<p>The optional <i>single_variable_expression</i> is used to define an initial value. It may contain variables and literal values as operands. The result of the expression must correspond to the
type of the variable.</p>
</li>
</ul>
<p><a href="#Ex1">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="2.">2. Declaring a variable of referenced type</a></h4>
<hr align="left" width="50%" color="#0094D2">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>var </b></font> [ <i>module_id</i> [.<i>obj_id</i> ].] <i>type_reference</i> [.<i>field_reference</i> ] <i>var_identifier </i>
[<font face="Courier New" color="#003258" size="5"><b>:=</b></font> <br>
<i>single_variable_expression</i> | <i>value_list</i> | <i>value_assginment_list</i> ]<font face="Courier New" color="#003258" size="5"><b>;</b></font></h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>var</b></font> keyword introduces the variable definition.</p>
</li>
<li>
<p><i><a href="BNF.html#moduleidentifier">module_id</a></i> is needed when the referenced type is defined in another TTCN-3 module and denotes the name of that module.</p>
</li>
</ul>
<div align="center">
<center>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
<tr>
<td width="100%">
<blockquote> <u>TITAN specific restriction compared to the standard</u>: objid is not implemented yet; it is discarded when encountered.</blockquote>
<ul>
<li>
<p><i><a href="BNF.html#objidcomponent">obj_id</a></i> is an optional object identifier which may follow the TTCN-3 module identifier.</p>
</li>
</ul>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p><i><a name="par2">type_reference</a></i> refers to an already defined (structured or simple) <a href="type.html">type</a>.</p>
</li>
</ul>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
<tr>
<td width="100%">
<blockquote> <u>TITAN specific restriction compared to the standard</u>: field reference can only be used with structured variables defined in the module definition
part.</blockquote>
<ul>
<p>
<li><i><a href="BNF.html#extendedfieldreference">field_reference</a></i> optionally stands for a field of a structured type.
</p>
</li>
</ul>
</td>
</tr>
</table>
<ul>
<li>
<p><i>var_identifier</i> is the name used to refer to the variable. Must begin with a letter, may contain letters, numbers and underscore characters.</p>
</li>
<li>
<p>The optional <a href="BNF.html#singleconstexpression"><i>single_variable_expression</i> </a> may contain variables and literal values as operands. The result of the expression
must correspond to the type of the variable. Used with simple types to define an initial value.</p>
</li>
<li>
<p>The optional <a href="BNF.html#arrayconstexpression"><i>value_list</i></a> is a comma-separated list of the variable values between curly brackets. Used with structured types
to define an initial value</p>
</li>
</ul>
<div align="center">
<center>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
<tr>
<td width="100%">
<blockquote> <u>TITAN specific restriction compared to the standard</u>: value assignment can only be used with structured variables defined in the module definition
part.</blockquote>
<ul>
<li>
<p>The optional <a href="BNF.html#fieldconstexpressionspec"><i>value_assignment_list</i></a> is a comma-separated list of the field name - variable value pairs between curly
brackets. Used with structured types to define an initial value.</p>
</li>
</ul>
</td>
</tr>
</table>
</center>
</div>
<p><a href="#Ex2">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="3.">3. Multiple declaration of variables of the same type</a></h4>
<hr align="left" width="50%" color="#0094D2">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>var </b></font> <i>type </i> <i>identifier<sub>1</sub> </i>[ <font face="Courier New" color="#003258"
size="5"> <b>:=</b></font> <i> variable_expression<sub>1</sub></i><font face="Courier New" color="#003258" size="5"><b>],</b></font><i> identifier<sub>2</sub> </i> [<font face="Courier New"
color="#003258" size="5"><b>:=</b></font> <i> variable_expression<sub>2</sub> </i>]<i>â¦</i> <font face="Courier New" color="#003258" size="5"> <b>;</b></font></h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>var</b></font> keyword introduces the variable definition.</p>
</li>
<li>
<p align="left"><i>type</i> is one of the built-in types mentioned in <a href="#par1">paragraph 1</a> or referenced types mentioned in <a href="#par2">paragraph 2</a> .</p>
</li>
<li>
<p><i>identifier<sub>n</sub></i> is the name used to refer to the n<sup>th</sup> variable.</p>
</li>
<li>
<p>The optional <i>variable_expression<sub>n</sub></i> determines the initial value of the n<sup>th</sup> variable.</p>
</li>
</ul>
<p><a href="#Ex3">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="4.">4. Declaring a variable array</a></h4>
<hr align="left" width="50%" color="#0094D2">
<div align="center">
<center>
<table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
<tr>
<td width="100%">
<h3 align="center"><font face="Courier New" color="#003258" size="5"><b>var </b></font> <i>type var_identifier </i> <font face="Courier New" color="#003258" size="5"><b>[ </b></font> <i>array_index</i>
<font face="Courier New" color="#003258" size="5"><b> ]</b> </font>[<font face="Courier New" color="#003258" size="5"><b>:=</b></font> <i>value_list</i><font face="Courier New" color="#003258"
size="5">]<b>;</b></font></h3>
</td>
</tr>
</table>
</center>
</div>
<ul>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>var</b></font> keyword introduces the variable definition.</p>
</li>
<li>
<p align="left"><i>type</i> is one of the built-in types mentioned in <a href="#par1">paragraph 1</a> or referenced types mentioned in <a href="#par2">paragraph 2</a> .</p>
</li>
<li>
<p><i>var_identifier</i> is the name used to refer to the variable. Must begin with a letter, may contain letters, numbers and underscore characters.</p>
</li>
<li>
<p><i><a href="BNF.html#arraydef">array index</a></i> is a non-negative integer value corresponding to the number of elements in the array. <br>
Alternatively, the lower and upper index values are given joined by two dots.</p>
</li>
<li>
<p>The optional <a href="BNF.html#arrayconstexpression"><i>value_list</i> </a> is a comma-separated list of the initial variable values between curly brackets.</p>
</li>
</ul>
<p><a href="#Ex4">Example</a></p>
<hr align="left" width="50%">
<hr align="left" width="50%">
<p><a name="Ex1">Example 1a</a>:
<p><font face="Courier New">var integer v_myVariable := 127;</font>
<p>A variable called v_MyVariable is defined. The variable will have the initial value one hundred twenty seven.</p>
<hr align="left" width="50%">
<p>Example 1b:
<p><font face="Courier New">var bitstring v_myGarland := '00101101'B; <br>
var bitstring v_myBiggerGarland := v_myGarland & '11000010'B;</font></p>
<p>Two variables are defined. The one called v_myBiggerGarland initially will have the binary value 11101111.</p>
<hr align="left" width="50%">
<p><a name="Ex2">Example 2a</a>:
<p><font face="Courier New">type record E_Rec {integer field1, boolean field2}; //defined in Elsewhere</font></p>
<p><font face="Courier New">var Elsewhere.E_Rec v_CurrVar := {17, true};</font></p>
<p>A record called E_Rec have been defined in the TTCN-3 module Elsewhere. In the current module we define a variable named v_CurrVar and assign values to all of its fields. In TITAN, the value
notation as shown above may only be used in the module definition part.</p>
<hr align="left" width="50%">
<p>Example 2b:
<p><font face="Courier New">type record G_Rec {float first_field, hexstring last_field}; <br>
var G_Rec.last_field v_FuzerVar;</font></p>
<p>First we define a record called G_Rec. Then we define a variable named v_FuzerVar derived from the second field of the referred type and assign no initial value to it. </p>
<hr align="left" width="50%">
<p>Example 2c:
<p><font face="Courier New">type record G_Rec {float first_field, hexstring last_field}; <br>
var G_Rec v_UeppigVar := {<br>
first_field := 5.77,<br>
last_field := '55'H;<br>
}</font></p>
<p>First we define a record called G_Rec. Then we define a variable named v_UeppigVar and assign initial values to both of its fields using assignment notation.</p>
<hr align="left" width="50%">
<p><a name="Ex3">Example 3</a>:
<p><font face="Courier New">var boolean v_MyVar2 := true, v_MyVar3;</font></p>
<p>Two variables (v_MyVar2 and v_MyVar3) are declared within one operation. The latter variable has no initial value assigned.</p>
<hr align="left" width="50%">
<p><a name="Ex4">Example 4a</a>:
<p><font face="Courier New">var boolean v_MinVar[3] := { true, false, false };</font></p>
<p>The array defined v_MinVar consists of three elements indexed from 0 to 2.</p>
<hr align="left" width="50%">
<p>Example 4b:
<p><font face="Courier New">var boolean v_DinVar[7..9] := { true, false, false };</font></p>
<p>The array defined v_DinVar consists also of three elements as in the example 4a, but here the indices run from 7 to 9.</p>
<hr align="left" width="25%">
<hr align="left" width="25%">
<p><a HREF="BNF.html#varinstance">BNF definition</a> of <font face="Courier New"> var</font></p>
</body>
</html>
|