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.

150van Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report 151e)doif match (idf, chan, book of bf)then found : = trueelse bf : = next of bffiod;if - foundthen up bfileprotect; undefinedelse ref book book := book of bf;if putting of book v (put of chan) (book) ^ users of book > 0thenup bfileprotect; undefined ¢ in this case opening isinhibited by other users - the system may eitherwait, or yield nonzero (indicating unsuccessfulopening) immediately ¢elseusers of book +: = 1;((put of chan) (book) t putting of book : = true);ref ref bflle (bf) := next of bf; ¢ remove bfile from chain ¢(opened of file I up gremlins I up bfileprotect);file :=(book, text of book, chan, skip, skip,¢ state: ¢ heap bool : = false, heap bool : = false,heap bool : = false, heap bool : = false,heap bool : = true,heap pos := (1, 1, 1), "", (standconv of chan) (book),¢ event routines: ¢ false, false, false, false, false,false, (ref file f, ref char a) bool : false);(- bin possible (file) I set char mood (file));(~ get possible (file) I set write mood (file));(- put possible (file) I set read mood (file));0fifielse up bfileprotect; undefinedfiend;proc associate =(ref file file, ref [ ] [ ] [ J char sss) void :if int p = lwb sss; int l = lwb sss [p J; int c = lwb sss IPI [ l ];p=1^1=1^c=1thenproc t = (ref book a) bool : true;proc f = (ref book a) bool : false;channel chan = (t, t, t, t, f, f, f, bool: false,pos : (max int, max int, max int), skip, skip);(opened of file I down bfileprotect; up gremlins);f)g)h)i)J)k)file : =(heap book := (skip, (upb sss + I, 1, 1), skip, true, 1), sss, than,skip, skip,¢ state: ¢ heap bool : = false, heap bool : = false,heap bool : = true, heap bool : = false, heap bool : = true,heap pos := (1, 1, i), "', skip,¢ event routines: ¢ false, false, false, false, false,, false,(ref file f, ref char a) bool : false)else undefinedJfi;proc .~ file available = (channel chan) bool :c true if another file, at this instant of time, may be opened on'chan' and false otherwise c ;proc .~ idf ok = (string idf) bool :c true if 'idf' is acceptable to the implementation as theidentification of a new book and false otherwise c ;proc .~ match =(string idf, channel chan, ref book book name)boo/:c true if the book referred to by 'book name' may be identified by'idf', and if the book may legitimately be accessed through'chan', and false otherwise c ;proc .~ false = (ref file file) bool : false¢ this is included for brevity in 'establish', 'open' and 'associate' ¢ ;proc .~ set write mood = (ref file f) void :if - put possible (f) v- setpossible (f) ^ bin mood off ^ read mood offthen undefinedelse ref bool (read mood off) := false; ref bool (write mood off: := truefi;proc .~ set read mood = (ref file f) void :if - get possible (f) v- setpossible (f) ^ bin mood off ^ write mood offthen undefinedelse ref bool (read mood off) : = true; ref bool (write mood off) : = falsefi;proc .~ set char mood = (ref file f) void :Sif - set possible (f) ^ bin mood offthen undefinedelse ref bool (char mood off) := true; ref bool (bin mood off) : = falsefi;

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

Saved successfully!

Ooh no, something went wrong!