diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /pkg/tbtables/tbxwer.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/tbtables/tbxwer.x')
-rw-r--r-- | pkg/tbtables/tbxwer.x | 37 |
1 files changed, 37 insertions, 0 deletions
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 |