import.html 16.3 KB
Newer Older
Elemer Lelik's avatar
Elemer Lelik committed
1
<!--
Adam Knapp's avatar
Adam Knapp committed
2
 Copyright (c) 2000-2021 Ericsson Telecom AB
Elemer Lelik's avatar
Elemer Lelik committed
3
 All rights reserved. This program and the accompanying materials
4
 are made available under the terms of the Eclipse Public License v2.0
Elemer Lelik's avatar
Elemer Lelik committed
5
 which accompanies this distribution, and is available at
6
 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
Elemer Lelik's avatar
Elemer Lelik committed
7
8
9
10
11
12
13
14
15

 Contributors:
  Baji, Laszlo
  Balasko, Jeno
  Farkas, Laszlo
  Raduly, Csaba
  Szabados, Kristof
  Szabo, Janos Zoltan – initial implementation
-->
Elemer Lelik's avatar
Elemer Lelik committed
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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<title>import</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="ifpresent.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
    <td><a href="in.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>import</h1>
<hr align="left" width="75%">
<p>The statement makes it possible to <a href="#selective"> reuse all</a> or <a href="#selective">some of the definitions</a> specified in the module definitions part of a different module.</p>
<ul>
  <li><a name="stop_all">The</a> keyword <a href="objid.html"><b><font face="Courier New" color="#003258" size="4">objid</font></b></a> is optionally used when the source <a href="#timer_start">module
  has an object identifier</a>.</li>
  <li><a name="stop_all">The</a> keyword <a href="language.html"><b><font face="Courier New" color="#003258" size="4">language</font></b></a> is used when importing <a href="#default">from a
  non-TTCN-3 module</a>.</li>
  <li><a name="stop_all">The</a> keyword <a href="except.html"><b><font face="Courier New" color="#003258" size="4">except</font></b></a> is used when there is a need <a href="#default">to
  exclude some of the definitions</a> from the import.</li>
  <li>
  <p>The keyword <a href="recursive.html"><font face="Courier New" size="4"><b>recursive</b></font> </a> means that every definition required by the specified definitions must also be imported. It
  can only be used with selective import.</p>
  </li>
</ul>
<p>Related keywords:</p>
<ul>
  <li><a href="all.html"><b><font face="Courier New" color="#003258" size="4">all</font></b></a></li>
  <li><a href="except.html"><b><font face="Courier New" color="#003258" size="4">except</font></b></a></li>
  <li><a href="from.html"><b><font face="Courier New" color="#003258" size="4">from</font></b></a></li>
  <li><a href="language.html"><b><font face="Courier New" color="#003258" size="4">language</font></b></a></li>
  <li><a href="language.html"><b><font face="Courier New" color="#003258" size="4">objid</font></b></a></li>
</ul>
<hr align="left" width="50%">
<p>1. <a name="timer">Importing everything from a module</a></p>
<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>import from </b></font><i>module_identifier</i> [<font face="Courier New" color="#003258" size="5"><b>.objid(</b></font><i>object_identifier</i><font
      face="Courier New" color="#003258" size="5"><b>)</b></font> ] [ <font face="Courier New" color="#003258" size="5"><b>language &quot;</b></font><i>language_identifier</i><font face="Courier New"
      color="#003258" size="5"><b>&quot;</b></font> ] <font face="Courier New" color="#003258" size="5"><b>all;</b></font></h3>
    </td>
  </tr>
</table>
</center>
</div>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>import from</b></font> is a keyword of two parts, they together introduce the import definition.</p>
  </li>
  <li>
  <p><i>module_identifier</i> is the&nbsp;name used to refer to the module where the definitions are imported from. It must begin with a letter, may contain letters, numbers and underscore
  characters.</p>
  </li>
</ul>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
  <tr>
    <td width="100%">
    <blockquote>
    <p><u>TITAN specific restriction compared to the standard:</u></p>
    </blockquote>
    <ul>
      <li>
      <p>&nbsp;<font face="Courier New" size="4"><b>objid(</b></font><i>object_identifier</i><font face="Courier New" size="4"><b>)</b></font> is not implemented. When encountered in the TTCN-3
      program, it will be discarded without evaluation.</p>
      </li>
    </ul>
    </td>
  </tr>
</table>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>language</b></font><font face="Courier New" color="#003258" size="5"><b>&quot;</b></font><i>language_identifier</i><font face="Courier New"
    color="#003258" size="5"><b>&quot;</b></font> is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=<i>language_identifier</i>) of that source.</p>
  </li>
  <li>
  <p><font face="Courier New" size="4"><b>all</b></font> means that every definition must be imported from the source.</p>
  </li>
</ul>
<hr align="left" width="50%">
<p><a name="timer_start">Example 1a</a>:
<p><font face="Courier New">import from Ce_mod all;<br>
</font>
<p>All definitions from the module Ce_mod will be imported.</p>
<hr align="left" width="50%">
<p><a name="timer_start">Example 1b</a>:
<p><font face="Courier New">import from Ia_mod.objid{0 4 0 127 5 0} all;<br>
</font>
<p>All definitions will be imported from the module Ia_mod with the object identifier 0.4.0.127.5.0 in the module name.</p>
<hr align="left" width="50%">
<p><a name="default">Example 1c:</a>
<p><font face="Courier New">import from Muj_mod language &quot;ASN.1:2002&quot; all;<br>
</font>
<p>All definitions from the module Muj_mod written in the 2002 version of ASN.1 will be imported.</p>
<hr align="left" width="75%">
<p>2. <a name="selective">Selective import</a></p>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
  <tr>
    <td width="100%">
    <blockquote>
    <p><u>TITAN specific restriction compared to the standard:</u></p>
    </blockquote>
    <p>&nbsp;Selective import is not implemented. When encountered in the TTCN-3 program, it will be treated as a statement for importing all definitions.</p>
    </td>
  </tr>
</table>
<p>&nbsp;</p>
<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>import from </b></font><i>module_identifier</i> [<font face="Courier New" color="#003258" size="5"><b>.objid(</b></font><i>object_identifier</i><font
      face="Courier New" color="#003258" size="5"><b>)</b></font> ] [ <font face="Courier New" color="#003258" size="5"><b>language &quot;</b></font><i>language_identifier</i><font face="Courier New"
      color="#003258" size="5"><b>&quot;</b></font> ] <font face="Courier New" color="#003258" size="5"><b>all except {</b></font><i>exception_list</i><font face="Courier New" color="#003258" size="5"><b>};</b></font>
    </h3>
    </td>
  </tr>
</table>
</center>
</div>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>import from</b></font> is a keyword of two parts, they together introduce the import definition.</p>
  </li>
  <li>
  <p><i>module_identifier</i> is the&nbsp;name used to refer to the module where the definitions are imported from. It must begin with a letter, may contain letters, numbers and underscore
  characters.</p>
  </li>
</ul>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
  <tr>
    <td width="100%">
    <blockquote>
    <p><u>TITAN specific restriction compared to the standard:</u></p>
    </blockquote>
    <ul>
      <li>
      <p>&nbsp;<font face="Courier New" size="4"><b>objid(</b></font><i>object_identifier</i><font face="Courier New" size="4"><b>)</b></font> is not implemented. When encountered in the TTCN-3
      program, it will be discarded without evaluation.</p>
      </li>
    </ul>
    </td>
  </tr>
</table>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>language</b></font><font face="Courier New" color="#003258" size="5"><b> &quot;</b></font><i>language_identifier</i><font face="Courier New"
    color="#003258" size="5"><b>&quot;</b></font> is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=<i>language_identifier</i>) of that source.</p>
  </li>
  <li>
  <p><font face="Courier New" size="4"><b>all</b></font> means that every definition must be imported from the source.</p>
  </li>
  <li><font face="Courier New" size="4"><b>except</b></font><font face="Courier New" color="#003258" size="5"><b> {</b></font><i>exception_list</i><font face="Courier New" color="#003258"
    size="5"><b>}</b></font> is used to exclude some of the definitions of the source module.&nbsp;<br>
  <i>exception_list</i> may contain one of the following definitions:&nbsp; modulepar | const | type | signature | template | function | altstep | testcase | group.&nbsp;<br>
  It is possible to list several restrictions of the same type separated by comma and enumerate several types of restrictions separated by semicolon..</li>
</ul>
<hr align="left" width="50%">
<p><a name="except">Example 2a:</a>
<p><font face="Courier New">import from Min_mod all except {testcase tc_one, tc_deux; function f_tre()};<br>
</font>
<p>All definitions from the module Min_mod will be imported except the test cases tc_one and&nbsp; tc_deux as well as the function f_tre().</p>
<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>import from </b></font><i>module_identifier</i> [<font face="Courier New" color="#003258" size="5"><b>.objid(</b></font><i>object_identifier</i><font
      face="Courier New" color="#003258" size="5"><b>)</b></font> ] [ <font face="Courier New" color="#003258" size="5"><b>language &quot;</b></font><i>language_identifier</i><font face="Courier New"
      color="#003258" size="5"><b>&quot;</b></font> ]&nbsp;[ <font face="Courier New" color="#003258" size="5"><b>recursive</b></font> ]<font face="Courier New" color="#003258" size="5"><b>
    {</b></font><i>importation_list</i><font face="Courier New" color="#003258" size="5"><b>};</b></font></h3>
    </td>
  </tr>
</table>
</center>
</div>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>import from</b></font> is a keyword of two parts, they together introduce the import definition.</p>
  </li>
  <li>
  <p><i>module_identifier</i> is the&nbsp;name used to refer to the module where the definitions are imported from. It must begin with a letter, may contain letters, numbers and underscore
  characters.</p>
  </li>
</ul>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
  <tr>
    <td width="100%">
    <blockquote>
    <p><u>TITAN specific restriction compared to the standard:</u></p>
    </blockquote>
    <ul>
      <li>
      <p>&nbsp;<font face="Courier New" size="4"><b>objid(</b></font><i>object_identifier</i><font face="Courier New" size="4"><b>)</b></font> is not implemented. When encountered in the TTCN-3
      program, it will be discarded without evaluation.</p>
      </li>
    </ul>
    </td>
  </tr>
</table>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>language</b></font><font face="Courier New" color="#003258" size="5"><b> &quot;</b></font><i>language_identifier</i><font face="Courier New"
    color="#003258" size="5"><b>&quot;</b></font> is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=<i>language_identifier</i>) of that source.</p>
  </li>
  <li>
  <p><font face="Courier New" size="4"><b>recursive</b></font> means that every definition required by the specified definitions must also be imported.</p>
  </li>
  <li><i>importation_list</i> is used to enumerate the definitions of the source module to be imported.&nbsp;<br>
  It may contain one of the following definitions:&nbsp; modulepar | const | type | signature | template | function | altstep | testcase | group.&nbsp;<br>
  It is possible to list several definitions of the same type separated by comma and enumerate several types of definitions separated by semicolon..</li>
</ul>
<hr align="left" width="50%">
<p><a name="list">Example 2b:</a>
<p><font face="Courier New">import from Mon_Mod {const c_derde, c_fjaerde; var v_cinquieme; template all};</font>
<p>The constants c_derde and c_fjaerde as well as the variable v_cinquieme together with all templates will be imported from the module Mon_mod.</p>
<hr align="left" width="50%">
<p><a name="recursive">Example 2c:</a>
<p><font face="Courier New">import from Mon_Mod recursive {const c_hetedik};</font>
<p>The constant c_hetedik will be imported from the module Mon_mod along with the definitions required by c_hetedik.</p>
<hr align="left" width="75%">
<p>3. <a name="timer">Importing of import statements</a></p>
<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>import from </b></font><i>module_identifier</i> [<font face="Courier New" color="#003258" size="5"><b>.objid(</b></font><i>object_identifier</i><font
      face="Courier New" color="#003258" size="5"><b>)</b></font> ] [ <font face="Courier New" color="#003258" size="5"><b>language &quot;</b></font><i>language_identifier</i><font face="Courier New"
      color="#003258" size="5"><b>&quot;</b></font> ] <font face="Courier New" color="#003258" size="5"><b>{ import all; }</b></font></h3>
    </td>
  </tr>
</table>
</center>
</div>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>import from</b></font> is a keyword of two parts, they together introduce the import definition.</p>
  </li>
  <li>
  <p><i>module_identifier</i> is the&nbsp;name used to refer to the module where the definitions are imported from. It must begin with a letter, may contain letters, numbers and underscore
  characters.</p>
  </li>
</ul>
<table border="0" width="100%" bgcolor="#C9C2BB" cellpadding="4">
  <tr>
    <td width="100%">
    <blockquote>
    <p><u>TITAN specific restriction compared to the standard:</u></p>
    </blockquote>
    <ul>
      <li>
      <p>&nbsp;<font face="Courier New" size="4"><b>objid(</b></font><i>object_identifier</i><font face="Courier New" size="4"><b>)</b></font> is not implemented. When encountered in the TTCN-3
      program, it will be discarded without evaluation.</p>
      </li>
    </ul>
    </td>
  </tr>
</table>
<ul>
  <li>
  <p><font face="Courier New" size="4"><b>language</b></font><font face="Courier New" color="#003258" size="5"><b>&quot;</b></font><i>language_identifier</i><font face="Courier New"
    color="#003258" size="5"><b>&quot;</b></font> is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=<i>language_identifier</i>) of that source.</p>
  </li>
  <li>
  <p><font face="Courier New" size="4"><b>import all</b></font> means that every visible<a href="#visible"><sup>*</sup></a> import statement must be imported from the source.</p>
  </li>
</ul>
<hr align="left" width="50%">
<p><a name="timer_start">Example 1a</a>:
<p><font face="Courier New">import from G_mod { import all };<br>
</font>
<p>All visible import statements from the module G_mod will be imported.
This has the same effect as if the visible import statements of module G_mod were copied into the importing module.</p>
<hr align="left" width="75%">
<a name="visible">Note that the visibility of import statements is by default <a href="private.html">private</a>.
For an import statement to be visible, it must be made <a href="public.html">public</a>, or the importing module
has to be declared as <a href="friend.html">friend</a> of the module containing the import statement.</a>
<p><a HREF="BNF.html#importdef">BNF definition</a> of <font face="Courier New">import</font></p>
</body>
</html>