aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/apextract/apshow.x
blob: 16f4d504ffe9e0d6a18b734cd958840df4ea804d (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	"apertures.h"

# AP_SHOW -- List the apertures to a text file.

procedure ap_show (file, aps, naps)

char	file[ARB]		# Aperture file
pointer	aps[ARB]		# Aperture pointers
int	naps			# Number of apertures

pointer	ap
int	i, apaxis, fd, open()
errchk	open

begin
	if (naps == 0)
	    return

	# Open the output file.  Return if an error occurs.
	fd = open (file, APPEND, TEXT_FILE)

	call fprintf (fd, "# APERTURES\n\n%4s %4s %7s %7s %7s %s\n")
	    call pargstr ("##ID")
	    call pargstr ("BEAM")
	    call pargstr ("CENTER")
	    call pargstr ("LOW")
	    call pargstr ("HIGH")
	    call pargstr ("TITLE")
	for (i = 1; i <= naps; i = i + 1) {
	    ap = aps[i]
	    apaxis = AP_AXIS(ap)
	    call fprintf (fd, "%4d %4d %7.2f %7.2f %7.2f")
		call pargi (AP_ID(ap))
		call pargi (AP_BEAM(ap))
		call pargr (AP_CEN(ap, apaxis))
		call pargr (AP_LOW(ap, apaxis))
		call pargr (AP_HIGH(ap, apaxis))
	    if (AP_TITLE(ap) != NULL) {
		call fprintf (fd, " %s")
		    call pargstr (Memc[AP_TITLE(ap)])
	    }
	    call fprintf (fd, "\n")
	}

	call close (fd)
end