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 b(add_build) a
 23 m(temp)                                 " first move the line to temp
 24 b(build)                                " then go into build and append
 25 a
 26 \c\c\c\b(temp)\c\c\c\f                  " the line in temp
 27 b(0)                                    " return to main buffer
 28 \f                                      " end subroutine
 29 
 30 " create subroutine to clear the building buffer
 31 
 32 b(clear_build) a
 33 b(build) a
 34 xxx
 35 \c\f
 36 1,$d
 37 b(0)
 38 \f
 39 
 40 b(0)                                    " 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 b(tape) a
 49 
 50 .-1n
 51 /tape_drive device:/p                   " find next real entry
 52 s/^.*: //                               " isolate name of device
 53 \b(add_build)                           " put in build buffer
 54 -1n /^.*Model *= */n                    " skip to Model
 55 s//-pattr model=/                       " make attribute from it
 56 \b(add_build)                           " put in build buffer
 57 -1n /^.*Tracks *= */n                   " skip to Tracks
 58 s//,track=/                             " make attribute from it
 59 \b(add_build)                           " put in build buffer
 60 -1n /^.*Densities *= */n                " skip to Densities
 61 s// /
 62 s/ /,den=/
 63 \b(add_build)                           " put in build buffer
 64 -1n /^.*Speed *= */n                    " skip to Speed
 65 s//,speed=/                             " make attribute from it
 66 \b(add_build)                           " put in build buffer
 67 
 68 b(build)                                " go into build buffer and insert
 69 1i
 70 register_resource tape_drive
 71 \c\f                                    " get out of insert mode
 72 2m(name)                                " put the name in a buffer
 73 i\c\b(name)\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\b(name)\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 b(0)                                    " go back to main buffer
 89 \c\b(tape)\f                            " and try to iterate (recur)
 90 
 91 b(0)                                    " 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 b(disk) a
100 
101 .-1n
102 /disk_drive device:/p                   " find next real entry
103 s/^.*: //                               " isolate name of device
104 \b(add_build)                           " put in build buffer
105 -1n /^.*Model *= */n                    " skip to Model
106 s//-pattr model=/                       " make attribute from it
107 \b(add_build)                           " put in build buffer
108 
109 b(build)                                " 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 2m(name)                                " put the name in a buffer
117 i\c\b(name)\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\b(name)\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 b(0)
133 \c\b(disk)\f                            " and try to iterate (recur)
134 
135 b(0)                                    " 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 b(console) a
144 
145 .-1n
146 /console device:/p                      " find next real entry
147 s/^.*: //                               " isolate name of device
148 \b(add_build)                           " put in build buffer
149 -1n /^.*Model *= */n                   " skip to Model
150 s//-pattr model=/                       " make attribute from it
151 \b(add_build)                           " put in build buffer
152 
153 b(build)                                " go into build buffer and insert
154 1i
155 register_resource console
156 \c\f                                    " get out of insert
157 2m(name)                                " put the name in a buffer
158 i\c\b(name)\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\b(name)\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 b(0)                                    " go back to main buffer
170 \c\b(console)\f                         " and try to iterate (recur)
171 
172 b(0)                                    " 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 b(printer) a
181 
182 .-1n
183 /printer device:/p                      " find next real entry
184 s/^.*: //                               " isolate name of device
185 \b(add_build)                           " put in build buffer
186 -1n /^.*Model *= */n                    " skip to Model
187 s//-pattr model=/                       " make attribute from it
188 
189 b(test)                                 " have to do funnies to state speed
190 a
191 s/model=1200/&,speed=1200/
192 \c\f
193 b(0)
194 \c\b(test)
195 
196 b(test)                                 " and again...
197 1i
198 s/model=1600/&,speed=1600/
199 \c\f
200 b(0)
201 \c\b(test)
202 
203 b(test)                                 " and again...
204 1i
205 s/model=301/&,speed=1150/
206 \c\f
207 b(0)
208 \c\b(test)
209 
210 b(test)
211 1,$d                                    " leave buffer clean for next iter.
212 b(0)
213 
214 \b(add_build)                           " put in build buffer
215 
216 b(build)                                " go into build buffer and insert
217 1i
218 register_resource printer
219 \c\f                                    " get out of insert
220 2m(name)                                " put the name in a buffer
221 i\c\b(name)\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\b(name)\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 b(0)                                    " go back to main buffer
233 \c\b(printer)\f                         " and try to iterate (recur)
234 
235 b(0)                                    " 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 b(punch) a
244 
245 .-1n
246 /punch device:/p                        " find next real entry
247 s/^.*: //                               " isolate name of device
248 \b(add_build)                           " put in build buffer
249 -1n /^.*Model *= */n                    " skip to Model
250 s//-pattr model=/                       " make attribute from it
251 \b(add_build)                           " put in build buffer
252 
253 b(build)                                " go into build buffer and insert
254 1i
255 register_resource punch
256 \c\f                                    " get out of insert
257 2m(name)                                " put the name in a buffer
258 i\c\b(name)\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\b(name)\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 b(0)                                    " go back to main buffer
270 \c\b(punch)\f                           " and try to iterate (recur)
271 
272 b(0)                                    " 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 b(reader) a
281 
282 .-1n
283 /reader device:/p                       " find next real entry
284 s/^.*: //                               " isolate name of device
285 \b(add_build)                           " put in build buffer
286 -1n /^.*Model *= */n                    " skip to Model
287 s//-pattr model=/                       " make attribute from it
288 \b(add_build)                           " put in build buffer
289 
290 b(build)                                " go into build buffer and insert
291 1i
292 register_resource reader
293 \c\f                                    " get out of insert
294 2m(name)                                " put the name in a buffer
295 i\c\b(name)\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\b(name)\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 b(0)                                    " go back to main buffer
307 \c\b(reader)\f                          " and try to iterate (recur)
308 
309 b(0)                                    " get back to main buffer
310 
311 " call the subroutines we just created.
312 
313 b(0)                                    " go back to main buffer
314 \b(tape)
315 \b(clear_build)
316 \b(disk)
317 \b(clear_build)
318 \b(console)
319 \b(clear_build)
320 \b(printer)
321 \b(clear_build)
322 \b(punch)
323 \b(clear_build)
324 \b(reader)
325 \b(clear_build)
326 
327 " sort this exec_com in place so it will look pretty.
328 
329 e sort_seg register.ec -replace
330 
331 b(last)
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