aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbsirow.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/tbtables/tbsirow.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/tbtables/tbsirow.x')
-rw-r--r--pkg/tbtables/tbsirow.x36
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