1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 linus_lila:
19 proc (sci_ptr_parm, lcb_ptr_parm);
20 %skip(3);
21 dcl lcb_ptr_parm ptr parm;
22 dcl sci_ptr_parm ptr parm;
23 %skip(1);
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 ^L
104 %include linus_lcb;
105 %page;
106 %include linus_char_argl;
107 %page;
108 %include linus_rel_array;
109 ^L
110 dcl sci_ptr ptr;
111
112 dcl (
113 nread,
114 rec_len,
115 read_len
116 ) fixed bin (21);
117
118 dcl cmd_len fixed bin;
119
120 dcl (
121 ref_ptr init (null),
122 ica_ptr init (null),
123 acmd_ptr init (null),
124 siocb_ptr init (null),
125 env_ptr init (null)
126 ) ptr;
127
128 dcl (
129 code,
130 icode
131 ) fixed bin (35);
132
133 dcl aligned_cmd char (cmd_len) based (acmd_ptr);
134 dcl arg char (char_argl.arg.arg_len (arg_index))
135 based (char_argl.arg.arg_ptr (arg_index));
136
137 dcl arg_index fixed bin;
138 dcl atd char (173);
139 dcl build_increment fixed bin;
140 dcl build_mode bit (1);
141 dcl next_build_line pic "9999";
142 dcl chars (nread) char (1) unal based (lcb.rb_ptr);
143
144 dcl control_arg bit (1) unal;
145 dcl done bit (1) unal;
146 dcl lila_prompt_flag bit (1) unal;
147 dcl i fixed bin;
148 dcl key pic "9999";
149 dcl key_var char (256) var;
150 dcl parameter fixed bin;
151 dcl parameter_number fixed bin;
152 dcl prompt_char char (32) varying
153 based (lcb.lila_promp_chars_ptr);
154 dcl req_index fixed bin (17);
155 dcl request char (nread) based (lcb.rb_ptr);
156
157 dcl request_count fixed bin init (11) int static options (constant);
158 dcl 1 request_table (request_count) aligned,
159
160 2 name char (15) var
161 init (".", "?", "build", "execute", "invoke",
162 "list_requests", "list", "new", "proc", "quit",
163 "save"),
164 2 short char (5) var
165 init ("", "", "", "e", "i", "lr", "ls", "", "",
166 "q", "sv"),
167 2 summary char (60) var
168 init ("Print the current lila status.",
169 "List all lila request names.",
170 "Enter build mode to insert/overwrite text.",
171 "Execute a Multics command line.",
172 "Invoke the specified Linus macro.",
173 "List brief information on lila requests.",
174 "List the current file.",
175 "Delete all text from the current lila file.",
176 "Process the current lila file.", "Leave LILA.",
177 "Save the current text into the specified linus macro."
178 );
179 dcl token char (15) var;
180 dcl work_area area (sys_info$max_seg_size)
181 based (lcb.lila_area_ptr);
182
183 dcl 1 list_buf aligned,
184 2 key char (4) unal,
185 2 data char (256) unal;
186
187 dcl WHT_SPC char (3) int static options (constant) init ("
188 ");
189 dcl NO_KILL fixed bin (35) int static options (constant)
190 init (0);
191 dcl KILL fixed bin (35) int static options (constant)
192 init (1);
193 dcl NL char (1) int static options (constant) init ("
194 ");
195 dcl BOF fixed bin int static options (constant) init (-1);
196 dcl KSU fixed bin int static options (constant) init (10);
197 dcl SO fixed bin int static options (constant) init (2);
198
199 dcl (
200 error_table_$end_of_info,
201 error_table_$no_record,
202 linus_data_$lila_id,
203 linus_error_$bad_stmt_no,
204 linus_error_$build_overflow,
205 linus_error_$conv,
206 linus_error_$integer_too_large,
207 linus_error_$integer_too_small,
208 linus_error_$inv_arg,
209 linus_error_$inv_lila_req,
210 linus_error_$no_db,
211 linus_error_$no_lila_data,
212 linus_error_$no_macro_arg,
213 linus_error_$no_path,
214 linus_error_$nonex_del,
215 linus_error_$non_integer,
216 linus_error_$bad_num_args,
217 sys_info$max_seg_size
218 ) ext fixed bin (35);
219
220 dcl (
221 iox_$user_input,
222 iox_$user_output
223 ) ptr ext;
224
225 dcl (cleanup, conversion)
226 condition;
227
228 dcl (addr, after, bin, char, divide, before, fixed, index, length, ltrim,
229 mod, null, rel, rtrim, search, substr, string, verify)
230 builtin;
231
232
233
234 dcl cu_$cp entry (ptr, fixed bin, fixed bin (35));
235 dcl cu_$decode_entry_value
236 entry (entry, ptr, ptr);
237 dcl cv_dec_check_ entry (char (*), fixed bin (35))
238 returns (fixed bin (35));
239 dcl ioa_ entry options (variable);
240 dcl ioa_$ioa_switch entry options (variable);
241 dcl ioa_$nnl entry options (variable);
242 dcl iox_$attach_name entry (char (*), ptr, char (*), ptr,
243 fixed bin (35));
244 dcl iox_$close entry (ptr, fixed bin (35));
245 dcl iox_$delete_record entry (ptr, fixed bin (35));
246 dcl iox_$detach_iocb entry (ptr, fixed bin (35));
247 dcl iox_$get_line entry (ptr, ptr, fixed bin (21), fixed bin (21),
248 fixed bin (35));
249 dcl iox_$open entry (ptr, fixed bin, bit (1) aligned,
250 fixed bin (35));
251 dcl iox_$position entry (ptr, fixed bin, fixed bin (21),
252 fixed bin (35));
253 dcl iox_$read_key entry (ptr, char (256) var, fixed bin (21),
254 fixed bin (35));
255 dcl iox_$read_record entry (ptr, ptr, fixed bin (21), fixed bin (21),
256 fixed bin (35));
257 dcl iox_$rewrite_record entry (ptr, ptr, fixed bin (21), fixed bin (35));
258 dcl iox_$seek_key entry (ptr, char (256) var, fixed bin (21),
259 fixed bin (35));
260 dcl iox_$write_record entry (ptr, ptr, fixed bin (21), fixed bin (35));
261 dcl get_pdir_ entry returns (char (168));
262 dcl ssu_$abort_line entry options (variable);
263 dcl ssu_$abort_subsystem entry options (variable);
264 dcl ssu_$arg_count entry (ptr, fixed bin);
265 dcl ssu_$arg_ptr entry (ptr, fixed bin, ptr, fixed bin (21));
266 dcl ssu_$execute_line entry (ptr, ptr, fixed bin (21), fixed bin (35));
267 dcl unique_chars_ entry (bit (*)) returns (char (15));
268
269
270
271 dcl linus_convert_code entry (fixed bin (35), fixed bin (35),
272 fixed bin (35));
273 dcl linus_invoke$pop_all
274 entry (ptr, fixed bin (35));
275 dcl linus_print_error entry (fixed bin (35), char (*));
276 dcl linus_translate_query$proc
277 entry (ptr, fixed bin (35));
278 ^L
279 sci_ptr = sci_ptr_parm;
280 lcb_ptr = lcb_ptr_parm;
281 build_mode = "0"b;
282 lila_prompt_flag = lcb.prompt_flag;
283 ica_ptr, siocb_ptr = null;
284 call cu_$decode_entry_value (linus_lila, ref_ptr, env_ptr);
285
286
287 on cleanup call tidy_up;
288 on conversion call error (linus_error_$conv, "", NO_KILL);
289
290 ca_ptr = null;
291 if lcb.db_index = 0 then
292 call error (linus_error_$no_db, "", NO_KILL);
293
294 call ssu_$arg_count (sci_ptr, nargs_init);
295
296 if nargs_init ^= 0
297 then do;
298 allocate char_argl in (lcb.static_area);
299 do i = 1 to nargs_init;
300 call ssu_$arg_ptr (sci_ptr, i, char_argl.arg.arg_ptr (i), char_argl.arg.arg_len (i));
301 end;
302 do arg_index = 1 to char_argl.nargs;
303 if arg = "-new"
304 then do;
305 if lcb.liocb_ptr = null
306 then call init_lila_file;
307 else if lcb.lila_count > 0
308 then call delete_old_file;
309 end;
310
311 else if arg = "-no_prompt"
312 then lila_prompt_flag = "0"b;
313
314 else if arg = "-prompt"
315 then lila_prompt_flag = "1"b;
316
317 else if arg = "-build"
318 then do;
319 build_increment = lcb.build_increment;
320 next_build_line = 0;
321
322 parameter_number = 1;
323 control_arg = "0"b;
324 do while ((arg_index + 1 <= char_argl.nargs) & (^control_arg));
325 arg_index = arg_index + 1;
326 parameter = cv_dec_check_ (arg, code);
327 if code ^= 0
328 then do;
329 control_arg = "1"b;
330 arg_index = arg_index - 1;
331 end;
332 else do;
333 if (parameter < 1)
334 then call error (linus_error_$integer_too_small, arg, NO_KILL);
335 if (parameter > 9999)
336 then call error (linus_error_$integer_too_large, arg, NO_KILL);
337
338 if parameter_number = 1
339 then next_build_line = parameter;
340 else if parameter_number = 2
341 then build_increment = parameter;
342 else call error (linus_error_$bad_num_args, "^/""-build"" allows a maximum of two parameters. " || arg, NO_KILL);
343
344 parameter_number = parameter_number + 1;
345 end;
346 end;
347 build_mode = "1"b;
348 end;
349
350 else call error (linus_error_$inv_arg, arg, NO_KILL);
351 end;
352 end;
353
354 if build_mode
355 then call set_build_start ("0"b);
356
357 if lcb.liocb_ptr = null then
358
359
360 call init_lila_file;
361
362 done = "0"b;
363 code = 0;
364
365 do while (^done);
366
367 if build_mode then
368 call build;
369
370 if lila_prompt_flag then do;
371 if lcb.is_ptr = iox_$user_input
372 & prompt_char ^= "" then
373 call ioa_$nnl ("^a ", prompt_char);
374 end;
375
376 call iox_$get_line (iox_$user_input, lcb.rb_ptr, lcb.rb_len, nread, icode);
377
378
379 if icode = linus_error_$no_macro_arg then
380 call error (icode, "reading LILA build text", NO_KILL);
381 else if icode ^= 0 then
382 call error (icode, "reading LILA text", KILL);
383 else call process_line;
384 if lcb.is_ptr ^= iox_$user_input & code ^= 0 then
385 do;
386 call linus_invoke$pop_all (lcb_ptr, icode);
387 call tidy_up;
388 end;
389
390 end;
391
392 code = 0;
393 exit:
394 if ca_ptr ^= null
395 then free char_argl;
396 if code ^= 0
397 then call ssu_$abort_subsystem (sci_ptr, code);
398 return;
399 %page;
400 initialize_lila_file: entry (
401
402 lcb_ptr_parm
403 );
404 %skip(3);
405 lcb_ptr = lcb_ptr_parm;
406 sci_ptr = lcb.subsystem_control_info_ptr;
407 if lcb.liocb_ptr = null ()
408 then call init_lila_file;
409 else call delete_old_file;
410 lcb.lila_chars = 0;
411 lcb.lila_count = 0;
412 %skip(1);
413 return;
414 ^L
415 error:
416 proc (icode, msg, fatal_flag);
417
418
419
420 dcl (ucode, icode, fatal_flag)
421 fixed bin (35);
422 dcl msg char (*);
423
424 if lcb.is_ptr ^= iox_$user_input then
425 call linus_invoke$pop_all (lcb_ptr, code);
426 call linus_convert_code (icode, ucode, linus_data_$lila_id);
427 code = fatal_flag;
428 call tidy_up;
429 if fatal_flag = NO_KILL
430 then call ssu_$abort_line (sci_ptr, ucode, msg);
431 else call ssu_$abort_subsystem (sci_ptr, ucode, msg);
432
433
434 end error;
435 ^L
436 tidy_up:
437 proc;
438
439
440
441 if (icode ^= 0 | code ^= 0) & ^lcb.prompt_flag then
442 call linus_print_error (0, "Returning to linus request level.");
443 if ca_ptr ^= null
444 then free char_argl;
445 if siocb_ptr ^= null then
446 do;
447 call iox_$close (siocb_ptr, icode);
448 call iox_$detach_iocb (siocb_ptr, icode);
449 end;
450
451 end tidy_up;
452 ^L
453 process_line:
454 proc;
455
456
457
458 dcl (i, j) fixed bin;
459
460 i = verify (request, WHT_SPC);
461 if i <= 0 then
462 return;
463 j = search (substr (request, i), WHT_SPC);
464 if j <= 0 then
465 j = nread - i + 1;
466 else j = j - 1;
467
468 token = substr (request, i, j);
469 if token >= "0" & token <= "9999" then
470 do;
471 if verify (token, "0123456789") ^= 0
472 | length (token) > 4 then
473 do;
474 call linus_print_error (linus_error_$bad_stmt_no, (token));
475 return;
476 end;
477 key = fixed (token);
478 i = i + j;
479 j = verify (substr (request, i), WHT_SPC);
480 if j <= 0 then
481 do;
482 call iox_$seek_key (lcb.liocb_ptr, (key), rec_len, icode);
483
484 if icode ^= 0 then
485 call linus_print_error (linus_error_$nonex_del, (token));
486 else
487 do;
488 lcb.si_ptr = null;
489 call iox_$delete_record (lcb.liocb_ptr, icode);
490 if icode ^= 0 then
491 call error (icode, "", KILL);
492 lcb.lila_chars = lcb.lila_chars - rec_len;
493
494 lcb.lila_count = lcb.lila_count - 1;
495 end;
496 end;
497 else call write_line ((key), addr (chars (i)), nread - i + 1);
498
499 end;
500
501 else if token = "." then
502 call ioa_ ("linus version ^a (lila)", lcb.linus_version);
503
504 else if token = "list" | token = "ls" then
505 do;
506 if lcb.lila_count <= 0 then
507 call linus_print_error (linus_error_$no_lila_data, request);
508 else call list_file (iox_$user_output);
509 end;
510
511 else if token = "proc" then
512 do;
513 call linus_translate_query$proc (lcb_ptr, code);
514 if code ^= 0 then go to exit;
515 end;
516
517 else if token = "quit" | token = "q" then
518 done = "1"b;
519
520 else if token = "invoke" | token = "i" then
521 do;
522 call ssu_$execute_line (sci_ptr, lcb.rb_ptr, nread, icode);
523 if icode ^= 0 then
524 go to exit;
525 ica_ptr = null;
526 end;
527
528 else if token = "save" | token = "sv" then
529 do;
530 if lcb.lila_count <= 0 then
531 call linus_print_error (linus_error_$no_lila_data, request);
532 else
533 do;
534 call get_token;
535 if j > 0 then
536 do;
537 if substr (request, i + j - 6, 6) = ".linus" then
538
539 atd = "vfile_ " || substr (request, i, j);
540 else atd = "vfile_ " || substr (request, i, j)
541 || ".linus";
542 call
543 iox_$attach_name (unique_chars_ ("0"b)
544 || ".lila_save", siocb_ptr, atd, ref_ptr, icode);
545 if icode ^= 0 then
546 call soft_error (icode, atd);
547 call iox_$open (siocb_ptr, SO, "0"b, icode);
548 if icode ^= 0 then
549 call soft_error (icode, atd);
550 call list_file (siocb_ptr);
551 call iox_$close (siocb_ptr, icode);
552 if icode ^= 0 then
553 call soft_error (icode, atd);
554 call iox_$detach_iocb (siocb_ptr, icode);
555 if icode ^= 0 then
556 call soft_error (icode, atd);
557 siocb_ptr = null;
558 end;
559 else call soft_error (linus_error_$no_path, (token));
560 end;
561 end;
562 else if token = "e" | token = "execute" | index (token, "..") = 1 then
563 do;
564 cmd_len = nread;
565 allocate aligned_cmd in (work_area);
566 if index (token, "..") = 1 then
567 token = "..";
568 aligned_cmd = ltrim (after (request, rtrim (token)));
569 call cu_$cp (acmd_ptr, cmd_len, icode);
570 acmd_ptr = null;
571 end;
572
573 else if token = "build"
574 then
575 do;
576 build_increment = lcb.build_increment;
577 next_build_line = 0;
578 call get_token;
579 parameter_number = 1;
580 do while (j > 0);
581 parameter = cv_dec_check_ (substr (request, i, j), code);
582 if code ^= 0
583 then call soft_error (linus_error_$non_integer, substr (request, i, j));
584 if (parameter < 1)
585 then call soft_error (linus_error_$integer_too_small, substr (request, i, j));
586 if (parameter > 9999)
587 then call soft_error (linus_error_$integer_too_large, substr (request, i, j));
588
589 if parameter_number = 1
590 then next_build_line = parameter;
591 else if parameter_number = 2
592 then build_increment = parameter;
593 else call soft_error (linus_error_$bad_num_args, "^/""build"" allows a maximum of two parameters. " || substr (request, i, j));
594 call get_token;
595 parameter_number = parameter_number + 1;
596 end;
597 build_mode = "1"b;
598 call set_build_start ("1"b);
599 end;
600
601 else if token = "new" then
602 do;
603 if lcb.lila_count > 0 then
604 call delete_old_file;
605 end;
606
607 else if token = "?" then
608 do;
609 call ioa_ ("^/Available lila requests:^/");
610 do req_index = 1 to divide (request_count, 3, 17) * 3 by 3;
611 call
612 ioa_ (
613 "^a^[^s^;, ^a^]^[^25t^a^[^s^;, ^a^]^[^50t^a^[^s^;, ^a^]^]^]",
614 request_table.name (req_index),
615 (request_table.short (req_index) = ""),
616 request_table.short (req_index),
617 (req_index + 1 <= request_count),
618 request_table.name (req_index + 1),
619 (request_table.short (req_index + 1) = ""),
620 request_table.short (req_index + 1),
621 (req_index + 2 <= request_count),
622 request_table.name (req_index + 2),
623 (request_table.short (req_index + 2) = ""),
624 request_table.short (req_index + 2));
625 end;
626 if mod (request_count, 3) = 2 then
627 call
628 ioa_ ("^a^[^s^;, ^a^]^25t^a^[^s^;, ^a^]",
629 request_table.name (req_index),
630 (request_table.short (req_index) = ""),
631 request_table.short (req_index),
632 request_table.name (req_index + 1),
633 (request_table.short (req_index + 1) = ""),
634 request_table.short (req_index + 1));
635
636 if mod (request_count, 3) = 1 then
637 call
638 ioa_ ("^a^[^s^;, ^a^]", request_table.name (req_index),
639 (request_table.short (req_index) = ""),
640 request_table.short (req_index));
641
642 call
643 ioa_ (
644 "^/Type ""list_requests"" for a short description of the requests.^/"
645 );
646 end;
647
648 else if token = "list_requests" | token = "lr" then
649 do;
650 call ioa_ ("^/Summary of lila requests:");
651 call
652 ioa_ (
653 "^/Use "".. COMMAND_LINE"" to escape a command line to Multics.^/")
654 ;
655 do req_index = 1 to request_count;
656 call
657 ioa_ ("^a^[^s^;, ^a^]^20t^a", request_table.name (req_index),
658 (request_table.short (req_index) = ""),
659 request_table.short (req_index),
660 request_table.summary (req_index));
661 end;
662 call
663 ioa_ (
664 "^/Type ""help"" at LINUS request level for more information.^/");
665 end;
666
667 else
668 call linus_print_error (linus_error_$inv_lila_req, (" bad request: " || token));
669
670 list_file:
671 proc (iocb_ptr);
672
673
674
675 dcl iocb_ptr ptr;
676
677 call iox_$position (lcb.liocb_ptr, BOF, 0, icode);
678 if icode ^= 0 then
679 call error (icode, "", KILL);
680 do while (icode = 0);
681 string (list_buf) = " ";
682 call iox_$read_key (lcb.liocb_ptr, key_var, rec_len, icode);
683 if icode = 0 then
684 do;
685 call
686 iox_$read_record (lcb.liocb_ptr, addr (list_buf.data),
687 rec_len, read_len, icode);
688 if icode = 0 then
689 do;
690 list_buf.key = key_var;
691 call
692 ioa_$ioa_switch (iocb_ptr, "^a",
693 before (string (list_buf), NL));
694 end;
695 end;
696 end;
697 if icode ^= error_table_$end_of_info then
698 call error (icode, "", KILL);
699
700 end list_file;
701
702 get_token:
703 proc;
704
705
706
707 i = i + j;
708 if i <= nread then
709 do;
710 j = verify (substr (request, i), WHT_SPC);
711 if j > 0 then
712 do;
713 i = i + j - 1;
714 j = search (substr (request, i), WHT_SPC);
715 if j <= 0 then
716 j = nread - i + 1;
717 else j = j - 1;
718 end;
719 end;
720 else j = 0;
721
722 end get_token;
723
724 soft_error:
725 proc (cd, msg);
726
727
728
729 dcl (cd, ucd) fixed bin (35);
730 dcl msg char (*);
731
732 call linus_convert_code (cd, ucd, linus_data_$lila_id);
733 call linus_print_error (ucd, msg);
734 go to pl_exit;
735
736 end soft_error;
737
738 pl_exit:
739 end process_line;
740 ^L
741 init_lila_file:
742 proc;
743
744
745
746 lcb.lila_fn = unique_chars_ ("0"b) || ".lila";
747 call
748 iox_$attach_name (unique_chars_ ("0"b) || ".lila_switch",
749 lcb.liocb_ptr,
750 "vfile_ " || before (get_pdir_ (), " ") || ">" || lcb.lila_fn, ref_ptr,
751 icode);
752 if icode ^= 0 then
753 call error (icode, "", KILL);
754 call iox_$open (lcb.liocb_ptr, KSU, "0"b, icode);
755 if icode ^= 0 then
756 call error (icode, "", KILL);
757 else
758 do;
759 call write_line ((1), addr (chars (1)), 0);
760 call delete_old_file;
761 end;
762
763 end init_lila_file;
764 ^L
765 delete_old_file:
766 proc;
767
768
769
770 lcb.si_ptr = null;
771 call iox_$position (lcb.liocb_ptr, BOF, 0, icode);
772 if icode ^= 0 then
773 call error (icode, "", KILL);
774
775 do while (icode = 0);
776 call iox_$delete_record (lcb.liocb_ptr, icode);
777 end;
778
779 if icode ^= error_table_$no_record then
780 call error (icode, "", KILL);
781 lcb.lila_chars, lcb.lila_count = 0;
782
783 end delete_old_file;
784
785 write_line:
786 proc (source_key, source_ptr, source_len);
787
788
789
790
791 dcl source_key pic "9999" parameter;
792 dcl source_ptr ptr parameter;
793 dcl source_len fixed bin (21) parameter;
794
795 lcb.si_ptr = null;
796 call iox_$seek_key (lcb.liocb_ptr, (source_key), rec_len, icode);
797
798 if icode = 0 then
799 do;
800 call
801 iox_$rewrite_record (lcb.liocb_ptr, source_ptr, source_len,
802 icode);
803 if icode ^= 0 then
804 call error (icode, "", KILL);
805 lcb.lila_chars = lcb.lila_chars - rec_len + source_len;
806 end;
807 else if icode = error_table_$no_record then
808 do;
809 call
810 iox_$write_record (lcb.liocb_ptr, source_ptr, source_len, icode);
811 if icode ^= 0 then
812 call error (icode, "", KILL);
813 lcb.lila_chars = lcb.lila_chars + source_len;
814 lcb.lila_count = lcb.lila_count + 1;
815 end;
816 else call error (icode, "", KILL);
817
818
819 end write_line;
820
821 build:
822 proc;
823
824
825
826 do while (build_mode);
827
828 if lcb.is_ptr = iox_$user_input
829 then do;
830 call iox_$seek_key (lcb.liocb_ptr, (next_build_line), rec_len, icode);
831 if icode = 0
832 then call ioa_$nnl ("^a*", next_build_line);
833 else call ioa_$nnl ("^a ", next_build_line);
834 end;
835
836 call iox_$get_line (iox_$user_input, lcb.rb_ptr, lcb.rb_len, nread, icode);
837
838
839 if icode = linus_error_$no_macro_arg then
840 call error (icode, "reading build text", NO_KILL);
841
842 else if icode ^= 0 then
843 call error (icode, "reading build text", KILL);
844
845 if verify (request, WHT_SPC) > 0 then
846 do;
847 if substr (request, 1, nread - 1) = "." then
848 build_mode = "0"b;
849
850 else
851 do;
852 nread = nread + 1;
853 request = " " || substr (request, 1, nread - 1);
854 call
855 write_line ((next_build_line), addr (chars (1)), nread);
856
857 if next_build_line + build_increment > 9999 then
858 do;
859 build_mode = "0"b;
860 call
861 linus_print_error (linus_error_$build_overflow,
862 char (next_build_line + build_increment));
863 end;
864 else next_build_line = next_build_line + build_increment;
865
866
867 end;
868
869 end;
870 end;
871
872 end build;
873
874 last_line_num:
875 proc returns (pic "9999");
876
877
878
879
880 dcl line_number pic "9999";
881 dcl line_number_key char (256) var;
882 dcl EOF fixed bin int static options (constant) init (+1);
883
884 if lcb.lila_count = 0 then
885 line_number = 0;
886 else
887 do;
888 call iox_$position (lcb.liocb_ptr, EOF, 0, icode);
889 if icode ^= 0 then
890 call error (icode, "", NO_KILL);
891
892 call iox_$position (lcb.liocb_ptr, 0, -1, icode);
893 if icode ^= 0 then
894 call error (icode, "", NO_KILL);
895
896 call iox_$read_key (lcb.liocb_ptr, line_number_key, rec_len, icode);
897 if icode ^= 0 then
898 call error (icode, "", NO_KILL);
899 line_number = bin (line_number_key);
900 end;
901 return (line_number);
902 end last_line_num;
903
904 set_build_start:
905 proc (request);
906
907 dcl request bit(1) unal parm;
908
909 if next_build_line = 0
910 then do;
911 next_build_line = last_line_num ();
912
913 if next_build_line + build_increment <= 9999
914 then next_build_line = next_build_line + build_increment;
915 else do;
916 build_mode = "0"b;
917 if ^request
918 then call error (0, "The build increment (" || ltrim (char (build_increment))
919 || ") is too large.", NO_KILL);
920 call linus_print_error (linus_error_$integer_too_large, "The build increment (" || ltrim (char (build_increment))
921 || ") is too large.");
922 return;
923 end;
924 end;
925 end set_build_start;
926
927 end linus_lila;