Chains

TCL API

C Routine Interface

Contributed Functions

Chains

CHAINs are defined in the header file shChain.h.

The Chain Package under DERVISH provides users with a generic container class. We use the word chain as a synonym for a linked list. We have chosen to use chain so as to:

A chain is a doubly linked list made up of one or more chain elements. Each of these chain elements holds data inserted on the chain. A chain can be a homogeneous chain, in which case it holds data of the same type (for example a chain of MASKs, REGIONs, PTs, etc), or it can be a heterogeneous chain, in which case it can hold data of differing types.

A chain responds to the following operations:

Chain are 0-indexed beasts. Logically, they look like:

                                    chain
                                   +-----+
                                   |     |
               +-------------------|     |------------------+
               |                   +-----+                  |
               |                                            |
          HEAD V                                            V TAIL
            +-----+        +-----+        +-----+        +-----+      
            |     |------->|     |------->|     |------->|     |--> NULL
    NULL <--|     |<-------|     |<-------|     |<-------|     |
            +-----+        +-----+        +-----+        +-----+
       (Index  0              1              2              3)

                          Elements on the chain