List
Program Control

number of data entries in the list
index of the list data entry
automatic index incrementing

The list is helpful for creating data fields. On compiling a list definition the number of data entries in the list must be set and variables must be added to the list. Variables of arbitrary type can be used as list variables. No internal list can be used in the list. The group of variables in the list is called data entry. The entry variables are referred to by setting the entry index and by a simple usage of the list variables.

A multidimensional list can readily be created by index computation from multidimensional indexes. For example, the elements of a matrix having dimensions of 20(x) * 30(y) can be indexed by the term index = x + 20*y.

The list size is determined by the number of data entries in the list element. Number of data entries in the list is a numeric constant. Its value has to be entered when creating the program; it cannot be changed when the program is running. Entering the value is done like in the case of numeric constants, either by adding number elements or by entering the number text into the element's descriptive text (This is used, if no number element is added; following the number arbitrary text may be quoted). In the program the number of data entries in the list element can be used as a numeric constant. Thus it is guaranteed that after a list size change this change will be reflected also in the program without the necessity to interfere with it.

The list entries are addressed by means of the entry index. This is a normal numeric variable, which, having been set, makes the selected entry variables accessible. When setting the entry index the entered numeric term is rounded up to the nearest whole number, and adapted to the valid list limits by the modulo operation. In this way it is secured that the index always points to the valid list entry. Testing the condition of reaching the list end cannot be done by comparing the index with the list size, because the index can never reach the element value of the number of data entries in the list. Thus some index shifts even by rather large sections can easily be implemented in the list, as the index overflows the list boundary to the list's opposite end.

To facilitate the manipulation with the list positions an element for automatic list index incrementing is available. This element makes it possible to automatically increment the list index by a number of entries given by the element of the automatic incrementing after each access to some list variable. This is suitable e.g. when the list is filled up during initialization. By simple assigning the variables to the list entries the list index is automatically shifted to further entries. If there are several variables in one entry, it is therefore more suitable to fill up always one variable for all indexes, and then to proceed to a further variable.

Example of using:

Full Html Context Help of The Peter - Gemtree Software & Children Programming