aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbxwnc.x
blob: 409973898f3fb7c58502aaa73bd0965a16b2b66d (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
36
37
include "tbtables.h"

# tbxwnc -- X write new columns
# Write new column descriptors into a row-ordered table.
# The table must have already been reorganized (if necessary) to make
# sufficient space for column descriptors or row length.
#
# Phil Hodge,  1-May-1989  Change calling sequence; don't call tbxsiz.
# Phil Hodge, 30-Mar-1993  TB_INDEF is now TY_CHAR rather than TY_REAL.
# Phil Hodge, 14-Apr-1998  Change calling sequence of tbcwcd.

procedure tbxwnc (tp, colptr, numcols, old_colused)

pointer tp			# i: pointer to table descriptor
pointer colptr[numcols]		# i: pointers to descriptors for new columns
int	numcols			# i: number of new columns
int	old_colused		# i: previous value of TB_COLUSED
#--
pointer cp			# Pointer to a specific column
int	k			# Loop index
errchk	tbxncn, tbcwcd

begin
	# Assign appropriate indef values in indef record.
	do k = 1, numcols
	    call tbbnll (tp, colptr[k])

	# Write descriptors of new columns to table.
	do k = 1, numcols {
	    cp = colptr[k]
	    call tbcwcd (tp, cp)
	}

	# Assign indef values for each new column in each existing row.
	if (TB_NROWS(tp) > 0)
	    call tbxncn (tp, old_colused, Memc[TB_INDEF(tp)])
end