aboutsummaryrefslogtreecommitdiff
path: root/pkg/utilities/nttools/gtedit/gtwrhead.x
blob: 2b941be4a28d3e1a7a6c71846a568fd1c4e4f42a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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