% pro-pas.ch -*-mode: change; webfile: crudetype.web version 3.01;-*-
% Attempted changefile for PRO-pascal for MS-DOS, RMD.
% Doesnt work; unfortunately the disgnostics of pro-pascal are so vague
% that I cannot tell what is wrong
%
% COPYRIGHT ( C ) R.M.Damerell,1990
%
% This may be distributed on the same terms as the main Crudetype program.
%
% 1. All copies of the software must carry an exact copy of this notice.
%
% 2. This software is distributed free of charge, "AS IS" with absolutely no
% guarantee of performance. Any persons receiving or using this software must do
% so entirely at their own risk. Neither the authors nor their institutions
% accept any liability for any defects of this software, or for any consequential
% loss or damage however caused.
%
% 3. Any person who changes this software must clearly mark it as modified and
% add a note describing the changes made.
%

% WEAVE: print changes only
@x  Module 0; Lines 42 -- 42
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
\def\title{Crudetype for {\mc MS-Dos }  }
@z

@x  Module 4; Lines 213 -- 213
@d banner=='This is Crudetype, Version 3.01, copyright, experimental'
@y
@d banner=='This is Crudetype, Version 3.01, copyright, experimental MS-DOS'
@z

@x  Module 5; Lines 234 -- 234
  var @<Globals in the outer block@>
@y
  common @<Common variables@>
  var @<Globals in the outer block@>
@z

@x  Module 11; Lines 312 -- 312
  i_word = -max_half-1 .. max_half ;
@y
  i_word = -max_half-1 .. max_half ;
  var_str_type = string[100];
@z

@x  Module 12; Lines 334 -- 334
@d Q_string == packed array[ first..last:integer] of char
@y
@d Q_string == var_str_type
@d first = 1
@d last == length( ss)
@z

@x  Module 14; Lines 360 -- 361
@<Lowest...@>=
  {Declare |parse_file|}
@y
@<Lowest...@>=
  procedure  parse_file( name: var_string; var dir, nam, ex: var_string) ;
  var p,r,s: s_ptr ;
  begin
    dir := blank; nam := blank; ex := blank;
    s := name.len ;
    if ( s>0) then begin
      p := s_search( name, '\', -s);
      if ( p>0) then substring( dir, name, 1, p) ;
      r := s_search( name, '.', -s);
      if ( r>p) then substring( ex, name, r, s-r+1)
      else r := s +1 ;
      substring( nam, name, p+1, r-p-1) ;
    end;
  end;
@z

% Mess-DOS filenames
% lower case file names, default to putting the .lpr file in the
% same directory as the .dvi file
@x  Module 18; Lines 433 -- 435
  be_string( '.DVI' ) ; dvi_def := buffer ;
  be_string( 'TEX$FONTS:.TFM' ) ; tfm_def := buffer ;
  be_string( 'TEX$GF:.&DGF' ) ; raster_def := buffer ;
@y
  be_string( '.DVI' ) ; dvi_def := buffer ;
  be_string( 'TEX\FONTS\' ) ; tfm_def := buffer ;
  be_string( 'TEX\GFDIR\.&DGF' ) ; raster_def := buffer ;
@z

@x  Module 19; Lines 442 -- 443
@<Lowest...@>=
  {Declare |open_binary|}
@y

@d close_binary(#)== do_nothing ;

@<Lowest...@>=
  function open_binary (var f_f: byte_file; name: var_string ): boolean;
  begin
    if fstat( name.data) then
    begin
      assign (f_f, name.data);
      reset( f_f) ;
      open_binary := true
    end
    else
    open_binary := false
  end;
@z

@x  Module 20; Lines 446 -- 446
  rewrite(printfile) ;
@y
  if inspection then
  assign(printfile, 'CON' )
  else assign(printfile, print_name.data ) ;
  rewrite(printfile ) ;
@z

@x  Module 21; Lines 453 -- 455
@d prefix == "/"
@d got_cl == ( command.len > 0)
@d read_command_line( #) == do_nothing
@y
@d prefix == "-"
@d got_cl == ( command.len > 0)
@d read_command_line( #) == getcomm( #)
@z

@x  Module 22; Lines 468 -- 477
@ Here are macros for the adaptable merge sort. See the section on sorting for
explanation.

@d image(#) == pool[#]
@d create == incr(cell)
@d link_type == page_i
@d first_cell == cell := 0
@d wipe_out(#) ==
@d declare_pool ==  pool: array [page_i] of page_record;
@d garbage == cell := zzz ;
@y
@ Here are macros for the adaptable merge sort. See the section on sorting for
explanation. Pro-Pascal craps out on large arrays.

@d image(#) == #^
@d create == new(cell)
@d first_cell == do_nothing
@d link_type == ^page_record
@d wipe_out(#) == dispose(#) ; { release data piecemeal}
@d garbage == do_nothing
@d declare_pool == do_nothing
@z

% Binary file types.
@x  Module 33; Lines 675 -- 676
  @!byte_block=packed array [0..block_length-1] of byte ;
  @!byte_file= packed file of byte_block;
@y
  @!byte_file= packed file of byte;
@z

@x  Module 38; Lines 753 -- 758
        read_byte := f_file^[f_indx] ;
        incr(f_indx);
        if f_indx =block_length then begin
            get(f_file );
            f_indx:=0;
          end;
@y
        read_byte := f_file^ ;
        incr(f_indx);
        get(f_file );
@z

@x  Module 38; Lines 768 -- 773
    while( f_indx >= block_length) do
      begin
        if eof(f_file) then
          warn('End of file' )
        else get(f_file );
        f_indx := f_indx - block_length ;
@y
    while( n > 0) do
      begin
        if eof(f_file) then
          warn('End of file' )
        else get(f_file );
        decr(n) ;
@z

@x  Module 98; Lines 1696 -- 1698
@ @<Glob...@>=
  ligatures : array[1..max_ligs] of lig_thing;
  top_of_ligs: 0..max_ligs ; {highest used point in |ligatures|}
@y
@ @<Common...@>=
  ligatures : array[1..max_ligs] of lig_thing;
  top_of_ligs: 0..max_ligs ; {highest used point in |ligatures|}
@z
