Initial version of donated sources by Avertec, 3.4p5.
[tas-yagle.git] / distrib / sources / beh / bhl / beh_freabl.c
1
2 /* ###--------------------------------------------------------------### */
3 /* */
4 /* file : beh_freabl.c */
5 /* date : Sep 9 1993 */
6 /* version : v106 */
7 /* authors : Pirouz BAZARGAN SABET */
8 /* description : high level function */
9 /* */
10 /* ###--------------------------------------------------------------### */
11
12 #include <stdio.h>
13 #include "bhl_lib.h"
14
15 /* ###--------------------------------------------------------------### */
16 /* function : beh_freabl */
17 /* description : free all ABLs in BEFIG structure */
18 /* called func. : freeExpr */
19 /* ###--------------------------------------------------------------### */
20
21 void beh_freabl (befig_list *ptr_befig)
22 {
23 struct beaux *ptr_beaux;
24 struct bemsg *ptr_bemsg;
25 struct beout *ptr_beout;
26 struct bebus *ptr_bebus;
27 struct biabl *ptr_biabl;
28 struct bebux *ptr_bebux;
29 struct bereg *ptr_bereg;
30
31 /* ###------------------------------------------------------### */
32 /* check that the unit exists */
33 /* ###------------------------------------------------------### */
34
35 if (ptr_befig != NULL)
36 {
37 /* ###------------------------------------------------------### */
38 /* release expression in simple internal signals' list */
39 /* ###------------------------------------------------------### */
40
41 ptr_beaux = ptr_befig->BEAUX;
42 while (ptr_beaux != NULL)
43 {
44 if (ptr_beaux->ABL != NULL)
45 {
46 freeExpr (ptr_beaux->ABL);
47 ptr_beaux->ABL = NULL;
48 }
49 ptr_beaux = ptr_beaux->NEXT;
50 }
51
52 /* ###------------------------------------------------------### */
53 /* release expression in delayed signals' list */
54 /* ###------------------------------------------------------### */
55
56 ptr_beaux = ptr_befig->BEDLY;
57 while (ptr_beaux != NULL)
58 {
59 if (ptr_beaux->ABL != NULL)
60 {
61 freeExpr (ptr_beaux->ABL);
62 ptr_beaux->ABL = NULL;
63 }
64 ptr_beaux = ptr_beaux->NEXT;
65 }
66
67 /* ###------------------------------------------------------### */
68 /* release expression in assertions' list */
69 /* ###------------------------------------------------------### */
70
71 ptr_bemsg = ptr_befig->BEMSG;
72 while (ptr_bemsg != NULL)
73 {
74 if (ptr_bemsg->ABL != NULL)
75 {
76 freeExpr (ptr_bemsg->ABL);
77 ptr_bemsg->ABL = NULL;
78 }
79 ptr_bemsg = ptr_bemsg->NEXT;
80 }
81
82 /* ###------------------------------------------------------### */
83 /* release expression in simple output ports' list */
84 /* ###------------------------------------------------------### */
85
86 ptr_beout = ptr_befig->BEOUT;
87 while (ptr_beout != NULL)
88 {
89 if (ptr_beout->ABL != NULL)
90 {
91 freeExpr (ptr_beout->ABL);
92 ptr_beout->ABL = NULL;
93 }
94 ptr_beout = ptr_beout->NEXT;
95 }
96
97 /* ###------------------------------------------------------### */
98 /* release expression in bussed output ports' list */
99 /* ###------------------------------------------------------### */
100
101 ptr_bebus = ptr_befig->BEBUS;
102 while (ptr_bebus != NULL)
103 {
104 ptr_biabl = ptr_bebus->BIABL;
105 while (ptr_biabl != NULL)
106 {
107 if (ptr_biabl->CNDABL != NULL)
108 {
109 freeExpr(ptr_biabl->CNDABL);
110 ptr_biabl->CNDABL = NULL;
111 }
112 if (ptr_biabl->VALABL != NULL)
113 {
114 freeExpr(ptr_biabl->VALABL);
115 ptr_biabl->VALABL = NULL;
116 }
117 ptr_biabl = ptr_biabl->NEXT;
118 }
119 ptr_bebus = ptr_bebus->NEXT;
120 }
121
122 /* ###------------------------------------------------------### */
123 /* release expression in bussed internal signals' list */
124 /* ###------------------------------------------------------### */
125
126 ptr_bebux = ptr_befig->BEBUX;
127 while (ptr_bebux != NULL)
128 {
129 ptr_biabl = ptr_bebux->BIABL;
130 while (ptr_biabl != NULL)
131 {
132 if (ptr_biabl->CNDABL != NULL)
133 {
134 freeExpr (ptr_biabl->CNDABL);
135 ptr_biabl->CNDABL = NULL;
136 }
137 if (ptr_biabl->VALABL != NULL)
138 {
139 freeExpr (ptr_biabl->VALABL);
140 ptr_biabl->VALABL = NULL;
141 }
142
143 ptr_biabl = ptr_biabl->NEXT;
144 }
145 ptr_bebux = ptr_bebux->NEXT;
146 }
147
148 /* ###------------------------------------------------------### */
149 /* release expression in internal registers' list */
150 /* ###------------------------------------------------------### */
151
152 ptr_bereg = ptr_befig->BEREG;
153 while (ptr_bereg != NULL)
154 {
155 ptr_biabl = ptr_bereg->BIABL;
156 while (ptr_biabl != NULL)
157 {
158 if ( ptr_biabl->CNDABL != NULL )
159 {
160 freeExpr(ptr_biabl->CNDABL);
161 ptr_biabl->CNDABL = NULL;
162 }
163 if ( ptr_biabl->VALABL != NULL )
164 {
165 freeExpr(ptr_biabl->VALABL);
166 ptr_biabl->VALABL = NULL;
167 }
168 ptr_biabl = ptr_biabl->NEXT;
169 }
170 ptr_bereg = ptr_bereg->NEXT;
171 }
172 }
173 }