xref: /original-bsd/usr.bin/struct/struct/3.main.c (revision 4f00418d)
1 /*-
2  * %sccs.include.proprietary.c%
3  */
4 
5 #ifndef lint
6 static char sccsid[] = "@(#)3.main.c	8.1 (Berkeley) 06/06/93";
7 #endif /* not lint */
8 
9 #include <stdio.h>
10 #include "def.h"
11 
12 structure()
13 	{
14 	VERT v, *head;
15 
16 	if (progress)
17 		fprintf(stderr,"	getreach:\n");
18 	getreach();
19 	if (routerr) return;
20 	if (progress)
21 		fprintf(stderr,"	getflow:\n");
22 	getflow();
23 	if (progress)
24 		fprintf(stderr,"	getthen:\n");
25 	getthen(START);
26 	head = challoc(nodenum * sizeof(*head));
27 	for (v = 0; v < nodenum; ++v)
28 		head[v] = UNDEFINED;
29 	for (v = START; DEFINED(v); v = RSIB(v))
30 		fixhd(v,UNDEFINED,head);
31 			/* fixhd must be called before getloop so that
32 				it gets applied to IFVX which becomes NXT(w) for UNTVX w */
33 	if (progress)
34 		fprintf(stderr,"	getloop:\n");
35 	getloop();
36 	if (progress)
37 		fprintf(stderr,"	getbranch:\n");
38 	getbranch(head);
39 	chfree(head,nodenum * sizeof(*head));
40 	head = 0;
41 	}
42