1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 generate_definition: proc(name,class,value);
16
17 dcl name char(*) aligned,
18 class fixed bin(3),
19 value bit(18) aligned;
20
21 dcl (cg_static_$def_base,cg_static_$def_reloc_base) ptr ext,
22 cg_static_$def_pos fixed bin(18) ext,
23 (cg_static_$last_def,cg_static_$zero_def,cg_static_$seg_def) bit(18) aligned ext;
24
25 dcl (b18,def_pos) bit(18) aligned,
26 (def_ptr,def_reloc_ptr) ptr;
27
28 dcl (addrel,bit,fixed,size,string) builtin;
29
30 dcl name_assign entry(char(*) aligned) returns(bit(18) aligned);
31
32 dcl 1 reloc(0:2) aligned based,
33 2 left unal bit(18),
34 2 right unal bit(18);
35
36 dcl rel_code(0:3) aligned bit(18) int static
37 init("000000000000010000"b,
38 "000000000000010010"b,
39 "000000000000010110"b,
40 "000000000000010101"b);
41
42 %include relbts;
43 %include definition;
44
45 b18 = name_assign(name);
46
47 def_pos = bit(cg_static_$def_pos,18);
48 def_ptr = addrel(cg_static_$def_base,def_pos);
49 def_reloc_ptr = addrel(cg_static_$def_reloc_base,def_pos);
50
51 if cg_static_$last_def then def_ptr -> definition.backward = cg_static_$last_def;
52 else def_ptr -> definition.backward = cg_static_$zero_def;
53
54 addrel(cg_static_$def_base,cg_static_$last_def) -> definition.forward = def_pos;
55
56 def_ptr -> definition.forward = cg_static_$zero_def;
57
58 def_ptr -> definition.new = "1"b;
59 def_ptr -> definition.symbol = b18;
60 def_ptr -> definition.value = value;
61
62 def_ptr -> definition.class = bit(class,3);
63
64 if class = 3 then cg_static_$seg_def = def_pos;
65 else do;
66 def_ptr -> definition.segname = cg_static_$seg_def;
67 def_ptr -> definition.entry = bit(fixed(class = 0,1),1);
68 end;
69
70 string(def_reloc_ptr -> reloc(0)) = rc_dp || rc_dp;
71 def_reloc_ptr -> reloc(1).left = rel_code(class);
72 string(def_reloc_ptr -> reloc(2)) = rc_dp || rc_dp;
73
74 cg_static_$def_pos = cg_static_$def_pos + 3;
75 cg_static_$last_def = def_pos;
76
77 end;