10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

156van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report157b)c)d)proc backspace = (ref file f) void :if - opened off then undefinedelse ref int c = c of cpos off;(c > 1 I c -: = 1 I undefined)fi;proc newline = (rot file f) void :if - opened off then undefinedelsebool reading =(read mood of f l true I: write mood of f l falsel undefined; skip);(- get good page (f, reading) l undefined);ref pos cpos = cpos off, lpos = lpos of book off;if p of cpos = p of lpos ^ l of cpos = l of lposthen c of cpos : = c of lpos;if reading then newline (f)elseif compressible (f)then ref int pl = p of lpos, ll = l of lpos;flextext text = (text of fl (flextext t2): t2);text [pl] [ll] := text [pl] Ill] [" cof lpos - 1]else while ~ line ended (f) do space (f) odfi;cpos : = lpos : = (p of cpos, l of cpos + 1, 1)fi;fielse cpos : = (p of cpos, l of cpos + 1, 1)fiproc newpage = (rof file f) void :if - opened off then undefinedelsebool reading =(read mood of f l true I" write mood of f l false I undefined;skip);(- get good file (f, reading) I undefined);ref pos epos = cpos off, lpos = lpos of book off;if p of cpos = p of lposthen cpos : = lpos;if reading then newpage (f)elseif compressible (f) ^ I of lpos ii 1ll 1l- 1) Jfl;else while - page ended (f) do newline (f) odfi;cpos : = lpos : = (p of cpos + 1, 1, 1)flelse cpos : = (p of cpos + 1, 1, 1)fl{Each of the following 3 routines either returns true, in which case theline, page or file is good (dd), or it returns false, in which case the currentposition may be outside the logical file or the page number may haveoverflowed, or it loops until the matter is resolved, or it is terminated by ajump. On exit, the read/write mood is as determined by its readingparameter.}e) proc 9 get good line = (rof file f, bool reading) bool :begin bool not ended;while not ended : = get good page (f, reading);line ended (f) ^ not endeddo (- (line mended off) (f) l set mood (f, reading); newline (f)) od;not endedend;f) proc 9 get good page = (ref file f, bool reading) bool :begin bool not ended;while not ended := get good file (f, reading);page ended (f) ^ not endeddo (- (page mended off) (f) I set mood (f, reading); newpage (f)) od;hot endedend;g) proc 9 get good file = (rof file f, bool reading) bool :begin bool not ended : = true;while set mood (f, reading);not ended a(reading l logical file ended l physical file ended) (f)do not ended : = (reading l logical file mended offI physical file mended off) (f)od;not endedend;h) proc 9 set mood = (ref file f, bool reading) void :(reading l set read mood (f) I set write mood (f)) ;i) proc set = (rot file f, int p, l, c) void :if - opened off v ~ set possible (f) then undefinedelse bool reading =(read mood of fl true I: write mood of fl false I undefined; skip);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!