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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 tedaddr_:
46 proc (adb_p, ain_p, ain_l, abp, msg, acode);
47 dcl (
48 adb_p ptr,
49 ain_p ptr,
50 ain_l fixed bin (21),
51
52
53 abp ptr,
54 msg char (168) var,
55 acode fixed bin (35)
56
57
58
59 ) parm;
60
61
62
63
64
65
66
67
68 NOTE
69 NOTE
70
71
72
73 NOTE
74 NOTE
75 NOTE
76 NOTE
77 NOTE
78 NOTE
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 NOTE
117
118
119 NOTE
120
121
122
123
124
125
126
127
128
129
130
131
132 dcl 1 ca_ based (ca__p) like b.a_;
133
134 dcl next_in fixed bin;
135 dcl in_p ptr;
136 dcl in_l fixed bin;
137 dcl in_s char (in_l) based (in_p);
138 dcl in_c (in_l) char (1) based (in_p);
139
140
141 dcl file_str char (last_file_char) based (b.cur.sp);
142 dcl first_file_char fixed bin (21);
143 dcl next_file_char fixed bin (21);
144 dcl last_file_char fixed bin (21);
145 dcl in_part_2 bit (1);
146
147 dcl adr_num fixed bin;
148 dcl all_buffer bit (1);
149 dcl bkp_sw bit (1);
150 dcl ca__p ptr;
151 dcl ch char (1);
152 dcl code fixed bin (35);
153 dcl concealsw bit (1);
154 dcl delim char (1);
155 dcl dot_sw bit (1);
156 dcl end_sw bit (1);
157 dcl expr_l fixed bin (21);
158 dcl i fixed bin (21);
159 dcl line_sw bit (1);
160 dcl negsw bit (1);
161 dcl num fixed bin (21);
162 dcl possw bit (1);
163 dcl q_sw bit (1);
164 dcl recurring bit (1);
165 dcl reg_sw bit (1);
166 dcl relsw bit (1);
167 dcl srb1 fixed bin (21);
168 dcl srb2 fixed bin (21);
169 dcl sre1 fixed bin (21);
170 dcl sre2 fixed bin (21);
171 dcl start_scan fixed bin (21);
172 dcl string_sw bit (1) defined (b.present (0));
173 dcl tbp ptr;
174 dcl used fixed bin (21);
175
176 dcl NL char (1) int static init ("
177 ");
178
179 dcl ioa_ entry options (variable);
180 dcl ioa_$ioa_switch entry () options (variable);
181 dcl ioa_$ioa_switch_nnl entry () options (variable);
182
183
184 dcl (
185 addr, fixed, index, null, reverse, substr, verify
186 ) builtin; %page;
187 dbase_p = adb_p;
188 bp = abp;
189 in_part_2 = ""b;
190 in_p = ain_p;
191 if (ain_l < 0)
192 then do;
193 ain_l = -ain_l;
194 recurring = "1"b;
195 end;
196 else recurring = ""b;
197 in_l = ain_l;
198 next_in = 1; %skip (2);
199 if db_addr
200 then call ioa_$ioa_switch (db_output,
201 "addr: in=^p,^i ""^a"" b(^a)",
202 ain_p, ain_l, substr (in_s, 1, in_l - 1), b.name);
203 if (in_c (next_in) = "@")
204 then do;
205 next_in = next_in + 1;
206 used = in_l - next_in + 1;
207 call tedget_buffer_ (adb_p, addr (in_c (next_in)),
208 used, tbp, msg);
209 next_in = next_in + used;
210 if (tbp = null ())
211 then do;
212 acode = 8;
213 return;
214 end;
215 bp = tbp;
216 next_in = next_in
217 + verify (substr (in_s, next_in), " ") - 1;
218 if (in_c (next_in) ^= ",")
219 then do;
220 q_sw = "1"b;
221 b.present (1), b.present (2) = ""b;
222 acode = 0;
223 goto finished;
224 end;
225 next_in = next_in + 1;
226 end; %skip (3);
227 adr_num = 1;
228 b.a_.r.ln (1), b.a_.r.ln (2) = -1;
229 ca__p = addr (b.a_ (1));
230 q_comma:
231 b.a_ (1) = b.a_ (0);
232 q_semi:
233 b.present (1), b.present (2) = ""b;
234 acode = 0;
235
236 line2:
237 line_sw = "1"b;
238 all_buffer = "0"b;
239 reg_sw = "0"b;
240 byte2:
241 start_scan = 0;
242 end_sw = "0"b;
243 q_sw = "0"b;
244 relsw = "0"b;
245 negsw = "0"b;
246 possw = "0"b;
247 dot_sw = "0"b;
248 goto scan2;
249
250 a_line:
251 ca_.l.re = ca_.l.le;
252 ca_.r.le = ca_.r.re;
253 scan:
254 acode = 1;
255 b.present (adr_num) = "1"b;
256 relsw = "1"b;
257 scan0:
258 if (start_scan = 0)
259 then start_scan = next_in;
260 scan1:
261 next_in = next_in + 1;
262 scan2:
263 if db_addr
264 then call ioa_$ioa_switch_nnl (db_output,
265 """^1a""(^i)", in_c (next_in), next_in);
266
267 if (next_in > in_l)
268 then do;
269 next_in = in_l;
270 err_Amn:
271 msg = "Amn) No NL.";
272 add_err_8:
273 acode = 8;
274 add_err_text:
275 if recurring
276 then goto fail;
277 if (start_scan = 0)
278 then start_scan = next_in;
279 msg = msg || " """;
280 msg = msg || substr (in_s, start_scan, next_in - start_scan + 1);
281 msg = msg || """";
282 goto fail;
283 end;
284 ch = in_c (next_in);
285 if db_addr
286 then call ioa_$ioa_switch (db_output,
287 "^-a^d:^[,rel^]^[,pos^]^[,neg^]", adr_num, relsw, possw, negsw);
288
289 if (ch = " ") then goto scan1;
290 if ^end_sw
291 then do;
292 if (ch = "/") then goto reg;
293
294
295
296
297 if (ch ^= ";")
298 then reg_sw = "0"b;
299 if (ch = "$") then goto last;
300 if (ch = "-") then goto neg; note
301 if (ch = "+") then goto pos; note
302 if (ch >= "0") & (ch <= "9") then goto get_num;
303 if (ch = "[") then goto limit;
304 if (ch = "?")
305 then do;
306 if b.present (1)
307 then goto err_Ad1;
308 q_sw = "1"b;
309 goto scan0;
310 end;
311 if ^line_sw
312 then do;
313 if (ch = ".")
314 then do;
315 if relsw
316 then do;
317 err_Ad1:
318 msg = "Ad1) . $ ? Can only appear first.";
319 goto add_err_8;
320 end;
321 dot_sw = "1"b;
322 goto scan;
323 end;
324 if (ch = ")")
325 then do;
326 if negsw | possw
327 then goto err_Anm;
328 line_sw = "1"b;
329 end_sw = "1"b;
330 goto scan1;
331 end;
332 if (ch = ",") | (ch = ";")
333 then do;
334 if q_sw
335 then goto err_Aqe;
336 if negsw | possw
337 then goto err_Anm;
338 if (adr_num = 2)
339 then goto only_2;
340 if ^b.present (1)
341 then goto err_Aa1;
342 next_in = next_in + 1;
343 adr_num = 2;
344 ca__p = addr (b.a_.l (2));
345 b.a_ (2) = b.a_ (1);
346 if (ch = ",")
347 then do;
348 b.a_.l.re (2) = b.a_.l.le (2);
349 b.a_.r.le (2) = b.a_.r.re (2);
350 end;
351 b.present (2) = "0"b;
352 goto byte2;
353 end;
354 msg = "Abc) Bad char in byte addr.";
355 goto add_err_8;
356 end;
357 else do;
358 if negsw | possw
359 then goto err_Anm;
360 if (ch = ".")
361 then do;
362 if q_sw & (ca_.r.le = 0)
363 then goto q_fail;
364 if relsw
365 then goto err_Ad1;
366 dot_sw = "1"b;
367 goto a_line;
368 end;
369 if (ch = "(")
370 then do;
371 relsw, dot_sw, line_sw = "0"b;
372 goto scan0;
373 end;
374 if (ch = "<")
375 then goto backup;
376 end;
377 end;
378 if negsw | possw
379 then goto err_Anm;
380 if (ch = ",") | (ch = ";")
381 then do;
382 if (adr_num = 2)
383 then do;
384 only_2:
385 msg = "Ao2) Only 2 addr allowed.";
386 goto add_err_8;
387 end;
388 if ^b.present (1)
389 then goto err_Aa1;
390 next_in = next_in + 1;
391 if (ca_.l.re < b.b_.l.le)
392 | (ca_.r.le > b.b_.r.re)
393 then goto q_fail;
394 if q_sw
395 then do;
396 q_sw = "0"b;
397 if (ch = ",")
398 then goto q_comma;
399 goto q_semi;
400 end;
401 ca__p = addr (b.a_ (2));
402 if (ch = ",")
403 then adr_num = 0;
404 else adr_num = 1;
405 ca_ = b.a_ (adr_num);
406 b.present (2) = "0"b;
407 adr_num = 2;
408 goto line2;
409 end;
410
411 if (ch = "\")
412 then do;
413 ch = in_c (next_in + 1);
414 if (ch = "s")
415 then do;
416 string_sw = "1"b;
417 next_in = next_in + 1;
418 goto scan1;
419 end;
420 if (ch = "l")
421 then do;
422 string_sw = "0"b;
423 next_in = next_in + 1;
424 goto scan1;
425 end;
426 end;
427
428 finished:
429 ain_l = next_in - 1;
430 if q_sw
431 then b.present (1) = "0"b;
432 if db_addr
433 then do;
434 call ioa_$ioa_switch (db_output,
435 """^1a""(^i) b(^a)", in_c (ain_l), ain_l, b.name);
436 call tedshow_ (bp, ". adr a0 a1 a2");
437 end;
438 abp = bp;
439 return;
440
441
442 q_fail:
443 b.present (1), b.present (2) = "0"b;
444 next_in = ain_l + 1;
445 fail:
446 ain_l = next_in - 1;
447 return;
448 %page;
449 limit:
450 if negsw | possw
451 then goto err_Anm;
452 if (start_scan = 0)
453 then start_scan = next_in;
454 next_in = next_in + 1;
455 if (in_c (next_in) = "@")
456 then do;
457 msg = "Misplaced @.";
458 goto add_err_8;
459 end;
460 b.rel_temp = b.a_;
461 if b.present (1)
462 then do;
463 b.a_ (0) = ca_;
464 end;
465 apr (1) = b.present (1);
466 apr (2) = b.present (2);
467 dcl apr (2) bit (1);
468 used = -(in_l - next_in + 1);
469 call tedaddr_ (adb_p, addr (in_c (next_in)), used, bp, msg, acode);
470 next_in = next_in + used;
471 if (acode = 8)
472 then do;
473 if q_sw
474 then goto q_fail;
475 goto add_err_text;
476 end;
477 if (in_c (next_in) ^= "]")
478 then do;
479 msg = "Anb) Missing ].";
480 goto add_err_8;
481 end;
482 next_in = next_in + 1;
483 next_in = next_in + verify (substr (in_s, next_in), " ") - 1;
484 if b.present (1)
485 then do;
486 b.a_ (0) = b.a_ (1);
487 if b.present (2)
488 then b.a_.r (0) = b.a_.r (2);
489 end;
490 b.present (1) = apr (1);
491 b.present (2) = apr (2);
492 ch = in_c (next_in);
493 if (ch = "<")
494 then do;
495 srb1 = 0;
496 srb2 = b.a_.l.le (0);
497 sre2 = b.a_.r.re (0);
498 b.a_ = b.rel_temp;
499 ca_.l.le = sre2;
500 goto backup_limit;
501 end;
502 if (ch = "/")
503 then do;
504 srb1 = b.a_.l.re (0);
505 sre1 = b.a_.r.le (0);
506 srb2, sre2 = 0;
507 b.a_ = b.rel_temp;
508 goto reg_limit;
509 end;
510
511 msg = "Invalid char follows [...].";
512 goto add_err_8; %page;
513 backup:
514 if negsw | possw
515 then goto err_Anm;
516 srb1 = -1;
517 srb2 = b.b_.l.le;
518 sre2 = ca_.l.le;
519 backup_limit:
520 next_in = next_in + 1;
521 delim = in_c (next_in);
522 bkp_sw = "1"b;
523 goto scan_reg; %skip (2);
524 reg:
525 if negsw | possw
526 then goto err_Anm;
527 srb1 = ca_.r.le + 1;
528 sre1 = b.b_.r.re;
529 srb2 = b.b_.l.le;
530 sre2 = ca_.r.le;
531 reg_limit:
532 delim = "/";
533 bkp_sw = "0"b; %skip (2);
534 scan_reg:
535 b.rel_temp = tedcommon_$no_data;
536 if (b.cur.sn = 0)
537 then goto buffer_empty;
538 if (start_scan = 0)
539 then start_scan = next_in;
540 i = next_in + 1;
541
542 concealsw = "0"b;
543 do next_in = i to in_l;
544 if concealsw
545 then concealsw = "0"b;
546 else do;
547 ch = in_c (next_in);
548 if (ch = delim)
549 then goto reg1;
550 if (ch = "^Y")
551 then concealsw = "1"b;
552 if (ch = "\")
553 then do;
554 if (in_c (next_in + 1) = "c")
555 | (in_c (next_in + 1) = "C")
556 then do;
557 next_in = next_in + 1;
558 concealsw = "1"b;
559 end;
560
561 end;
562 end;
563 end;
564 msg = "Ad2) No 2nd delimiter.";
565 acode = 8;
566 goto fail;
567
568 reg1:
569 expr_l = next_in - i;
570
571 if (expr_l > 0)
572 then do;
573 call tedsrch_$compile (addr (in_c (i)), expr_l, addr (dbase.regexp),
574 (string_sw), (dbase.lit_sw), msg, code);
575 if (code ^= 0)
576 then do;
577 acode = code;
578 goto fail;
579 end;
580 end;
581
582 if bkp_sw
583 then goto bkp1;
584 if ^line_sw
585 then goto creg;
586 if (srb1 < 1)
587 then do;
588 srb1 = b.b_.l.le;
589 sre1 = b.b_.r.re;
590 sre2 = 0;
591 end;
592 call tedsrch_$search (addr (dbase.regexp), bp,
593 srb1, sre1, ca_.l.re, ca_.r.le, 0,
594 msg, code);
595
596 if (code = 1) & (sre2 > 0)
597 then call tedsrch_$search (addr (dbase.regexp), bp,
598 srb2, sre2, ca_.l.re, ca_.r.le, 0,
599 msg, code);
600
601 if (code ^= 0)
602 then do;
603 if (code = 2)
604 then do;
605 acode = 8;
606 goto fail;
607 end;
608 if q_sw
609 then goto q_fail;
610 msg = "Als) Line search failed.";
611 acode = 2;
612 goto add_err_text;
613 end;
614
615 call find_line (0);
616 if line_sw
617 then goto a_line;
618 goto scan;
619
620 bkp1:
621 ca_.l.re, ca_.r.le = ca_.l.le;
622 do while (ca_.l.le > srb2);
623 call find_line (srb1);
624 srb1 = -1;
625 call tedsrch_$search (addr (dbase.regexp), abp,
626 ca_.l.le, ca_.r.re, ca_.l.re, ca_.r.le, 0, msg, code);
627 if (code = 0)
628 then do;
629 if line_sw
630 then goto a_line;
631 goto scan;
632 end;
633 if (code ^= 1)
634 then do;
635 acode = 8;
636 goto fail;
637 end;
638 expr_l = 0;
639 ca_.l.re, ca_.r.le = ca_.l.le;
640 end;
641 if q_sw
642 then goto q_fail;
643 msg = "Abs) Backup search failed.";
644 acode = 2;
645 goto add_err_text;
646
647 last:
648 if negsw | possw
649 then goto err_Anm;
650 if relsw
651 then goto err_Ad1;
652 if ^line_sw
653 then do;
654 if all_buffer
655 then ca_.r.re = b.b_.r.re;
656 if (ca_.r.re = -1)
657 then do;
658 err_Adn:
659 msg = "A.n) ""."" undefined.";
660 goto add_err_8;
661 end;
662 if (b_c (ca_.r.re) = NL)
663 then ca_.l.re, ca_.r.le = ca_.r.re;
664 else ca_.l.re, ca_.r.le = ca_.r.re + 1;
665 goto scan;
666 end;
667 if (b.cur.sn = 0)
668 then goto scan;
669 if (b.b_.r.re + 1 = b.b_.r.le)
670 then ca_.r.le = b.b_.l.re;
671 else ca_.r.le = b.b_.r.re;
672 ca_.l.re = ca_.r.le;
673 ca_.l.ln, ca_.r.ln = b.b_.r.ln;
674 call find_line (0);
675 goto a_line;
676
677 neg:
678 if possw | negsw
679 then do;
680 err_Anm:
681 msg = "Amn) Missing number value.";
682 goto add_err_8;
683 end;
684 dot_sw = "0"b;
685 negsw = "1"b; note
686
687
688
689
690
691
692
693 if (b.a_.r.re (0) = -1) & (ca_.r.re = -1)
694 then do;
695 msg = "A.u) ""."" undefined.";
696 goto add_err_8;
697 end;
698
699 goto scan;
700
701
702 pos:
703 if possw | negsw
704 then goto err_Anm;
705 dot_sw = "0"b;
706 possw = "1"b; note
707
708
709
710
711
712
713
714 if (b.a_.r.re (0) = -1) & (ca_.r.re = -1)
715 then do;
716 msg = "A.u) ""."" undefined.";
717 goto add_err_8;
718 end;
719
720 goto scan; %page;
721 get_num:
722 if (start_scan = 0)
723 then start_scan = next_in;
724 i = verify (substr (in_s, next_in), "0123456789") - 1;
725 num = fixed (substr (in_s, next_in, i));
726 next_in = next_in + i - 1;
727
728 if (b.cur.sn = 0) & ((num ^= 0) | relsw | ^line_sw)
729 then goto buffer_empty;
730 if dot_sw
731 then do;
732 dot_sw = "0"b;
733 possw = "1"b;
734 end;
735 if line_sw
736 then do;
737 if ^relsw
738 then do;
739
740 do i = 1 to 2;
741 end;
742 end;
743 if ^relsw
744 then do;
745 if (b.b_.l.le - 1 = b.b_.l.re)
746 then ca_.l.le = b.b_.r.le;
747 else ca_.l.le = b.b_.l.le;
748 if (num = 0)
749 then do;
750 all_buffer = "1"b;
751 ca_.r.re = ca_.l.le - 1;
752 end;
753 else do;
754 ca_.l.re, ca_.r.le = ca_.l.le;
755 ca_.r.ln = 1;
756 call find_line (num - 1);
757 end;
758 end;
759 else do;
760 if (ca_.r.re = -1)
761 then ca_.r.le, ca_.r.re = ca_.l.le;
762 else ca_.r.le = ca_.r.re;
763 ca_.l.re = ca_.l.le;
764 if negsw
765 then num = -num;
766 else if ^possw
767 then do;
768 err_Axn:
769 msg = "Axn) Extra number present.";
770 goto add_err_8;
771 end;
772 call find_line (num);
773 negsw, possw = "0"b;
774 end;
775 goto a_line;
776 end; %skip (2);
777 cnum:
778 if (ca_.r.re = -1)
779 then goto err_Adn;
780 ca_.l.ln, ca_.r.ln = -1;
781 if ^relsw
782 then do;
783
784
785 i = ca_.l.le - 1 + num;
786 if db_addr then call ioa_ ("(abs) ^i = ^i -1 + ^i", i, ca_.l.le, num);
787
788 if (ca_.l.le <= b.b_.l.re) & (i > b.b_.l.re)
789 then
790 do;
791 if db_addr then call ioa_ ("^i<=^i & ^i>^i", ca_.l.le, b.b_.l.re, i, b.b_.l.re);
792 i = b.b_.r.le - b.b_.l.re + i - 1;
793 if db_addr then call ioa_ ("^i = ^i - ^i +i-1", i, b.b_.r.le, b.b_.l.re);
794 end;
795 end;
796 else if negsw
797 then do;
798
799
800 i = ca_.l.re - num;
801 if (ca_.l.re >= b.b_.r.le) & (i < b.b_.r.le)
802 then i = i - b.b_.r.le + b.b_.l.re + 1;
803 end;
804 else if possw
805 then do;
806
807
808 i = ca_.l.re + num;
809 if (ca_.l.re <= b.b_.l.re) & (i > b.b_.l.re)
810 then i = b.b_.r.le - b.b_.l.re + i - 1;
811 end;
812 else goto err_Axn;
813 negsw, possw = "0"b;
814 if (i < ca_.l.le)
815 then do;
816 if ^string_sw
817 then goto addr_before_line;
818 if (i < 1)
819 then goto addr_before_buffer;
820 ca_.l.re, ca_.r.le = i;
821 call find_line (0);
822 goto scan;
823 end;
824 if (i ^< ca_.r.re)
825 then do;
826 if string_sw | all_buffer
827 then do;
828
829 if (i > b.b_.r.re)
830 then call addr_after_buffer;
831 ca_.l.re, ca_.r.le = i;
832 call find_line (0);
833 goto scan;
834 end;
835 if (b_c (ca_.r.re) = NL)
836 then ca_.r.le = ca_.r.re - 1;
837 else ca_.r.le = ca_.r.re;
838 if (i ^= ca_.r.le)
839 then goto addr_after_line;
840 end;
841 ca_.l.re, ca_.r.le = i;
842 goto scan; %skip (2);
843 creg:
844 if string_sw
845 then sre1 = b.b_.r.re;
846 else sre1 = ca_.r.re;
847 srb1 = ca_.l.re;
848
849
850
851
852 if reg_sw
853 then srb1 = srb1 + 1;
854 reg_sw = "1"b;
855 call tedsrch_$search (addr (dbase.regexp), bp, srb1, sre1,
856 ca_.l.re, ca_.r.le, 0, msg, code);
857 if (code ^= 0)
858 then do;
859 if (code = 2)
860 then do;
861 acode = 8;
862 goto fail;
863 end;
864 if q_sw
865 then goto q_fail;
866 msg = "Acs) Char search failed.";
867 acode = 2;
868 goto add_err_text;
869 end;
870 if string_sw
871 then call find_line (0);
872 goto scan; %page;
873 NOTE
874
875
876 find_line: proc (num);
877
878 dcl num fixed bin (21);
879
880 dcl NLct fixed bin (21);
881 dcl i fixed bin (21);
882 dcl (lb, le, se) fixed bin (21);
883
884 lb = ca_.l.re;
885 le = ca_.r.le;
886 if db_addr
887 then call ioa_$ioa_switch_nnl (db_output, "^i:^i", lb, le);
888 if (lb = le + 2) | (lb = le + 1)
889 then le = lb;
890 if (le = -1)
891 then goto err_Adn;
892 if (le < 1)
893 then call addr_after_buffer;
894 NLct = 0; %skip (3);
895 if (NLct < num)
896 then do;
897 call set_file (le);
898 do while ((NLct < num)
899 & ((next_file_char < last_file_char) | ^in_part_2));
900 i = index (substr (file_str, next_file_char), NL);
901 if (i = 0)
902 then next_file_char = last_file_char + 1;
903 else next_file_char = next_file_char + i;
904 if (next_file_char > last_file_char)
905 then if ^in_part_2
906 then call set_file (b.b_.r.le);
907 NLct = NLct + 1;
908 end;
909
910
911 lb, le = next_file_char;
912 if (ca_.r.ln ^= -1)
913 then ca_.r.ln = ca_.r.ln + NLct;
914 end; %skip (3);
915 if (NLct > num)
916 then do;
917 call set_file (lb);
918 do while ((NLct > num) & (first_file_char <= next_file_char));
919 i = index (reverse (substr (file_str, first_file_char,
920 next_file_char - first_file_char)), NL);
921 if (i = 0)
922 then do;
923 if in_part_2
924 then call set_file (b.b_.l.re);
925 else do;
926 if (NLct ^= num + 1)
927 then goto addr_before_buffer;
928 next_file_char = 0;
929 NLct = -1;
930 goto set;
931 end;
932 end;
933 next_file_char = next_file_char - i;
934 NLct = NLct - 1;
935 end;
936
937
938 lb, le = next_file_char;
939 if (le = 0)
940 then le = -1;
941 if (ca_.r.ln ^= -1)
942 then ca_.r.ln = ca_.r.ln + NLct;
943 end;
944 ca_.l.ln = ca_.r.ln;
945 if (NLct = num)
946 & (b.b_.l.le <= lb)
947
948 then do;
949 call set_file (le);
950 i = index (substr (file_str, le), NL);
951 if (i = 0)
952 then le = last_file_char + 1;
953 else le = le + i - 1;
954
955 call set_file (lb);
956 i = index (reverse (substr (file_str, first_file_char,
957 lb - first_file_char)), NL);
958 if (i = 0)
959 then lb = first_file_char;
960 else lb = lb - i + 1;
961 end;
962
963 if (NLct < num)
964 then call addr_after_buffer;
965 if (NLct > num)
966 then goto addr_before_buffer;
967 if (b_c (b.b_.r.re) = NL)
968 then se = b.b_.r.re;
969 else se = b.b_.r.re + 1;
970 if (le > se)
971 then call addr_after_buffer;
972 if (le = b.b_.r.re + 1)
973 then le = b.b_.r.re;
974 else if (le = b.b_.l.re + 1)
975 & (b.b_.r.le > b.b_.r.re)
976 then le = b.b_.l.re;
977 set:
978 ca_.l.le = lb;
979 ca_.r.re = le;
980 if (num ^= 0)
981 then do;
982 ca_.l.re = lb;
983 ca_.r.le = le;
984 end;
985 if db_addr
986 then do;
987 call ioa_$ioa_switch (db_output,
988 "^xfind[^d]a^d l=^4d,^d(^d)^30.1tr=^4d,^d(^d) ^[str^;lin^]",
989 num, adr_num,
990 ca_.l.le, ca_.l.re, ca_.l.ln, ca_.r.le, ca_.r.re, ca_.r.ln,
991 string_sw);
992 end;
993 end find_line; %skip (3);
994 set_file: proc (at);
995
996 dcl at fixed bin (21);
997
998 next_file_char = at;
999 if (next_file_char <= b.b_.l.re)
1000 then do;
1001 in_part_2 = ""b;
1002 first_file_char = b.b_.l.le;
1003 last_file_char = b.b_.l.re;
1004 end;
1005 else if (b.b_.r.le <= next_file_char)
1006 then do;
1007 in_part_2 = "1"b;
1008 first_file_char = b.b_.r.le;
1009 last_file_char = b.b_.r.re;
1010 end;
1011 else do;
1012 msg = "next in gap";
1013 range_err:
1014 call ioa_ (" addr: ^a", msg);
1015 signal condition (addr_error); dcl addr_error condition;
1016 goto fail;
1017 end;
1018 if (next_file_char < first_file_char)
1019 then goto addr_before_buffer;
1020 if (last_file_char < next_file_char)
1021 then call addr_after_buffer;
1022
1023 if db_addr
1024 then call ioa_$ioa_switch (db_output, "^-^[>>^;<<^] ^i)^i(^i",
1025 in_part_2, first_file_char, next_file_char, last_file_char);
1026
1027 end set_file; %page;
1028
1029 err_Aqe:
1030 msg = "Aqe) Bad ? form.";
1031 goto add_err_8;
1032
1033 err_Aa1:
1034 msg = "Aa1) No 1st addr.";
1035 goto add_err_8;
1036
1037 addr_before_buffer:
1038 msg = "Abb) Addr- before buffer";
1039 goto addr_outside;
1040
1041 addr_before_line:
1042 msg = "Abl) Addr- before line";
1043 goto addr_outside;
1044
1045 addr_after_buffer: proc;
1046 msg = "Aab) Addr- after buffer";
1047 goto addr_outside;
1048 end;
1049
1050 addr_after_line:
1051 msg = "Aal) Addr- after line";
1052 goto addr_outside;
1053
1054 buffer_empty:
1055 msg = "Abe) Buffer empty.";
1056 goto addr_outside;
1057
1058 addr_outside:
1059 if ^q_sw
1060 then do;
1061 acode = 8;
1062 goto fail;
1063 end;
1064 goto q_fail; %page;
1065 %include tedbase;
1066 %include tedcommon_;
1067 %include tedbcb;
1068 dcl tedaddr_ entry (
1069 ptr,
1070 ptr,
1071 fixed bin (21),
1072
1073
1074 ptr,
1075 char (168) var,
1076 fixed bin (35),
1077
1078
1079
1080 );
1081
1082
1083 dcl tedshow_ entry () options (variable);
1084 %include tedsrch_;
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094 dcl tedget_buffer_ entry (
1095 ptr,
1096 ptr,
1097 fixed bin (21),
1098
1099 ptr,
1100 char (168) var
1101 );
1102
1103
1104
1105 end tedaddr_;