aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/lib/allrows.x
blob: 086e6a4a49bb544cb735add39960c02e97ca2948 (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
include	<tbset.h>

# ALLROWS -- Return a pointer to an array containing the indices of all
# the rows in a table. The calling procedure must free the array when it
# is through with it.
#
# B.Simon	11-Dec-87	First Code

procedure allrows (tp, numrow, rowptr)

pointer	tp		# i: Table descriptor
int	numrow		# o: Number of rows in the table
pointer	rowptr		# o: Pointer to array of indices

int	irow

int	tbpsta()

errchk	tbpsta, malloc

begin
	
	numrow = tbpsta (tp, TBL_NROWS)
	call malloc (rowptr, numrow, TY_INT)

	do irow = 1, numrow
		Memi[rowptr+irow-1] = irow

end