previous contents index next
(..Functions) Contents Index (..Acc. Single Reg...)

2.9 Accessing Single Registers

As we have already seen before, the complete "state variable" of cell objects is subdivided into smaller units: the registers, which can be either of type INT or of type STRING; in other words: the CELL type of SCARLET is similar to the compounded data types struct of C or RECORD of Pascal. Hence it would be, of course, very nice to have a possibility to access the single components in order to get (or to store) their contents as strings or integers. And - how could it be otherwise - SCARLET comes up to our expectations: defining a state structure in the declaration part of a RDL or SDL program each register gets a name, which can be used to access this component of any cell object whatever, from then on. To do this, like in C or Pascal, the names of the object and the register are simply linked together separated by the selection operator . :

CellIdentifier . RegIdentifier

The only exception to the rule is the SelfAssignment environment of SDL where it is sufficient to type the name of the register if the "generic cell" is meant. (The "generic cell" stands in for each cell of the retina the local rule is applied to.)

The new object has got the same type as the register involved thus INT or STRING.

Note that the syntax will not change, if the cell structure only consists of one register. Even in this case the contents has got type CELL- not type INT or STRING, as one might possibly expect. Also here the register must be accessed to get the value in integer or string format.

Because there are some remarks to be made, we are going to distinguish between four different kinds of access:


previous contents index next
(..Functions) Contents Index (..Acc. Single Reg...)