next up previous contents index
Next: Definition of structures Up: Initialization file Previous: Data, results and command   Contents   Index


Definition of objects

This part of the initialization file is optional. It begins with the keyword !def and ends with a line containing a point. Between these two lines the objects types used by the interpreter are defined. See 6 for a detailed definition of objects. An object is an array (of any number of dimensions) of integers, floating point numbers or complex numbers (in simple or double precision). A definition of an object type will create a command understood by the interpreter. With this command, objects of this type can be created. For example, if the name of the command is defobj1, a command

defobj1 Obj_x

will create an object of this type whose name is Obj_x. Of course there is a way to recover the array from the name Obj_x, to use it (cf. 6). Objects can be also deleted. When an object is created, the appropriate allocations of memory are made and the name is associated to the array.

The definition of an object type begins with a line containing the name of the command that will create these objects.

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

The next line contains an integer which must be 0, 1, 2, 3, 4, 5, 6 or 7. It defines the type of data that will be contained in the objects of this type. For instance, 0 means that the objects are arrays of integers (see 6).

The next line contains a positive integer, which is the number of dimensions of the objects (i.e. of the corresponding arrays).

The next line contains a description of the object 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

Objects of type 1 :

and the command list will print on the screen

Objects of type 1 :
               Obj_x

if the object Obj_x of this type has been defined.

There must be then one line for each dimension of the arrays. Each line contains the name of the corresponding dimension. The way to associate an integer to a name an to recover an integer from a name is explained in 6. A dimension name can also be one of the parameter names defined in the section !var of the initialization file (cf. 3.3). The dimension names must actually be associated to positive integers when a command of creation of an object is executed. This indirect way to fix the size of the objects allows two objects of the same type to be of different sizes. It is also possible to fix a size depending on the context. Of course there is a way to recover the type, number of dimensions and dimensions of an object from its name (cf. 6).

The last line of the set of lines describing an object type is the maximal number of objects 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 :

!def
;Objects of type 1 (this line is a comment line, beginning with a ;)
defobj1
-1
0
2
Objects of type 1 : 
ndim1_1
ndim1_2
nb1
;Objects of type 2 (comment line)
defobj2
0
2
3
Objects of type 2 : 
ndim2_1
ndim2_2
ndim2_3
nb2
.

Here two object types are defined. The first type correspond to 2-dimensional arrays of integers, and the second to 3-dimensional arrays of double precision real numbers. The name of the command that creates objects of the first type is defobj1, and the name of the command that creates objects of the second type is defobj2.

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: Definition of structures Up: Initialization file Previous: Data, results and command   Contents   Index
2009-11-12