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.

140 van Wijngaarden, et al.e)op up = (sama edsger) void :pr s tart of incompatible part prif ref int dijkstra = F of edsger; (dijkstra +: = 1) _> Ithencall processes are resumed {2.1.4.3.g} which are haltedbecause the integer referred to by the name yielded by'dijkstra' was smaller than one cflpr finish of incompatible part pr ;{For the use of down and up, see E.W. Dijkstra, Cooperating SequentialProcesses, contained in Programming Languages, Genuys, F. (ed.),London etc., Academic Press, 19<strong>68</strong>: see also 11.12.}10.3. Transput declarations{"So it does!" said Pooh. "It goes in!""So it does!" said Piglet. "And it comes out!""Doesn't it?" said Eeyore. "It goes in and out likeanything."Winnie-the-Pooh,A.A. Milne.}{Three ways of "transput" (i.e., input and output) are provided by thestandard-prelude, viz., formatless transput {10.3.3), formatted transput(10.3.5} and binary transput (10.3.6).}10.3.1. Books, channels and files{"Books", "channels" and "files" model the transput devices of thephysical machine used in the implementation.}10.3.1.1. Books and backfiles{aa) All information within the system is to be found in a number of"books". A book (a) is a structured value including a field text of the modespecified by flextext (b) which refers to information in the form ofcharacters. The text has a variable number of pages, each of which mayhave a variable number of lines, each of which may have a variablenumber of characters. Positions within the text are indicated by a pagenumber, a line number and a character number. The book includes a fieldlpos which indicates the "logical end" of the book, i.e., the position up towhich it has been filled with information, a string idf, which identifies thebook and which may possibly include other information, e.g., ownership,and fields putting and users which permit the book to be opened(10.3.1.4.d) on more than one file simultaneously only if putting is notpossible on any of them.ALGOL <strong>68</strong> Revised Report 141bb) The books in the system are accessed via a chain of backfiles.The chain of books available for opening (10.3.1.4.dd) is referenced bychainbfile. A given book may be referenced by more than one backfile onthis chain, thus allowing simultaneous access to a single book by morethan one process {10.2.4}. However such access can only be for reading abook, since only one process may access a book such that it may be "written to (aa). The chain of books which have been locked {10.3.1.4.o) isreferenced by lockedbfile.cc) Simultaneous access by more than one process to the chain ofbackfiles is prevented by use of the semaphore bfileprotect, which providesmutual exclusion between such processes.dd) Books may be created (e.g., by input) or destroyed (e.g., afteroutput) by tasks (e.g., the operating system) in the system-task.list(10.4.2), such books being then added to or removed from the chain ofbackfiles.}a) mode .~ book =struct (flextext text,pos lpos ¢ logical end of book ¢,string idf ¢ identification ¢,boolputting ¢ true if the book may be written to ¢,int users ¢ the number of times the book is opened ¢) ;b) mode .~ text = ref[ ] [ ] [ ]char,mode .~ ffaxtext = ref flex [ ] flex [ ] flex [ ] char;c) mode .~ pos = struct (int p, l, c) ;d} prio .~ beyond = 5,op beyond = (pos a, b) bool :if p of a < p of b then falseelif p of a > p of b then trueelif l of a < / of b then falseelif l of a > l of b then trueelse c of a > c of bfl;e)f)g)h)mode .~ bflle = struct (ref book book, ref bflle next) ;ref bflle .~ chainbfile := nil;ref bflle .~ lockedbfile := nil;sema .~ bfileprotect = (sema s; F of s := PRIM10.3.1.2. Channelsint : = 1; s);{aa) A "channel" corresponds to one or more physical devices {e.g., acard reader, a card punch or a line printer, or even to a set up in nuclear

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

Saved successfully!

Ooh no, something went wrong!