1ADDCHAIN(3)                  MBK UTILITY FUNCTIONS                 ADDCHAIN(3)
2
3
4

NAME

6       addchain - create a chain and add it to a list
7

SYNOPSIS

9       #include "mut.h"
10       chain_list ∗addchain(pthead, ptdata)
11       chain_list ∗pthead;
12       void ∗ptdata;
13

PARAMETERS

15       pthead              Pointer to a chain_list
16
17       ptdata              Generic pointer to any kind of information
18

DESCRIPTION

20       addchain  creates  a  new chain element and adds it to the front of the
21       list pointed to by pthead, and becomes itself the list head.
22       The chain_lists are mosty used to create temporary lists of homogeneous
23       elements, for binary trees, and so on.
24       The  ptdata  points  to  any  kind of list or may itself be a value, if
25       proper cast is performed at compilation time, and fills the DATA  field
26       of the chain structure.  For details on the structure, see chain(3).
27

RETURN VALUE

29       addchain returns a pointer to the new head of list.
30

EXAMPLE

32       #include "mut.h"
33       #include "mlo.h"
34       chain_list ∗get_external_connectors(ptfig)
35       lofig_list ∗ptfig;
36       {
37       locon_list ∗pt = ptfig->LOCON;
38       chain_list ∗c = NULL; /∗ initialized for regularity ∗/
39          while (pt) {
40             if (pt->TYPE == EXTERNAL)
41                c = addchain(c, (void ∗)pt)
42             pt = pt->NEXT;
43          }
44          return c;
45       }
46

SEE ALSO

48       mbk(1), chain(3), freechain(3), delchain(3).
49
50
51
52
53
54
55ASIM/LIP6                       October 1, 1997                    ADDCHAIN(3)
Impressum