From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- pkg/tbtables/tbxwer.x | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 pkg/tbtables/tbxwer.x (limited to 'pkg/tbtables/tbxwer.x') diff --git a/pkg/tbtables/tbxwer.x b/pkg/tbtables/tbxwer.x new file mode 100644 index 00000000..bb06e9c1 --- /dev/null +++ b/pkg/tbtables/tbxwer.x @@ -0,0 +1,37 @@ +include "tbtables.h" + +# tbxwer -- write empty rows +# The purpose of this routine is to write empty (INDEF) rows beyond the +# current end of file for a row-ordered table, if the specified row is +# larger than the number of rows already written to the table. If the +# specified row is within the range of existing rows, the table itself +# will not be modified. +# +# Note that TB_NROWS will not be updated. +# +# Phil Hodge, 4-Mar-1998 Subroutine created, extracted from tbtwer. + +procedure tbxwer (tp, rownum) + +pointer tp # i: pointer to table descriptor +int rownum # i: (actual) row number in table +#-- +long locn # location for writing (at EOF) +int k # loop index +int nrows # number of rows on entry to this routine +int rowlen # record length +errchk seek, write + +begin + nrows = TB_NROWS(tp) + if (rownum <= nrows) + return # nothing to do + + rowlen = TB_ROWLEN(tp) + locn = TB_BOD(tp) + nrows * rowlen # this is the end of file + do k = nrows+1, rownum { + call seek (TB_FILE(tp), locn) + call write (TB_FILE(tp), Memc[TB_INDEF(tp)], rowlen) + locn = locn + rowlen + } +end -- cgit