@x \vfill} \pageno=\contentspagenumber \advance\pageno by 1 @y \centerline{(Microsoft Pascal Version 1.0.0, February 1987)} \vfill \centerline{\hsize 5in\baselineskip9pt \vbox{\ninerm\noindent The changes required to create this Microsoft 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 Microsoft 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 Microsoft Pascal version. @d banner=='This is SCANWEAVE, Microsoft Pascal Version 1.0.0' @z @x @@/ @y @@/ @@/ @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 @{@&$Debug-@} {no range check, catch arithmetic overflow, no debug overhead} @z @x @d othercases == others: {default for cases not listed explicitly} @y @d othercases == otherwise {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 @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:lstring(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:=ord(aux_buf.len); 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:lstring(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.len := wrd(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 DOS 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); @; endxqq; 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); @z @x fatal_message: print_nl('(That was a fatal error, my friend.)'); end {there are no other cases} @y fatal_message: print_nl('(That was a fatal error, my friend.)'); end; {there are no other cases} doseqq := wrd(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 Microsoft Pascal. @ Here is the stuff for Microsoft Pascal @= procedure endxqq ; extern; @ @^system dependencies@> @= doseqq [extern] : word; {completion code to be returned to DOS} @ This procedure appends a default file extension to a file name. @^system dependencies@> @= @+procedure setup_text_file(var the_file : text_file; @+const def_ext :lstring; @+const descr_str : lstring; main : boolean); extern; @ @= setup_text_file(tex_file,'TeX','input TeX',true); setup_text_file(out_tex_file,'out','output TeX',false); @z