program noblank(input, output); (* noblank: remove all blank lines from a file Tom Schneider NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) permanent email: toms@alum.mit.edu toms@ncifcrf.gov http://www-lecb.ncifcrf.gov/~toms/ National Cancer Institute Laboratory of Experimental and Computational Biology *) label 1; (* end of program *) const (* begin module version *) version = 1.00; (* of noblank.p 1998 April 29 origin 1998 April 29 *) updateversion = 1.00; (* defines lowest acceptable current parameter file *) (* end module version *) (* begin module describe.noblank *) (* name noblank: remove all blank lines from a file synopsis noblank(input: in, out, output: out) files input: a text file output: the text file with blank lines removed from the middle description This program will remove lines with blanks in them from the middle of a file. It will also remove lines that have only blank characters. examples documentation see also rembla.p author Thomas Dana Schneider bugs technical notes *) (* end module describe.noblank *) (* begin module halt *) procedure halt; (* stop the program. the procedure performs a goto to the end of the program. you must have a label: label 1; declared, and also the end of the program must have this label: 1: end. examples are in the module libraries. this is the only goto in the delila system. *) begin writeln(output,' program halt.'); goto 1 end; (* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; *) (* begin module noblank.themain *) procedure themain(var fin, fout: text); (* the main procedure of the program *) var c: char; (* a character in fin *) b: integer; (* index to blanks *) blanks: integer; (* number of leading blank characters *) blankline: boolean; (* the line was totally blank *) begin while not eof(fin) do begin blanks := 0; blankline := true; while not eoln(fin) do begin read(fin,c); if (c = ' ') and (blankline) then begin blanks := succ(blanks) end else begin blankline := false; for b := 1 to blanks do write(fout,' '); blanks := 0; end; if not blankline then write(fout,c); end; readln(fin); if not blankline then writeln(fout); end end; (* end module noblank.themain *) begin themain(input, output); 1: end.