aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbtflu.x
blob: 145c6930d63330a7009f600f2e4c07bed9a6fe4e (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
include <tbset.h>
include "tbtables.h"
include "tblerr.h"

# tbtflu -- call flush
# This routine writes the size-information record (in case the number of
# rows or columns has changed) and then flushes the fio buffer for the table.
#
# Phil Hodge,  2-Nov-1988  Subroutine created.
# Phil Hodge, 14-Jan-1992  Add option for text table type.
# Phil Hodge, 20-Jun-1995  Add option for FITS tables.

procedure tbtflu (tp)

pointer tp			# i: pointer to table descriptor
#--

begin
	if (TB_TYPE(tp) == TBL_TYPE_TEXT)
	    return			# don't do anything for text file

	if (TB_TYPE(tp) == TBL_TYPE_FITS)
	    return			# don't do anything for FITS file

	if (TB_FILE(tp) == NULL)
	    call error (ER_TBNOTOPEN, "tbtflu:  table is not open")

	if (TB_READONLY(tp))
	    call error (ER_TBREADONLY, "tbtflu:  table is readonly")

	call tbtwsi (tp)		# write size-info record

	call flush (TB_FILE(tp))
end