2 /* ###--------------------------------------------------------------### */
4 /* file : beh_freabl.c */
5 /* date : Sep 9 1993 */
7 /* authors : Pirouz BAZARGAN SABET */
8 /* description : high level function */
10 /* ###--------------------------------------------------------------### */
15 /* ###--------------------------------------------------------------### */
16 /* function : beh_freabl */
17 /* description : free all ABLs in BEFIG structure */
18 /* called func. : freeExpr */
19 /* ###--------------------------------------------------------------### */
21 void beh_freabl (befig_list
*ptr_befig
)
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
;
31 /* ###------------------------------------------------------### */
32 /* check that the unit exists */
33 /* ###------------------------------------------------------### */
35 if (ptr_befig
!= NULL
)
37 /* ###------------------------------------------------------### */
38 /* release expression in simple internal signals' list */
39 /* ###------------------------------------------------------### */
41 ptr_beaux
= ptr_befig
->BEAUX
;
42 while (ptr_beaux
!= NULL
)
44 if (ptr_beaux
->ABL
!= NULL
)
46 freeExpr (ptr_beaux
->ABL
);
47 ptr_beaux
->ABL
= NULL
;
49 ptr_beaux
= ptr_beaux
->NEXT
;
52 /* ###------------------------------------------------------### */
53 /* release expression in delayed signals' list */
54 /* ###------------------------------------------------------### */
56 ptr_beaux
= ptr_befig
->BEDLY
;
57 while (ptr_beaux
!= NULL
)
59 if (ptr_beaux
->ABL
!= NULL
)
61 freeExpr (ptr_beaux
->ABL
);
62 ptr_beaux
->ABL
= NULL
;
64 ptr_beaux
= ptr_beaux
->NEXT
;
67 /* ###------------------------------------------------------### */
68 /* release expression in assertions' list */
69 /* ###------------------------------------------------------### */
71 ptr_bemsg
= ptr_befig
->BEMSG
;
72 while (ptr_bemsg
!= NULL
)
74 if (ptr_bemsg
->ABL
!= NULL
)
76 freeExpr (ptr_bemsg
->ABL
);
77 ptr_bemsg
->ABL
= NULL
;
79 ptr_bemsg
= ptr_bemsg
->NEXT
;
82 /* ###------------------------------------------------------### */
83 /* release expression in simple output ports' list */
84 /* ###------------------------------------------------------### */
86 ptr_beout
= ptr_befig
->BEOUT
;
87 while (ptr_beout
!= NULL
)
89 if (ptr_beout
->ABL
!= NULL
)
91 freeExpr (ptr_beout
->ABL
);
92 ptr_beout
->ABL
= NULL
;
94 ptr_beout
= ptr_beout
->NEXT
;
97 /* ###------------------------------------------------------### */
98 /* release expression in bussed output ports' list */
99 /* ###------------------------------------------------------### */
101 ptr_bebus
= ptr_befig
->BEBUS
;
102 while (ptr_bebus
!= NULL
)
104 ptr_biabl
= ptr_bebus
->BIABL
;
105 while (ptr_biabl
!= NULL
)
107 if (ptr_biabl
->CNDABL
!= NULL
)
109 freeExpr(ptr_biabl
->CNDABL
);
110 ptr_biabl
->CNDABL
= NULL
;
112 if (ptr_biabl
->VALABL
!= NULL
)
114 freeExpr(ptr_biabl
->VALABL
);
115 ptr_biabl
->VALABL
= NULL
;
117 ptr_biabl
= ptr_biabl
->NEXT
;
119 ptr_bebus
= ptr_bebus
->NEXT
;
122 /* ###------------------------------------------------------### */
123 /* release expression in bussed internal signals' list */
124 /* ###------------------------------------------------------### */
126 ptr_bebux
= ptr_befig
->BEBUX
;
127 while (ptr_bebux
!= NULL
)
129 ptr_biabl
= ptr_bebux
->BIABL
;
130 while (ptr_biabl
!= NULL
)
132 if (ptr_biabl
->CNDABL
!= NULL
)
134 freeExpr (ptr_biabl
->CNDABL
);
135 ptr_biabl
->CNDABL
= NULL
;
137 if (ptr_biabl
->VALABL
!= NULL
)
139 freeExpr (ptr_biabl
->VALABL
);
140 ptr_biabl
->VALABL
= NULL
;
143 ptr_biabl
= ptr_biabl
->NEXT
;
145 ptr_bebux
= ptr_bebux
->NEXT
;
148 /* ###------------------------------------------------------### */
149 /* release expression in internal registers' list */
150 /* ###------------------------------------------------------### */
152 ptr_bereg
= ptr_befig
->BEREG
;
153 while (ptr_bereg
!= NULL
)
155 ptr_biabl
= ptr_bereg
->BIABL
;
156 while (ptr_biabl
!= NULL
)
158 if ( ptr_biabl
->CNDABL
!= NULL
)
160 freeExpr(ptr_biabl
->CNDABL
);
161 ptr_biabl
->CNDABL
= NULL
;
163 if ( ptr_biabl
->VALABL
!= NULL
)
165 freeExpr(ptr_biabl
->VALABL
);
166 ptr_biabl
->VALABL
= NULL
;
168 ptr_biabl
= ptr_biabl
->NEXT
;
170 ptr_bereg
= ptr_bereg
->NEXT
;