aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/selector/tcstotsize.x
blob: e20c1b67b48cced6239f678379de9534372f7e4f (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
include "tcs.h"

# TCS_TOTSIZE -- Get total length of array from column selector

int procedure tcs_totsize (descrip)

pointer	descrip		#i: column selector
#--
int	size, idim, ndim
pointer sp, length

begin
	call smark (sp)
	call salloc (length, MAXDIM, TY_INT)

	# Get length of each axis

	call tcs_shape (descrip, Memi[length], ndim, MAXDIM)

	# Multiply lengths together for total length

	size = 1
	do idim = 1, ndim
	    size = size * Memi[length+idim-1]

	call sfree (sp)
	return (size)
end