/usr/share/titan/help/info/const.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 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | <!--
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
Feher, Csaba
Szabados, Kristof
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>const</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="connect.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
<td><a href="continue.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>const</h1>
<blockquote>
<p>1. <a href="#1."> Declaring a constant of built-in type</a></p>
<p>2. <a href="#2."> Declaring a constant of referenced type</a></p>
<p>3. <a href="#3."> Multiple declaration of constants of the same type</a></p>
<p>4. <a href="#4.">Declaring a constant array</a></p>
<p>5. <a href="#5."> Declaring an external constant</a></p>
</blockquote>
<hr align="left" width="75%">
<h4><a name="1.">1. Declaring a constant 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>const </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>const_identifier </i> <font face="Courier New" color="#003258" size="5">
<b>:=</b></font> <i> single_constant_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>const</b></font> keyword introduces the constant 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>const_identifier</i> is the name used to refer to the constant. 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>cg_</b> for global constants (defined in the module declaration part),</li>
<li><b>c_</b> for constants declared in componets and</li>
<li>
<p><b>cl_</b> for constants declared elsewhere.</p>
</li>
</ul>
</li>
<li>
<p><i>single_constant_expression</i> may contain constants and literal values as operands. The result of the expression must correspond to the type of the constant.</p>
</li>
</ul>
<p><a href="#Ex1">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="2.">2. Declaring a constant 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>const </b></font> [ <i>module_id</i> [.<i>obj_id</i> ].] <i>type_reference</i> [.<i>field_reference</i> ] <i>const_identifier </i>
<font face="Courier New" color="#003258" size="5"> <b>:=</b></font> <br>
(<i>single_constant_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>const</b></font> keyword introduces the constant 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 constants 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>const_identifier</i> is the name used to refer to the constant. Must begin with a letter, may contain letters, numbers and underscore characters.</p>
</li>
<li>
<p><a href="BNF.html#singleconstexpression"><i>single_constant_expression</i> </a> may contain constants and literal values as operands. The result of the expression must
correspond to the type of the constant. Used with simple types.</p>
</li>
<li>
<p><a href="BNF.html#arrayconstexpression"><i>value_list</i> </a> is a comma-separated list of the constant values between curly brackets. Used with structured types.</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 constants defined in the module definition
part.</blockquote>
<ul>
<li>
<p><a href="BNF.html#fieldconstexpressionspec"><i>value_assignment_list</i></a> is a comma-separated list of the field name - constant value pairs between curly brackets.
Used with structured types.</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 constants 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>const </b></font> <i>type </i> <i>identifier<sub>1</sub> </i> <font face="Courier New" color="#003258"
size="5"> <b>:=</b></font> <i> constant_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> constant_expression<sub>2</sub> â¦</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>const</b></font> keyword introduces the constant 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> constant.</p>
</li>
<li>
<p><i>constant_expression<sub>n</sub></i> determines the value of the n<sup>th</sup> constant.</p>
</li>
</ul>
<p><a href="#Ex3">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="4.">4. Declaring a constant 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>const </b></font> <i>type const_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> <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>const</b></font> keyword introduces the constant 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>const_identifier</i> is the name used to refer to the constant. 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><a href="BNF.html#arrayconstexpression"><i>value_list</i> </a> is a comma-separated list of the constant values between curly brackets.</p>
</li>
</ul>
<p><a href="#Ex4">Example</a></p>
<hr align="left" width="75%" color="#0094D2">
<h4><a name="5.">5. Declaring an external constant</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>external const </b></font> <i>type const_identifier </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>external</b></font> keyword means that the constant is defined in a module other than TTCN-3 or ASN.1 (for example in a module written
in C++).</p>
</li>
<li>
<p>The <font face="Courier New" color="#003258" size="4"><b>const</b></font> keyword introduces the constant 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>const_identifier</i> is the name used to refer to the constant. Must begin with a letter, may contain letters, numbers and underscore characters.</p>
</li>
</ul>
<p><a href="#Ex5">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">const integer c_myConstant := 127;</font>
<p>A constant called c_MyConstant is defined. The constant will have the value one hundred twenty seven.</p>
<p> </p>
<p>Example 1b:
<p><font face="Courier New">const bitstring c_myGarland := '00101101'B; <br>
const bitstring c_myBiggerGarland := c_myGarland & '11000010'B;</font></p>
<p>Two constants are defined. The one called c_myBiggerGarland will have the binary value 11101111.</p>
<p> </p>
<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">const Elsewhere.E_Rec c_CurrConst := {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 constant named c_CurrConst 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>
<p> </p>
<p>Example 2b:
<p><font face="Courier New">type record G_Rec {float first_field, hexstring last_field}; <br>
const G_Rec.last_field c_FuzerConst := 'AA'H;</font></p>
<p>First we define a record called G_Rec. Then we define a constant named c_FuzerConst derived from the second field of the referred type and assign the hexadecimal value AA to it. </p>
<p> </p>
<p>Example 2c:
<p><font face="Courier New">type record G_Rec {float first_field, hexstring last_field}; <br>
const G_Rec c_UeppigConst := {<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 constant named c_UeppigConst and assign values to both of its fields using assignment notation.</p>
<p> </p>
<p><a name="Ex3">Example 3</a>:
<p><font face="Courier New">const boolean c_MyConst2 := true, c_MyConst3 := false;</font></p>
<p>Two constants (c_MyConst2 and c_MyConst3) are declared within one operation. </p>
<p> </p>
<p><a name="Ex4">Example 4a</a>:
<p><font face="Courier New">const boolean c_MinConst[3] := { true, false, false };</font></p>
<p>The array defined c_MinConst consists of three elements indexed from 0 to 2.</p>
<p> </p>
<p>Example 4b:
<p><font face="Courier New">const boolean c_DinConst[7..9] := { true, false, false };</font></p>
<p>The array defined c_DinConst consists also of three elements as in the example 4a, but here the indices run from 7 to 9.</p>
<p> </p>
<p><a name="Ex5">Example 5</a>:
<p><font face="Courier New">external const objid MonConst;</font></p>
<p>The constant called MonConst (an object identifier) is defined in an external module, e.g. in a module written in C++.</p>
<hr align="left" width="25%">
<hr align="left" width="25%">
<p><a HREF="BNF.html#constdef">BNF definition</a> of <font face="Courier New"> const</font></p>
</body>
</html>
|