1
2
3
4
5
6
7
8
9
10
11
12 load_tandd_library: ltdl: proc;
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 dcl iox_$attach_name entry (char (*), ptr, char (*), ptr, fixed bin (35));
28 dcl iox_$close entry (ptr, fixed bin (35));
29 dcl iox_$control entry (ptr, char (*), ptr, fixed bin (35));
30 dcl iox_$detach_iocb entry (ptr, fixed bin (35));
31 dcl iox_$open entry (ptr, fixed bin, bit (1) aligned, fixed bin (35));
32 dcl iox_$read_record entry (ptr, ptr, fixed bin (21), fixed bin (21), fixed bin (35));
33 dcl iox_$write_record entry (ptr, ptr, fixed bin (21), fixed bin (35));
34 dcl iox_$delete_record entry (ptr, fixed bin (35));
35 dcl iox_$seek_key entry (ptr, char (256) varying, fixed bin (21), fixed bin (35));
36 dcl get_wdir_ entry returns (char (168));
37 dcl date_time_ entry (fixed bin (52), char (*));
38 dcl (com_err_, ioa_$ioa_switch) entry options (variable);
39 dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin, fixed bin (35));
40 dcl bcd_to_ascii_ entry (bit (*), char (*) aligned);
41 dcl get_temp_segments_ entry (char (*), (*) ptr, fixed bin (35));
42 dcl release_temp_segments_ entry (char (*), (*) ptr, fixed bin (35));
43 dcl hcs_$set_bc_seg entry (ptr, fixed bin (24), fixed bin (35));
44 dcl hcs_$make_seg entry (char (*), char (*), char (*), fixed bin (5), ptr, fixed bin (35));
45 dcl hcs_$initiate entry (char (*), char (*), char (*), fixed bin (1), fixed bin (2), ptr, fixed bin (35));
46 dcl gload_ entry (ptr, ptr, fixed bin (18), ptr, fixed bin (35));
47 dcl gload_$allow_zero_checksums entry (char (*), char (*), char (*), ptr, ptr, fixed bin (18), ptr, fixed bin (35));
48 dcl absolute_pathname_ entry (char (*), char (*), fixed bin (35));
49 dcl cv_dec_check_ entry (char (*), fixed bin (35)) returns (fixed bin (35));
50
51
52
53 dcl pname char (18) int static options (constant) init
54 ("load_tandd_library");
55 dcl (opn_sqi init (4),
56 opn_sqo init (5),
57 opn_ksu init (10),
58 opn_so init (2)) fixed bin int static options (constant);
59 dcl buf_size fixed bin (21) int static options (constant) init (4 * 1024);
60 dcl bcd_obj bit (78) int static options (constant) init
61 ("53202020202020462241252363"b3);
62 dcl bcd_dkend bit (72) int static options (constant) init
63 ("532020202020202442254524"b3);
64 dcl g_label bit (72) int static options (constant) init
65 ("272520200600002022634320"b3);
66 dcl hdra char (18) static options (constant) init ("Edit Deck Assm");
67 dcl hdrb char (42) static options (constant) init ("N^H__^Ha_^Hm_^He T^H__^Hy_^Hp_^He D^H__^Ha_^Ht_^He");
68 dcl hdra1 char (5) static options (constant) init ("Ident");
69 dcl hdrb1 char (46) static options (constant) init ("C^H__^Ho_^Hd_^He M^H__^Ho_^Hd_^He_^Hl R^H__^He_^Hv.^H_");
70 dcl hdrb2 char (12) static options (constant) init ("T^H__^Hy_^Hp_^He");
71 dcl hdrb3 char (111) static options (constant) init ("S^H__^He_^Ha_^Hr_^Hc_^Hh K^H__^He_^Hy C^H__^Ho_^Hm_^Hp O^H__^Hf_^Hf_^Hs_^He_^Ht L^H__^He_^Hn_^Hg_^Ht_^Hh (^H_B^H__^Hy_^Ht_^He_^Hs)^H_");
72 dcl hdra2 char (2) static options (constant) init ("SS");
73 dcl hdra3 char (40) static options (constant) init ("Record Location Record");
74 dcl hdra4 char (7) static options (constant) init ("Multics");
75 dcl hdrb4 char (30) static options (constant) init ("A^H__^Hp_^Hp_^Hl_^Hi_^Hc_^Ha_^Hb_^Hl_^He");
76 dcl fmt1 char (53) static options (constant) init
77 ("^[^5-^12s^; ^[^6x^1s^;^6a^] ^4a ^4a ^2a/^2a/^2a ");
78 dcl fmt2 char (33) static options (constant) init
79 ("^[^6a ^6a ^2a^s^;^3s^4a^2-^]^]");
80 dcl fmt3 char (58) static options (constant) init
81 ("^-^[ ^[^;^[yes^;no ^]^]^;^2s^21a ^2d ^6o ^8d^]^/");
82 dcl density (5) char (5) static options (constant) init
83 ("d6250", "d1600", "d800", "d556", "d200");
84 dcl cleanup condition;
85 dcl (addr, addrel, char, clock, currentsize, fixed, index, ltrim, null,
86 rel, rtrim, substr, unspec, bin, hbound, string) builtin;
87
88
89
90 dcl (code, scode, tdec) fixed bin (35);
91 dcl rec_len fixed bin (21);
92 dcl (cfile, pfile, crec, nwds, dlen, c_rtrycnt, rtrycnt, bcnt, psz) fixed bin;
93 dcl (m, i, j, lx, al, line_count, page_no, denno) fixed bin;
94 dcl fnp_key fixed bin init (0);
95 dcl (ap, bptr, cvp, cvp1, cptr, segp, catp, svp) ptr;
96 dcl tempp (2) ptr;
97 dcl (m_att_desc, c_att_desc, l_att_desc) char (64);
98 dcl obj_buf char (80) aligned;
99 dcl err_card char (80) aligned;
100 dcl id_buf char (18) aligned;
101 dcl ident_buf (40) bit (36);
102 dcl dir char (168);
103 dcl ename char (32);
104 dcl (current_key, cat_key) char (24) init ("");
105 dcl work_key char (256) varying;
106 dcl tape_name char (16);
107 dcl time_string char (24);
108 dcl (dtype, fnp_type) char (4);
109 dcl (sstype, cden) char (5);
110 dcl t_stat bit (12) aligned;
111 dcl (cat_build, first_deck, eot, one_eof, hdr_sw, first_ff, cont_sw) bit (1) init ("0"b);
112 dcl (list, firmware_sw, deckfile_sw, config_sw, cd_sw) bit (1) init ("0"b);
113 dcl (attach_copy, copy_at_eof, first_write, fnp_tape, build_fnp_cat, patches) bit (1) init ("0"b);
114 dcl (dk_end, trm, first_rcd, obj_card, id_ld, v_patch, eof, err, lib, at_bot) bit (1);
115
116
117
118 dcl (error_table_$wrong_no_of_args,
119 error_table_$bad_arg,
120 error_table_$tape_error,
121 error_table_$no_record,
122 error_table_$inconsistent,
123 error_table_$end_of_info) ext fixed bin (35);
124 dcl (tiocb_ptr, fiocb_ptr, liocb_ptr, ciocb_ptr) ptr static;
125 dcl (t_attached, f_attached, l_attached, c_attached) bit (1) int static init ("0"b);
126
127
128
129 dcl 1 r_card based (cptr) aligned,
130 (2 type bit (12),
131 2 count fixed bin (5),
132 2 ld_add bit (18),
133 2 pad (psz) bit (36),
134 2 data (r_card.count) bit (36),
135 2 nxt_c_wd bit (36)) unaligned;
136
137 dcl 1 id_blk based (addr (id_buf)) aligned,
138 (2 ident char (6),
139 2 revision,
140 3 rev_dot char (4),
141 3 rev char (2),
142 2 type_code,
143 3 pad char (3),
144 3 type char (3)) unaligned;
145
146 dcl 1 o_card based (addr (obj_buf)) aligned,
147 (2 pad1 char (15),
148 2 library char (6),
149 2 ld_type char (1),
150 2 ss_type char (1),
151 2 pad2 char (3),
152 2 m_applic char (1),
153 2 pad3 char (15),
154 2 model char (6),
155 2 version char (6),
156 2 pad4 char (5),
157 2 assem char (1),
158 2 call_name char (6),
159 2 ttl_date char (6),
160 2 edit_name char (4)) unaligned;
161
162 dcl 1 o_patch based (addr (err_card)) aligned,
163 (2 add char (6),
164 2 blk1 char (1),
165 2 octal char (5),
166 2 blk2 char (3),
167 2 p_fld char (57),
168 2 comment char (8)) unaligned;
169
170 dcl 1 h_patch based (addr (err_card)) aligned,
171 (2 h_add char (6),
172 2 cr char (1),
173 2 hex char (3),
174 2 pad1 char (5),
175 2 inst char (8),
176 2 pad2 char (13),
177 2 rev char (6),
178 2 pad3 char (42),
179 2 lbl char (4)) unaligned;
180
181 dcl 1 p_blk aligned,
182 2 p_cnt fixed bin,
183 2 p_card (200) char (80);
184
185 dcl 1 cata based (catp) aligned,
186 2 n_entries fixed bin,
187 2 key (1 refer (cata.n_entries)) char (24);
188
189 dcl 1 rsi like rs_info aligned;
190
191 dcl arg char (al) based (ap);
192 dcl id_bbuf bit (108) based (cvp);
193 dcl bit_buf bit (rec_len * 9) based (prptr);
194 ^L
195
196 rs_info_ptr = null;
197 call cu_$arg_ptr (1, ap, al, code);
198 if code ^= 0 then do;
199 call com_err_ (error_table_$wrong_no_of_args, pname,
200 "^/Usage:^-^a reel_id {-control_args}", pname);
201 return;
202 end;
203 m_att_desc = "tape_nstd_ " || arg;
204 i = index (arg, ",");
205 if i > 1 then tape_name = substr (arg, 1, i - 1);
206 else tape_name = arg;
207 l_att_desc = "vfile_ " || tape_name;
208 call date_time_ (clock (), time_string);
209 dir = get_wdir_ ();
210 j = 2;
211 call cu_$arg_ptr (j, ap, al, code);
212 do while (code = 0);
213 if arg = "-track" | arg = "-tk" then do;
214 j = j + 1;
215 call cu_$arg_ptr (j, ap, al, code);
216 if code ^= 0 then do;
217 call com_err_ (code, pname, "obtaining ""-track"" specification.");
218 return;
219 end;
220 tdec = cv_dec_check_ (arg, code);
221 if code ^= 0 then go to bad_arg;
222 if tdec ^= 7 & tdec ^= 9 then go to bad_arg;
223 if attach_copy then
224 c_att_desc = rtrim (c_att_desc) || " -track " || ltrim (char (tdec));
225 else m_att_desc = rtrim (m_att_desc) || " -track " || ltrim (char (tdec));
226 end;
227 else if arg = "-density" | arg = "-den" then do;
228 j = j + 1;
229 call cu_$arg_ptr (j, ap, al, code);
230 if code ^= 0 then do;
231 call com_err_ (code, pname, "obtaining ""-density"" specification.");
232 return;
233 end;
234 tdec = cv_dec_check_ (arg, code);
235 if code ^= 0 then go to bad_arg;
236 if tdec = 6250 | tdec = 1600 | tdec = 800 | tdec = 556 | tdec = 200 then do;
237 if attach_copy then do;
238 c_att_desc = rtrim (c_att_desc) || " -density " || ltrim (char (tdec));
239 cd_sw = "1"b;
240 end;
241 else m_att_desc = rtrim (m_att_desc) || " -density " || ltrim (char (tdec));
242 end;
243 else go to bad_arg;
244 end;
245 else if arg = "-output_dir" | arg = "-odr" then do;
246 j = j + 1;
247 call cu_$arg_ptr (j, ap, al, code);
248 if code ^= 0 then do;
249 call com_err_ (code, pname, "obtaining ""-output_dir"" specification.");
250 return;
251 end;
252 call absolute_pathname_ (arg, dir, code);
253 if code ^= 0 then do;
254 call com_err_ (code, pname, "expanding pathname ""^a""", arg);
255 return;
256 end;
257 end;
258 else if arg = "-copy" | arg = "-cp" then do;
259 j = j + 1;
260 call cu_$arg_ptr (j, ap, al, code);
261 if code ^= 0 then do;
262 call com_err_ (code, pname, "obtaining ""-copy"" tape reel specification.");
263 return;
264 end;
265 c_att_desc = "tape_nstd_ " || arg;
266 attach_copy = "1"b;
267 end;
268 else if arg = "-list" | arg = "-ls" then list = "1"b;
269 else if arg = "-firmware" | arg = "-fw" then firmware_sw = "1"b;
270 else if arg = "-deckfile" | arg = "-dkf" then deckfile_sw = "1"b;
271 else if arg = "-config" then config_sw = "1"b;
272 else if arg = "-fnp_tape" then fnp_tape = "1"b;
273 else if arg = "-patches" then patches = "1"b;
274 else do;
275 bad_arg: call com_err_ (error_table_$bad_arg, pname, "argument number ^d: ""^a""", j, arg);
276 return;
277 end;
278 j = j + 1;
279 call cu_$arg_ptr (j, ap, al, code);
280 end;
281 if (firmware_sw & deckfile_sw) then do;
282 call com_err_ (error_table_$inconsistent, pname, "-firmware and -deckfile");
283 return;
284 end;
285 if (firmware_sw & list) then do;
286 call com_err_ (error_table_$inconsistent, pname, "-firmware and -list");
287 return;
288 end;
289 if (firmware_sw & attach_copy) then do;
290 call com_err_ (error_table_$inconsistent, pname, "-firmware and -copy");
291 return;
292 end;
293 if (firmware_sw & fnp_tape) then do;
294 call com_err_ (error_table_$inconsistent, pname, "-firmware and -fnp_tape");
295 return;
296 end;
297 if config_sw then
298 call set_fig;
299 call get_temp_segments_ (pname, tempp, code);
300 if code ^= 0 then do;
301 call com_err_ (code, pname, "getting temporary segments");
302 return;
303 end;
304 bptr = tempp (1);
305 catp = tempp (2);
306 cata.n_entries = 0;
307
308
309
310 call iox_$attach_name ("tape_sw", tiocb_ptr, m_att_desc, null, code);
311 if code ^= 0 then do;
312 call com_err_ (code, pname, "attaching tape");
313 return;
314 end;
315 t_attached = "1"b;
316 call iox_$open (tiocb_ptr, opn_sqi, "0"b, code);
317 if code ^= 0 then do;
318 call com_err_ (code, pname, "opening tape for sequential input");
319 call detach_tape_file;
320 return;
321 end;
322
323
324
325 if ^list & ^firmware_sw then do;
326 call iox_$attach_name ("dkfile_sw", fiocb_ptr, "vfile_ " || rtrim (dir) || ">tandd_deck_file", null, code);
327 if code ^= 0 then do;
328 call com_err_ (code, pname, "attaching tandd_deck_file");
329 call detach_tape_file;
330 return;
331 end;
332 f_attached = "1"b;
333 call iox_$open (fiocb_ptr, opn_ksu, "0"b, code);
334 if code ^= 0 then do;
335 call com_err_ (code, pname, "opening tandd_deck_file for keyed_sequential_update");
336 call detach_tape_file;
337 return;
338 end;
339 end;
340
341
342
343 if attach_copy then do;
344 c_att_desc = rtrim (c_att_desc) || " -write";
345 call iox_$attach_name ("copy_sw", ciocb_ptr, c_att_desc, null, code);
346 if code ^= 0 then do;
347 call com_err_ (code, pname, "attaching copy tape");
348 call detach_tape_file;
349 return;
350 end;
351 c_attached = "1"b;
352 call iox_$open (ciocb_ptr, opn_sqo, "0"b, code);
353 if code ^= 0 then do;
354 call com_err_ (code, pname, "opening copy tape for sequential output");
355 call detach_tape_file;
356 return;
357 end;
358 end;
359
360 on cleanup call detach_tape_file;
361 ^L
362
363
364 pfile, cfile, page_no = 1;
365 denno, crec = 0;
366 unspec (rsi) = "0"b;
367 rsi.version = rs_info_version_2;
368 at_bot = "1"b;
369
370 do while (^eot);
371 call read_deck (eof, err);
372 if err | (eof & one_eof) | eot then do;
373 eot = "1"b;
374 if attach_copy then call copy_eof;
375 if fnp_tape & ^err & ^list then do;
376 current_key = "cata." || rtrim (cat_key);
377 call insert_deck (catp, cata.n_entries * 24 + 4, err);
378 if ^err then call update_list (3);
379 end;
380 end;
381 else if eof then do;
382 one_eof = "1"b;
383 if attach_copy then
384 if ^copy_at_eof then
385 call copy_eof;
386 if cat_build & ^fnp_tape then do;
387 cat_build, first_deck = "0"b;
388 if index (cat_key, "itr.") ^= 0 then do;
389 if id_blk.type = "itr" | id_blk.type = "mdr" then do;
390 call com_err_ (0, pname, "Last object deck on itr file is not firmware");
391 call com_err_ (0, pname, "Last object card image is:^/""^a""", obj_buf);
392 eot = "1"b;
393 go to exit;
394 end;
395 else do;
396 do i = cata.n_entries to 1 by -1 while (index (cata.key (i), ".") > 4);
397 end;
398 cat_key = rtrim (cat_key) || substr (cata.key (i + 1), 8, 6) ||
399 "." || substr (cata.key (i + 1), 20, 2);
400 end;
401 end;
402 current_key = "cata." || rtrim (cat_key) || "." || ltrim (char (cfile - 1));
403 call insert_deck (catp, cata.n_entries * 24 + 4, err);
404 if err then eot = "1"b;
405 else call update_list (3);
406 end;
407 if ^fnp_tape then
408 hdr_sw, cont_sw = "0"b;
409 end;
410 else do;
411 one_eof = "0"b;
412 if list then
413 call update_list (1);
414 else if fnp_tape then go to i_deck;
415 else if ck_applic () then
416 if ^firmware_sw then do;
417 i_deck: call make_key;
418 call insert_deck (bptr, dlen * 4, err);
419 if err then eot = "1"b;
420 else call update_list (2);
421 end;
422 end;
423 exit:
424 end;
425 call detach_tape_file;
426 return;
427 ^L
428
429
430
431 read_deck: proc (end_file, abort);
432
433 dcl (end_file, abort) bit (1);
434
435 obj_card, id_ld, first_rcd, end_file, abort = "0"b;
436 dk_end = "0"b;
437 p_blk.p_cnt = 0;
438 if pfile < cfile then pfile = cfile;
439 prptr = bptr;
440 cvp, cvp1 = null;
441
442 do while (^dk_end);
443 rtrycnt = 0;
444 retry_rd:
445 call iox_$read_record (tiocb_ptr, prptr, buf_size, rec_len, code);
446 if code ^= 0 then do;
447 if code ^= error_table_$end_of_info then
448 if code = error_table_$tape_error then do;
449 if at_bot then do;
450 denno = denno + 1;
451 if denno > hbound (density, 1) then
452 go to get_stat;
453 call iox_$control (tiocb_ptr, "rewind", null, code);
454 call iox_$control (tiocb_ptr, density (denno), null, code);
455 go to retry_rd;
456 end;
457 rtrycnt = rtrycnt + 1;
458 if rtrycnt = 11 then do;
459 get_stat:
460 call iox_$control (tiocb_ptr, "saved_status", addr (t_stat), scode);
461 call com_err_ (code, pname,
462 "Tape status = ^4.3b, while reading record ^d, file ^d after 10 retries",
463 t_stat, crec, cfile);
464 abort = "1"b;
465 return;
466 end;
467 call iox_$control (tiocb_ptr, "backspace_record", null, code);
468 go to retry_rd;
469 end;
470 else do;
471 call com_err_ (code, pname, "While reading record ^d, file ^d", crec, cfile);
472 abort = "1"b;
473 return;
474 end;
475 else do;
476 end_file = "1"b;
477 cfile = cfile + 1;
478 crec = 0;
479 return;
480 end;
481 end;
482 if rec_len = 56 then
483 if substr (bit_buf, 1, 72) = g_label then
484 if substr (bit_buf, 145, 216) = "0"b then do;
485 eot = "1"b;
486 return;
487 end;
488 if ^first_rcd then do;
489 bcnt = bcw.bsn;
490 first_rcd = "1"b;
491 if fnp_tape & at_bot then
492 build_fnp_cat = "1"b;
493 at_bot = "0"b;
494 end;
495 else do;
496 bcnt = bcnt + 1;
497 if bcw.bsn ^= bcnt then do;
498 call com_err_ (0, pname,
499 "Block serial number error at record ^d, file ^d", crec, cfile);
500 call com_err_ (0, pname, "Block serial number was ^d, S/B ^d", bcw.bsn, bcnt);
501 abort = "1"b;
502 return;
503 end;
504 end;
505 lrptr = addr (gc_phy_rec.gc_phy_rec_data (1));
506 nwds = 0;
507
508 do while (nwds < bcw.blk_size);
509 if rcw.media_code = 2 then do;
510 if substr (gc_log_rec_bits, 1, 78) = bcd_obj then do;
511 call bcd_to_ascii_ (gc_log_rec_bits, obj_buf);
512 obj_card = "1"b;
513 if build_fnp_cat then do;
514 if o_card.edit_name = "2000" then
515 fnp_type = "6670";
516 else if o_card.edit_name = "0300" then
517 fnp_type = "6600";
518 else do;
519 call com_err_ (0, pname, "^a ""^a"", ^a",
520 "First object deck image on fnp tape has edit name", o_card.edit_name,
521 "which is not the first deck on a fnp binary deck tape");
522 abort = "1"b;
523 return;
524 end;
525 cat_key = "fnp.pol." || fnp_type;
526 l_att_desc = rtrim (l_att_desc) || ".fnp." || fnp_type;
527 build_fnp_cat = "0"b;
528 end;
529
530 end;
531 else do;
532 if o_card.library = "hmpcj1" & ^id_ld then do;
533 id_ld = "1"b;
534 if cvp1 = null then
535 cvp1 = cvp;
536 call load_ident;
537 end;
538 if substr (gc_log_rec_bits, 1, 72) = bcd_dkend then
539 dk_end = "1"b;
540 else call ck_patch (abort);
541 if abort then return;
542 end;
543 end;
544 else if rcw.media_code = 1 then
545 if ^obj_card then do;
546 call com_err_ (0, pname,
547 "Binary card image preceeds $ object card at record ^d, file ^d",
548 crec, cfile);
549 abort = "1"b;
550 return;
551 end;
552 else do;
553 cvp1 = cvp;
554 cvp = lrptr;
555 end;
556 else do;
557 call com_err_ (0, pname, "Card type ^o detected at record ^d, file ^d",
558 rcw.media_code, crec, cfile);
559 abort = "1"b;
560 return;
561 end;
562 nwds = nwds + rcw.rsize + 1;
563 lrptr = addrel (lrptr, currentsize (gc_log_rec));
564 end;
565 crec = crec + 1;
566 prptr = addrel (prptr, currentsize (gc_phy_rec));
567 end;
568 dlen = fixed (rel (prptr)) + 1;
569
570 end read_deck;
571
572
573
574
575 load_ident: proc;
576
577 svp = lrptr;
578 lrptr = cvp1;
579 lx = 0;
580
581 do while (gc_log_rec.rcw.media_code = 1);
582 cptr = addrel (lrptr, 1);
583 psz = 4;
584 m = r_card.count;
585 trm = "0"b;
586 do while (^trm);
587 do i = 1 to r_card.count;
588 ident_buf (lx + i) = r_card.data (i);
589 end;
590 lx = lx + r_card.count;
591 if m = rcw.rsize - 8 | substr (r_card.nxt_c_wd, 1, 12) ^= "2005"b3 then
592 trm = "1"b;
593 else do;
594 cptr = addr (r_card.nxt_c_wd);
595 psz = 0;
596 m = m + r_card.count;
597 end;
598 end;
599 lrptr = addrel (lrptr, currentsize (gc_log_rec));
600 if rcw.media_code ^= 1 & rcw.media_code ^= 2 then
601 if lrptr -> bcw.bsn = bcnt then
602 lrptr = addrel (lrptr, 1);
603 end;
604
605
606
607 trm = "0"b;
608 do i = 1 to 40 while (^trm);
609 if ident_buf (i) = "444723224663"b3 then
610 trm = "1"b;
611 end;
612 cvp = addr (ident_buf (i - 10));
613 call bcd_to_ascii_ (id_bbuf, id_buf);
614 lrptr = svp;
615
616 end load_ident;
617 ^L
618
619
620
621 update_list: proc (ltype);
622
623 dcl ltype fixed bin (2);
624
625 if ^l_attached then do;
626 call iox_$attach_name ("list_sw", liocb_ptr, rtrim (l_att_desc) || ".list", null, code);
627 if code ^= 0 then do;
628 call com_err_ (code, pname, "attaching listing file");
629 eot = "1"b;
630 go to exit;
631 end;
632 l_attached = "1"b;
633 call iox_$open (liocb_ptr, opn_so, "0"b, code);
634 if code ^= 0 then do;
635 call com_err_ (code, pname, "opening listing file for stream_output");
636 eot = "1"b;
637 go to exit;
638 end;
639 end;
640 dtype, sstype = "";
641 lib = "0"b;
642 if fnp_tape then do;
643 sstype = "pol ";
644 dtype = "fnp ";
645 end;
646 else if o_card.library = "hmpcj1" then do;
647 lib = "1"b;
648 if id_blk.type ^= "itr" & id_blk.type ^= "mdr" then
649 dtype = " fw ";
650 else substr (dtype, 2, 3) = id_blk.type;
651 end;
652 else do;
653 if o_card.ld_type = "m" then dtype = "mast";
654 else if o_card.ld_type = "s" then dtype = "slav";
655 else if o_card.ld_type = "p" then dtype = "prog";
656 else if o_card.ld_type = "r" then dtype = "rloc";
657 else dtype = "data";
658 if o_card.ss_type = "p" then sstype = "polt";
659 else if o_card.ss_type = "m" then sstype = "molt";
660 else if o_card.ss_type = "c" then sstype = "colt";
661 else if o_card.ss_type = "h" then sstype = "heal";
662 else if o_card.ss_type = "u" then sstype = "util";
663 else if o_card.ss_type = "s" then
664 if o_card.m_applic = " " then sstype = "isol";
665 else sstype = "solt";
666 end;
667 if ^list then
668 call iox_$control (fiocb_ptr, "record_status", addr (rsi), code);
669 if ^hdr_sw & (ltype ^= 3 | (ltype = 3 & line_count > 26)) then
670 call put_hdr;
671 call ioa_$ioa_switch (liocb_ptr, fmt1 || fmt2 || fmt3, (ltype = 3), fnp_tape,
672 o_card.call_name, o_card.edit_name, dtype, substr (o_card.ttl_date, 1, 2),
673 substr (o_card.ttl_date, 3, 2), substr (o_card.ttl_date, 5, 2), lib, id_blk.ident, o_card.model,
674 id_blk.rev, sstype, list, fnp_tape, (o_card.m_applic = " "), current_key,
675 addr (rsi.descriptor) -> rs_desc.comp_num, fixed (rel (rsi.record_ptr), 18), rsi.record_length);
676 line_count = line_count + 1;
677 if line_count >= 25 then hdr_sw = "0"b;
678 if p_blk.p_cnt ^= 0 then
679 call put_patch;
680 if attach_copy then
681 if ltype ^= 3 then
682 call write_copy;
683
684 end update_list;
685 ^L
686
687
688
689 put_hdr: proc;
690
691 call ioa_$ioa_switch (liocb_ptr,
692 "^[^|^]^-^a ^[POL^4s^;^a,^-^a ^2d^[ (cont't)^;^]^],^61tTime - ^a, Page - ^2d^/",
693 first_ff, "Library -", fnp_tape, o_card.library, "Tape File Number -", pfile,
694 cont_sw, time_string, page_no);
695 call ioa_$ioa_switch (liocb_ptr,
696 "^a ^[FNP ^a ^a^1s^;^2s^a^] ^a^[^;^71tContents of ^a>tandd_deck_file^]^/",
697 "Contents of", fnp_tape, fnp_type, "Binary Deck Tape",
698 "ITR, Firmware And Diagnostic (IFAD) Tape", tape_name, list, dir);
699 call ioa_$ioa_switch (liocb_ptr, " ^[ call^; ^] ^a ^[^a^2-^s^;^s ^a^2-^]^-^[ ^[^a^]^;^2s ^a^]",
700 (o_card.call_name ^= "" & ^fnp_tape), hdra, lib, hdra1, hdra2, list, ^fnp_tape, hdra4, hdra3);
701 call ioa_$ioa_switch (liocb_ptr, " ^[ N^H__^Ha_^Hm_^He^; ^] ^a ^[^a^s^;^s^a^2-^]^-^[^[^a^]^;^2s ^a^]^/",
702 (o_card.call_name ^= "" & ^fnp_tape), hdrb, lib, hdrb1, hdrb2, list, ^fnp_tape, hdrb4, hdrb3);
703 hdr_sw, cont_sw, first_ff = "1"b;
704 line_count = 0;
705 page_no = page_no + 1;
706
707 end put_hdr;
708
709
710
711 put_patch: proc;
712
713 if ^hdr_sw then call put_hdr;
714 call ioa_$ioa_switch (liocb_ptr, "The following patch cards are contained in the above deck:^/");
715 line_count = line_count + 1;
716 if line_count >= 25 then call put_hdr;
717 do i = 1 to p_blk.p_cnt;
718 call ioa_$ioa_switch (liocb_ptr, "^-^a^/", p_blk.p_card (i));
719 line_count = line_count + 1;
720 if line_count >= 25 then call put_hdr;
721 end;
722 p_blk.p_cnt = 0;
723
724 end put_patch;
725 ^L
726
727
728
729 ck_patch: proc (err_bit);
730
731 dcl err_bit bit (1);
732
733 call bcd_to_ascii_ (gc_log_rec_bits, err_card);
734 v_patch = "0"b;
735 if h_patch.hex = "hex" then
736 if o_card.assem = "m" then
737 if h_patch.cr = "c" | h_patch.cr = "r" then
738 if h_patch.lbl = o_card.edit_name then
739 if h_patch.rev = string (id_blk.revision) then
740 v_patch = "1"b;
741 if ^v_patch then
742 if o_patch.octal = "octal" | o_patch.octal = "mask" then
743 v_patch = "1"b;
744 if v_patch then do;
745 p_blk.p_cnt = p_blk.p_cnt + 1;
746 p_blk.p_card (p_blk.p_cnt) = err_card;
747 end;
748 else do;
749 call com_err_ (0, pname,
750 "BCD card image at record ^d, file ^d is not $ object, $ dkend, or valid patch card:^/""^a""",
751 crec, cfile, err_card);
752 err_bit = "1"b;
753 end;
754 end ck_patch;
755
756
757
758 make_key: proc;
759 current_key = "";
760 if fnp_tape then do;
761 fnp_key = fnp_key + 1;
762 current_key = "fnp." || fnp_type || ".pol." || ltrim (char (fnp_key)) || "." ||
763 substr (o_card.edit_name, 1, 2);
764 end;
765 else if o_card.library = "hmpcj1" then do;
766 if id_blk.type ^= "itr" & id_blk.type ^= "mdr" then
767 current_key = string (id_blk.type_code) || ".";
768 else current_key = id_blk.type || ".";
769 current_key = rtrim (current_key) || id_blk.ident || "." || o_card.edit_name;
770 current_key = rtrim (current_key) || "." || id_blk.rev;
771 end;
772 else do;
773 if o_card.ss_type = "s" then
774 current_key = "pas." || substr (o_card.edit_name, 1, 3);
775 else if o_card.ss_type = "u" then
776 current_key = "utl." || o_card.call_name;
777 else current_key = o_card.ss_type || "lt." || o_card.call_name;
778 return;
779 end;
780 cata.n_entries = cata.n_entries + 1;
781 cata.key (n_entries) = current_key;
782 end make_key;
783 ^L
784
785
786
787 insert_deck: proc (bufp, buf_len, isd_abort);
788
789 dcl bufp ptr;
790 dcl buf_len fixed bin (21);
791 dcl isd_abort bit (1);
792
793 isd_abort = "0"b;
794 reseek:
795 work_key = current_key;
796 call iox_$seek_key (fiocb_ptr, work_key, rec_len, code);
797 if code ^= error_table_$no_record then do;
798 if code = 0 then do;
799 if index (current_key, ".common.") ^= 0 then
800 return;
801 call iox_$delete_record (fiocb_ptr, code);
802 go to reseek;
803 end;
804 else do;
805 call com_err_ (code, pname,
806 "attempting to seek to record whose key is ""^a""", work_key);
807 isd_abort = "1"b;
808 return;
809 end;
810 end;
811 call iox_$write_record (fiocb_ptr, bufp, buf_len, code);
812 if code ^= 0 then do;
813 call com_err_ (code, pname,
814 "attempting to write record whose key is ""^a"" to the tandd_deck_file", work_key);
815 isd_abort = "1"b;
816 end;
817
818 end insert_deck;
819 ^L
820
821
822
823 ld_fw_deck: proc;
824
825 ename = "fw." || id_blk.ident || "." || o_card.edit_name ||
826 "." || id_blk.rev;
827 call hcs_$initiate (dir, ename, "", 0, 0, segp, code);
828 if segp = null then do;
829 call hcs_$make_seg (dir, ename, "", 01010b, segp, code);
830 if segp = null then do;
831 call com_err_ (code, pname, "Unable to create ^a>^a", dir, ename);
832 return;
833 end;
834 end;
835 if patches then
836 call gload_$allow_zero_checksums (pname, dir, ename,
837 bptr, segp, 0, addr (gload_data), code);
838 else call gload_ (bptr, segp, 0, addr (gload_data), code);
839 if code ^= 0 then do;
840 call com_err_ (code, pname, "^a^/attempting to load core image of ^a>^a",
841 gload_data.diagnostic, dir, ename);
842 return;
843 end;
844 call hcs_$set_bc_seg (segp, fixed (gload_data.text_len) * 36, code);
845 if code ^= 0 then do;
846 call com_err_ (code, pname, "Unable to set bit count of ^a>^a",
847 dir, ename);
848 return;
849 end;
850
851 end ld_fw_deck;
852 ^L
853
854
855
856 ck_applic: proc returns (bit (1));
857
858 if o_card.m_applic ^= " " then do;
859 if o_card.library = "hmpcj1" then
860 if id_blk.type = "itr" then
861 call space_file;
862 else ;
863 else if o_card.ss_type = "h" then
864 call space_file;
865 return ("0"b);
866 end;
867 else do;
868 if config_sw then
869 if ^ck_fig () then
870 return ("0"b);
871 if o_card.library = "hmpcj1" then do;
872 if id_blk.type = "mdr" then
873 if firmware_sw then do;
874 eot = "1"b;
875 return ("0"b);
876 end;
877 else ;
878 else if id_blk.type ^= "itr" then
879 if ^deckfile_sw then
880 call ld_fw_deck;
881 if ^first_deck & ^firmware_sw then do;
882 cat_build, first_deck = "1"b;
883 cata.n_entries = 0;
884 if id_blk.type = "mdr" then cat_key = "mdr.";
885 else cat_key = "itr.";
886 if id_blk.type = "mdr" then do;
887 if o_card.ss_type = "t" then sstype = "tape ";
888 else if o_card.ss_type = "p" then sstype = "print";
889 else if o_card.ss_type = "c" then sstype = "card ";
890 else if o_card.ss_type = "d" then sstype = "disk ";
891 else do;
892 call com_err_ (0, pname,
893 "Unknown subsystem type (col 23) on $ object card");
894 call com_err_ (0, pname, "Last $ object card image is: ^/""^a""", obj_buf);
895 first_deck = "0"b;
896 return ("1"b);
897 end;
898 cat_key = rtrim (cat_key) || sstype;
899 end;
900 end;
901 end;
902 end;
903 return ("1"b);
904 end ck_applic;
905 ^L
906
907
908 write_copy: proc;
909
910 if ^first_write then do;
911 first_write = "1"b;
912 if cd_sw | denno ^= 0 then do;
913 if denno ^= 0 & ^cd_sw then
914 cden = density (denno);
915 call iox_$control (ciocb_ptr, cden, null, code);
916 end;
917 end;
918 prptr = bptr;
919 do while (bin (rel (prptr)) < dlen - 1 & ^eot);
920 c_rtrycnt = 0;
921 retry_cp:
922 call iox_$write_record (ciocb_ptr, prptr, (bcw.blk_size + 1) * 4, code);
923 if code ^= 0 then
924 if code = error_table_$tape_error then do;
925 c_rtrycnt = c_rtrycnt + 1;
926 if c_rtrycnt > 10 then do;
927 call iox_$control (ciocb_ptr, "saved_status", addr (t_stat), scode);
928 call com_err_ (code, pname,
929 "Tape status = ^4.3b, while writing copy tape after 10 retrys", t_stat);
930 eot = "1"b;
931 end;
932 else do;
933 call iox_$control (ciocb_ptr, "backspace_record", null, scode);
934 call iox_$control (ciocb_ptr, "erase", null, scode);
935 go to retry_cp;
936 end;
937 end;
938 else do;
939 call com_err_ (code, pname, "while writing copy tape");
940 eot = "1"b;
941 end;
942 else prptr = addrel (prptr, currentsize (gc_phy_rec));
943 end;
944 copy_at_eof = "0"b;
945
946 end write_copy;
947 ^L
948
949
950
951 set_fig: proc;
952
953
954
955 end set_fig;
956 ^L
957
958
959
960 ck_fig: proc returns (bit (1));
961
962
963
964 return ("1"b);
965
966 end ck_fig;
967 ^L
968
969
970
971 detach_tape_file: proc;
972 if t_attached then do;
973 call iox_$close (tiocb_ptr, code);
974 call iox_$detach_iocb (tiocb_ptr, code);
975 call release_temp_segments_ (pname, tempp, code);
976 t_attached = "0"b;
977 end;
978 if l_attached then do;
979 call iox_$close (liocb_ptr, code);
980 call iox_$detach_iocb (liocb_ptr, code);
981 l_attached = "0"b;
982 end;
983 if f_attached then do;
984 call iox_$close (fiocb_ptr, code);
985 call iox_$detach_iocb (fiocb_ptr, code);
986 f_attached = "0"b;
987 end;
988 if c_attached then do;
989 call iox_$close (ciocb_ptr, code);
990 call iox_$detach_iocb (ciocb_ptr, code);
991 c_attached = "0"b;
992 end;
993
994 end detach_tape_file;
995
996
997
998 space_file: proc;
999
1000 call iox_$control (tiocb_ptr, "forward_file", null, code);
1001 cfile = cfile + 1;
1002 crec = 0;
1003 one_eof = "1"b;
1004
1005 end space_file;
1006
1007
1008
1009 copy_eof: proc;
1010
1011 call iox_$control (ciocb_ptr, "write_eof", null, code);
1012 copy_at_eof = "1"b;
1013
1014 end copy_eof;
1015 ^L
1016 %include gcos_ssf_records;
1017 %include gload_data;
1018 %include rs_info;
1019
1020 end load_tandd_library;