home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Tex
/
texchang.arc
/
tangle
< prev
next >
Wrap
Text File
|
1990-03-16
|
8KB
|
322 lines
TANGLE change file for the Atari ST
Author: Nico Poppelier.
Date : December 30, 1988.
Due to an error in the Prospero Pascal compiler the control variable
of the FOR loops in sections 138, 182, and 184 are judged 'insecure',
i.e., it looks as if they are modified by a routine.
To avoid this 'error' a new loop variable k is introduced.
@x
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
% \let\maybe=\iffalse
% \def\title{TANGLE changes for the Atari ST}
\def\title{TANGLE, Version 2.8 for the Atari ST}
@z
@x
@d banner=='This is TANGLE, Version 2.8'
@y
@d banner=='This is TANGLE, Version 2.8 for the Atari ST'
@z
@x
and the string pool output goes to file |pool|.
@y
and the string pool output goes to file |pool|.
Prospero Pascal for the Atari ST requires us to mention
|input| and |output| in the program header, too.
They are used for terminal input and output.
@z
@x
program TANGLE(@!web_file,@!change_file,@!Pascal_file,@!pool);
@y
program TANGLE(@!input,@!output,
@!web_file,@!change_file,@!Pascal_file,@!pool);
@z
@x
procedure initialize;
@y
procedure wait(delay:real); external; {from doslib}@/
procedure initialize;
@z
@x
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@d debug== {we are debugging}
@d gubed==
@z
@x
@d stat==@{ {change this to `$\\{stat}\equiv\null$'
when gathering usage statistics}
@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
when gathering usage statistics}
@y
@d stat== {we are gathering usage statistics}
@d tats==
@z
@x
@<Compiler directives@>=
@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
@y
On the Atari ST, things are different:
Prospero Pascal does not allow in-comment directives
@<Compiler directives@>=
@z
@x
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == otherwise {default for cases not listed explicitly}
@z
@x
@!max_toks=50000; {|1/zz| times the number of bytes in compressed \PASCAL\ code;
must be less than 65536}
@y
@!max_toks=51000; {|1/zz| times the number of bytes in compressed \PASCAL\ code;
must be less than 65536}
@z
@x
@!text_file=packed file of text_char;
@y
@!text_file=text;
@z
@x
@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
@y
@d term_in==input
@d term_out==output
@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
@z
@x
@<Globals...@>=
@!term_out:text_file; {the terminal as an output file}
@y
@z
@x
rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@y
print_ln(banner); {print a ``banner line''}
@z
@x
@d update_terminal == break(term_out) {empty the terminal output buffer}
@y
@d update_terminal == {emptying the screen output buffer is not necessary}
@z
@x
@ The following code opens |Pascal_file| and |pool|.
Since these files were listed in the program header, we assume that the
\PASCAL\ runtime system has checked that suitable external file names have
been given.
@^system dependencies@>
@<Set init...@>=
rewrite(Pascal_file); rewrite(pool);
@y
@ The following code opens |Pascal_file| and |pool|.
Actually, on the Atari ST this task is put off until later.
@^system dependencies@>
@z
@x
@!string_ptr:name_pointer; {next number to be given to a string of length |<>1|}
@y
@!string_ptr:name_pointer; {next number to be given to a string of length |<>1|}
@!k:integer; {extra loop variable}
@z
@x
begin for loc:=0 to change_limit do buffer[loc]:=change_buffer[loc];
@y
begin for k:=0 to change_limit do buffer[k]:=change_buffer[k];
@z
@x
@!term_in:text_file; {the user's terminal as an input file}
@y
@z
@x
reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
@y
@z
@x
print_ln(banner); {print a ``banner line''}
@y
@z
@x
stat for zo:=0 to zz-1 do max_tok_ptr[zo]:=tok_ptr[zo];@+tats@;@/
@y
stat for k:=0 to zz-1 do max_tok_ptr[k]:=tok_ptr[k];@+tats@;@/
@z
@x save pool and Pascal files only if they were written to.
if string_ptr>128 then @<Finish off the string pool file@>;
stat @<Print statistics about memory usage@>;@+tats@;@/
@t\4\4@>{here files should be closed if the operating system requires it}
@<Print the job |history|@>;
end.
@y
if history<fatal_message then begin
if string_ptr>128 then begin @<Finish off the string pool file@>;
close(pool, true);
end;
close(Pascal_file, true);
end;
stat @<Print statistics about memory usage@>;@+tats@;@/
@<Print the job |history|@>;
wait(3);
end.
@z
@x
for string_ptr:=1 to 9 do
@y
for k:=1 to 9 do
@z
@x
for string_ptr:=9 downto 1 do write(pool,xchr["0"+out_buf[string_ptr]]);
@y
for k:=9 downto 1 do write(pool,xchr["0"+out_buf[k]]);
@z
@x
for zo:=1 to zz-1 do print('+',max_tok_ptr[zo]:1);
@y
for k:=1 to zz-1 do print('+',max_tok_ptr[k]:1);
@z
@x
This module should be replaced, if necessary, by changes to the program
that are necessary to make \.{TANGLE} work at a particular installation.
It is usually best to design your change file so that all changes to
previous modules preserve the module numbering; then everybody's version
will be consistent with the printed program. More extensive changes,
which introduce new modules, can be inserted here; then only the index
itself will get a new module number.
@y
Here are the remaining changes to the program
that are necessary to make \.{TANGLE} work on the Atari ST.
@ @<Local...@>=
@!ask,@!name_found: boolean;
@!file_name,@!job_name: string;
@!name_length,@!name_index: integer;
@ Get the external file names, and then call |open|
to associate an external file with each file variable.
@<Set init...@>=
getcomm(job_name);
name_length:=l @& e @& n @& g @& t @& h(job_name); name_index:=1;
while (name_index <= name_length) and
(job_name[name_index] = ' ') do incr(name_index);
name_found:=name_index <= name_length;
if name_found then delete(job_name, 1, name_index-1);
if name_found then begin
file_name:=concat(job_name,'.WEB');
assign(web_file,file_name);
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name);
end
else ask:=true;
while ask do begin
write('Web file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
if checkfn(file_name) then begin
ask:= not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name)
else assign(web_file,file_name);
end
else begin
ask:=true; write_ln('"',file_name,'" is not a good filename')
end;
end;
if name_found then begin
file_name:=concat(job_name,'.CH');
assign(change_file,file_name);
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name);
end
else ask:=true;
while ask do begin
write('Change file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
if file_name='' then file_name:='empty.ch';
if checkfn(file_name) then begin
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name)
else assign(change_file,file_name);
end
else begin
ask:=true; write_ln('"',file_name,'" is not a good filename')
end;
end;
if name_found then begin
file_name:=concat(job_name,'.PAS');
assign(Pascal_file,file_name);
ask:=not checkfn(file_name);
if ask then write_ln('"',file_name,'" is not a good filename')
end
else ask:=true;
while ask do begin
write('Pascal file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
ask := not checkfn(file_name);
if ask then
write_ln('"',file_name,'" is not a good filename')
else
assign(Pascal_file,file_name);
end;
if name_found then begin
file_name:=concat(job_name,'.POO');
assign(pool,file_name);
ask:=not checkfn(file_name);
if ask then write_ln('"',file_name,'" is not a good filename')
end
else ask:=true;
while ask do begin
write('Pool file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
ask := not checkfn(file_name);
if ask then
write_ln('"',file_name,'" is not a good filename')
else
assign(pool,file_name);
end;
rewrite(Pascal_file); rewrite(pool);
@z