aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/quadred/src/quad/quaddelete.x
blob: bdee65b2cc44bc2ea440b262c7467bf95aa68482 (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
include "quadgeom.h"

# QUADDELETE --  Delete subimages, one for each readout.

procedure quaddelete (qg, rootname)

pointer	qg		#I Pointer to open quadgeom structure
char	rootname[ARB]	#I Root name for subimages.

int	amp
pointer	fullname

pointer	sp
int	imaccess()

begin
	call smark (sp)
	call salloc (fullname, SZ_LINE, TY_CHAR)

	# Loop over active readouts
	do amp = 1, QG_NAMPS(qg) {

	    # The sub-section image will only exist if this is not a phantom
	    if (QG_PHANTOM (qg, amp) == NO) {

		# Make sub-image name
		call sprintf (Memc[fullname], SZ_LINE, "%s.%s")
		    call pargstr (rootname)
		    call pargstr (Memc[QG_AMPID(qg, amp)])

		# Delete the sub-image (if it exists)
		if (imaccess (Memc[fullname], READ_ONLY) == YES) {
		    call imdelete (Memc[fullname])
		}
	    }
	}
	
	call sfree (sp)
end