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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <plio.h>
# PLL_PRINTS -- Print a line list on the given output stream.
procedure pll_prints (ll, fd, label, firstcol, maxcols)
short ll[ARB] #I line list
int fd #I output file
char label[ARB] #I line label
int firstcol #I first column for output
int maxcols #I width of formatted output
pointer sp, buf
bool skipword
int opcode, data
int ll_len, ll_first, col, ip, pv, x
int strlen()
begin
call smark (sp)
call salloc (buf, SZ_FNAME, TY_CHAR)
# Support old format line lists.
if (LL_OLDFORMAT(ll)) {
ll_len = OLL_LEN(ll)
ll_first = OLL_FIRST
} else {
ll_len = LL_LEN(ll)
ll_first = LL_FIRST(ll)
}
# Output the line label and advance to the first column. If the label
# extends beyond the first column, start a new line.
call putline (fd, label)
col = strlen (label) + 1
if (col > firstcol)
call pl_debugout (fd, "", col, firstcol, maxcols)
skipword = false
pv = 1
x = 1
# Decode the line list proper.
do ip = ll_first, ll_len {
if (skipword) {
skipword = false
next
}
opcode = I_OPCODE(ll[ip])
data = I_DATA(ll[ip])
switch (opcode) {
case I_ZN:
x = x + data
call sprintf (Memc[buf], SZ_FNAME, "Z%d")
call pargi (data)
case I_HN:
x = x + data
call sprintf (Memc[buf], SZ_FNAME, "H%d")
call pargi (data)
case I_PN:
x = x + data
call sprintf (Memc[buf], SZ_FNAME, "P%d")
call pargi (data)
case I_SH:
pv = (int(ll[ip+1]) * I_SHIFT) + data
skipword = true
call sprintf (Memc[buf], SZ_FNAME, "SH(%d)")
call pargi (pv)
case I_IH:
pv = pv + data
call sprintf (Memc[buf], SZ_FNAME, "IH%d(%d)")
call pargi (data)
call pargi (pv)
case I_DH:
pv = pv - data
call sprintf (Memc[buf], SZ_FNAME, "DH%d(%d)")
call pargi (data)
call pargi (pv)
case I_IS, I_DS:
x = x + 1
if (opcode == I_IS) {
pv = pv + data
call sprintf (Memc[buf], SZ_FNAME, "IS%d(%d)")
call pargi (data)
call pargi (pv)
} else {
pv = pv - data
call sprintf (Memc[buf], SZ_FNAME, "DS%d(%d)")
call pargi (data)
call pargi (pv)
}
}
call pl_debugout (fd, Memc[buf], col, firstcol, maxcols)
}
call sprintf (Memc[buf], SZ_FNAME, "(%d,%d)")
call pargi (x - 1)
call pargi (pv)
call pl_debugout (fd, Memc[buf], col, firstcol, maxcols)
call pl_debugout (fd, "", col, firstcol, maxcols)
call sfree (sp)
end
|