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/tbsirow.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'pkg/tbtables/tbsirow.x')
-rw-r--r-- | pkg/tbtables/tbsirow.x | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pkg/tbtables/tbsirow.x b/pkg/tbtables/tbsirow.x new file mode 100644 index 00000000..8129df52 --- /dev/null +++ b/pkg/tbtables/tbsirow.x @@ -0,0 +1,36 @@ +include "tbtables.h" +include "tblerr.h" + +# tbsirow -- get actual row number from selected row number +# +# This routine is for translating the selected row number to the actual +# row number for an input table, i.e. for the case where the row number +# may not be greater than the number of rows in the table. + +procedure tbsirow (tp, selrow, rownum) + +pointer tp # i: pointer to table descriptor +int selrow # i: row number (or selected row number) +int rownum # o: actual row number +#-- +int rst_rownum() + +begin + if (selrow < 1) + call error (1, "row number less than one is invalid") + + if (TB_ROW_SELECT(tp) == YES) { + + if (selrow > TB_NSEL_ROWS(tp)) + call error (ER_TBBEYONDEOF, "input row is beyond EOF") + + rownum = rst_rownum (TB_ROWSET(tp), selrow) + + } else { + + if (selrow > TB_NROWS(tp)) + call error (ER_TBBEYONDEOF, "input row is beyond EOF") + + rownum = selrow + } +end |