aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/apextract/apselect.x
blob: 47730f4767b79db232b419d5e0c9105f71eabbef (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
include	"apertures.h"

define	NRANGES	100


# AP_SELECT -- Select apertures.
# The AP_SELECT field of the aperture structure is set.

procedure ap_select (apertures, aps, naps)

char	apertures[ARB]		#I Aperture selection string
pointer	aps[ARB]		#U Aperture pointers
int	naps			#I Number of apertures

pointer	sp, ranges
int	i, decode_ranges()
bool	is_in_range()

begin
	# Check if apertures are defined.
	if (naps < 1)
	    return

	call smark (sp)
	call salloc (ranges, 3*NRANGES, TY_INT)

	# Decode aperture string.
	if (decode_ranges (apertures, Memi[ranges], NRANGES, i) == ERR)
	    call error (0, "Bad aperture list")

	# Select apertures.
	do i = 1, naps {
	    if (is_in_range (Memi[ranges], AP_ID(aps[i])))
		AP_SELECT(aps[i]) = YES
	    else
		AP_SELECT(aps[i]) = NO
	}

	call sfree (sp)
end