aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/lib/allcols.x
blob: 64e497865ece5aa7f7299ecda50689a8c2dfddd2 (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>

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

procedure allcolumns (tp, numcol, colptr)

pointer	tp		# i: Table descriptor
int	numcol		# o: Number of columns in the table
pointer	colptr		# o: Pointer to array of indices

int	icol

int	tbpsta(), tbcnum()

errchk	tbpsta, malloc

begin
	
	numcol = tbpsta (tp, TBL_NCOLS)
	call malloc (colptr, numcol, TY_INT)

	do icol = 1, numcol
		Memi[colptr+icol-1] = tbcnum (tp, icol)

end