2 /* ###--------------------------------------------------------------### */
4 /* file : beh_delbefig.c */
5 /* date : Sep 3 1993 */
7 /* authors : Pirouz BAZARGAN SABET */
8 /* content : low-level function */
10 /* ###--------------------------------------------------------------### */
17 /* ###--------------------------------------------------------------### */
18 /* function : beh_delbefig */
19 /* description : delete a BEFIG structure and return the pointer of */
20 /* the next object. A warning is printed out if the */
21 /* object to be deleted is not empty when the mode is N. */
22 /* called func. : mbkfree , beh_frebereg, beh_frebemsg, */
23 /* beh_freberin, beh_frebeout, beh_frebebus, */
24 /* beh_frebeaux, beh_frebebux, beh_frebepor, */
25 /* beh_frebegen, getptype */
26 /* ###--------------------------------------------------------------### */
28 befig_list
*beh_delbefig (listbefig
, ptbefig
, mode
)
30 befig_list
*listbefig
; /* list of befig containing the object */
31 befig_list
*ptbefig
; /* pointer of the BEFIG to be deleted */
32 char mode
; /* recursive delete or not (Y or N) */
36 struct befig
*ptlastfig
;
39 if ((listbefig
!= NULL
) && (ptbefig
!= NULL
))
42 /* ###------------------------------------------------------### */
43 /* Search the object to be deleted */
44 /* ###------------------------------------------------------### */
46 headfig
.NEXT
= listbefig
;
48 while ((ptlastfig
!= NULL
) && (ptlastfig
->NEXT
!= ptbefig
))
49 ptlastfig
= ptlastfig
->NEXT
;
51 if (ptlastfig
!= NULL
)
54 /* ###------------------------------------------------------### */
55 /* If the object doesn't exist return the list without */
57 /* If the object has been found check the mode and, if asked */
58 /* delete pointed objects recursively. */
59 /* ###------------------------------------------------------### */
63 if ((ptbefig
->BEREG
!= NULL
) || (ptbefig
->BEMSG
!= NULL
) ||
64 (ptbefig
->BERIN
!= NULL
) || (ptbefig
->BEOUT
!= NULL
) ||
65 (ptbefig
->BEBUS
!= NULL
) || (ptbefig
->BEAUX
!= NULL
) ||
66 (ptbefig
->BEBUX
!= NULL
) || (ptbefig
->BEDLY
!= NULL
) ||
67 (ptbefig
->BEPOR
!= NULL
) || (ptbefig
->USER
!= NULL
) ||
68 (ptbefig
->BEVECTREG
) || (ptbefig
->BEVECTOUT
) ||
69 (ptbefig
->BEVECTBUS
) || (ptbefig
->BEVECTAUX
) ||
70 (ptbefig
->BEVECTBUS
) || (ptbefig
->BEVECTPOR
) )
72 beh_warning(304,ptbefig
->NAME
,NULL
);
73 // (stderr,"BEH_warning : befig `%s` not empty\n", ptbefig->NAME);
77 beh_frebereg (listbefig
->BEREG
);
78 beh_frebevectreg (listbefig
->BEVECTREG
);
79 beh_frebemsg (listbefig
->BEMSG
);
80 beh_freberin (listbefig
->BERIN
);
81 beh_frebeout (listbefig
->BEOUT
);
82 beh_frebevectout (listbefig
->BEVECTOUT
);
83 beh_frebebus (listbefig
->BEBUS
);
84 beh_frebevectbus (listbefig
->BEVECTBUS
);
85 beh_frebeaux (listbefig
->BEAUX
);
86 beh_frebevectaux (listbefig
->BEVECTAUX
);
87 beh_frebeaux (listbefig
->BEDLY
);
88 beh_frebebux (listbefig
->BEBUX
);
89 beh_frebevectbux (listbefig
->BEVECTBUX
);
90 beh_frebepor (listbefig
->BEPOR
);
91 beh_frebevectpor (listbefig
->BEVECTPOR
);
92 if ((ptptype
= getptype (ptbefig
->USER
,BEH_GENERIC
)) != NULL
)
93 beh_frebegen (ptptype
->DATA
);
96 ptlastfig
->NEXT
= ptbefig
->NEXT
;
97 if (ptbefig
->CIRCUI
) destroyCct(ptbefig
->CIRCUI
);
101 listbefig
= headfig
.NEXT
;