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
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <mach.h>
include <fset.h>
include <gset.h>
define XS 0.216
define XE 0.719
define YS 0.214
define YE 0.929
task test = t_test
# T_TEST -- Test program for graphics plotting. A labelled grid is output.
procedure t_test ()
bool redir
pointer sp, gp
char command[SZ_LINE], image[SZ_FNAME], word[SZ_LINE]
char output[SZ_FNAME], output_file[SZ_FNAME], device[SZ_FNAME]
int cmd, input_fd, stat, fd
pointer gopen()
bool streq()
int fstati(), open(), getline()
begin
# If the input has been redirected, input is read from the named
# command file. If not, each image name in the input template is
# plotted.
if (fstati (STDIN, F_REDIR) == YES) {
call eprintf ("Input has been redirected\n")
redir = true
cmd = open (STDIN, READ_ONLY, TEXT_FILE)
}
# Loop over commands until EOF
repeat {
if (redir) {
if (getline (STDIN, command, SZ_LINE) == EOF)
break
call sscan (command)
call gargwrd (word, SZ_LINE)
if (!streq (word, "plot")) {
# Pixel window has been stored as WCS 2
call gseti (gp, G_WCS, 2)
call gscan (command)
next
} else
call gargwrd (image)
}
call clgstr ("output", output, SZ_FNAME)
if (!streq (output, "")) {
call strcpy (output, output_file, SZ_FNAME)
fd = open (output_file, NEW_FILE, BINARY_FILE)
} else
fd = open ("dev$crt", NEW_FILE, BINARY_FILE)
call clgstr ("device", device, SZ_FNAME)
gp = gopen (device, NEW_FILE, fd)
call gseti (gp, G_XDRAWGRID, 1)
call gseti (gp, G_YDRAWGRID, 1)
call gseti (gp, G_NMAJOR, 21)
call glabax (gp, "TEST", "NDC_X", "NDC_Y")
call gline (gp, XS, YS, XE, YS)
call gline (gp, XE, YS, XE, YE)
call gline (gp, XE, YE, XS, YE)
call gline (gp, XS, YE, XS, YS)
call gmark (gp, 0.5, 0.5, GM_CROSS, 3.0, 3.0)
call gtext (gp, XS, YS-0.1, "DICOMED crtpict film area")
call gclose (gp)
call close (fd)
}
call clpcls (input_fd)
call sfree (sp)
end
|