aboutsummaryrefslogtreecommitdiff
path: root/pkg/tbtables/tbrsft.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/tbrsft.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/tbtables/tbrsft.x')
-rw-r--r--pkg/tbtables/tbrsft.x51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkg/tbtables/tbrsft.x b/pkg/tbtables/tbrsft.x
new file mode 100644
index 00000000..0cc4bbcf
--- /dev/null
+++ b/pkg/tbtables/tbrsft.x
@@ -0,0 +1,51 @@
+include <tbset.h>
+include "tbtables.h"
+include "tblerr.h"
+
+# tbrsft -- shift rows
+# Shift one or more rows down (to leave a gap in the table) or up (to
+# delete rows). The range of rows that is shifted is from FIRST to
+# the last row in the table. Shift down if SHIFT > 0, or shift up if
+# SHIFT < 0. SHIFT is the number of rows by which to shift.
+#
+# Rows that are exposed by the shift are NOT set to indef. The total
+# number of rows TB_NROWS(tp) will NOT be reduced if SHIFT < 0, but
+# it will be increased if SHIFT > 0. The calling routine (e.g. tbrdel)
+# is responsible for cleaning up such details.
+#
+# Phil Hodge, 23-Mar-1988 Subroutine created.
+# Phil Hodge, 30-Jan-1992 Add option for text table type.
+# Phil Hodge, 3-Apr-1995 Set TB_MODIFIED to true.
+# Phil Hodge, 21-Jun-1995 Modify for FITS tables.
+# Phil Hodge, 3-Mar-1998 Error if a row selector is in effect.
+
+procedure tbrsft (tp, first, shift)
+
+pointer tp # i: pointer to table descriptor
+int first # i: first row to be moved
+int shift # i: shift by this many rows
+#--
+errchk tbxsft, tbysft, tbzsft, tbfsft
+
+begin
+ if (shift == 0)
+ return
+
+ if (TB_ROW_SELECT(tp) == YES) {
+ call error (1,
+ "Can't shift rows in a table with row selector in effect.")
+ }
+
+ if (TB_TYPE(tp) == TBL_TYPE_S_ROW)
+ call tbxsft (tp, first, shift)
+ else if (TB_TYPE(tp) == TBL_TYPE_S_COL)
+ call tbysft (tp, first, shift)
+ else if (TB_TYPE(tp) == TBL_TYPE_TEXT)
+ call tbzsft (tp, first, shift)
+ else if (TB_TYPE(tp) == TBL_TYPE_FITS)
+ call tbfsft (tp, first, shift)
+ else
+ call error (ER_TBCORRUPTED, "tbrsft: table type is messed up")
+
+ TB_MODIFIED(tp) = true
+end