aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbscol.x
blob: 549706d4c0994164300d120d539a37419baf741a (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
include "tbtables.h"

# If we need to reallocate the space for column selector descriptors,
# this is the amount we will add to the current size.
define	INCR_MAX_SELCOLS	20

# tbscol -- add a new column to the list of selected columns
# If a column selector is in effect, this routine adds one column to the
# list of selected columns.  This would be called primarily when creating
# a new column.
#
# Phil Hodge,  2-Mar-1998  Subroutine created.

procedure tbscol (tp, cp)

pointer tp		# i: pointer to table descriptor
pointer cp		# i: pointer to column descriptor
#--
errchk	tcs_addcol

begin
	if (TB_COLUMN_SELECT(tp) == YES) {	# column selection is in effect

	    if (TB_NSEL_COLS(tp) + 1 > TB_MAX_SELCOLS(tp)) {
		TB_MAX_SELCOLS(tp) = TB_NSEL_COLS(tp) + INCR_MAX_SELCOLS
		call realloc (TB_SELCOL_PTR(tp), TB_MAX_SELCOLS(tp), TY_POINTER)
	    }

	    call tcs_addcol (tp, cp,
		TB_SELCOL(tp,1), TB_NSEL_COLS(tp), TB_MAX_SELCOLS(tp))
	}
end