1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
@x
@d banner=='This is TIE, Version 1.3'
@y
@d banner=='This is TIE, Version 1.3 (MUNIX changes by THD/ITI)'
@z
@x
@!max_name_length=54; {adapt this to your local name space}
@y
@!max_name_length=120; {adapt this to your local name space}
@z
@x
@!ascii_code=0..127; {seven-bit numbers, a subrange of the integers}
@y
@!ascii_code=packed 0..127;
@z
@x
@!text_file=packed file of text_char;
@y
@!text_file=text;
@z
@x
xchr["\"]:='\';
@y
xchr["\"]:='\\';
@z
@x
for i:=1 to @'37 do xchr[i]:=' ';
@y
for i:=1 to @'37 do xchr[i]:=' ';
xchr[tab_mark]:=chr(tab_mark);
@z
@x
reset(term_in,'TTY:','/I')
@y
reset(term_in,'/dev/tty')
@z
@x
rewrite(term_out,'TTY:');
@y
rewrite(term_out,'/dev/tty');
@z
@x
@d update_terminal == break(term_out) {empty the terminal output buffer}
@y
@d update_terminal == write_ln(term_out) {empty the terminal output buffer}
@z
Delete definition of |get_line|. Replace by procedure.
@x
@d get_line(#)==get_ln_from_file(#,input_files[#]);
@y
@z
Add the definition now
@x
exit: end;
@y
exit: end;
procedure get_line(i:file_index);@/
begin
case i of
0 : get_ln_from_file(0,infile0);
1 : get_ln_from_file(1,infile1);
2 : get_ln_from_file(2,infile2);
3 : get_ln_from_file(3,infile3);
4 : get_ln_from_file(4,infile4);
5 : get_ln_from_file(5,infile5);
6 : get_ln_from_file(6,infile6);
7 : get_ln_from_file(7,infile7);
8 : get_ln_from_file(8,infile8);
9 : get_ln_from_file(9,infile9);
end;
end;
@z
@x
@!input_files: array[0..max_file_index] of text_file;
@y
@!infile0,@!infile1,@!infile2,@!infile3,@!infile4,@!infile5:text_file;
@!infile6,@!infile7,@!infile8,@!infile9:text_file;
@z
@x
@ We continue with a function to open a text file. Success
is indicated by a boolean result. We assume that empty
files can be handled like non existent ones.
@^system dependencies@>
@p function file_open(var f:text_file;name:name_type):boolean;
begin
reset(f,name.name);
file_open:=not eof(f);
end;
@y
@ We continue with a function to open a text file. Success
is indicated by a boolean result. We assume that empty
files can be handled like non existent ones.
@^system dependencies@>
We use a special function to determine missing files.
@p function lookop(var n:string):integer; externc;
function file_open(var f:text_file;name:name_type):boolean;@/
var curname:string;
begin
curname:=con@&vert(name.name,string);
if lookop(curname)=1 then
begin
reset(f,curname);
file_open:=not eof(f);
end else file_open:=false;
end;
@z
@x
for i:=1 to max_name_length do name_of_file.name[i]:=' ';
for i:=1 to prefix.nam_len do name_of_file.name[i]:=prefix.name[i];
for i:=1 to extension.nam_len do
name_of_file.name[prefix.nam_len+i]:=extension.name[i];
@y
for i:=1 to prefix.nam_len do name_of_file.name[i]:=prefix.name[i];
for i:=1 to extension.nam_len do
name_of_file.name[prefix.nam_len+i]:=extension.name[i];
name_of_file.name[prefix.nam_len+extension.nam_len+1]:=chr(0);
@z
@x
if not file_open(input_files[0],input_organization[0].name_of_file) then
@y
if not file_open(infile0,input_organization[0].name_of_file) then
@z
@x
procedure open_input; {prepare to read |input_files|}
label done;
var i:integer;
@y
procedure open_input; {prepare to read |input_files|}
label done;
var i:integer;
b:boolean;
@z
@x
if not file_open(input_files[no_ch],
input_organization[no_ch].name_of_file)
@y
case no_ch of
1: b:=file_open(infile1,input_organization[1].name_of_file);
2: b:=file_open(infile2,input_organization[2].name_of_file);
3: b:=file_open(infile3,input_organization[3].name_of_file);
4: b:=file_open(infile4,input_organization[4].name_of_file);
5: b:=file_open(infile5,input_organization[5].name_of_file);
6: b:=file_open(infile6,input_organization[6].name_of_file);
7: b:=file_open(infile7,input_organization[7].name_of_file);
8: b:=file_open(infile8,input_organization[8].name_of_file);
9: b:=file_open(infile9,input_organization[9].name_of_file);
end;
if not b
@z
@x
cf_ext.name[1]:='.';
cf_ext.name[2]:='C';
cf_ext.name[3]:='F';
cf_ext.name[4]:=' ';
cf_ext.nam_len:=4;
for i:=cf_ext.nam_len+1 to max_name_length do cf_ext.name[i]:=' ';
@y
cf_ext.name[1]:='.';
cf_ext.name[2]:='c';
cf_ext.name[3]:='f';
cf_ext.name[4]:=' ';
cf_ext.name[5]:=chr(0);
cf_ext.nam_len:=4;
@z
@x
{here files should be closed if the operating system requires it}
@y
{here files should be closed if the operating system requires it}
{terminate with return code}
halt(history);
@z
|