home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / fbi92-11.zip / FIXFBI.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-09  |  3KB  |  110 lines

  1. program fixfbi( input, output);
  2.  
  3. uses CRT;
  4.  
  5. const space = ' ';
  6.  
  7. var v1,v2,response: char;
  8.     source, destination : string[ 30 ];
  9.     match : boolean;
  10.     lineknt : integer;
  11.     have_read, have_written : longint;
  12.     rawdata, asciidata : text;
  13.  
  14. begin
  15. clrscr;
  16. gotoxy( 8, 10 );
  17. writeln( 'Enter the path + name of the file to be converted below:');
  18. gotoxy( 8, 11 );
  19. write( '==> '); readln( source );
  20. gotoxy( 8, 13 );
  21. writeln( 'Now enter the path + name of the file to be created that');
  22. gotoxy( 8, 14 );
  23. writeln( 'will contain the converted text.');
  24. gotoxy( 8, 15 );
  25. write( '==> '); readln( destination );
  26. gotoxy( 8, 17 );
  27. writeln( 'SOURCE      ==> ',source);
  28. gotoxy( 8, 18 );
  29. writeln( 'DESTINATION ==> ',destination);
  30. response := ' ';
  31. gotoxy( 8, 20 );
  32. write( 'Are the above filenames correct? (y/n)  ==> ');
  33. readln( response );
  34. if ((response = 'n') or (response = 'N' )) then exit;
  35. assign( rawdata, source );
  36. assign( asciidata, destination );
  37. reset( rawdata );
  38. rewrite( asciidata );
  39. have_read := 0;
  40. have_written := 0;
  41. lineknt := 0;
  42. clrscr;
  43. writeln; writeln;
  44. v1 := ' '; v2 := ' ';
  45.  
  46. while (not (eof(rawdata)) ) do
  47.    begin
  48.    read( rawdata, v1 );
  49.    inc( have_read );
  50.    match := false;
  51.  
  52.    if ( (ord(v1) in [ $20..$7E ]) and
  53.         (not ((ord(v1) = $6A) and (ord(v2) = $DC)) ) ) then
  54.         begin
  55.         inc( have_written );
  56.         write( asciidata, v1 );
  57.         write( v1 );
  58.         match := true;
  59.         end;
  60.  
  61.    if ( (ord(v1) = $6A) and (ord(v2) = $DC) ) then
  62.       begin
  63.       writeln( asciidata, space);
  64.       writeln( space );
  65.       inc( have_written );
  66.       inc( lineknt );
  67.       end;
  68.  
  69.    if ( ord(v1) = $0D ) then
  70.       begin
  71.       inc( have_written );
  72.       writeln( asciidata, space );
  73.       writeln( space );
  74.       inc( lineknt );
  75.       match := true;
  76.       end;
  77.  
  78.    if ( ord(v1) = $0A ) then
  79.       begin
  80.       inc( have_written );
  81.       writeln( asciidata, space );
  82.       writeln( space );
  83.       inc( lineknt );
  84.       match := true;
  85.       end;
  86.  
  87.    if ( (match = false) and
  88.         (not (ord(v1) in [ $DC, $6A, $0, $2, $B ])) ) then
  89.         begin
  90.         write( asciidata, space );
  91.         inc( have_written );
  92.         end;
  93.    v2 := v1;
  94.    end;
  95.  
  96. writeln; writeln;
  97. writeln( asciidata, space );
  98. close( rawdata );
  99. close( asciidata );
  100. writeln( '                Summary Report' );
  101. writeln( '                **************' );
  102. writeln( 'Characters read from source file       => ',have_read );
  103. writeln( 'Characters written to destination file => ',have_written );
  104. writeln( 'Total lines in destination file        => ',lineknt );
  105. writeln;
  106. writeln;
  107. end.
  108.  
  109.  
  110.