aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/gtedit/gtwrhead.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /pkg/utilities/nttools/gtedit/gtwrhead.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'pkg/utilities/nttools/gtedit/gtwrhead.x')
-rw-r--r--pkg/utilities/nttools/gtedit/gtwrhead.x47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkg/utilities/nttools/gtedit/gtwrhead.x b/pkg/utilities/nttools/gtedit/gtwrhead.x
new file mode 100644
index 00000000..2b941be4
--- /dev/null
+++ b/pkg/utilities/nttools/gtedit/gtwrhead.x
@@ -0,0 +1,47 @@
+include <gset.h>
+include <tbset.h>
+
+# GT_WRHEAD -- Write out the column names of the table
+
+procedure gt_wrhead (gd, tp)
+
+pointer gd # Graphics descriptor
+pointer tp # Table descriptor
+
+pointer sp
+pointer cname, cunits, cfmt # pointers to scratch space for column info
+pointer ctext, cp
+int i, colnum, datatype, lendata, lenfmt, ncols
+
+pointer tbpsta(), tbcnum()
+
+begin
+ # Allocate some space
+ call smark (sp)
+ call salloc (cname, SZ_LINE, TY_CHAR)
+ call salloc (cunits, SZ_LINE, TY_CHAR)
+ call salloc (cfmt, SZ_COLFMT, TY_CHAR)
+ call salloc (ctext, SZ_LINE, TY_CHAR)
+
+ # Deactivate the workstation
+ call gdeactivate (gd, 0)
+ # Now get the info on the columns
+ ncols = tbpsta (tp, TBL_NCOLS)
+
+ call printf ("Column names:\n\n")
+ do i = 1, ncols {
+ cp = tbcnum (tp, i)
+ call tbcinf (cp,
+ colnum, Memc[cname], Memc[cunits], Memc[cfmt],
+ datatype, lendata, lenfmt)
+
+ # Print column name (and include trailing blanks)
+ # (calling sequence of inquotes modified by PEH on 13 Jan 1995)
+ call inquotes (Memc[cname], Memc[cname], SZ_LINE, YES)
+ call printf ("%-16s \n")
+ call pargstr (Memc[cname])
+
+ }
+ call greactivate (gd, AW_PAUSE)
+ call sfree (sp)
+end