Debian Codegraph @

texk/web2c/alephdir/eomem.ch

raw
1 % vim ft=ch
2 % This file is part of the e-Omega project
3 % Purpouse of this file: adapting e-TeX to Omega memory management
4 % Most registers are reverted to the Omega model. The only exception
5 % is markings.
6 %---------------------------------------
7 @x eobase.ch l.672
8 begin if eTeX_ex and(eqtb[p].int=w) then
9 @y
10 begin if eTeX_ex and(new_eqtb_int(p)=w) then
11 @z
12 %---------------------------------------
13 @x eobase.ch l.1071
14 if m=mem_bot then
15 begin scan_register_num;
16 if cur_val<256 then cur_val:=equiv(toks_base+cur_val)
17 else begin find_sa_element(tok_val,cur_val,false);
18 if cur_ptr=null then cur_val:=null
19 else cur_val:=sa_ptr(cur_ptr);
20 end;
21 end
22 else cur_val:=sa_ptr(m)
23 else cur_val:=equiv(m);
24 cur_val_level:=tok_val;
25 @y
26 begin scan_eight_bit_int; m:=toks_base+cur_val;
27 end;
28 scanned_result(equiv(m))(tok_val);
29 @z
30 %----------------------------------------
31 @x l.1220
32 begin if (m<mem_bot)or(m>lo_mem_stat_max) then
33 begin cur_val_level:=sa_type(m);
34 if cur_val_level<glue_val then cur_val:=sa_int(m)
35 else cur_val:=sa_ptr(m);
36 end
37 else begin scan_register_num; cur_val_level:=m-mem_bot;
38 if cur_val>255 then
39 begin find_sa_element(cur_val_level,cur_val,false);
40 if cur_ptr=null then
41 if cur_val_level<glue_val then cur_val:=0
42 else cur_val:=zero_glue
43 else if cur_val_level<glue_val then cur_val:=sa_int(cur_ptr)
44 else cur_val:=sa_ptr(cur_ptr);
45 end
46 else
47 case cur_val_level of
48 @y
49 begin scan_eight_bit_int;
50 case m of
51 @z
52 %---------------------------------------
53 @x
54 end;
55 @y
56 cur_val_level:=m;
57 @z
58 %----------------------------------------
59 @x l.1420
60 if eTeX_ex and(tracing_lost_chars>1) then tracing_online:=1;
61 @y
62 if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1);
63 @z
64 %----------------------------------------
65 @x
66 tracing_online:=old_setting;
67 @y
68 set_new_eqtb_int(int_base+tracing_online_code,old_setting);
69 @z
70 %---------------------------------------
71 @x l.2336
72 @d global_box_flag==box_flag+(number_regs+number_regs) {context code for `\.{\\global\\setbox0}'}
73 @d ship_out_flag==global_box_flag+1 {context code for `\.{\\shipout}'}
74 @y
75 @d global_box_flag==(box_flag+number_regs) {context code for `\.{\\global\\setbox0}'}
76 @d max_global_box_flag==(global_box_flag+number_regs)
77 @d ship_out_flag==(max_global_box_flag+1) {context code for `\.{\\shipout}'}
78 @z
79 %----------------------------------------
80 @x
81 @!a:small_number; {global prefix}
82 @y
83 @z
84 %----------------------------------------
85 @x eobase.ch l.2309
86 begin if box_context<global_box_flag then
87 begin cur_val:=box_context-box_flag; a:=0;
88 end
89 else begin cur_val:=box_context-global_box_flag; a:=4;
90 end;
91 if cur_val<256 then define(box_base+cur_val,box_ref,cur_box)
92 else sa_def_box;
93 end
94 @y
95 if box_context<global_box_flag then
96 eq_define(box_base+box_context-box_flag,box_ref,cur_box)
97 else geq_define(box_base+box_context-global_box_flag,box_ref,cur_box)
98 @z
99 %---------------------------------------
100 @x eobase.ch l.2328
101 @!n:halfword; {a box number}
102 begin case cur_chr of
103 box_code: begin scan_register_num; fetch_box(cur_box);
104 set_equiv(box_base+cur_val,null);
105 {the box becomes void, at the same level}
106 end;
107 copy_code: begin scan_register_num; fetch_box(q); cur_box:=copy_node_list(q);
108 @y
109 @!n:eight_bits; {a box number}
110 begin case cur_chr of
111 box_code: begin scan_eight_bit_int; cur_box:=box(cur_val);
112 set_equiv(box_base+cur_val,null);
113 {the box becomes void, at the same level}
114 end;
115 copy_code: begin scan_eight_bit_int; cur_box:=copy_node_list(box(cur_val));
116 @z
117 %---------------------------------------
118 @x eobase.ch l.2359
119 begin scan_register_num; n:=cur_val;
120 @y
121 begin scan_eight_bit_int; n:=cur_val;
122 @z
123 %---------------------------------------
124 @x eobase.ch l.2422
125 begin if cur_chr>copy_code then @<Handle saved items and |goto done|@>;
126 c:=cur_chr; scan_register_num; fetch_box(p);
127 @y
128 begin if cur_chr>copy_code then @<Handle saved items and |goto done|@>;
129 c:=cur_chr; scan_eight_bit_int; p:=box(cur_val);
130 @z
131 %---------------------------------------
132 @x eobase.ch l.2431
133 else begin link(tail):=list_ptr(p);
134 change_box(null);
135 @y
136 else begin link(tail):=list_ptr(p);
137 set_equiv(box_base+cur_val,null);
138 @z
139 %----------------------------------------
140 @x eobase.ch l.2698
141 othercases begin scan_register_num;
142 if cur_val>255 then
143 begin j:=n-count_def_code; {|int_val..box_val|}
144 if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|}
145 find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr);
146 if j=tok_val then j:=toks_register@+else j:=register;
147 define(p,j,cur_ptr);
148 end
149 else
150 @y
151 othercases begin scan_eight_bit_int;
152 @z
153 %---------------------------------------
154 @x eobase.ch l.2726
155 e:=false; {just in case, will be set |true| for sparse array elements}
156 if cur_cmd=toks_register then
157 if cur_chr=mem_bot then
158 begin scan_register_num;
159 if cur_val>255 then
160 begin find_sa_element(tok_val,cur_val,true);
161 cur_chr:=cur_ptr; e:=true;
162 end
163 else cur_chr:=toks_base+cur_val;
164 end
165 else e:=true;
166 p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots}
167 @y
168 if cur_cmd=toks_register then
169 begin scan_eight_bit_int; p:=toks_base+cur_val;
170 end
171 else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots}
172 @z
173 %---------------------------------------
174 @x eobase.ch l.2746
175 begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref);
176 end
177 else begin if (p=output_routine_loc)and not e then {enclose in curlies}
178 @y
179 begin define(p,undefined_cs,null); free_avail(def_ref);
180 end
181 else begin if p=output_routine_loc then {enclose in curlies}
182 @z
183 %---------------------------------------
184 @x eobase.ch l.2754
185 sa_define(p,def_ref)(p,call,def_ref);
186 @y
187 define(p,call,def_ref);
188 @z
189 %---------------------------------------
190 @x eobase.ch l.2770
191 if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then
192 begin if cur_cmd=toks_register then
193 if cur_chr=mem_bot then
194 begin scan_register_num;
195 if cur_val<256 then q:=equiv(toks_base+cur_val)
196 else begin find_sa_element(tok_val,cur_val,false);
197 if cur_ptr=null then q:=null
198 else q:=sa_ptr(cur_ptr);
199 end;
200 end
201 else q:=sa_ptr(cur_ptr)
202 else q:=equiv(cur_chr);
203 if q=null then sa_define(p,null)(p,undefined_cs,null)
204 else begin add_token_ref(q); sa_define(p,q)(p,call,q);
205 end;
206 goto done;
207 end
208 @y
209 begin if cur_cmd=toks_register then
210 begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val;
211 end;
212 if cur_cmd=assign_toks then
213 begin q:=equiv(cur_chr);
214 if q=null then define(p,undefined_cs,null)
215 else begin add_token_ref(q); define(p,call,q);
216 end;
217 goto done;
218 end;
219 end
220 @z
221 %---------------------------------------
222 @x eobase.ch l.2792
223 @!e:boolean; {does |l| refer to a sparse array element?}
224 @!w:integer; {integer or dimen value of |l|}
225 begin q:=cur_cmd;
226 e:=false; {just in case, will be set |true| for sparse array elements}
227 @y
228 begin q:=cur_cmd;
229 @z
230 %----------------------------------------
231 @x eobase.ch l.2802
232 if p<glue_val then sa_word_define(l,cur_val)
233 else begin trap_zero_glue; sa_define(l,cur_val)(l,glue_ref,cur_val);
234 @y
235 if p<glue_val then word_define(l,cur_val)
236 else begin trap_zero_glue; define(l,glue_ref,cur_val);
237 @z
238 %---------------------------------------
239 @x eobase.ch l.2809
240 if (cur_chr<mem_bot)or(cur_chr>lo_mem_stat_max) then
241 begin l:=cur_chr; p:=sa_type(l); e:=true;
242 end
243 else begin p:=cur_chr-mem_bot; scan_register_num;
244 if cur_val>255 then
245 begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true;
246 end
247 else
248 @y
249 p:=cur_chr; scan_eight_bit_int;
250 @z
251 %---------------------------------------
252 @x eobase.ch l.2823
253 end;
254 end;
255 found: if p<glue_val then@+if e then w:=sa_int(l)@+else w:=new_eqtb_int(l);
256 else if e then s:=sa_ptr(l)@+else s:=equiv(l)
257 @y
258 end;
259 found:
260 @z
261 %---------------------------------------
262 @x eobase.ch l.2832
263 if q=advance then cur_val:=cur_val+w;
264 @y
265 if q=advance then cur_val:=cur_val+new_eqtb_int(l);
266 @z
267 %---------------------------------------
268 @x eobase.ch l.2838
269 begin q:=new_spec(cur_val); r:=s;
270 @y
271 begin q:=new_spec(cur_val); r:=equiv(l);
272 @z
273 %---------------------------------------
274 @x eobase.ch l.2847
275 if p=int_val then cur_val:=mult_integers(w,cur_val)
276 else cur_val:=nx_plus_y(w,cur_val,0)
277 else cur_val:=x_over_n(w,cur_val)
278 else begin r:=new_spec(s);
279 @y
280 if p=int_val then cur_val:=mult_integers(new_eqtb_int(l),cur_val)
281 else cur_val:=nx_plus_y(new_eqtb_int(l),cur_val,0)
282 else cur_val:=x_over_n(new_eqtb_int(l),cur_val)
283 else begin s:=equiv(l); r:=new_spec(s);
284 @z
285 %---------------------------------------
286 @x eobase.ch l.2859
287 set_box: begin scan_register_num;
288 if global then n:=global_box_flag+cur_val@+else n:=box_flag+cur_val;
289 scan_optional_equals;
290 if set_box_allowed then scan_box(n)
291 @y
292 set_box: begin scan_eight_bit_int;
293 if global then n:=global_box_flag+cur_val@+else n:=box_flag+cur_val;
294 scan_optional_equals;
295 if set_box_allowed then scan_box(n)
296 @z
297 %---------------------------------------
298 @x eobase.ch l.2883
299 @!b:pointer; {box register}
300 begin c:=cur_chr; scan_register_num; fetch_box(b); scan_optional_equals;
301 scan_normal_dimen;
302 if b<>null then mem[b+c].sc:=cur_val;
303 @y
304 @!b:eight_bits; {box number}
305 begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals;
306 scan_normal_dimen;
307 if box(b)<>null then mem[box(b)+c].sc:=cur_val;
308 @z
309 %---------------------------------------
310 @x [49] m.1296 l.23637 - e-TeX sparse arrays
311 begin scan_register_num; fetch_box(p); begin_diagnostic;
312 print_nl("> \box"); print_int(cur_val); print_char("=");
313 if p=null then print("void")@+else show_box(p);
314 @y
315 begin scan_eight_bit_int; begin_diagnostic;
316 print_nl("> \box"); print_int(cur_val); print_char("=");
317 if box(cur_val)=null then print("void")
318 else show_box(box(cur_val));
319 @z
320 %----------------------------------------
321 @x eobase.ch l.2979
322 if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]);
323 @y
324 @z
325 %----------------------------------------
326 @x eobase.ch l.2986
327 if eTeX_ex then for k:=int_val to tok_val do
328 undump(null)(lo_mem_max)(sa_root[k]);
329 @y
330 @z
331 @x l. 3132
332 for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements}
333 @y
334 for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements}
335 @z