home *** CD-ROM | disk | FTP | other *** search
-
- {$I-}
-
- program stripcmt; { Strips out dbase comments from code }
- { Looks for *'s and maybe later &&'s }
- uses crt;
-
- var f,f2:text;
- data:string[255];
- infile,outfile:string[15];
- error,ripout:boolean;
- loc:integer;
- ln:real;
- begin;
- clrscr;
- writeln ('STRIPCMT - Removes any line from a file that begins with a ''*''.');
- writeln ('To be used for removing dBASE comments from source code.');
- writeln ('By Barry Watson - Dec 1988 Compiled with Turbo Pascal 5.0 ');
- writeln;
- error := true;
- repeat;
- write ('Name of input file to process: ');
- readln (infile);
- if length (infile) = 0 then halt (1);
- assign (f,infile);
- reset (f);
- if ioresult <> 0 then
- writeln ('Sorry! I get an error when I attempt to read that file!')
- else error := false;
- close (f);
- until error = false;
- repeat;
- write ('Name of file to create for output: ');
- readln (outfile);
- if length (outfile) = 0 then halt(1);
- assign (f2,outfile);
- rewrite (f2);
- if ioresult <> 0 then
- writeln ('Sorry! I get an error when I attempt to make that file!')
- else error := false;
- close (f2);
- until error=false;
- writeln;
- assign (f,infile);
- assign (f2,outfile);
- reset (f);
- rewrite (f2);
- ln := 0;
- while not eof(f) do begin
- ln:=ln+1;
- if ln > 31499 then begin;
- writeln;
- writeln;
- writeln ('HOLY SHIT! This file has too many lines for me to process.');
- writeln ('Program TERMINATED abnormally!');
- halt (1);
- end;
- gotoxy (5,20);
- if ln/10 = int(ln/10) then write ('Processing at line number ',ln:5:0);
- readln(f,data);
- loc := 1;
- while (loc < length(data)) and (copy(data,loc,1) < '!') { Zap spaces }
- do begin;
- inc (loc);
- end; { now the next char is a real char, lets see if it's a * }
- if copy(data,loc,1) <> '*' then begin;
- append(f2);
- writeln(f2,data);
- end;
- end;
- writeln;
- writeln;
- writeln ('Processing finished. Job completed sucessfully!');
- writeln;
- writeln ('Thanks for using a program from Insane Software Publishers!');
- writeln;
- writeln;
- close(f);
- close(f2);
- halt (0);
- end.