1
2
3
4
5
6
7
8
9
10
11
12
13
14 get_location: proc(block_pt,line_no) returns(fixed bin(18));
15
16 dcl block_pt ptr,
17 line_no fixed bin(18);
18
19 dcl (p,q) ptr,
20 std bit(1) aligned,
21 (ln,loc,inc) fixed bin;
22
23 dcl (addrel,fixed,null,size) builtin;
24
25 dcl 1 map aligned based,
26 2 location unal bit(18),
27 2 line unal bit(18);
28
29 %include runtime_symbol;
30 %include statement_map;
31
32 q = block_pt;
33 if q = null then goto no;
34
35 if q -> runtime_block.first = (18)"0"b then goto no;
36
37 std = q -> runtime_block.standard;
38 if std then inc = size(statement_map); else inc = size(map);
39
40 p = addrel(q,q -> runtime_block.first);
41 q = addrel(q,fixed(q -> runtime_block.last,18) + inc);
42
43 do while(p ^= q);
44
45 if std then ln = fixed(p -> statement_map.source_id.line,14);
46 else ln = fixed(p -> map.line,18);
47
48 if ln = line_no
49 then do;
50 if std then loc = fixed(p -> statement_map.location,18);
51 else loc = fixed(p -> map.location,18);
52 return(loc);
53 end;
54
55 p = addrel(p,inc);
56 end;
57
58 no: return(-1);
59 end;