diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/tbtables/tbcchg.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/tbtables/tbcchg.x')
-rw-r--r-- | pkg/tbtables/tbcchg.x | 35 |
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 |