aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbscol.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/tbtables/tbscol.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/tbtables/tbscol.x')
-rw-r--r--pkg/tbtables/tbscol.x32
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