206 van Wijngaa~den. et al.10.3.6.1. Binary outputa) procputbin=(reffllef, [ ] outtypeot)void:if opened off thenset bin mood (f); set write mood (f);for k to upb otdo [ ] simplout y = straightoul ot [ k ];for j to upb ydo [ ] char bin = to bin (f, y [j]);for i to upb bindo next pos (f);set bin mood (f);refpos cpos = cpos off, lpos = lpos of book off;case text of fin(flextext t2):t2 [p of cpos ] [ l of cpos ] [ c of cpos ] := bin [i]esac;c of cpos+:= 1;if cpos beyond lpos then lpos : = cposslit - set possible (f)^ pos (p of lpos, I of lpos, 1) beyond cposthen lpos := cpos;(compressible (f) lc the size of the line and page containing thelogical end of the book and of allsubsequent lines and pages may beincreased c)flodododelse undefinedfl;10.3.6.2. Binary inputa) proc get bin = (ref file f, [ ] intype it) void :if opened off thenset bin mood (f); set read mood (f);for k to upb itdo [ ] simplin y=streightin it [k ];for j to upb ydoslmplout yj = case y [j ] in~(refL intO: i~, ~(refL realr): r~,~ (ref L compl z): z~ , (ref bool b): b,~(ref L bits lb): lb~ , (ref char c): c, (ref [ ] chars): s,(ref slring ss): ss esac;ALGOL <strong>68</strong> Revised Report[1 : upb (to bin (f, yj)) ] char bin;for i to upb bindo next pos (f); set bin mood (f);retpos cpos = cpos off;bin [i] :=case text of f ln(flextext t2):t2 [p of cpos ] [ l of cpos ] [ c of cpos ]esac;c ofcpos +: = 1od;case y [j ] In+ (ref L int ii): (~m ~in (f, ii, bin) l (L IntO: ,~. = i) ~ ,(ref L real rr):(from bin (f, rr, bin) ] (L real r): rr : = r) ~ ,(ref L compl zz):(from bin (f, zz, bin) l (L compl z): zz : = z) ~ ,(refbool bb): (from bin (f, bb, bin) l (bool b): bb := b) ,~ (ref L bits lb):(from bin (f, lb, bin) l (L bits b): lb := b)~,(ref cher cc): (from/bin (f, cc, bin)[ (char c): cc := c) ,(ref [ ] char ss)i= "(from bin (f, ss, bin) l ([ ] chars): ss := s) ,(ref string ssss):(from bin (f, ssss, bin) l ([ ] chars): ssss := s)esacI"ododelse undefinedfl;[But Eeyore wasn't listening. He was takingthe balloon out, and putting it back again,as happy as could be ....Winnie-the-Pooh,A.A.Milne.}}
208 van Wijngaar~en. et al.10.4. The system prelude and task list10.4.1. The system preludeThe representation of the system.prelude is obtained from the followingform, to which may be added further forms not defined in this Report.{The syntax of program-texts ensures that a declaration contained in thesystem-prelude may not contradict any declaration contained in thestandard-prelude. It is intended that the further forms should containdeclarations that are needed for the correct operation of any system-tasksthat may be added (by the implementer, as provided in 10.1.2.d).}a) sema .~gremlins=(semas; Fofs :=PRIMint:=O; s);10.4.2. The system task listThe representation of the {first} constituent system-task of the systemtask-listis obtained from the following form. The other system-tasks, ifany, are not defined by this Report {but may be defined by theimplementer in order to account for the particular features of hisoperating environment, especially in so far as they interact with therunning of particular-programs {see, e.g., 10.3.1.1.dd)}.a) do down gremlins; undefined; up bfileprotect od{The intention is that this call of undefined, which is released by an upgremlins whenever a book is closed, may reorganize the chain of backfilesand the chain of locked backfiles, such as by removing the book if it is notto be available for further opening, or by inserting it into the chain ofbackfiles several times over if it is to be permitted for several particularprogramsto read it simultaneously. Note that, when an up gremlins isgiven, bfileprotect is always down and remains so until such reorganizationhas taken place.}10.5. The particular preludes and postludes10.5.1. The particular preludes{From ghoulies and ghosties and Iongleggetybeasties and things that go bumpin the night,Good Lord, deliver us!Ancient Cornish litany}The representation of the particular-prelude of each user-task isobtained from the following forms, to which may be added such otherforms as may be needed for the proper functioning of the facilities definedin the constituent library-prelude of the program-text {, e.g., declarationsand calls of open for additional standard files}. However, for eachQUALITY-new-new-PROPS l-LAYER2-defining-indicator-with-TAX containedALGOL <strong>68</strong> Revised Report 209in such an additional form, the predicate 'where QUALITY TAXindependent PROPSI' {7.1.l.a,c} must hold {i.e., no declaration contained inthe standard-prelude may be contradicted}.a) Lint L last random : = round (L max int / L 2) ;b) proc L random = L real : L next random (L last random) ;c) file stand in, stand out, stand back ;open (stand in, "", stand in channel) ;open (stand out, "", stand out channel) ;open (stand back, "", stand back channel) ;d) proc print = ([ ] union (outtype, proc (ref file) void) x) void :put (stand out, x),proc write = ([ ] union (outtype, proc (ref file) void) x) void :put (stand out, x) ;e) proc read = ([ ] union (intype, proc (ref file) void) x) void :get (stand in, x) ;f) proc printf = ([ ] union (outtype, format) x) void : putf (stand out, x),proc writef = ([ ] union (outtype, format) x) void : putf (stand out, x) ;g) proc readf = ([ ] union (intype, format) x) void : getf (stand in, x) ;h) proc write bin = ([ J outtype x) void : put bin (stand back, x) ;i) proc read bin = ({ ] intype x) void : get bin (stand back, x) ;10.5.2. The particular postludesThe representation of the particular-postlude of each user-task isobtained from the following form, to which may be added such otherforms as may be needed for the proper functioning of the facilities definedin the constituent library-prelude of the program-text {, e.g., calls of lockfor additional standard files}.a) stop: lock (stand in); lock (stand out); lock (stand back)II. Examples11.1. Complex square rootproc compsqrt = (compl z) compl :¢ the square root whose real part is nonnegative of the complexnumber 'z' ¢begin real x = re z, y = im z; real rp = sqrt ((abs x + sqrt (x r 2 + y ! 2)) / 2);realip=(rp=OI OI y / (2x rp));/
- Page 2 and 3:
van Wijngaarden, et al.1.1.4.2. Par
- Page 4:
Acknowledgements{Habent sua fata li
- Page 8 and 9:
14 van Wijngaarden, et al.0.3.4. Mo
- Page 10 and 11:
. . . . . . . 4 " ' 0 . . . . . . .
- Page 12 and 13:
22 van Wijngaarden, et al.• let P
- Page 14 and 15:
26 van Wijngaarden, et al.{Since so
- Page 16 and 17:
30 van Wijngaarden, et aLloperandfo
- Page 18 and 19:
34 van Wijngaarden, et al.j) WHETHE
- Page 20 and 21:
38 van Wijngaarden, et al.A protono
- Page 22 and 23:
42 van Wijngaarden, et al.d) If N i
- Page 24 and 25:
46 van Wijngaarden, et al.c) {There
- Page 26 and 27:
50 van Wijngaarden, et al.c) The ph
- Page 28 and 29:
54 van Wijngaarden, et al.3.1.1. Sy
- Page 30 and 31:
58 van Wijngaarden, et al.where (RO
- Page 32 and 33:
62 van Wijngaarden, et al.1) SOlD N
- Page 34 and 35:
66 van Wijngaarden, et al.ALGOL 68
- Page 36 and 37:
70 van Wijngaarden, et el.For each
- Page 38 and 39:
74 van Wijngaarden, et al.If 'MODE"
- Page 40 and 41:
78 J van Wijngaarden, et al.C) SECO
- Page 42 and 43:
82 van Wijngaarden, et al.ALGOL 68
- Page 44 and 45:
86 van Wijngaarden. et al.ALGOL 68
- Page 46 and 47:
90 van Wijngaarden, et al.5.4.4.1.
- Page 48 and 49:
94van Wijngaarden, et al.ALGOL 68 R
- Page 50 and 51:
98 van Wijngaarden, et al.Assignati
- Page 52 and 53:
102 van Wijngaarden, et at.{A nest,
- Page 54 and 55: 106 van Wijngaarden, et al.'HEAD's
- Page 56 and 57: 110 van Wijngaarden, et al.ALGOL 68
- Page 58 and 59: 114van Wijngaarden, et al.ALGOL 68
- Page 60 and 61: 118 van Wijngaarden, et al.ALGOL 68
- Page 62 and 63: 122 van Wijngaarden, et al.style ii
- Page 64 and 65: 126 van Wijngaarden, et al.b) The c
- Page 66 and 67: 130van Wijngaarden, et al.ALGOL 68
- Page 68 and 69: 134van Wijngaarden, et al.ALGOL 68
- Page 70 and 71: 138d)e)f)g)h)i)J)k)1)m)n)van Wijnga
- Page 72 and 73: 142 van Wijngaarden, et al.physics
- Page 74 and 75: 146 van Wijngaarden, et al.gg) On s
- Page 76 and 77: 150van Wijngaarden, et al.ALGOL 68
- Page 78 and 79: 154/van Wijngaarden, et al.ALGOL 68
- Page 80 and 81: 158 van Wijngaarden, et el.fi;ref p
- Page 82 and 83: 162van Wijngaarden, et al.ALGOL 68
- Page 84 and 85: 166van Wijngaarden, et al.ALGOL 68
- Page 86 and 87: 170/van Wijngaarden, etal.ALGOL 68
- Page 88 and 89: 174J)K)L)M)N)O)P)a)b)c)d)e)van Wijn
- Page 90 and 91: 178/van Wijngaarden, et al.ALGOL 68
- Page 92 and 93: 182 van Wijngaarden, et al.• let
- Page 94 and 95: 186van Wijngaarden, et al./ALGOL 68
- Page 96 and 97: 190 van Wijngaarden, etal.composed
- Page 98 and 99: 194h)i)J)van Wijngaa(rden, et al.pr
- Page 100 and 101: 198 van Wijngaarden, et al.¢ strin
- Page 102 and 103: 202tvan Wijngaarden, et al.ALGOL 68
- Page 106 and 107: 210 van Wijngaarden, et al.!ALGOL 6
- Page 108 and 109: 214 van Wijngaarden, et al.inoperat
- Page 110 and 111: 218fvan Wijngaarden, et al.¢ move
- Page 112 and 113: 222 van Wijngaarden, etaL{overflow}
- Page 114 and 115: 226 van Wijngaarden, et al.ALGOL 68
- Page 116 and 117: 230max int 10.2.1.cmax real 10.2.l.
- Page 118 and 119: 234 van Wijngaarden, et al.ALGOL 68