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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <error.h>
include <syserr.h>
include <imhdr.h>
include <imset.h>
include <mach.h>
include "imx.h"
task imt = t_imt,
parse = t_parse,
fnexpand = t_fnexpand,
prelist = t_prelist,
preproc = t_preproc,
breakout = t_breakout,
imexpand = t_imexpand,
fexpand = t_fexpand
# IMT -- Test the image template package.
procedure t_imt ()
char template[SZ_LINE]
char image[SZ_FNAME]
pointer imt, im, imtopen(), immap()
int i, imtgetim()
bool num, clgetb()
begin
call clgstr ("in", template, SZ_LINE)
num = clgetb ("number")
imt = imtopen (template)
for (i=0; imtgetim (imt, image, SZ_FNAME) != EOF; i=i+1) {
if (num) {
im = immap (image, READ_ONLY, 0)
call printf ("%3d %s %d x %d\n")
call pargi (i+1)
call pargstr (image)
call pargi (IM_LEN(im,1))
call pargi (IM_LEN(im,2))
call imunmap (im)
} else {
if (i > 0)
call printf (",")
call printf ("%s")
call pargstr (image)
}
}
call printf ("\n")
call printf ("Nimages = %d\n")
call pargi (i)
call imtclose (imt)
end
# PARSE -- Test the image template package expression parse.
procedure t_parse ()
char template[SZ_LINE], name[SZ_LINE], index[SZ_LINE], ikparams[SZ_LINE]
char extname[SZ_LINE], extver[SZ_LINE], expr[SZ_LINE], sec[SZ_LINE]
int nch, imx_parse()
begin
call clgstr ("in", template, SZ_LINE)
nch = imx_parse (template, name, index, extname, extver,
expr, sec, ikparams, SZ_LINE)
call eprintf ("%s\n") ; call pargstr (template)
call eprintf ("\tname\t= %s\n") ; call pargstr (name)
call eprintf ("\tindex\t= %s\n") ; call pargstr (index)
call eprintf ("\textname\t= %s\n") ; call pargstr (extname)
call eprintf ("\textver\t= %s\n") ; call pargstr (extver)
call eprintf ("\texpr\t= %s\n") ; call pargstr (expr)
call eprintf ("\tikparams\t= %s\n") ; call pargstr (ikparams)
call eprintf ("\tsec\t= %s\n") ; call pargstr (sec)
end
# FNEXPAND -- Test the image template package pre-processor.
procedure t_fnexpand ()
char template[SZ_LINE]
pointer pp, imx_fnexpand()
begin
call clgstr ("in", template, SZ_LINE)
pp = imx_fnexpand (template)
call eprintf ("%s\n")
call pargstr (Memc[pp])
call mfree (pp, TY_CHAR)
end
# PRELIST -- Test the image template package pre-processor.
procedure t_prelist ()
char template[SZ_LINE]
pointer pp, imx_preproc_list()
begin
call clgstr ("in", template, SZ_LINE)
pp = imx_preproc_list (template)
call eprintf ("%s\n")
call pargstr (Memc[pp])
call mfree (pp, TY_CHAR)
end
# PREPROC -- Test the image template package pre-processor.
procedure t_preproc ()
char template[SZ_LINE]
pointer pp, imx_preproc()
begin
call clgstr ("in", template, SZ_LINE)
pp = imx_preproc (template)
call eprintf ("%s\n")
call pargstr (Memc[pp])
call mfree (pp, TY_CHAR)
end
# BREAKOUT -- Test the image template package expression breakout code.
procedure t_breakout ()
char template[SZ_LINE]
int nchars
char image[SZ_LINE], expr[SZ_LINE], sec[SZ_LINE], ikparams[SZ_LINE]
int imx_breakout()
begin
call clgstr ("in", template, SZ_LINE)
nchars = imx_breakout(template, NO, image, expr, sec, ikparams, SZ_LINE)
call eprintf ("nchars=%d image='%s' expr='%s' sec='%s' ik='%s'\n")
call pargi (nchars)
call pargstr (image)
call pargstr (expr)
call pargstr (sec)
call pargstr (ikparams)
end
# IMEXPAND -- Test the MEF image expansion.
procedure t_imexpand ()
char template[SZ_LINE]
int nimages
pointer imt, imx_imexpand()
begin
call clgstr ("in", template, SZ_LINE)
imt = imx_imexpand (template,
"", # expr
"", # index
"", # extname
"", # extver
"", # ikparams
"", # sections
nimages)
call printf ("nimages = %d\n%s\n");
call pargi (nimages)
call pargstr (Memc[imt])
call mfree (imt, TY_CHAR)
end
# FEXPAND -- Test the filename expansion.
procedure t_fexpand ()
char template[SZ_LINE]
int nimages
pointer imt, imx_fexpand()
begin
call clgstr ("in", template, SZ_LINE)
imt = imx_fexpand (template,
"", # expr
"", # index
"", # extname
"", # extver
"", # ikparams
"", # sections
nimages)
call printf ("nimages = %d\n%s\n");
call pargi (nimages)
call pargstr (Memc[imt])
call mfree (imt, TY_CHAR)
end
|