aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/photcal/mctable/mctgetrow.x
blob: bc46b06e6a9bf8adc133d1211a0a8015d228d312 (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
include	"../lib/mctable.h"


# MCT_GETROW - Get pointer to row data values.

pointer procedure mct_getrow (table, row)

pointer	table			# table descriptor
int	row			# row number

begin
	# Check the pointer and magic number.
	if (table == NULL)
	    call error (0, "mct_getrow: Null table pointer")
	if (MCT_MAGIC (table) != MAGIC)
	    call error (0, "mct_getrow: Bad magic number")

	# Return the pointer to a row buffer, or NULL.
	# if row is out of range
	if (row < 1 || row > MCT_NPROWS (table))
	    call error (0, "mct_getrow: Bad row number")

	# Return row pointer.
	return (MCT_DATA (table) + (row - 1) * MCT_MAXCOL (table))
end