aboutsummaryrefslogtreecommitdiff
path: root/sys/mwcs/iwfind.x
blob: e400f9ee48b2191c06c7e7bc29a8c200989a17ed (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	"imwcs.h"

# IW_FINDCARD -- Search the card list in the IMWCS descriptor for a card of
# the given type, with the given axis and index numbers.  Return a pointer to
# the card if found, else NULL.

pointer procedure iw_findcard (iw, type, axis, index)

pointer	iw			#I pointer to IMWCS descriptor
int	type			#I card type code
int	axis			#I axis number, or <0 to ignore
int	index			#I index number, or <=0 to ignore

int	i
pointer	cp

begin
	do i = 1, IW_NCARDS(iw) {
	    cp = IW_CARD(iw,i)
	    if (C_TYPE(cp) != type)
		next
	    if (axis >= 0)
		if (C_AXIS(cp) != axis)
		    next
	    if (index > 0)
		if (C_INDEX(cp) != index)
		    next
	    return (cp)
	}

	return (NULL)
end