BSD 4 release
[unix-history] / usr / src / cmd / struct / 1.finish.c
CommitLineData
aaa7ced1
BJ
1#include <stdio.h>
2#include "def.h"
3#include "1.incl.h"
4
5fingraph()
6 {
7 /* if any entry statements, add a DUMVX with arcs to all entry statements */
8 if (ENTLST)
9 {
10 ARC(START,0) = addum(ARC(START,0),ENTLST);
11 freelst(ENTLST);
12 }
13 /* if any FMTVX, add a DUMVX with arcs to all FMTVX's */
14 if (FMTLST)
15 {
16 ARC(START,0) = addum(ARC(START,0),FMTLST);
17 freelst(FMTLST);
18 }
19 }
20
21addum(v,lst)
22VERT v;
23struct list *lst;
24 {
25 VERT new;
26 int count,i;
27 struct list *ls;
28 count = lslen(lst); /* length of lst */
29 new = create(DUMVX,1+count);
30 ARC(new,0) = v;
31 for (i = count, ls = lst; i >= 1; --i, ls = ls->nxtlist)
32 {
33 ASSERT(ls,addum);
34 ARC(new,i) = ls->elt;
35 }
36 ASSERT(!ls, addum);
37 return(new);
38 }