1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    * Copyright (c) 1972 by Massachusetts Institute of        *
 6    * Technology and Honeywell Information Systems, Inc.      *
 7    *                                                         *
 8    *********************************************************** */
 9 
10 
11 fill_refer: proc(pp,qq,copy) returns(ptr);
12 
13 dcl       (pp,qq) ptr,
14           copy bit(1) aligned;
15 
16 dcl       (i,n) fixed bin(15),
17           (p,q) ptr,
18           null builtin;
19 
20 %include language_utility;
21 %include nodes;
22 %include reference;
23 %include operator;
24 %include op_codes;
25 
26           p = pp;
27           if p = null then return(null);
28 
29           q = qq;
30 
31           if p -> node.type = reference_node
32           then do;
33                p -> reference.qualifier = fill_refer((p -> reference.qualifier),q,copy);
34                p -> reference.offset = fill_refer((p -> reference.offset),q,copy);
35                p -> reference.length = fill_refer((p -> reference.length),q,copy);
36                return(p);
37                end;
38 
39           if p ->node.type = operator_node
40           then do;
41                if p -> op_code = refer
42                then do;
43                     p = p -> operand(2);
44                     if p -> node.type = token_node then p = create_reference(p);
45 
46                     if q -> node.type = reference_node
47                     then if q -> reference.shared
48                           & q -> reference.qualifier = null
49                           & q -> reference.offset = null
50                           & q -> reference.length = null
51                          then do;
52                               p -> reference.qualifier = q;
53                               return(p);
54                               end;
55 
56                     if copy then q = copy_expression((q));
57                     p -> reference.qualifier = q;
58                     return(p);
59                     end;
60 
61                do i = 1 to p -> operator.number;
62                     p -> operand(i) = fill_refer((p -> operand(i)),q,copy);
63                     end;
64 
65                return(p);
66                end;
67 
68           return(p);
69           end;