next up previous contents index
Next: Command names Up: Initialization file Previous: Definition of objects   Contents   Index


Definition of structures

This section of the initialization file is optional. It begins with the keyword !struct and ends with a line containing a point. Between these two lines the structure types used by the interpreter are defined. See 6 for a detailed definition of structures.

A definition of a structure type will create a command understood by the interpreter. With this command, structures of this type can be created. For example, if the name of the command is defstruc1, a command

defstruc1 Struc_x

will create a structure of this type whose name is Struc_x.

The definition of a structure type begins with a line containing the name of the command that will create the structures of this type.

In the next line in an integer which is the number of members of the structure. The members are object types or structure types previously defined. They can also be variables of the expression evaluator.

Then there are pairs of lines, one pair for each member of the structure. The first line of a pair contains the name of the corresponding member The second line contains the object (or structure) type of this member (i.e. the name of the command that defines objects (or structures) of this type), if the member is an object or a structure. If the second line does not contain the name of a previously defined object or structure type, it is assumed that the member is a variable of the expression evaluator.

The next line contains a description of the structure type. It is used by the command list that gives the list of names of all the objects and structures that have been defined. For instance this line may contain

Structures of type 1 :

and the command list will print on the screen

Structures of type 1 :
                  Struc_x

if the structure Struc_x of this type has been defined.

In the next line is the list of running mode numbers (cf. 3.2) where the structures will be used. If the this line contains the unique number -1, the structures can be used in all the running modes.

The last line of the set of lines describing a structure type is the maximal number of structures of this type that can be defined. It can be a positive integer, or a parameter name defined in the section !var of the initialization file (cf. 3.3).


Example :

!struct
; Structures of the first type (this is a comment line)
defstruc1
2
member_1
defobj1
member_2
defobj2
Structures 1 :
-1
nb1
; Structures of the second type (this is a comment line)
defstruc2
3
member_1b
defobj1
member_2b
defobj2
member_3b
defstruc1
Structures 1 : 
0
nb2
.

Here two structure types are defined. The first has two members. The name of the first member is member_1, and it is an object of type defobj1. The name of the second member is member_2, and it is an object of type defobj2. The second structure has 3 members. The name of the first member is member_1b, and it is an object of type defobj1. The name of the second member is member_2b, and it is an object of type defobj2. The name of the third member is member_3b, and it is a structure of type defstruc1.

Several such sections can appear in an initialization file, for instance when two applications of the command interpreter are glued to produce a single program.


next up previous contents index
Next: Command names Up: Initialization file Previous: Definition of objects   Contents   Index
2009-11-12