aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/inlfit/ingvars.gx
blob: 291284a02bce7b34807834b8267a927988a9deeb (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
48
49
50
51
52
53
54
55
include <pkg/inlfit.h>

# ING_VARIABLES -- Write the variable numbers, names and minimum and maximum
# values to a file.

procedure ing_variables$t (in, file, nvars)

pointer	in			# pointer to the inlfit structure
char	file[ARB]		# output file name
int	nvars			# number of variables

int	i, fd
pointer	sp, labels, pvnames, name, minptr, maxptr
int	open(), inlstrwrd()
pointer	in_getp()

begin
	if (file[1] == EOS)
	    return
	fd = open (file, APPEND, TEXT_FILE)

	call smark (sp)
	call salloc (labels, SZ_LINE, TY_CHAR)
	call salloc (pvnames, SZ_LINE, TY_CHAR)
	call salloc (name, SZ_LINE, TY_CHAR)
	call in_gstr (in, INLVLABELS, Memc[labels], SZ_LINE)
	call strcpy (Memc[labels], Memc[pvnames], SZ_LINE)

	# Print the title string.
	call fprintf (fd, "\n%-10.10s  %-10.10s  %14.14s  %14.14s\n")
	    call pargstr ("number")
	    call pargstr ("variable")
	    call pargstr ("minimum")
	    call pargstr ("maximum")

	# Print the variables.
	minptr = in_getp (in, INLXMIN)
	maxptr = in_getp (in, INLXMAX)
	do i = 1, nvars {
	    if (inlstrwrd (i, Memc[name], SZ_LINE, Memc[pvnames]) == 0) {
		call sprintf (Memc[name], SZ_LINE, "var %d")
		    call pargi (i)
	    }
	    call fprintf (fd, "%-10.2d  %-10.10s  ")
		call pargi (i)
		call pargstr (Memc[name])
	    call fprintf (fd, "%14.7f  %14.7f\n")
		call parg$t (Mem$t[minptr+i-1])
		call parg$t (Mem$t[maxptr+i-1])
	}
	call fprintf (fd, "\n")

	call close (fd)
	call sfree (sp)
end