next up previous contents index
Next: Lists Up: Data Types Previous: System Defined Attributes

Labels

  

All LIBLINCKS functions have at least one label pointer as argument. The label structure is declared in liblincks.h as follows:

typedef struct {
    int vs;               /* Version structure node index     */
                          /* Identifier for a set of versions
                           * of a node. */
#define VS_SYS_ROOT 0     /* System root node. */

    int inst;             /* Instance node index */
                          /* Identifier for a particular version
                             of a node, or indicator for unbound
                             reference. */
#define INST_UNBOUND (-1) /* Unbound link.  The old term was
                             "free reference". */
} label;
       

Labels should always be treated as handles to objects and nodes and should not be changed by the application program. The label fields can be read out as `` inst version of object with vs as history structure node''.

A label is either bound to some particular version of an object, or is an unbound reference to the object, in which case it dynamically refers to the current version. A bound label becomes unbound through a call to the function UBL_UNBINDLABEL()    , while an unbound label becomes bound either as a side effect when it is passed in to LIBLINCKS functions that change node contents, or through a call to the LIBLINCKS function GC_GETCURRENT() .        

The application program is free to assign labels to labels, and to compare labels. The labels should then be treated as pairs of integers according to above. Label comparison has intricate semantics though, due to the use of currency.

If two labels are equal in both vs  and inst , they refer to the same version of the same object. This holds independent of whether they are unbound or bound.

If the labels differ in the inst field but not in the vs field and both are bound, they refer to different versions of the same object.

If the labels differ in the inst field, but not in the vs field and one of them is unbound, then they may still refer to the same version of same object. The unbound label may refer to it through the current link, while the bound label refers to it directly. In this case, it is advisable to bind the unbound label through a call to GC_GETCURRENT().

If the labels are different in the vs field, they refer to different objects.



next up previous contents index
Next: Lists Up: Data Types Previous: System Defined Attributes



Martin Sjolin
Thu Jun 15 20:41:59 MET DST 1995