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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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));/

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

Saved successfully!

Ooh no, something went wrong!