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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
include <pkg/rg.h>
include "apertures.h"
# AP_GMARK -- Mark an aperture.
define SZ_TEXT 10 # Maximum size of aperture number string
procedure ap_gmark (gp, imvec, aps, naps)
pointer gp # GIO pointer
int imvec # Image vector
pointer aps[ARB] # Aperture data
int naps # Number of apertures
int i, apaxis
real x1, x2, y1, y2, dy, xc, xl, xu
pointer sp, text, format, ap
int itoc()
real ap_cveval()
begin
# The aperture is marked at the top of the graph.
call smark (sp)
call salloc (text, SZ_TEXT, TY_CHAR)
call ggwind (gp, xl, xu, y1, y2)
x1 = min (xl, xu)
x2 = max (xl, xu)
dy = 0.025 * (y2 - y1)
y1 = y2 - 4 * dy
if (naps > 20) {
call salloc (format, SZ_LINE, TY_CHAR)
call sprintf (Memc[format], SZ_LINE, "h=c,v=b,s=%4.2f")
call pargr (20. / naps)
}
for (i = 1; i <= naps; i = i + 1) {
ap = aps[i]
apaxis = AP_AXIS(ap)
xc = AP_CEN(ap, apaxis) + ap_cveval (AP_CV(ap), real (imvec))
xl = xc + AP_LOW(ap, apaxis)
xu = xc + AP_HIGH(ap, apaxis)
call gline (gp, xc, y1 - 2 * dy, xc, y1 + 2 * dy)
call gline (gp, xl, y1 - dy, xl, y1 + dy)
call gline (gp, xu, y1 - dy, xu, y1 + dy)
call gline (gp, xl, y1, xu, y1)
if ((xc > x1) && (xc < x2)) {
if (itoc (AP_ID(ap), Memc[text], SZ_TEXT) > 0) {
if (naps > 20)
call gtext (gp, xc, y1 + 2.5 * dy, Memc[text],
Memc[format])
else
call gtext (gp, xc, y1 + 2.5 * dy, Memc[text],
"h=c,v=b")
}
}
}
call sfree (sp)
end
# AP_GMARKB -- Mark backgrounds.
procedure ap_gmarkb (gp, imvec, aps, naps)
pointer gp # GIO pointer
int imvec # Image vector
pointer aps[ARB] # Aperture data
int naps # Number of apertures
int i, j, nx, apaxis
real x1, x2, y1, y2, dy, xc, xl, xu
pointer sp, sample, x, ap, rg
real ap_cveval()
pointer rg_xrangesr()
begin
call smark (sp)
call salloc (sample, SZ_LINE, TY_CHAR)
# The background is marked at the bottom of the graph.
call ggwind (gp, xl, xu, y1, y2)
x1 = min (xl, xu)
x2 = max (xl, xu)
dy = 0.005 * (y2 - y1)
y1 = y1 + 4 * dy
# Allocate x array.
nx = x2 - x1 + 2
call salloc (x, nx, TY_REAL)
for (i = 1; i <= naps; i = i + 1) {
ap = aps[i]
apaxis = AP_AXIS(ap)
xc = AP_CEN(ap, apaxis) + ap_cveval (AP_CV(ap), real (imvec))
if (AP_IC(ap) == NULL)
next
call ic_gstr (AP_IC(ap), "sample", Memc[sample], SZ_LINE)
do j = 0, nx-1
Memr[x+j] = x1 + j - xc
rg = rg_xrangesr (Memc[sample], Memr[x], nx)
do j = 1, RG_NRGS(rg) {
xl = Memr[x+RG_X1(rg,j)-1] + xc
xu = Memr[x+RG_X2(rg,j)-1] + xc
if (xl > x1 && xl < x2)
call gline (gp, xl, y1-dy, xl, y1+dy)
if (xu > x1 && xu < x2)
call gline (gp, xu, y1-dy, xu, y1+dy)
call gline (gp, xl, y1, xu, y1)
}
call rg_free (rg)
}
call sfree (sp)
end
|