Module <tt>idents</tt>

HANDBOOK / LIBRARY REFERENCE MANUAL /

# Module `idents`

The module `idents` implements an abstract type `IDENT`.

    'type' IDENT

A value of type `IDENT` (an identifier) is a reference to an entry of the identifier table maintained by the module.

Each entry has a unique string representation which may be used to select the entry: the procedure `string_to_id` provides a mapping from strings to values of type `IDENT`. Such an identifier may have a meaning: procedure `HasMeaning` defines a mapping from identifiers to meanings.

    'action' string_to_id (STRING -> IDENT)

    void string_to_id (string, ref_id)
       char *string;
       IDENT *ref_id;

If an identifier with the string representation given by the first parameter exists in the identifier table it is a assigned to the variable referred by the second parameter. Otherwise such an identifier is created and assigned to that variable.

    'action' id_to_string (IDENT -> STRING)

    void id_to_string (id, ref_string)
       IDENT id;
       char **ref_string;

The procedure assigns the string representation of the identifier given as first parameter to the variable referred by the second parameter.

    'action' DefMeaning (IDENT, MEANING)

    void DefMeaning (id, m)
       IDENT id;
       long m;

The procedure `DefMeaning` defines the value of its second parameter as the meaning of the identifier given as the first parameter (a previous value is overridden).

`MEANING` may be any Gentle type.

    'action' UndefMeaning (IDENT)

    void UndefMeaning (id)
       IDENT id;

The procedure `UndefMeaning` indicates that the identifier given as parameter has no associated meaning (a previous value is overridden).

    'condition' HasMeaning (IDENT -> MEANING)

    int HasMeaning (id, ref_meaning)
       IDENT id;
       long *ref_meaning;

If the identifier given as first parameter has an associated meaning it is assigned to the variable referred by the second parameter, the procedure succeeds (returns 1). Otherwise the procedure fails (returns 0).

    'action' ErrorI (STRING, IDENT, STRING, POS)

    ErrorI (str1, id, str2, pos)
       char *str1;
       IDENT id;
       char *str2;
       long pos;

Procedure `ErrorI` is equivalent to procedure `Error` of module `errmsg` except that the text of the error message is given as the concatenation of the first parameter, the string representation of the identifier given as second parameter, and the third parameter.