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

include	<plset.h>
include	<plio.h>

# PL_COMPARE -- Compare two masks for equality, optionally noting any
# differences on the output file.  PL_EQUAL is returned if the two masks
# are equivalent.

int procedure pl_compare (pl_1, pl_2, outfd)

pointer	pl_1, pl_2		#I masks to be compared
int	outfd			#I file for diagnostic output, or NULL

int	i
bool	pll_equal()

begin
	if (PL_NAXES(pl_1) != PL_NAXES(pl_2) || PL_NLP(pl_1) != PL_NLP(pl_2)) {
	    if (outfd != NULL)
		call fprintf (outfd, "the masks are not the same size\n")
	    return (PL_NOTEQUAL)
	}

	do i = 1, PL_NLP(pl_1)
	    if (!pll_equal (LL(pl_1,PL_LP(pl_1,i)), LL(pl_2,PL_LP(pl_2,i)))) {
		if (outfd != NULL) {
		    call fprintf (outfd, "masks differ at line %d\n")
			call pargi (i)
		}
		return (PL_NOTEQUAL)
	    }

	return (PL_EQUAL)
end