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/tbsirow.x | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pkg/tbtables/tbsirow.x (limited to 'pkg/tbtables/tbsirow.x') 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 -- cgit