next up previous contents
Next: Property Lists Up: Generic Lists Previous: Specifying Types   Contents

Lists and Ddlists

Two basic structures exist for the representation of lists. These are singly

typedef struct list  /* generic list type for all simple list structures */
{
    Ts_id ts_id;                /* Tina structure identifier */
    int type;
    struct list *next;
    void *to;
} List;

and doubly connected

typedef struct ddlist  /* generic double dircted list type */
{
    Ts_id ts_id;                /* Tina structure identifier */
    int type;
    struct ddlist *next;
    struct ddlist *last;
    void *to;
} Ddlist;

with obvious meanings.

The field to provides a pointer to the data specified by type. The fields next and last provide simple and doubly directed manipulation.

As far as possible the names of functions for manipulating list structures conform to the following conventions. Functions acting upon single elements of a list are prefixed either link_ or ref_ depending whether they act upon the list element or the item referenced through it respectively. Functions that act upon lists as a whole are prefixed list_. Wherever possible functions for manipulating doubly directed lists have the same names and meanings except they have a further (or alternative) prefix dd_. In general complementary functions exist for each type of list with as similar a functionality as possible.


next up previous contents
Next: Property Lists Up: Generic Lists Previous: Specifying Types   Contents
root 2017-11-22