Research V7 development
[unix-history] / usr / src / cmd / struct / 1.node.c
CommitLineData
e858a77f
BB
1#include <stdio.h>
2#include "def.h"
3#include "1.incl.h"
4
5makenode(type,addimp,addcom, labe,arcnum,arctype,arclab)
6LOGICAL addimp,addcom;
7int type, arctype[], arcnum;
8long arclab[], labe;
9 {
10 int i;
11 VERT num;
12
13 ASSERT(arcsper[type] < 0 || arcnum == arcsper[type], makenode);
14 num = create(type,arcnum);
15
16 if (addimp) fiximp(num,labe);
17
18 for (i = 0; i < arcnum; ++i)
19 {
20 if (arctype[i] == -2)
21 addref(arclab[i],&ARC(num,i));
22 else
23 ARC(num,i) = arctype[i];
24 }
25
26
27 if (hascom[type] )
28 {
29 if (!addcom || endcom < begline)
30 BEGCOM(num) = UNDEFINED;
31 else{
32 BEGCOM(num) = begchar - rtnbeg;
33 if((unsigned)(BEGCOM(num))!=begchar-rtnbeg)
34 faterr("program too long","","");
35 }
36 }
37 return(num);
38 }
39
40
41
42
43
44fiximp(num,labe) /* fix implicit links, check nesting */
45VERT num;
46long labe;
47 {
48 fixvalue(implicit, num); /* set implicit links to this node */
49 clear(implicit);
50 if(labe != implicit) fixvalue(labe, num);
51 }