aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbywer.x
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tbtables/tbywer.x')
-rw-r--r--pkg/tbtables/tbywer.x32
1 files changed, 32 insertions, 0 deletions
diff --git a/pkg/tbtables/tbywer.x b/pkg/tbtables/tbywer.x
new file mode 100644
index 00000000..6c3585b1
--- /dev/null
+++ b/pkg/tbtables/tbywer.x
@@ -0,0 +1,32 @@
+include "tbtables.h"
+
+define FRAC_INCR 1.2 # fractional increase in allrows
+define DEFNUMROWS 100 # minimum increase in allrows
+
+# tbywer -- write empty rows
+# The purpose of this routine is to allocate more space for rows for a
+# column-ordered table. If the specified row is within the range of
+# existing rows, the table itself will not be modified.
+#
+# If rownum is greater than TB_ALLROWS then tbtchs will be called to
+# rewrite the table and increase the allocated number of rows by a default
+# amount.
+#
+# Note that TB_NROWS will not be updated.
+#
+# Phil Hodge, 4-Mar-1998 Subroutine created, extracted from tbtwer.
+
+procedure tbywer (tp, rownum)
+
+pointer tp # i: pointer to table descriptor
+int rownum # i: (actual) row number in table
+#--
+int allrows # allocated number of rows
+errchk tbtchs
+
+begin
+ if (rownum > TB_ALLROWS(tp)) {
+ allrows = rownum * FRAC_INCR + DEFNUMROWS
+ call tbtchs (tp, -1, -1, -1, allrows) # change table size
+ }
+end