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/selector/tbcnel.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/tbtables/selector/tbcnel.x')
-rw-r--r-- | pkg/tbtables/selector/tbcnel.x | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/pkg/tbtables/selector/tbcnel.x b/pkg/tbtables/selector/tbcnel.x new file mode 100644 index 00000000..9173a1ff --- /dev/null +++ b/pkg/tbtables/selector/tbcnel.x @@ -0,0 +1,52 @@ +include <tbset.h> + +# This file contains tbcnel and tbcnel1. + +# tbcnel -- get the total number of elements for a column +# This function multiplies the number of selected rows by the number of +# elements in one row, for the specified column. The column may contain +# scalars or arrays. +# +# If the column was listed in a column selector string, and if this +# included an array section, the number of elements for one row will be +# the number in the array section. +# +# Phil Hodge, 5-Mar-1998 Function created. + +int procedure tbcnel (tp, cp) + +pointer tp # i: pointer to table descriptor +pointer cp # i: pointer to column descriptor +#-- +pointer descrip # column selector descriptor (ignored) +int nrows # number of selected rows +int nelem # number of elements in one cell + +begin + call tbcnel1 (tp, cp, descrip, nelem, nrows) + + return (nrows * nelem) +end + +procedure tbcnel1 (tp, cp, descrip, nelem, nrows) + +pointer tp # i: pointer to table descriptor +pointer cp # i: pointer to column descriptor +pointer descrip # o: column selector descriptor +int nelem # o: number of elements in one cell +int nrows # o: number of selected rows +#-- +pointer tbcdes() +int tcs_totsize() +int tbpsta(), tbalen() + +begin + descrip = tbcdes (tp, cp) + + if (descrip == NULL) + nelem = tbalen (cp) # cp is not a selected column + else + nelem = tcs_totsize (descrip) + + nrows = tbpsta (tp, TBL_NROWS) # number of selected rows +end |