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
6
%---------------------------------------
8
begin if eTeX_ex and(eqtb[p].int=w) then
10
begin if eTeX_ex and(new_eqtb_int(p)=w) then
12
%---------------------------------------
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);
22
else cur_val:=sa_ptr(m)
23
else cur_val:=equiv(m);
24
cur_val_level:=tok_val;
26
begin scan_eight_bit_int; m:=toks_base+cur_val;
28
scanned_result(equiv(m))(tok_val);
30
%----------------------------------------
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);
37
else begin scan_register_num; cur_val_level:=m-mem_bot;
39
begin find_sa_element(cur_val_level,cur_val,false);
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);
49
begin scan_eight_bit_int;
52
%---------------------------------------
58
%----------------------------------------
60
if eTeX_ex and(tracing_lost_chars>1) then tracing_online:=1;
62
if eTeX_ex and(tracing_lost_chars>1) then set_new_eqtb_int(int_base+tracing_online_code,1);
64
%----------------------------------------
66
tracing_online:=old_setting;
68
set_new_eqtb_int(int_base+tracing_online_code,old_setting);
70
%----------------------------------------
72
begin if box_context<global_box_flag then
73
begin cur_val:=box_context-box_flag; a:=0;
75
else begin cur_val:=box_context-global_box_flag; a:=4;
77
if cur_val<256 then define(box_base+cur_val,box_ref,cur_box)
81
if box_context<box_flag+number_regs then
82
eq_define(box_base-box_flag+box_context,box_ref,cur_box)
83
else geq_define(box_base-box_flag-number_regs+box_context,box_ref,cur_box)
85
%---------------------------------------
87
@!n:halfword; {a box number}
89
box_code: begin scan_register_num; fetch_box(cur_box);
90
set_equiv(box_base+cur_val,null);
91
{the box becomes void, at the same level}
93
copy_code: begin scan_register_num; fetch_box(q); cur_box:=copy_node_list(q);
95
@!n:eight_bits; {a box number}
97
box_code: begin scan_eight_bit_int; cur_box:=box(cur_val);
98
set_equiv(box_base+cur_val,null);
99
{the box becomes void, at the same level}
101
copy_code: begin scan_eight_bit_int; cur_box:=copy_node_list(box(cur_val));
103
%---------------------------------------
105
begin scan_register_num; n:=cur_val;
107
begin scan_eight_bit_int; n:=cur_val;
109
%---------------------------------------
111
begin if cur_chr>copy_code then @<Handle saved items and |goto done|@>;
112
c:=cur_chr; scan_register_num; fetch_box(p);
114
begin if cur_chr>copy_code then @<Handle saved items and |goto done|@>;
115
c:=cur_chr; scan_eight_bit_int; p:=box(cur_val);
117
%---------------------------------------
119
else begin link(tail):=list_ptr(p);
122
else begin link(tail):=list_ptr(p);
123
set_equiv(box_base+cur_val,null);
125
%----------------------------------------
127
othercases begin scan_register_num;
129
begin j:=n-count_def_code; {|int_val..box_val|}
130
if j>mu_val then j:=tok_val; {|int_val..mu_val| or |tok_val|}
131
find_sa_element(j,cur_val,true); add_sa_ref(cur_ptr);
132
if j=tok_val then j:=toks_register@+else j:=register;
137
othercases begin scan_eight_bit_int;
139
%---------------------------------------
141
e:=false; {just in case, will be set |true| for sparse array elements}
142
if cur_cmd=toks_register then
143
if cur_chr=mem_bot then
144
begin scan_register_num;
146
begin find_sa_element(tok_val,cur_val,true);
147
cur_chr:=cur_ptr; e:=true;
149
else cur_chr:=toks_base+cur_val;
152
p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots}
154
if cur_cmd=toks_register then
155
begin scan_eight_bit_int; p:=toks_base+cur_val;
157
else p:=cur_chr; {|p=every_par_loc| or |output_routine_loc| or \dots}
159
%---------------------------------------
161
begin sa_define(p,null)(p,undefined_cs,null); free_avail(def_ref);
163
else begin if (p=output_routine_loc)and not e then {enclose in curlies}
165
begin define(p,undefined_cs,null); free_avail(def_ref);
167
else begin if p=output_routine_loc then {enclose in curlies}
169
%---------------------------------------
171
sa_define(p,def_ref)(p,call,def_ref);
173
define(p,call,def_ref);
175
%---------------------------------------
177
if (cur_cmd=toks_register)or(cur_cmd=assign_toks) then
178
begin if cur_cmd=toks_register then
179
if cur_chr=mem_bot then
180
begin scan_register_num;
181
if cur_val<256 then q:=equiv(toks_base+cur_val)
182
else begin find_sa_element(tok_val,cur_val,false);
183
if cur_ptr=null then q:=null
184
else q:=sa_ptr(cur_ptr);
187
else q:=sa_ptr(cur_ptr)
188
else q:=equiv(cur_chr);
189
if q=null then sa_define(p,null)(p,undefined_cs,null)
190
else begin add_token_ref(q); sa_define(p,q)(p,call,q);
195
begin if cur_cmd=toks_register then
196
begin scan_eight_bit_int; cur_cmd:=assign_toks; cur_chr:=toks_base+cur_val;
198
if cur_cmd=assign_toks then
199
begin q:=equiv(cur_chr);
200
if q=null then define(p,undefined_cs,null)
201
else begin add_token_ref(q); define(p,call,q);
207
%---------------------------------------
209
@!e:boolean; {does |l| refer to a sparse array element?}
210
@!w:integer; {integer or dimen value of |l|}
212
e:=false; {just in case, will be set |true| for sparse array elements}
216
%----------------------------------------
218
if p<glue_val then sa_word_define(l,cur_val)
219
else begin trap_zero_glue; sa_define(l,cur_val)(l,glue_ref,cur_val);
221
if p<glue_val then word_define(l,cur_val)
222
else begin trap_zero_glue; define(l,glue_ref,cur_val);
224
%---------------------------------------
226
if (cur_chr<mem_bot)or(cur_chr>lo_mem_stat_max) then
227
begin l:=cur_chr; p:=sa_type(l); e:=true;
229
else begin p:=cur_chr-mem_bot; scan_register_num;
231
begin find_sa_element(p,cur_val,true); l:=cur_ptr; e:=true;
235
p:=cur_chr; scan_eight_bit_int;
237
%---------------------------------------
241
found: if p<glue_val then@+if e then w:=sa_int(l)@+else w:=new_eqtb_int(l);
242
else if e then s:=sa_ptr(l)@+else s:=equiv(l)
247
%---------------------------------------
249
if q=advance then cur_val:=cur_val+w;
251
if q=advance then cur_val:=cur_val+new_eqtb_int(l);
253
%---------------------------------------
255
begin q:=new_spec(cur_val); r:=s;
257
begin q:=new_spec(cur_val); r:=equiv(l);
259
%---------------------------------------
261
if p=int_val then cur_val:=mult_integers(w,cur_val)
262
else cur_val:=nx_plus_y(w,cur_val,0)
263
else cur_val:=x_over_n(w,cur_val)
264
else begin r:=new_spec(s);
266
if p=int_val then cur_val:=mult_integers(new_eqtb_int(l),cur_val)
267
else cur_val:=nx_plus_y(new_eqtb_int(l),cur_val,0)
268
else cur_val:=x_over_n(new_eqtb_int(l),cur_val)
269
else begin s:=equiv(l); r:=new_spec(s);
271
%---------------------------------------
273
set_box: begin scan_register_num;
274
if global then n:=global_box_flag+cur_val@+else n:=box_flag+cur_val;
275
scan_optional_equals;
276
if set_box_allowed then scan_box(n)
278
set_box: begin scan_eight_bit_int;
279
if global then n:=number_regs+cur_val@+else n:=cur_val;
280
scan_optional_equals;
281
if set_box_allowed then scan_box(box_flag+n)
283
%---------------------------------------
285
@!b:pointer; {box register}
286
begin c:=cur_chr; scan_register_num; fetch_box(b); scan_optional_equals;
288
if b<>null then mem[b+c].sc:=cur_val;
290
@!b:eight_bits; {box number}
291
begin c:=cur_chr; scan_eight_bit_int; b:=cur_val; scan_optional_equals;
293
if box(b)<>null then mem[box(b)+c].sc:=cur_val;
295
%---------------------------------------
296
@x [49] m.1296 l.23637 - e-TeX sparse arrays
297
begin scan_register_num; fetch_box(p); begin_diagnostic;
298
print_nl("> \box"); print_int(cur_val); print_char("=");
299
if p=null then print("void")@+else show_box(p);
301
begin scan_eight_bit_int; begin_diagnostic;
302
print_nl("> \box"); print_int(cur_val); print_char("=");
303
if box(cur_val)=null then print("void")
304
else show_box(box(cur_val));
306
%----------------------------------------
308
if eTeX_ex then for k:=int_val to tok_val do dump_int(sa_root[k]);
311
%----------------------------------------
313
if eTeX_ex then for k:=int_val to tok_val do
314
undump(null)(lo_mem_max)(sa_root[k]);
318
for j:=0 to eTeX_states-1 do eTeX_state(j):=0; {disable all enhancements}
320
for j:=0 to eTeX_states-1 do set_new_eqtb_int(eTeX_state_base+j,0); {disable all enhancements}