aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/center/apcfree.x
blob: 7fb219c780b6f776077347aad2e3e3b31b91ab32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
include "../lib/apphotdef.h"
include "../lib/centerdef.h"

# APCFREE -- Procedure to free the centering data structure.

procedure apcfree (ap)

pointer	ap		# pointer to the apphot structure

begin
	if (ap == NULL)
	    return
	if (AP_NOISE(ap) != NULL)
	    call ap_noisecls (ap)
	if (AP_PCENTER(ap) != NULL)
	    call ap_ctrcls (ap)
	if (AP_PDISPLAY(ap) != NULL)
	    call ap_dispcls (ap)
	if (AP_IMBUF(ap) != NULL)
	    call mfree (AP_IMBUF(ap), TY_REAL)
	if (AP_MW(ap) != NULL)
	    call mw_close (AP_MW(ap))
	call mfree (ap, TY_STRUCT)
end


# AP_CTRCLS -- Procedure to close up the centering structure arrays.

procedure ap_ctrcls (ap)

pointer	ap			# pointer to apphot structure

pointer	ctr

begin
	ctr = AP_PCENTER(ap)
	if (ctr == NULL)
	    return
	if (AP_CTRPIX(ctr) != NULL)
	    call mfree (AP_CTRPIX(ctr), TY_REAL)
	if (AP_XCTRPIX(ctr) != NULL)
	    call mfree (AP_XCTRPIX(ctr), TY_REAL)
	if (AP_YCTRPIX(ctr) != NULL)
	    call mfree (AP_YCTRPIX(ctr), TY_REAL)
	call mfree (AP_PCENTER(ap), TY_STRUCT)
end