1 " make_rgr_commands.qedx: qedx macro which examines all known devices
2 " at a site and creates an ec to register them under RCP Resource Management.
3
4 " Modified 1985-03-21 by E. Swenson to anticipate query from sort_seg
5 " and to quit out of qedx with the force option.
6
7 e delete register.ec rcp.list -bf
8
9 " Produce a list of the configured devices.
10
11 e file_output rcp.list
12 e rcp_list -lg
13 e revert_output
14
15 " Read in output from rcp_list command
16
17 r rcp.list
18 1,3d " kill header
19
20 " create subroutine to move line to building buffer
21
22 badd_build a
23 mtemp " first move the line to temp
24 bbuild " then go into build and append
25 a
26 \c\c\c\btemp\c\c\c\f " the line in temp
27 b0 " return to main buffer
28 \f " end subroutine
29
30 " create subroutine to clear the building buffer
31
32 bclear_build a
33 bbuild a
34 xxx
35 \c\f
36 1,$d
37 b0
38 \f
39
40 b0 " return to main buffer
41
42 " process tape drives
43
44 /Device type: "tape_drive"/n " find right section
45
46 " set up buffer program to create registration command from each tape entry
47
48 btape a
49
50 .-1n
51 /tape_drive device:/p " find next real entry
52 s/^.*: // " isolate name of device
53 \badd_build " put in build buffer
54 -1n /^.*Model *= */n " skip to Model
55 s//-pattr model=/ " make attribute from it
56 \badd_build " put in build buffer
57 -1n /^.*Tracks *= */n " skip to Tracks
58 s//,track=/ " make attribute from it
59 \badd_build " put in build buffer
60 -1n /^.*Densities *= */n " skip to Densities
61 s// /
62 s/ /,den=/
63 \badd_build " put in build buffer
64 -1n /^.*Speed *= */n " skip to Speed
65 s//,speed=/ " make attribute from it
66 \badd_build " put in build buffer
67
68 bbuild " go into build buffer and insert
69 1i
70 register_resource tape_drive
71 \c\f " get out of insert mode
72 2mname " put the name in a buffer
73 i\c\bname\c\f " put it back
74 $a
75 -owner system
76 -pacc system_low:system_high
77 -acc system_low:system_high
78 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
79 w build_temp
80 e file_output register.ec
81 e string contents build_temp
82 e revert_output
83 1,$d " clear the buffer
84 r register.ec
85 $s/ *,/,/ " make the attributes adjacent
86 w
87 1,$d " so build can be reused
88 b0 " go back to main buffer
89 \c\btape\f " and try to iterate recur
90
91 b0 " get back to main buffer
92
93 " process disk drives
94
95 /Device type: "disk_drive"/n " find disk section
96
97 " set up buffer program to create registration command from each disk entry
98
99 bdisk a
100
101 .-1n
102 /disk_drive device:/p " find next real entry
103 s/^.*: // " isolate name of device
104 \badd_build " put in build buffer
105 -1n /^.*Model *= */n " skip to Model
106 s//-pattr model=/ " make attribute from it
107 \badd_build " put in build buffer
108
109 bbuild " go into build buffer and insert
110 1i
111 register_resource disk_drive
112 \c\f " get out of insert, and append to end
113 $a
114 ,use=io,use=ss
115 \c\f " get out of append
116 2mname " put the name in a buffer
117 i\c\bname\c\f " put it back
118 $a
119 -owner system
120 -pacc system_low:system_high
121 -acc system_low:system_high
122 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
123 w build_temp
124 e fo register.ec
125 e string contents build_temp
126 e ro
127 1,$d " clear the buffer
128 r register.ec
129 $s/ *,/,/ " make the attributes adjacent
130 w
131 1,$d
132 b0
133 \c\bdisk\f " and try to iterate recur
134
135 b0 " get back to main buffer
136
137 " process console
138
139 /Device type: "console"/n " find console section
140
141 " set up buffer program to create registration command from each console entry
142
143 bconsole a
144
145 .-1n
146 /console device:/p " find next real entry
147 s/^.*: // " isolate name of device
148 \badd_build " put in build buffer
149 -1n /^.*Model *= */n " skip to Model
150 s//-pattr model=/ " make attribute from it
151 \badd_build " put in build buffer
152
153 bbuild " go into build buffer and insert
154 1i
155 register_resource console
156 \c\f " get out of insert
157 2mname " put the name in a buffer
158 i\c\bname\c\f " put it back
159 $a
160 -owner system
161 -pacc system_low:system_high
162 -acc system_low:system_high
163 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
164 w build_temp
165 e fo register.ec
166 e string contents build_temp
167 e ro
168 1,$d " clear the buffer
169 b0 " go back to main buffer
170 \c\bconsole\f " and try to iterate recur
171
172 b0 " get back to main buffer
173
174 " process printer
175
176 /Device type: "printer"/n " find printer section
177
178 " set up buffer program to create registration command from each printer entry
179
180 bprinter a
181
182 .-1n
183 /printer device:/p " find next real entry
184 s/^.*: // " isolate name of device
185 \badd_build " put in build buffer
186 -1n /^.*Model *= */n " skip to Model
187 s//-pattr model=/ " make attribute from it
188
189 btest " have to do funnies to state speed
190 a
191 s/model=1200/&,speed=1200/
192 \c\f
193 b0
194 \c\btest
195
196 btest " and again...
197 1i
198 s/model=1600/&,speed=1600/
199 \c\f
200 b0
201 \c\btest
202
203 btest " and again...
204 1i
205 s/model=301/&,speed=1150/
206 \c\f
207 b0
208 \c\btest
209
210 btest
211 1,$d " leave buffer clean for next iter.
212 b0
213
214 \badd_build " put in build buffer
215
216 bbuild " go into build buffer and insert
217 1i
218 register_resource printer
219 \c\f " get out of insert
220 2mname " put the name in a buffer
221 i\c\bname\c\f " put it back
222 $a
223 -owner system
224 -pacc system_low:system_high
225 -acc system_low:system_high
226 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
227 w build_temp
228 e fo register.ec
229 e string contents build_temp
230 e ro
231 1,$d " clear the buffer
232 b0 " go back to main buffer
233 \c\bprinter\f " and try to iterate recur
234
235 b0 " get back to main buffer
236
237 " process punch
238
239 /Device type: "punch"/n " find punch section
240
241 " set up buffer program to create registration command from each punch entry
242
243 bpunch a
244
245 .-1n
246 /punch device:/p " find next real entry
247 s/^.*: // " isolate name of device
248 \badd_build " put in build buffer
249 -1n /^.*Model *= */n " skip to Model
250 s//-pattr model=/ " make attribute from it
251 \badd_build " put in build buffer
252
253 bbuild " go into build buffer and insert
254 1i
255 register_resource punch
256 \c\f " get out of insert
257 2mname " put the name in a buffer
258 i\c\bname\c\f " put it back
259 $a
260 -owner system
261 -pacc system_low:system_high
262 -acc system_low:system_high
263 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
264 w build_temp
265 e fo register.ec
266 e string contents build_temp
267 e ro
268 1,$d " clear the buffer
269 b0 " go back to main buffer
270 \c\bpunch\f " and try to iterate recur
271
272 b0 " get back to main buffer
273
274 " process reader
275
276 /Device type: "reader"/n " find reader section
277
278 " set up buffer program to create registration command from each reader entry
279
280 breader a
281
282 .-1n
283 /reader device:/p " find next real entry
284 s/^.*: // " isolate name of device
285 \badd_build " put in build buffer
286 -1n /^.*Model *= */n " skip to Model
287 s//-pattr model=/ " make attribute from it
288 \badd_build " put in build buffer
289
290 bbuild " go into build buffer and insert
291 1i
292 register_resource reader
293 \c\f " get out of insert
294 2mname " put the name in a buffer
295 i\c\bname\c\f " put it back
296 $a
297 -owner system
298 -pacc system_low:system_high
299 -acc system_low:system_high
300 -acs_path >sc1>rcp>\c\bname\c\f " acquire it to system
301 w build_temp
302 e fo register.ec
303 e string contents build_temp
304 e ro
305 1,$d " clear the buffer
306 b0 " go back to main buffer
307 \c\breader\f " and try to iterate recur
308
309 b0 " get back to main buffer
310
311 " call the subroutines we just created.
312
313 b0 " go back to main buffer
314 \btape
315 \bclear_build
316 \bdisk
317 \bclear_build
318 \bconsole
319 \bclear_build
320 \bprinter
321 \bclear_build
322 \bpunch
323 \bclear_build
324 \breader
325 \bclear_build
326
327 " sort this exec_com in place so it will look pretty.
328
329 e sort_seg register.ec -replace
330
331 blast
332 r register.ec
333 1,$s/$/\c
334 /
335 w
336
337 e delete build_temp rcp.list
338
339 " And we are done. Quit, anticipating the query about modified buffers.
340
341 qf