aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbcchg.x
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tbtables/tbcchg.x')
-rw-r--r--pkg/tbtables/tbcchg.x35
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/tbtables/tbcchg.x b/pkg/tbtables/tbcchg.x
new file mode 100644
index 00000000..5b381adc
--- /dev/null
+++ b/pkg/tbtables/tbcchg.x
@@ -0,0 +1,35 @@
+include <tbset.h>
+include "tbtables.h"
+include "tblerr.h"
+
+# tbcchg -- change allocated row length
+# This procedure is for changing the number of allocated columns, i.e.
+# the row length.
+# The allocated space for column descriptors will also be increased, if
+# necessary, to allow defining a single-precision column for each SZ_REAL
+# added to the row length.
+# For column-ordered tables this procedure does nothing.
+#
+# Phil Hodge, 6-Feb-1992 Include only section for row ordered.
+
+procedure tbcchg (tp, rowlen)
+
+pointer tp # Pointer to table descriptor
+int rowlen # The new value for the row length in SZ_CHAR
+
+int maxcols # New value for TB_MAXCOLS
+errchk tbtchs
+
+begin
+ if (TB_TYPE(tp) == TBL_TYPE_S_ROW) {
+ if (TB_IS_OPEN(tp)) {
+ maxcols = TB_NCOLS(tp) + (rowlen - TB_COLUSED(tp)) / SZ_REAL
+ # maxcols < 0 means that tbtchs should not change TB_MAXCOLS.
+ if (maxcols <= TB_MAXCOLS(tp))
+ maxcols = -1
+ call tbtchs (tp, -1, maxcols, rowlen, -1)
+ } else {
+ TB_ROWLEN(tp) = rowlen
+ }
+ }
+end