aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/fitsio/fitssppb/fsgrsz.x
blob: 83dca679c685798fdff3bbbcac0e6dc510ebe9c2 (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
include <fset.h>
include "fitsio.h"

# This was added for compatibility with CFITSIO.

procedure fsgrsz (iunit, maxrows, status)


int     iunit           # i input file pointer
int     maxrows         # o number of rows that fit in buffer
int     status          # o error status
#--
int	fd
int	bufsize
int	naxis1
char	comm[SZ_FCOMMENT]
int	fstati()
include	"../fitsspp.com"	# in order to get fd from iunit

begin
	call fsgkyj (iunit, "NAXIS1", naxis1, comm, status)
	if (status != 0)
	    return
	naxis1 = naxis1 / 2		# convert from bytes to SPP char

	fd = bufid[iunit]

	bufsize = fstati (fd, F_BUFSIZE)
	if (naxis1 > 0) {
	    maxrows = bufsize / naxis1
	    maxrows = max (1, maxrows)
	} else {
	    maxrows = bufsize
	}
end