6. Access by names: associative addressing#
Objects JEVEUX, simple objects and objects of collections, are accessible by name. The names handled by the routines JE… contain 24 characters, the names used internally by JEVEUX have 32 characters to handle the case of collections. Access by name, while it facilitates readability and allows data to be structured, cannot be used directly internally. An associative addressing algorithm is therefore used which, using a coding function, makes it possible to associate an integer identifier with a name. This coding system is used to manage the names of JEVEUX objects for each defined class (associated with each base), but also for the names of collection objects.
For this purpose, either a pair of objects formed by a vector of integers and a vector of character strings is used for the management of the various classes, or a name directory object having the particularity of being of heterogeneous content (storage of character strings and integer identifiers) for the named collections. The use of these directories requires specific access functions. These objects are sized in such a way as to contain the required number of identifiers while minimizing their size and collisions in terms of the coding function. Our choice to size the integer pointer associated with the result of the addressing function was based on the following condition:
\(\mathit{nrep}\mathrm{=}\mathit{nprem}\) where \(\mathit{nprem}>1.3\mathrm{\times }\mathit{nmax}\)
\(\mathit{nprem}\) is a prime number and \(\mathit{nmax}\) is the maximum number of identifiers to store.
The size of the directories is calculated by the function JJPREM in which a list of 56 prime numbers up to the value 611957 is stored in the form of DATA, which limits the capacity of the name directories to this value (and that of the integer pointer to approximately 795,000).
The coding function chosen JXHCOD uses the system function STRMOV which makes it possible to transfer a character string into an integer array byte by byte and the function XOR to combine the results into an integer (INTEGER). The identifier is finally obtained by a congruence modulo the length of the \(\mathit{nrep}\) directory.
Inserting a name
The insertion of a new name in the directories associated with the various databases is carried out using the JJCREN routine. All open database directories are examined to ensure the uniqueness of the object name, as JEVEUX routines do not accept the class associated with the database as an argument.
If the name directory begins to be saturated, the coding function, although chosen to be dispersive, can give an identical identifier for two distinct strings, so there is a collision. A new identifier must be determined taking into account the value obtained previously.
Search for a name in a directory
This algorithm requires a certain number of string comparisons and can therefore become expensive. A common one, updated by the last search in the directories of the various databases, contains the identifier and the associated string in order to reduce the cost of the search (/IATCJE/). It is the routine JJVERN that compares the content of the common before calling JJCREN. The return code of the JJCREN routine depends on the type of search in the directory: with insertion into the name directory (ICRE =1) this return code is necessarily non-zero (there may be an error stopping), without insertion it can be 0, otherwise 1 corresponds to a simple object and 2 to a collection. It is the presence of a non-white string between positions 25 to 32 that indicates that we are treating a collector’s object.
The characters composing the names of the objects are limited to alphanumeric characters supplemented by the special characters:
“” |
the white one, |
“ . “ |
the point, |
“_” |
the underlined white, |
“$” |
the dollar symbol, |
“&” |
the and commercial. |
The conformity of the character strings is checked after insertion into the directories (when creating the name only) by comparing character by character with the content of the common/JCHAJE/initialized in the JEDEBU routine.
Destruction of a name
Destroying a name uses the same algorithm as the insertion, the position in the directory cannot be released due to possible collisions, so we proceed by making the identifier negative and assigning to “?” the character string of the name to be destroyed. So it will always be possible to recover this position later.
Resizing directories
Directories are automatically resized using the JJAREP routine. The size of the database directories is doubled during the operation. This operation completely rebuilds the new directory by inserting the existing names. Since the order of insertion is maintained, the system objects do not require any particular treatment, other than copying them into a larger container (the latter is then moved into memory) and updated on disk.
Case of collection directories
Collection directories are objects of non-homogeneous content: they store both the result (integer type) of the coding function and the character strings that make up the names. They are self-described and the routines using them contain the following instructions:
PARAMETER (ILOREP =1, IDENO =2, ILNOM =2, =3, =3, ILMAX =4, ILUTI =5, IDEHC =6)
The value positioned at: |
Represents: |
ILOREP |
the size needed for all integer codes, |
IDENO |
the address from which names are stored, |
ILNOM |
the length of the stored strings, |
ILMAX |
the maximum dimension of the directory, |
ILUTI |
the number of names actually stored, |
IDEHC |
the address from which whole codes are stored. |
The information stored at address ILUTI is updated and used in internal directory access functions; its value is only accessible externally, using the JELIRA utility with the attribute name NOMUTI.
Named collection objects, when created by the JECROC routine, are inserted using the JJCODN function. The intermediate routine JJCROC allows, depending on the value of its second parameter, to insert a new name or to verify its existence and to retrieve its insertion order.