# import

The statement makes it possible to reuse all or some of the definitions specified in the module definitions part of a different module.

- The keyword objid is optionally used when the source module has an object identifier.
- The keyword language is used when importing from a non-TTCN-3 module.
- The keyword except is used when there is a need to exclude some of the definitions from the import.

- The keyword recursive means that every definition required by the specified definitions must also be imported. It can only be used with selective import.

Related keywords:

- all
- except
- from
- language
- objid

1. Importing everything from a module

### import from module_identifier [.objid(object_identifier) ] [ language "language_identifier" ] all;

- import from is a keyword of two parts, they together introduce the import definition.

- module_identifier is the 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.

TITAN specific restriction compared to the standard: objid(object_identifier) is not implemented. When encountered in the TTCN-3 program, it will be discarded without evaluation.

- language"language_identifier" is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=language_identifier) of that source.

- all means that every definition must be imported from the source.

Example 1a:

import from Ce_mod all;

All definitions from the module Ce_mod will be imported.

Example 1b:

import from Ia_mod.objid{0 4 0 127 5 0} all;

All definitions will be imported from the module Ia_mod with the object identifier 0.4.0.127.5.0 in the module name.

Example 1c:

import from Muj_mod language "ASN.1:2002" all;

All definitions from the module Muj_mod written in the 2002 version of ASN.1 will be imported.

2. Selective import

TITAN specific restriction compared to the standard: Selective import is not implemented. When encountered in the TTCN-3 program, it will be treated as a statement for importing all definitions.

### import from module_identifier [.objid(object_identifier) ] [ language "language_identifier" ] all except {exception_list};

- import from is a keyword of two parts, they together introduce the import definition.

- module_identifier is the 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.

TITAN specific restriction compared to the standard: objid(object_identifier) is not implemented. When encountered in the TTCN-3 program, it will be discarded without evaluation.

- language "language_identifier" is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=language_identifier) of that source.

- all means that every definition must be imported from the source.

- except {exception_list} is used to exclude some of the definitions of the source module.
  exception_list may contain one of the following definitions: modulepar | const | type | signature | template | function | altstep | testcase | group.
  It is possible to list several restrictions of the same type separated by comma and enumerate several types of restrictions separated by semicolon..

Example 2a:

import from Min_mod all except {testcase tc_one, tc_deux; function f_tre()};

All definitions from the module Min_mod will be imported except the test cases tc_one and tc_deux as well as the function f_tre().

### import from module_identifier [.objid(object_identifier) ] [ language "language_identifier" ] [ recursive ] {importation_list};

- import from is a keyword of two parts, they together introduce the import definition.

- module_identifier is the 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.

TITAN specific restriction compared to the standard: objid(object_identifier) is not implemented. When encountered in the TTCN-3 program, it will be discarded without evaluation.

- language "language_identifier" is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=language_identifier) of that source.

- recursive means that every definition required by the specified definitions must also be imported.

- importation_list is used to enumerate the definitions of the source module to be imported.
  It may contain one of the following definitions: modulepar | const | type | signature | template | function | altstep | testcase | group.
  It is possible to list several definitions of the same type separated by comma and enumerate several types of definitions separated by semicolon..

Example 2b:

import from Mon_Mod {const c_derde, c_fjaerde; var v_cinquieme; template all};

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.

Example 2c:

import from Mon_Mod recursive {const c_hetedik};

The constant c_hetedik will be imported from the module Mon_mod along with the definitions required by c_hetedik.

3. Importing of import statements

### import from module_identifier [.objid(object_identifier) ] [ language "language_identifier" ] { import all; }

- import from is a keyword of two parts, they together introduce the import definition.

- module_identifier is the 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.

TITAN specific restriction compared to the standard: objid(object_identifier) is not implemented. When encountered in the TTCN-3 program, it will be discarded without evaluation.

- language"language_identifier" is used when definitions are imported from sources other than TTCN-3 modules to denote the language (=language_identifier) of that source.

- import all means that every visible* import statement must be imported from the source.

Example 1a:

import from G_mod { import all };

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.

Note that the visibility of import statements is by default private. For an import statement to be visible, it must be made public, or the importing module has to be declared as friend of the module containing the import statement.

BNF definition of import