aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbfwsi.x
blob: 985eb27cfc0897fdac5ba6b4840aeed07b25fe42 (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
include <tbset.h>
include "tbtables.h"

# tbfwsi -- write size info
# If the current HDU is a table, this routine writes the number of rows and
# the number of columns as FITS keywords NAXIS2 and TFIELDS respectively.
#
# Phil Hodge,  6-Jul-1995  Subroutine created
# Phil Hodge,  2-Feb-1996  Check that current HDU is a table.
# Phil Hodge,  7-Jun-1999  Use TB_SUBTYPE instead of TB_HDUTYPE.

procedure tbfwsi (tp)

pointer tp		# i: pointer to table descriptor
#--
int	status		# zero is OK
errchk	tbferr

begin
	status = 0

	if (TB_SUBTYPE(tp) == TBL_SUBTYPE_BINTABLE || 
	    TB_SUBTYPE(tp) == TBL_SUBTYPE_ASCII) {

	    call fsmkyj (TB_FILE(tp), "NAXIS2", TB_NROWS(tp), "", status)
	    if (status != 0)
		call tbferr (status)

	    call fsmkyj (TB_FILE(tp), "TFIELDS", TB_NCOLS(tp), "", status)
	    if (status != 0)
		call tbferr (status)
	}
end