aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/threed/titable/titable.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/utilities/nttools/threed/titable/titable.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/utilities/nttools/threed/titable/titable.x')
-rw-r--r--pkg/utilities/nttools/threed/titable/titable.x83
1 files changed, 83 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/threed/titable/titable.x b/pkg/utilities/nttools/threed/titable/titable.x
new file mode 100644
index 00000000..476f00ef
--- /dev/null
+++ b/pkg/utilities/nttools/threed/titable/titable.x
@@ -0,0 +1,83 @@
+include <tbset.h>
+
+# TITABLE -- Insert 2D tables into 3D table rows.
+#
+# Input tables are given by a filename template list. All row/column
+# selection on input tables is performed by bracket-enclosed selectors
+# appended to the file name. The output is a 3-D table with no row/column
+# selectors.
+#
+#
+#
+# Revision history:
+# ----------------
+# 20-Jan-97 - Task created (I.Busko)
+# 17-Mar-97 - Revised after code review (IB)
+# 8-Apr-02 - Remove the unused strings for error messages (P. Hodge)
+# 8-Dec-03 - Use tbtacc() instead of access() to test for a new table;
+# use mfree instead of tcs_close for cpo.
+
+
+procedure t_titable()
+
+char tablist[SZ_LINE] # Input table list
+char output[SZ_PATHNAME] # Output table name
+char template[SZ_PATHNAME] # Template table name
+int row # Row where to begin insertion
+bool verbose # Print operations ?
+#--
+char root[SZ_FNAME]
+char rowselect[SZ_FNAME]
+char colselect[SZ_FNAME]
+char colname[SZ_COLNAME]
+char colunits[SZ_COLUNITS]
+char colfmt[SZ_COLFMT]
+pointer cpo
+pointer otp, list
+int ncpo, rowc
+bool rflag
+
+pointer imtopen()
+int clgeti(), tbtacc()
+bool clgetb(), streq()
+
+begin
+ # Get task parameters.
+
+ call clgstr ("intable", tablist, SZ_LINE)
+ call clgstr ("outtable", output, SZ_PATHNAME)
+ call clgstr ("template", template, SZ_PATHNAME)
+ row = clgeti ("row")
+ verbose = clgetb ("verbose")
+
+ # Abort if invalid output name..
+ if (streq (output, "STDOUT"))
+ call error (1, "Invalid output file name.")
+ call rdselect (output, root, rowselect, colselect, SZ_FNAME)
+ if (rowselect[1] != EOS || colselect[1] != EOS)
+ call error (1, "Sections not permitted on output table name.")
+
+ # Open input list.
+ list = imtopen (tablist)
+
+ # Open/create the output table.
+ if (tbtacc (output) == YES)
+ call tiupdate (root, otp, cpo, ncpo)
+ else
+ call tinew (template, list, root, rowselect, colselect, colname,
+ colunits, colfmt, otp, cpo, ncpo)
+
+ # Initialize row counter.
+ rowc = row
+ rflag = false
+ if (rowc <= 0 || IS_INDEFI(rowc)) rflag = true
+
+ # Do the insertion.
+ call tinsert (list, output, otp, cpo, ncpo, rowc, rflag, verbose,
+ rowselect, colselect, colname, colunits, colfmt)
+
+ # Cleanup. The cpo array was allocated by tiupdate/tinew.
+ call mfree (cpo, TY_INT)
+ call tbtclo (otp)
+ call imtclose (list)
+end