@x \vfill} \pageno=\contentspagenumber \advance\pageno by 1 @y \centerline{(Turbo Pascal Version 1.0.0, February 1987)} \vfill \centerline{\hsize 5in\baselineskip9pt \vbox{\ninerm\noindent The changes required to create this Turbo Pascal version of \.{SCANWEAVE} are the portions of the sections marked with asterisks (*) below.}}} \pageno=1 @z @x @d banner=='This is SCANWEAVE, Version 1.0' @y For the Turbo Pascal versions of \.{SCANWEAVE}, we add a second decimal point and number to the main version number, so we can differentiate between changes to the standard \.{SCANWEAVE}\ and changes local to the Turbo Pascal version. @d banner=='This is SCANWEAVE, Turbo Pascal Version 1.0.0' @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== {change this to `$\\{stat}\equiv\null$' when gathering usage statistics} @d tats== {change this to `$\\{tats}\equiv\null$' when gathering usage statistics} @z @x @{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead} @!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging} @y @{@&$k-@} {no range check, catch arithmetic overflow, no debug overhead} @z @x @d othercases == others: {default for cases not listed explicitly} @y @d othercases == else {default for cases not listed explicitly} @z @x @!buf_size=1000; {maximum length of input line} @y @!buf_size=255; {maximum length of input line} @z @x @d last_text_char=127 {ordinal number of the largest element of |text_char|} @= @!text_file=packed file of text_char; @y @d last_text_char=127 {ordinal number of the largest element of |text_char|} @d text_file==text @z @x rewrite(term_out,'TTY:'); {send |term_out| output to the terminal} @y assign(term_out,'con:'); rewrite(term_out); {send |term_out| output to the terminal} @z @x @d update_terminal == break(term_out) {empty the terminal output buffer} @y @d update_terminal == @z @x begin reset(tex_file); rewrite(out_tex_file); @y begin assign(tex_file,paramstr(1) ); reset(tex_file); assign(out_tex_file,paramstr(2)); rewrite(out_tex_file); @z @x @p function input_ln(var f:text_file):boolean; {inputs a line or returns |false|} var final_limit:0..buf_size; {|limit| without trailing blanks} begin limit:=0; final_limit:=0; if eof(f) then input_ln:=false else begin while not eoln(f) do begin buffer[limit]:=xord[f^]; get(f); incr(limit); if buffer[limit-1]<>" " then final_limit:=limit; if limit=buf_size then begin while not eoln(f) do get(f); decr(limit); {keep |buffer[buf_size]| empty} print_nl('! Input line too long'); loc:=0; error; @.Input line too long@> end; end; read_ln(f); limit:=final_limit; input_ln:=true; end; end; @y @p function input_ln(var f:text_file):boolean; {inputs a line or returns |false|} label done; var @!aux_buf:string[buf_size]; {intermediate input buffer} k:0..buf_size; {index into |buffer|} begin limit:=0; if eof(f) then input_ln:=false else begin read(f,aux_buf); read_ln(f); limit:=length(aux_buf); if limit>=buf_size then begin print_nl('! Input line too long'); loc:=0; error; @.Input line too long@> limit:=buf_size-1; end; for k:=1 to limit do buffer[k-1]:=xord[aux_buf[k]]; while limit>1 do if buffer[limit-1]=" " then decr(limit) @+else goto done; done: input_ln:=true; end; end; @z @x @!temp : 0..buf_size; begin if limit > 0 then begin for temp := 0 to limit - 1 do begin ch := xchr[buffer[temp]]; f^ := ch; put(f); end; end; write_ln(f); @y @!temp : 0..buf_size; @!aux_buf:string[buf_size]; {intermediate input buffer} begin if limit > 0 then begin for temp := 0 to limit - 1 do begin aux_buf[temp+1] := xchr[buffer[temp]]; end; end; aux_buf[0] := chr(limit); write_ln(f,aux_buf); @z @x and jumps out of the program. This is the only non-local |goto| statement in \.{SCANWEAVE}. It is used when no recovery from a particular error has been provided. @y and jumps out of the program. It calls a Turbo routine to exit. It is used when no recovery from a particular error has been provided. @z @x begin goto end_of_SCANWEAVE; end; @y begin stat @;@+tats@;@/ close(tex_file); close(out_tex_file); @; halt(history); end; @z @x @t\4\4@>{here files should be closed if the operating system requires it} @; @y close(tex_file); close(out_tex_file); @; halt(history); @z @x This module should be replaced, if necessary, by changes to the program that are necessary to make \.{SCANWEAVE} 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 will be the changes to the program that are necessary to make \.{SCANWEAVE} work with Turbo Pascal. @z