1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    *********************************************************** */
 6 %;
 7 /* ******************************************************
 8    *                                                    *
 9    *                                                    *
10    * Copyright (c) 1972 by Massachusetts Institute of   *
11    * Technology and Honeywell Information Systems, Inc. *
12    *                                                    *
13    *                                                    *
14    ****************************************************** */
15 
16 name_assign: proc(name) returns(bit(18) aligned);
17 
18 dcl       name char(*) aligned,
19           (n,def_pos) fixed bin(18),
20           (p,q) ptr;
21 
22 dcl       create_list entry(fixed bin) returns(ptr);
23 
24 dcl       (addrel,divide,fixed,length,null,rel) builtin;
25 
26 dcl       (cg_static_$name_list,cg_static_$def_base) ptr ext,
27           (cg_static_$def_origin,cg_static_$def_pos) fixed bin(18) ext;
28 
29 dcl       1 name_mask         aligned based,
30           2 count             unal bit(9),
31           2 string            unal char(n);
32 
33 %include list;
34 
35           p = cg_static_$name_list;
36 
37           do while(p ^= null);
38 
39                q = p -> list.element(2);
40 
41                n = fixed(q -> count,9);
42                if length(name) = n
43                then if name = q -> string
44                     then do;
45                          def_pos = fixed(rel(q),18) - cg_static_$def_origin;
46                          goto ret;
47                          end;
48 
49                p = p -> list.element(1);
50                end;
51 
52           n = length(name);
53           p = create_list(2);
54 
55           p -> list.element(1) = cg_static_$name_list;
56           cg_static_$name_list = p;
57 
58           def_pos = cg_static_$def_pos;
59           p -> list.element(2), q = addrel(cg_static_$def_base,def_pos);
60 
61           q -> count = bit(fixed(n,9),9);
62           q -> string = name;
63 
64           cg_static_$def_pos = def_pos + divide(n+4,4,17,0);
65 
66 ret:      return(bit(def_pos,18));
67 
68           end;