program bookends(book, pairs, output); (* bookends: report the endpoint coordinates of pieces in a book Elaine Bucheimer NCI/FCRDC Bldg 469. Room 144 P.O. Box B Frederick, MD 21702-1201 (301) 846-5581 (-5532 for messages) bucheime@ncifcrf.gov http://www-lecb.ncifcrf.gov/~bucheime/ National Cancer Institute Laboratory of Experimental and Computational Biology *) label 1; (* end of program *) const (* begin module version *) version = 1.02; (* of bookends.p 1999 January 12 origin 1998 June 4 *) updateversion = 1.00; (* defines lowest acceptable current parameter file *) (* end module version *) (* begin module describe.bookends *) (* name bookends: report the endpoint coordinates of pieces in a book synopsis bookends(book: in, pairs: out, output: out) files book: the book generated by delila using inst pairs: listing of the coordinates of the pieces in the book as a series of pairs: one beginning and one ending per line output: messages to the user description This program reads in a book and extracts the coordinates of the pieces for use in the live program. examples documentation see also live.p author Elaine Bucheimer bugs technical notes *) (* end module describe.bookends *) var book, (* file used by this program *) pairs: text; (* file used by this program *) (* 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 getcoords *) procedure getcoords(var afile, bfile: text); (* procedure to find the coords of a piece, read them, and write them into the pairs file *) var ch: char; firstnum, lastnum: integer; begin ch:=' '; (* reads book until beginning of piece is found *) while (not eof(afile)) and (ch<>'p') do readln(afile,ch); if not eof(afile) then begin readln(afile); (* reads short name *) readln(afile); (* reads long name *) (* read a char to see if a note exists. If it does, read until the end of the note is found *) readln(afile,ch); if ch='n' then begin repeat readln(afile,ch) until ch='n'; readln(afile,ch); end; (* read in the piece coordinate information *) readln(afile); readln(afile); readln(afile); readln(afile); readln(afile); readln(afile); (* read the beginning and ending coordinates *) readln(afile, ch, firstnum); readln(afile, ch, lastnum); (* write the beginning and ending coordinates *) writeln(bfile, firstnum:1,' ',lastnum:1); (* read to the end of the piece for which the coordinates were reported *) repeat readln(afile, ch) until ch='p' end; end; (* end module getcoords *) (* begin module bookends.themain *) procedure themain(var book, pairs: text); (* the main procedure of the program *) { var parameterversion: real; (* parameter version number *) } begin writeln(output,'bookends ',version:4:2); (* reset(bookendsp); readln(bookendsp, parameterversion); if parameterversion < updateversion then begin writeln(output, 'You have an old parameter file!'); halt end; *) reset(book); rewrite(pairs); while not eof(book) do getcoords(book,pairs); end; (* end module bookends.themain *) begin themain(book, pairs); 1: end.