WEAVE change file for VM/CMS and MVS.
Copyright (C) 1984 by David Fuchs.  All rights are reserved.

@x banner line
@d banner=='This is WEAVE, Version 2.8'
@y
@d banner=='This is WEAVE, VM/CMS Version 2.8'
@d term_in==tty_in
@d term_out==tty_out
@z

@x debug switch
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@d debug==@{
@d gubed==@t@>@}
@z

@x statistics switch
@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==
@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
{It seems impossible to turn CHECK and DEBUG on and off easily given
 how Tangle and VS/PASCAL work}
@z

@x otherwise clause
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == otherwise {default for cases not listed explicitly}
@z

@x enlarge |max_refs| so we can WEAVE TeX with CMS changes
@!max_refs=20000; {number of cross references; must be less than 65536}
@y
@!max_refs=25000; {number of cross references; must be less than 65536}
@z

@x packing
@!ASCII_code=0..127; {seven-bit numbers, a subrange of the integers}
@y
@!ASCII_code=packed 0..127; {seven-bit numbers, a subrange of the integers}
@z

@x EBCDIC
@d last_text_char=127 {ordinal number of the largest element of |text_char|}
@y
@d last_text_char=255 {ordinal number of the largest element of |text_char|}
@z

@x text files
@!text_file=packed file of text_char;
@y
@!text_file=text;
@z

@x terminal output
rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@y
rewrite(term_out); {often redirected to the user's terminal}
@z

@x update terminal buffer
@d update_terminal == break(term_out) {empty the terminal output buffer}
@y
@d update_terminal == do_nothing
@z

@x pack buffer
@<Globals...@>=@!buffer: array[0..long_buf_size] of ASCII_code;
@y
@<Globals...@>=@!buffer: packed array[0..long_buf_size] of ASCII_code;
@z

@x input_ln optimization
@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|}
var i:0..buf_size;
@!temp_buf:@=string@>(buf_size);
begin
limit:=0;
if eof(f) then input_ln:=false
else begin
  read(f,temp_buf);
  limit:=@=length@>(trim(temp_buf));
  if not eoln(f) then begin
    print_nl('! Input line too long'); loc:=0; error;
@.Input line too long@>
    end
  else read_ln(f);
  if limit>0 then for i:=0 to limit-1 do
    buffer(.i.):=xord(.temp_buf(.i+1.).);
  input_ln:=true;
  end;
end;
@z

@x packing
@!eight_bits=0..255; {unsigned one-byte quantity}
@!sixteen_bits=0..65535; {unsigned two-byte quantity}
@y
@!eight_bits=packed 0..255; {unsigned one-byte quantity}
@!sixteen_bits=packed 0..65535; {unsigned two-byte quantity}
@z

@x
reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
@y
{reset(term_in,'INTERACTIVE'); {open |term_in|, don't do a |get|}}
@=termin@>(term_in); {don't ask me why the above line didn't work!}
@z

@x
The main procedure has been split into three sub-procedures in order to
keep certain \PASCAL\ compilers from overflowing their capacity.
@^split procedures@>

@p procedure Phase_I;
begin @<Phase I:...@>;
end;
@#
procedure Phase_II;
begin @<Phase II:...@>;
end;
@#
@y
The main procedure has been split into three sub-procedures in order to
keep certain \PASCAL\ compilers from overflowing their capacity.
@^split procedures@>

@p procedure Phase_I;
begin @<Phase I:...@>;
end;
@#
procedure Phase_II;
begin @<Phase II:...@>;
end;
@#
procedure Store_reserved_words;
begin @<Store all the reserved words@>;
end;
@#
@z

@x
@<Store all the reserved words@>;
@y
Store_reserved_words;
@z

@x set return code
case history of
@y
retcode(4*history); {set return code}
case history of
@z