home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / strip.zip / STRIP.PAS < prev   
Pascal/Delphi Source File  |  1988-12-15  |  2KB  |  82 lines

  1.  
  2. {$I-}
  3.  
  4. program stripcmt;  { Strips out dbase comments from code }
  5.                    { Looks for *'s and maybe later &&'s }
  6. uses crt;
  7.  
  8. var  f,f2:text;
  9.      data:string[255];
  10.      infile,outfile:string[15];
  11.      error,ripout:boolean;
  12.      loc:integer;
  13.       ln:real;
  14. begin;
  15. clrscr;
  16. writeln ('STRIPCMT - Removes any line from a file that begins with a ''*''.');
  17. writeln ('To be used for removing dBASE comments from source code.');
  18. writeln ('By Barry Watson - Dec 1988     Compiled with Turbo Pascal 5.0 ');
  19. writeln;
  20. error := true;
  21. repeat;
  22. write ('Name of input file to process: ');
  23. readln (infile);
  24. if length (infile) = 0 then halt (1);
  25. assign (f,infile);
  26. reset (f);
  27. if ioresult <> 0 then
  28. writeln ('Sorry!  I get an error when I attempt to read that file!')
  29. else error := false;
  30. close (f);
  31. until error = false;
  32. repeat;
  33. write ('Name of file to create for output: ');
  34. readln (outfile);
  35. if length (outfile) = 0 then halt(1);
  36. assign (f2,outfile);
  37. rewrite (f2);
  38. if ioresult <> 0 then
  39. writeln ('Sorry!  I get an error when I attempt to make that file!')
  40. else error := false;
  41. close (f2);
  42. until error=false;
  43. writeln;
  44. assign (f,infile);
  45. assign (f2,outfile);
  46. reset (f);
  47. rewrite (f2);
  48. ln := 0;
  49. while not eof(f) do begin
  50.  ln:=ln+1;
  51.   if ln > 31499 then begin;
  52.    writeln;
  53.    writeln;
  54.    writeln ('HOLY SHIT!  This file has too many lines for me to process.');
  55.    writeln ('Program TERMINATED abnormally!');
  56.    halt (1);
  57.   end;
  58.  gotoxy (5,20);
  59.  if ln/10 = int(ln/10) then write ('Processing at line number ',ln:5:0);
  60.  readln(f,data);
  61.  loc := 1;
  62.  while (loc < length(data)) and (copy(data,loc,1) < '!') { Zap spaces }
  63.  do begin;
  64.  inc (loc);
  65.  end;  { now the next char is a real char, lets see if it's a * }
  66.   if copy(data,loc,1) <> '*' then begin;
  67.    append(f2);
  68.    writeln(f2,data);
  69.   end;
  70. end;
  71. writeln;
  72. writeln;
  73. writeln ('Processing finished.  Job completed sucessfully!');
  74. writeln;
  75. writeln ('Thanks for using a program from Insane Software Publishers!');
  76. writeln;
  77. writeln;
  78. close(f);
  79. close(f2);
  80. halt (0);
  81. end.
  82.