diff options
Diffstat (limited to 'pkg/tbtables/tbscol.x')
-rw-r--r-- | pkg/tbtables/tbscol.x | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/tbtables/tbscol.x b/pkg/tbtables/tbscol.x new file mode 100644 index 00000000..549706d4 --- /dev/null +++ b/pkg/tbtables/tbscol.x @@ -0,0 +1,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 |