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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
include <pkg/inlfit.h>
define NPERLINE 5
# ING_DATA -- List the raw data on the screen.
procedure ing_data$t (in, file, x, names, npts, nvars, len_name)
pointer in # INLFIT pointer
char file[ARB] # Output file name
PIXEL x[ARB] # Ordinates (npts * nvars)
char names[ARB] # Object names
int npts # Number of data points
int nvars # Number of variables
int len_name # Length of the name
int i, j, fd
pointer sp, vnames, name
int open()
int inlstrwrd()
errchk open()
begin
# Open the output file.
if (file[1] == EOS)
return
fd = open (file, APPEND, TEXT_FILE)
# Test the number of data points.
if (npts == 0) {
call eprintf ("Incomplete output - no data points for fit\n")
return
}
# Allocate memory.
call smark (sp)
call salloc (vnames, SZ_LINE, TY_CHAR)
call salloc (name, SZ_LINE, TY_CHAR)
# Get the variable names.
call in_gstr (in, INLVLABELS, Memc[vnames], SZ_LINE)
# Print title.
do j = 1, nvars + 1 {
if (mod (j, NPERLINE) == 1) {
call fprintf (fd, "\n")
call fprintf (fd, "#")
}
if (j == 1) {
call fprintf (fd, "%14.14s ")
call pargstr ("objectid")
} else if (inlstrwrd (j-1, Memc[name], SZ_LINE, Memc[vnames]) !=
0) {
call fprintf (fd, "%14.14s ")
call pargstr (Memc[name])
} else {
call fprintf (fd, "%12.12s%02.2d ")
call pargstr ("var")
call pargi (j-1)
}
}
call fprintf (fd, "\n")
# List the variables values.
do i = 1, npts {
do j = 1, nvars + 1 {
if (j == 1) {
call fprintf (fd, "\n")
call fprintf (fd, "%15.15s")
call pargstr (names[(i-1)*len_name+1])
} else if (mod (j, NPERLINE) == 1) {
call fprintf (fd, "\n")
call fprintf (fd, "*%14.7g")
call parg$t (x[(i-1)*nvars+j-1])
} else {
call fprintf (fd, " %14.7g")
call parg$t (x[(i-1)*nvars+j-1])
}
}
}
call fprintf (fd, "\n\n")
# Free allocated memory and close output file.
call sfree (sp)
call close (fd)
end
|