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 linus:
28 proc;
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 %page;
197 %include condition_info;
198 %page;
199 %include condition_info_header;
200 ^L
201 %include linus_lcb;
202 %page;
203 %include cp_character_types;
204 %page;
205 %include definition;
206 %page;
207 %include linus_char_argl;
208 %page;
209 %include linus_rel_array;
210 %page;
211 %include object_info;
212 %page;
213 %include ssu_prompt_modes;
214 %page;
215 %include ssu_rp_options;
216 %page;
217 %include sub_error_info;
218 ^L
219 dcl sci_ptr ptr;
220
221 dcl (
222 i,
223 j,
224 nargs
225 ) fixed bin;
226
227 dcl (
228 acc_ptr init (null),
229 arg_ptr init (null),
230 ctl_ptr init (null),
231 d_ptr init (null),
232 ent_ptr init (null),
233 lb_ptr init (null),
234 ptr_sink init (null)
235 ) ptr;
236
237 dcl code fixed bin (35);
238
239 dcl (
240 initial_linus_vclock,
241 initial_mrds_vclock
242 ) float bin (63) int static;
243
244 dcl ab bit (1);
245 dcl bit18 bit (18) based;
246 dcl ctl_arg char (ctl_len) based (ctl_ptr);
247 dcl ctl_len fixed bin (21);
248 dcl dname char (168);
249 dcl ename char (32);
250 dcl function_entry entry variable;
251 dcl function_name char (32) varying;
252 dcl highest_numbered_subsystem_invocation fixed bin;
253 dcl lb_bc fixed bin (24);
254 dcl lb_type fixed bin (2);
255 dcl macro_request char (macro_rq_len) based (macro_rq_ptr);
256 dcl macro_rq_len fixed bin (21);
257 dcl macro_rq_ptr ptr;
258 dcl pf_arg_len fixed bin (21);
259 dcl pf_arg_ptr ptr;
260 dcl req_buf char (linus_data_$req_buf_len);
261 dcl rq_arg_len fixed bin (21);
262 dcl rq_arg_ptr ptr;
263 dcl start_up bit (1);
264 dcl lila_prompt_char char (32) varying based (lcb.lila_promp_chars_ptr);
265 dcl 1 local_rpo aligned like rp_options;
266 dcl ptr_desc bit (36) init ("100110100000000000000000000000000000"b);
267 dcl fixed_bin_35_desc bit (36) init ("100000110000000000000000000000100011"b);
268
269 dcl 1 obj_info aligned like object_info;
270
271 dcl 1 acc aligned based (acc_ptr),
272 2 len fixed bin (8) unal,
273 2 string char (0 refer (acc.len)) unal;
274
275 dcl recursed bit (1) int static init ("0"b);
276 dcl RW fixed bin (5) int static options (constant) init (01010b);
277 dcl WHITESPACE_OR_QUOTE char (7) int static options (constant) init (" ^K^L^M
278 """);
279 dcl LAST_POSITION_IN_THE_TABLE fixed bin internal static options (constant) init (9999);
280 dcl my_name char (5) int static options (constant) init ("linus");
281
282 dcl (
283 SEG init ("011"b),
284 TEXT init ("000"b)
285 ) bit (3) int static options (constant);
286
287 dcl (
288 error_table_$badopt,
289 error_table_$inconsistent,
290 error_table_$notadir,
291 error_table_$noentry,
292 linus_data_$max_range_items,
293 linus_data_$req_buf_len,
294 linus_data_$req_proc_id,
295 linus_error_$abort,
296 linus_error_$bad_builtin_obj,
297 linus_error_$conv,
298 linus_error_$dup_ctl_args,
299 linus_error_$inval_ctl_arg,
300 linus_error_$recursed,
301 linus_error_$too_few_ctl_args,
302 linus_rq_table_$linus_rq_table_,
303 ssu_et_$request_line_aborted,
304 ssu_et_$subsystem_aborted,
305 sys_info$max_seg_size
306 ) ext fixed bin (35);
307
308 dcl ssu_info_directories_$standard_requests char (168) external;
309 dcl ssu_request_tables_$standard_requests bit(36) aligned external;
310
311
312 dcl iox_$user_input ptr ext static;
313
314 dcl (cleanup, conversion, sub_error_) condition;
315
316 dcl (addr, addrel, empty, fixed, null, ptr, rank, rel,
317 rtrim, search, substr, vclock) builtin;
318
319
320
321 dcl com_err_ entry options (variable);
322 dcl continue_to_signal_ entry (fixed bin(35));
323 dcl cu_$arg_count entry (fixed bin);
324 dcl cu_$arg_ptr entry (fixed bin, ptr, fixed bin (21), fixed bin (35));
325 dcl cu_$decode_entry_value entry (entry, ptr, ptr);
326 dcl cv_entry_ entry (char (*), ptr, fixed bin (35)) returns (entry);
327 dcl expand_pathname_$add_suffix entry (char (*), char (*), char (*), char (*),
328 fixed bin (35));
329 dcl find_condition_info_ entry (ptr, ptr, fixed bin(35));
330 dcl get_pdir_ entry returns (char (168));
331 dcl hcs_$del_dir_tree entry (char (*), char (*), fixed bin (35));
332 dcl hcs_$delentry_file entry (char (*), char (*), fixed bin (35));
333 dcl hcs_$delentry_seg entry (ptr, fixed bin (35));
334 dcl hcs_$initiate entry (char (*), char (*), char (*), fixed bin (1),
335 fixed bin (2), ptr, fixed bin (35));
336 dcl hcs_$make_seg
337 entry (char (*), char (*), char (*), fixed bin (5), ptr, fixed bin (35))
338 ;
339 dcl hcs_$status_mins
340 entry (ptr, fixed bin (2), fixed bin (24), fixed bin (35));
341 dcl ioa_ entry options (variable);
342 dcl iox_$close entry (ptr, fixed bin (35));
343 dcl iox_$detach_iocb entry (ptr, fixed bin (35));
344 dcl iox_$destroy_iocb entry (ptr, fixed bin (35));
345 dcl object_info_$brief entry (ptr, fixed bin (24), ptr, fixed bin (35));
346 dcl release_temp_segment_ entry (char (*), ptr, fixed bin (35));
347 dcl requote_string_ entry (char(*)) returns(char(*));
348 dcl ssu_$add_info_dir entry (ptr, char(*), fixed bin, fixed bin(35));
349 dcl ssu_$add_request_table entry (ptr, ptr, fixed bin, fixed bin(35));
350 dcl ssu_$create_invocation entry (char (*), char (*), ptr, ptr, char (*), ptr,
351 fixed bin (35));
352 dcl ssu_$destroy_invocation entry (ptr);
353 dcl ssu_$execute_line entry (ptr, ptr, fixed bin (21), fixed bin (35));
354 dcl ssu_$execute_start_up entry () options (variable);
355 dcl ssu_$get_area entry (ptr, ptr, char(*), ptr);
356 dcl ssu_$get_info_ptr entry (ptr) returns (ptr);
357 dcl ssu_$get_invocation_count entry (ptr, fixed bin, fixed bin);
358 dcl ssu_$get_procedure entry (ptr, char (*), entry, fixed bin (35));
359 dcl ssu_$get_request_processor_options
360 entry (ptr, char(8), ptr, fixed bin(35));
361 dcl ssu_$listen entry (ptr, ptr, fixed bin (35));
362 dcl ssu_$print_message entry options (variable);
363 dcl ssu_$release_area entry (ptr, ptr);
364 dcl ssu_$set_ec_suffix entry (ptr, char (32));
365 dcl ssu_$set_procedure entry (ptr, char (*), entry, fixed bin (35));
366 dcl ssu_$set_prompt entry (ptr, char (64) varying);
367 dcl ssu_$set_prompt_mode entry (ptr, bit (*));
368 dcl ssu_$set_request_processor_options
369 entry (ptr, ptr, fixed bin(35));
370 dcl unique_chars_ entry (bit (*)) returns (char (15));
371
372
373
374 dcl linus_abort_line entry() options(variable);
375 dcl linus_convert_code entry (fixed bin (35), fixed bin (35), fixed bin (35));
376 dcl linus_invoke$pop_all entry (ptr, fixed bin (35));
377 dcl linus_invoke$pop_all_on_pi entry (ptr);
378 dcl linus_thread_fn_list
379 entry (ptr, entry, char (168) varying, char (32) varying,
380 fixed bin (35));
381 dcl linus_builtin_ entry;
382 dcl linus_define_area entry (ptr, char (6), fixed bin (35));
383 dcl linus_options$terminate entry (ptr, fixed bin (35));
384 dcl linus_table$terminate entry (ptr, fixed bin (35));
385 dcl linus_temp_seg_mgr$get_segment
386 entry (ptr, char(*), char(*), ptr, fixed bin(35));
387 dcl linus_temp_seg_mgr$release_segment
388 entry (ptr, char(*), ptr, fixed bin(35));
389 dcl linus_temp_seg_mgr$terminate
390 entry (ptr, fixed bin(35));
391 dcl dsl_$close entry options (variable);
392 ^L
393 sci_ptr = null;
394 lcb_ptr = null;
395 if recursed then do;
396 call com_err_ (linus_error_$recursed, my_name);
397 return;
398 end;
399 else do;
400 on cleanup call tidy_up;
401 recursed = "1"b;
402 end;
403
404 arg_ptr, ca_ptr, ent_ptr = null;
405 macro_rq_ptr, pf_arg_ptr, rq_arg_ptr = null;
406 ab = "0"b;
407 start_up = "1"b;
408
409 call
410 hcs_$make_seg ("", unique_chars_ ("0"b) || ".lcb", "", RW, ptr_sink,
411 code);
412 if ptr_sink = null then
413 call error (code, "^/Creating LINUS Control Block");
414
415 ptr_sink -> lcb.linus_area_ptr, ptr_sink -> lcb.lila_area_ptr,
416 ptr_sink -> lcb.i_o_area_ptr = null;
417
418 ptr_sink -> lcb.lila_count, ptr_sink -> lcb.lila_chars,
419 ptr_sink -> lcb.curr_lv_val_offset, ptr_sink -> lcb.curr_lit_offset,
420 ptr_sink -> lcb.db_index = 0;
421 ptr_sink -> lcb.request_time, ptr_sink -> lcb.mrds_time = 0;
422 ptr_sink -> lcb.prompt_flag = "1"b;
423 ptr_sink -> lcb.test_flag = "0"b;
424 ptr_sink -> lcb.pso_flag = "0"b;
425 ptr_sink -> lcb.no_ot_flag = "0"b;
426 ptr_sink -> lcb.cal_ptr, ptr_sink -> lcb.ttn_ptr, ptr_sink -> lcb.si_ptr,
427 ptr_sink -> lcb.force_retrieve_scope_info_ptr, ptr_sink -> lcb.setfi_ptr,
428 ptr_sink -> lcb.sclfi_ptr, ptr_sink -> lcb.lv_ptr,
429 ptr_sink -> lcb.lvv_ptr, ptr_sink -> lcb.ivs_ptr,
430 ptr_sink -> lcb.lit_ptr, ptr_sink -> lcb.liocb_ptr = null;
431 ptr_sink -> lcb.is_ptr = iox_$user_input;
432 ptr_sink -> lcb.rb_len = linus_data_$req_buf_len;
433 ptr_sink -> lcb.lila_fn = "";
434 ptr_sink -> lcb.static_area = empty;
435
436 ptr_sink -> lcb.build_increment = 10;
437 ptr_sink -> lcb.build_start = 10;
438
439 ptr_sink -> lcb.linus_version = "4.5";
440 ptr_sink -> lcb.iteration = "0"b;
441 ptr_sink -> lcb.report_control_info_ptr = null;
442 ptr_sink -> lcb.table_control_info_ptr = null;
443 ptr_sink -> lcb.temp_seg_info_ptr = null;
444 ptr_sink -> lcb.query_temp_segment_ptr = null;
445 ptr_sink -> lcb.general_work_area_ptr = null;
446
447 lcb_ptr = ptr_sink;
448 ptr_sink = null;
449
450 call ssu_$create_invocation ("linus", (lcb.linus_version), lcb_ptr,
451 addr (linus_rq_table_$linus_rq_table_), ">doc>ss>linus", sci_ptr, code);
452 if code ^= 0
453 then call error (code, "");
454 call ssu_$add_request_table (sci_ptr,
455 addr (ssu_request_tables_$standard_requests), LAST_POSITION_IN_THE_TABLE, code);
456 if code ^= 0
457 then call error (code, "Unable to add the ssu_ standard requests.");
458 call ssu_$add_info_dir (sci_ptr, ssu_info_directories_$standard_requests, LAST_POSITION_IN_THE_TABLE, code);
459 if code ^= 0
460 then call error (code, "Unable to add the ssu_ standard request info segs.");
461
462 lcb.subsystem_control_info_ptr = sci_ptr;
463 call ssu_$get_invocation_count (sci_ptr, lcb.subsystem_invocation_level,
464 highest_numbered_subsystem_invocation);
465
466 allocate lila_prompt_char in (lcb.static_area) set (lcb.lila_promp_chars_ptr);
467 lila_prompt_char = "->";
468
469 num_of_rels_init = linus_data_$max_range_items;
470 allocate linus_rel_array in (lcb.static_area);
471 lcb.rel_array_ptr = linus_rel_array_ptr;
472 linus_rel_array.num_of_rels = 0;
473
474 call cu_$decode_entry_value (linus_builtin_, lb_ptr, ptr_sink);
475
476 if lb_ptr ^= null then do;
477 lb_ptr = ptr (lb_ptr, 0);
478 call hcs_$status_mins (lb_ptr, lb_type, lb_bc, code);
479
480 if code ^= 0 then
481 call error (linus_error_$bad_builtin_obj, "");
482 call object_info_$brief (lb_ptr, lb_bc, addr (obj_info), code);
483
484 if code ^= 0 then
485 call error (linus_error_$bad_builtin_obj, "");
486
487 do d_ptr = addrel (obj_info.defp, obj_info.defp -> bit18)
488
489 repeat addrel (obj_info.defp, d_ptr -> definition.value)
490 while (addrel (obj_info.defp, d_ptr -> definition.symbol)
491 -> acc.string ^= "linus_builtin_"
492 & addrel (obj_info.defp, d_ptr -> definition.forward) -> bit18
493 ^= "0"b);
494 end;
495 if addrel (obj_info.defp, d_ptr -> definition.symbol) -> acc.string
496 ^= "linus_builtin_" then
497 call error (linus_error_$bad_builtin_obj, "");
498
499 do d_ptr = addrel (obj_info.defp, d_ptr -> definition.segname)
500
501 repeat addrel (obj_info.defp, d_ptr -> definition.forward)
502 while (d_ptr -> definition.class ^= SEG
503 & d_ptr -> definition.forward ^= "0"b);
504 if d_ptr -> definition.class = TEXT
505 & ^d_ptr -> definition.flags.ignore
506 & d_ptr -> definition.flags.entry then do;
507 acc_ptr = addrel (obj_info.defp, d_ptr -> definition.symbol);
508
509 if substr (acc.string, acc.len - 4, 5) = "_calc" then do;
510
511 function_name = substr (acc.string, 1, acc.len - 5);
512 function_entry =
513 cv_entry_ ("linus_builtin_$" || acc.string, null, code);
514 if code ^= 0 then
515 call
516 error (code,
517 "^/Converting builtin entry: " || function_name);
518 call
519 linus_thread_fn_list (lcb_ptr, function_entry,
520 "linus_builtin_", function_name, code);
521 if code ^= 0 then
522 call error (code, "");
523 end;
524 end;
525 end;
526 end;
527
528 if lcb.setfi_ptr = null then
529 call error (linus_error_$bad_builtin_obj, "");
530
531 lcb.rb_ptr = addr (req_buf);
532
533 on conversion call error (linus_error_$conv, "");
534
535
536 call ssu_$set_procedure (sci_ptr, "program_interrupt", linus_invoke$pop_all_on_pi, code);
537 if code ^= 0
538 then call error (code, "");
539
540 call cu_$arg_count (nargs);
541
542 do i = 1 to nargs;
543 call cu_$arg_ptr (i, ctl_ptr, ctl_len, code);
544 if code ^= 0 then
545 call error (code, ctl_arg);
546
547 if ctl_arg = "-set_linus_prompt_string" | ctl_arg = "-slups" | ctl_arg = "-prompt"
548 then do;
549 if i >= nargs then
550 call
551 error (linus_error_$too_few_ctl_args,
552 "^2/-set_linus_prompt_string requires a parameter");
553 i = i + 1;
554 call cu_$arg_ptr (i, ctl_ptr, ctl_len, code);
555 if code ^= 0 then
556 call error (code, ctl_arg);
557 call ssu_$set_prompt (sci_ptr, (ctl_arg));
558 end;
559 else if ctl_arg = "-set_lila_prompt_string" | ctl_arg = "-slaps"
560 then do;
561 if i >= nargs then
562 call
563 error (linus_error_$too_few_ctl_args,
564 "^2/-set_lila_prompt_string requires a parameter");
565 i = i + 1;
566 call cu_$arg_ptr (i, ctl_ptr, ctl_len, code);
567 if code ^= 0 then
568 call error (code, ctl_arg);
569 lila_prompt_char = ctl_arg;
570 end;
571 else if ctl_arg = "-no_prompt" | ctl_arg = "-npmt" then do;
572 lcb.prompt_flag = "0"b;
573 call ssu_$set_prompt_mode (sci_ptr, DONT_PROMPT);
574 end;
575 else if ctl_arg = "-print_search_order" | ctl_arg = "-pso"
576 then lcb.pso_flag = "1"b;
577 else if ctl_arg = "-no_optimize" | ctl_arg = "-no_ot"
578 then lcb.no_ot_flag = "1"b;
579 else if ctl_arg = "-abbrev" | ctl_arg = "-ab"
580 then ab = "1"b;
581 else if ctl_arg = "-no_abbrev" | ctl_arg = "-nab"
582 then ab = "0"b;
583 else if ctl_arg = "-profile" | ctl_arg = "-pf"
584 then do;
585 if i >= nargs
586 then call error (linus_error_$too_few_ctl_args,
587 "^2/-profile requires a parameter");
588 i = i + 1;
589 call cu_$arg_ptr (i, pf_arg_ptr, pf_arg_len, code);
590 if code ^= 0
591 then call error (code, ctl_arg);
592 ab = "1"b;
593 end;
594 else if ctl_arg = "-request" | ctl_arg = "-rq"
595 then do;
596 if ca_ptr ^= null
597 then call error (error_table_$inconsistent,
598 "^2/A LINUS macro cannot be specified in addition to -request.");
599 if i >= nargs
600 then call error (linus_error_$too_few_ctl_args,
601 "^2/-request requires a parameter");
602 i = i + 1;
603 call cu_$arg_ptr (i, rq_arg_ptr, rq_arg_len, code);
604 if code ^= 0
605 then call error (code, ctl_arg);
606 end;
607 else if ctl_arg = "-iteration" | ctl_arg = "-it"
608 then lcb.iteration = "1"b;
609 else if ctl_arg = "-no_iteration" | ctl_arg = "-nit"
610 then lcb.iteration = "0"b;
611 else if ctl_arg = "-start_up" | ctl_arg = "-su"
612 then start_up = "1"b;
613 else if ctl_arg = "-no_startup" | ctl_arg = "-no_start_up"
614 | ctl_arg = "-ns" | ctl_arg = "-nsu" then start_up = "0"b;
615 else if ctl_arg = "-arguments" | ctl_arg = "-ag" then do;
616 if ca_ptr = null then
617 call
618 error (linus_error_$inval_ctl_arg,
619 "^2/A macro_name must be given before the -arguments control argument is vaild."
620 );
621
622 if i >= nargs then
623 call
624 error (linus_error_$too_few_ctl_args,
625 "^2/-arguments requires at least one parameter");
626 i = i + 1;
627 j = 2;
628 do while (i ^> nargs);
629 char_argl.nargs = char_argl.nargs + 1;
630 call
631 cu_$arg_ptr (i, char_argl.arg.arg_ptr (j),
632 char_argl.arg.arg_len (j), code);
633 if code ^= 0 then
634 call error (code, "macro argument");
635 i = i + 1;
636 j = j + 1;
637 end;
638 end;
639 else if substr (ctl_arg, 1, 1) ^= "-" then do;
640 if ca_ptr ^= null then
641 call
642 error (linus_error_$dup_ctl_args,
643 "^2/Only one macro path may be given: " || ctl_arg);
644 if rq_arg_ptr ^= null
645 then call error (error_table_$inconsistent,
646 "^2/A LINUS macro cannot be specified in addition to -request.");
647 nargs_init = nargs - i + 1;
648 if nargs_init > 1 then
649 nargs_init = nargs_init - 1;
650 allocate char_argl in (lcb.static_area);
651 char_argl.nargs = 1;
652 char_argl.arg.arg_ptr (1) = ctl_ptr;
653 char_argl.arg.arg_len (1) = ctl_len;
654 end;
655 else call error (error_table_$badopt, ctl_arg);
656 end;
657
658 call ssu_$set_ec_suffix (sci_ptr, "lec");
659
660
661
662
663
664
665
666 call ssu_$get_procedure (sci_ptr, "pre_request_line", lcb.ssu_pre_request_line, code);
667 if code ^= 0
668 then call error (code, "");
669
670 call ssu_$get_procedure (sci_ptr, "post_request_line", lcb.ssu_post_request_line, code);
671 if code ^= 0
672 then call error (code, "");
673
674
675
676
677
678 call ssu_$get_procedure (sci_ptr, "abort_line", lcb.ssu_abort_line, code);
679 if code ^= 0
680 then call error (code, "");
681
682 call ssu_$set_procedure (sci_ptr, "abort_line", linus_abort_line, code);
683 if code ^= 0
684 then call error (code, "");
685
686
687
688
689 call ssu_$get_request_processor_options (sci_ptr, RP_OPTIONS_VERSION_1, addr(local_rpo), code);
690 if code ^= 0 then call error (code, "");
691
692 if ^lcb.iteration
693 then do;
694 local_rpo.language_info.non_standard_language = "1"b;
695 local_rpo.language_info.character_types (rank ("(")) = NORMAL_CHARACTER;
696 local_rpo.language_info.character_types (rank (")")) = NORMAL_CHARACTER;
697 end;
698
699 if ab = "1"b
700 then do;
701 if pf_arg_ptr ^= null
702 then do;
703 ctl_len = pf_arg_len;
704 ctl_ptr = pf_arg_ptr;
705 call expand_pathname_$add_suffix (ctl_arg, "profile", dname, ename, code);
706 if code ^= 0
707 then call error (code, ctl_arg);
708 call hcs_$initiate (dname, ename, "", 0, 0, local_rpo.abbrev_info.default_profile_ptr, code);
709 if local_rpo.abbrev_info.default_profile_ptr = null
710 then call error (code, rtrim (dname) || ">" || ename);
711 end;
712
713 local_rpo.abbrev_info.expand_request_lines = "1"b;
714 end;
715
716 call ssu_$set_request_processor_options (sci_ptr, addr(local_rpo), code);
717 if code ^= 0 then call error (code, "");
718
719 if ca_ptr ^= null then do;
720 macro_rq_len = 6 + char_argl.nargs;
721 do i = 1 to char_argl.nargs;
722 macro_rq_len = macro_rq_len + char_argl.arg.arg_len (i) + 1;
723 end;
724 macro_rq_len = macro_rq_len * 2 +2;
725 allocate macro_request in (lcb.static_area);
726 macro_request = "invoke";
727 do i = 1 to char_argl.nargs;
728 ctl_ptr = char_argl.arg.arg_ptr (i);
729 ctl_len = char_argl.arg.arg_len (i);
730 if ctl_len = 0
731 then macro_request = rtrim(macro_request) || " """"";
732 else if search (ctl_arg, WHITESPACE_OR_QUOTE) ^= 0
733 then call requote_arg (ctl_arg);
734 else macro_request = rtrim(macro_request) || " " || ctl_arg;
735 end;
736 free char_argl;
737 call ssu_$execute_line (sci_ptr, macro_rq_ptr, macro_rq_len, code);
738 free macro_request;
739 if code = ssu_et_$subsystem_aborted
740 then do;
741 call tidy_up;
742 goto exit;
743 end;
744 else if code ^= 0 & code ^= ssu_et_$request_line_aborted
745 then do;
746 call error (linus_error_$abort, "");
747 return;
748 end;
749 end;
750
751 on sub_error_ call sub_error_handler;
752
753 call linus_define_area (lcb.lila_area_ptr, "LILA", code);
754 if code ^= 0 then
755 call error (code, "");
756
757 call linus_define_area (lcb.linus_area_ptr, "LINUS", code);
758 if code ^= 0
759 then call error (code, "");
760
761 call linus_temp_seg_mgr$get_segment (lcb_ptr, "LINUS", "",
762 lcb.query_temp_segment_ptr, code);
763 if code ^= 0
764 then call error (code, "^/While trying to aquire a temp segment for the query.");
765 call ssu_$get_area (sci_ptr, null, "general use area", lcb.general_work_area_ptr);
766
767
768 if start_up
769 then do;
770 call ssu_$execute_start_up (sci_ptr, code);
771 if code ^= 0 & code ^= error_table_$noentry
772 then call error (code, "While executing start_up");
773 end;
774
775 initial_linus_vclock = vclock;
776 lcb.request_time, lcb.mrds_time = 0;
777
778 if rq_arg_ptr ^= null
779 then do;
780 call ssu_$execute_line (sci_ptr, rq_arg_ptr, rq_arg_len, code);
781 if code = ssu_et_$subsystem_aborted
782 then do;
783 call tidy_up;
784 goto exit;
785 end;
786 else if code ^= 0
787 then call ssu_$print_message (sci_ptr, code);
788 end;
789
790 listen:
791 call ssu_$listen (sci_ptr, iox_$user_input, code);
792 if code ^= ssu_et_$subsystem_aborted
793 then call error (linus_error_$abort, "");
794 call tidy_up;
795
796 exit:
797 return;
798 ^L
799 timer_print:
800 proc;
801
802 call
803 ioa_ ("^/LINUS time^13t= ^10.3f" || "^/MRDS time^13t= ^10.3f"
804 || "^/Total time^13t= ^10.3f^/",
805 lcb.request_time / 1000000, lcb.mrds_time / 1000000,
806 (lcb.request_time + lcb.mrds_time) / 1000000);
807 lcb.request_time, lcb.mrds_time = 0;
808
809 end timer_print;
810 ^L
811 tidy_up:
812 proc;
813
814
815
816 dcl icode fixed bin (35);
817 dcl temp_index fixed bin (35);
818
819 if lcb.general_work_area_ptr ^= null
820 then call ssu_$release_area (sci_ptr, lcb.general_work_area_ptr);
821
822 if sci_ptr ^= null
823 then call ssu_$destroy_invocation (sci_ptr);
824
825 if lcb_ptr ^= null then do;
826
827 if lcb.is_ptr ^= iox_$user_input
828 then do;
829 lcb.prompt_flag = "0"b;
830 call linus_invoke$pop_all (lcb_ptr, icode);
831 end;
832 if lcb.db_index ^= 0 then do;
833 temp_index = lcb.db_index;
834 lcb.db_index = 0;
835 on sub_error_ ;
836 if lcb.timing_mode then
837 initial_mrds_vclock = vclock;
838 call dsl_$close (temp_index, icode);
839 if lcb.timing_mode then
840 lcb.mrds_time = lcb.mrds_time + vclock - initial_mrds_vclock;
841 revert sub_error_;
842 end;
843
844 if lcb.liocb_ptr ^= null then do;
845 call iox_$close (lcb.liocb_ptr, icode);
846 call iox_$detach_iocb (lcb.liocb_ptr, icode);
847 call iox_$destroy_iocb (lcb.liocb_ptr, icode);
848 lcb.liocb_ptr = null;
849 call hcs_$del_dir_tree (get_pdir_ (), lcb.lila_fn, icode);
850 if icode = error_table_$notadir | icode = 0 then
851 call hcs_$delentry_file (get_pdir_ (), lcb.lila_fn, icode);
852
853 end;
854 if lcb.linus_area_ptr ^= null then do;
855 call
856 release_temp_segment_ ("LINUS.LINUS.area", lcb.linus_area_ptr,
857 icode);
858 if icode ^= 0 then
859 call com_err_ (icode, my_name);
860 lcb.linus_area_ptr = null;
861 end;
862 if lcb.lila_area_ptr ^= null then do;
863 call
864 release_temp_segment_ ("LINUS.LILA.area", lcb.lila_area_ptr,
865 icode);
866 if icode ^= 0 then
867 call com_err_ (icode, my_name);
868 lcb.lila_area_ptr = null;
869 end;
870 if lcb.i_o_area_ptr ^= null then do;
871 call
872 release_temp_segment_ ("LINUS.I_O_.area", lcb.i_o_area_ptr,
873 icode);
874 if icode ^= 0 then
875 call com_err_ (icode, my_name);
876 lcb.i_o_area_ptr = null;
877 end;
878 if lcb.table_control_info_ptr ^= null
879 then do;
880 call linus_table$terminate (lcb_ptr, icode);
881 if icode ^= 0 then
882 call com_err_ (icode, my_name);
883 end;
884 if lcb.report_control_info_ptr ^= null
885 then do;
886 call linus_options$terminate (lcb_ptr, icode);
887 if icode ^= 0 then
888 call com_err_ (icode, my_name);
889 end;
890 if lcb.query_temp_segment_ptr ^= null
891 then do;
892 call linus_temp_seg_mgr$release_segment (lcb_ptr,
893 "LINUS", lcb.query_temp_segment_ptr, icode);
894 if icode ^= 0
895 then call com_err_ (icode, my_name);
896 else;
897 end;
898 if lcb.temp_seg_info_ptr ^= null
899 then do;
900 call linus_temp_seg_mgr$terminate (lcb_ptr, icode);
901 if icode ^= 0 then
902 call com_err_ (icode, my_name);
903 end;
904 if lcb_ptr ^= null then do;
905 call hcs_$delentry_seg (lcb_ptr, icode);
906 if icode ^= 0 then
907 call com_err_ (icode, my_name);
908 lcb_ptr = null;
909 end;
910 else if ptr_sink ^= null then do;
911 call hcs_$delentry_seg (ptr_sink, icode);
912 if icode ^= 0 then
913 call com_err_ (icode, my_name);
914 ptr_sink = null;
915 end;
916
917
918 end;
919
920 recursed = "0"b;
921
922 end tidy_up;
923 ^L
924 error:
925 proc (icode, msg_str);
926
927
928
929 dcl (icode, user_code) fixed bin (35);
930 dcl msg_str char (*);
931
932 call linus_convert_code (icode, user_code, linus_data_$req_proc_id);
933 call com_err_ (user_code, my_name, msg_str);
934 call tidy_up;
935 go to exit;
936
937 end error;
938 ^L
939 requote_arg:
940 proc(arg);
941 dcl arg char(*) parm;
942 macro_request = rtrim(macro_request) || " " || requote_string_(arg);
943 end requote_arg;
944 %page;
945 sub_error_handler: proc;
946 %skip(1);
947
948
949
950
951
952
953
954 %skip(1);
955 dcl 1 local_condition_info like condition_info;
956 dcl seh_code fixed bin (35);
957 %skip(1);
958 condition_info_ptr = addr (local_condition_info);
959 condition_info.version = condition_info_version_1;
960 call find_condition_info_ (null (), condition_info_ptr, seh_code);
961 if seh_code ^= 0
962 then do;
963 call tidy_up;
964 goto exit;
965 end;
966 %skip(1);
967 sub_error_info_ptr = condition_info.info_ptr;
968 if substr (sub_error_info.name, 1, 9) ^= "mrds_dsl_"
969 & substr (sub_error_info.name, 1, 3) ^= "mu_"
970 & substr (sub_error_info.name, 1, 4) ^= "mus_"
971 then do;
972 call continue_to_signal_ (seh_code);
973 return;
974 end;
975 %skip(1);
976 call linus_convert_code (sub_error_info.header.status_code, seh_code,
977 linus_data_$req_proc_id);
978 call ssu_$print_message (sci_ptr, seh_code, sub_error_info.header.info_string);
979 %skip(1);
980 goto listen;
981 %skip(1);
982 end sub_error_handler;
983 ^L
984 pre_request_line:
985 entry (bv_sci_ptr);
986
987
988
989
990 dcl bv_sci_ptr ptr parameter;
991
992 lcb_ptr = ssu_$get_info_ptr (bv_sci_ptr);
993 if ^lcb.timing_mode
994 then return;
995 lcb.mrds_time = 0;
996 initial_linus_vclock = vclock;
997 return;
998
999 post_request_line:
1000 entry (bv_sci_ptr);
1001
1002
1003
1004
1005
1006
1007 lcb_ptr = ssu_$get_info_ptr (bv_sci_ptr);
1008 if ^lcb.timing_mode
1009 then return;
1010 if lcb.request_time = -1
1011 then do;
1012 lcb.request_time = 0;
1013 return;
1014 end;
1015 lcb.request_time = vclock - initial_linus_vclock - lcb.mrds_time;
1016 call timer_print;
1017 return;
1018
1019 end linus;
1020