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/tbzudf.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/tbtables/tbzudf.x')
-rw-r--r-- | pkg/tbtables/tbzudf.x | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pkg/tbtables/tbzudf.x b/pkg/tbtables/tbzudf.x new file mode 100644 index 00000000..a3339610 --- /dev/null +++ b/pkg/tbtables/tbzudf.x @@ -0,0 +1,43 @@ +include <tbset.h> +include "tbtables.h" +include "tblerr.h" + +# tbzudf -- set to undefined +# "Delete" entries in a table by setting each entry in the internal +# memory for the column to the INDEF value appropriate for its datatype. +# This version is for text tables. +# +# Phil Hodge, 3-Feb-1992 Subroutine created. + +procedure tbzudf (tp, cp, numcols, rownum) + +pointer tp # i: pointer to table descriptor +pointer cp[numcols] # i: array of pointers to column descriptors +int numcols # i: number of columns +int rownum # i: row number +#-- +int k # Loop index +int datatype # Data type of a column +int lenstr # length of a string table element +int ip # offset to a string in Memc + +begin + do k = 1, numcols { + + datatype = COL_DTYPE(cp[k]) + + if (datatype == TBL_TY_DOUBLE) { + Memd[COL_OFFSET(cp[k]) + rownum - 1] = INDEFD + + } else if (datatype == TBL_TY_INT) { + Memi[COL_OFFSET(cp[k]) + rownum - 1] = INDEFI + + } else if (datatype < 0) { + lenstr = -COL_DTYPE(cp[k]) # not including EOS + ip = (rownum - 1) * (lenstr + 1) # including EOS + Memc[COL_OFFSET(cp[k]) + ip] = EOS + } else { + call error (ER_TBCOLBADTYP, "tbzudf: bad datatype") + } + } +end |