202tvan Wijngaarden, et al.ALGOL <strong>68</strong> Revised Report203¢ string ¢(y [J] ](rat char cc):(upb s = 1 I cc := s [1 ] I incomp := true),(ref [ ] char ss):(upb ss - Iwb ss + 1 = upb s ] ss [@ I ] := sI incomp := true),(ref string ss): ss := sI incomp := true)out¢ bits ¢(yD]l¢ (telL bits lb):if L int i; string to Lint (s, radix, i)then lb := bin ielse incomp : = true] incomp := true)esacend,(cpattern choice):begin[ 1 : upb (i of choice) ] sinsert si;staticize insertion (i of choice, si);get insertion (f, si);inl c = c of cpos of f, char kk;int k := O, bool found := false;while k < upb (c of choice) ^ - founddok+:= l;[1 : upb ((c of choice) [k])] sinsert si;bool bool : = true;staticize insertion ((c of choice) [ k ], si);string s;for i to upb sido s plusab(sa of si [i] ] (string ss): ss) x rep of si [i]od;for jj to upb swhile bool : = bool ^ - line ended (f)a - logical file ended (f)do get char (f, kk); bool := kk = s [j~] od;(~ (found := bool) l set char number (f, c))od;it - found then incomp : = trueelsecase type of choice inb)¢ boolean ¢(y [J] l(refbool b): b := k = 1I incomp := true),¢ integral ¢(y [J] I(ref int i): i : = k] incomp := true)esacfi;staticize insertion (i of picture, sinsert)end,(fpatlern fpattern):begin do fpattern (f, fpattern, true);for i to upb sinsert do sinsert [i] := (0, "") od;j-:=lend,(gpattern gpattern):([ 1 : upb (i of gpattern) ] sinsert si;(staticize insertion (i of gpattern, si),staticize insertion (i of picture, sinsert));get insertion (f, si);get (f, y [j])),(void):(j -: = 1; staticize insertion (i of picture, sinsert))esac ;if incompthen set read mood (f);(- (value error mended off) (f) I undefined)fI;get insertion (f, sinsert)odendesac odelse undefinedfl;proc 9 indit string = (ref file f, ref string s, [ ] shame s f, int radix) void :beginbool supp, zs : = true, sign found : = false, space found : = false,no sign : = false, int sp : = 1, rep;prlo ! = 8;
204 van Wijngaarden. et al.op ! = (string s, char c) char :¢ expects a character contained in 's'; if the characterread is not in 's', the event routine corresponding to 'onchar error' is called with the suggestion 'c'¢if char k; check pos (f); get char (f, k);char in string (k, Ioc inl, s)then kelse char sugg : = c;if (char error mended off) (f, sugg) then(char in string (sugg, Ioc int, s) [ sugg [ undefined; c)else undefined; cfi;set read mood (f)n;op ! = (char s, c) char : string (s) ! c;[ ] chargood digits = "0123456789abcdef"[ : radix];S := "+';fork to upb sfdo shame sfk = s/[ k ]; supp : = supp of sfk;get insertion (f, si of sfk);to rep of sfkdo char marker = marker of sfk;if marker = "d" thens plusab (supp [ "0"[ good digits ! "0"); zs : = trueelif marker = "z" thens plusab (supp I "0"i char c = ((zs i ".- "l "") + good digits) ! "0";(c ~ ". "[ zs := false); c)elif marker = "u" v marker = "+" thenif sign foundthen zs : = false; s plusab ("0123456789" ! "0")else char c = ("+-" + (marker = "u" l "._ "[ "")) ! "+";(c = %" v c =' .... I sign found : = true; s [ sp ] : = c)fielif marker = "v" v marker= ' .... thenif sign foundthen zs := false; s plusab ("0123456789"! "0~9elif char c; space foundthen c := "+-_.0123456789"! "+";(c= "+" v c =' .... I sign found := true; s [sp] := cJ: c ¢ "_."l zs : ~ false; sign found : = true; s plusab c)else c := "+-."! "+";(c= "+" v c= ..... [ sign found := true; s [sp] := c[ space found := true)fielif marker = "." thens plusab (supp [ "."1 ". "! ". ")ALGOL <strong>68</strong> Revised Report 205elif marker = "e" thens plusab (supp I "1o"1 "1o\ e'' ! "1o"; "lo");sig n found : = false;zs : = true; s plusab "+"; sp : = upb selif marker= "i" thens plusab (supp I "1 "1 "i± "! "]_ "; "J_");sign found:= false; zs := true; s plusab '%"; sp := upb selif marker= "b" thens plusab (flip + flop) ! flop; no sign : = trueelif marker = " a" thens plusab (supp I "._"[ char c; check pos (f); get char (f, c);c);no sign : = trueelif marker = "r"then skipflodod;if no sign then s : = s [2 : ] flend;10.3.6. Binary transput{In binary transput, the values obtained by straightening the elementsof a data list (cf. 10.3.3) are transput, via the specified file, one after theother. The manner in which such a value is stored in the book is definedonly to the extent that a value of mode M (being some mode from whichthat specified by simplout is united) output at a given position maysubsequently be re-input from that same position to a name of mode'reference to M'. Note that, during input to the name referring to amultiple value, the number of elements read will be the existing numberof elements referred to by that name.The current position is advanced after each value by a suitable amountand, at the end of each line or page, the appropriate event routine iscalled, and next, if this returns false, the next good character position ofthe book is found (cf. 10.3.3).For binary output, put bin (10.3.6.1.a) and write bin (10.5.l.h) may beused and, for binary input, get bin (10.3.6.2.a) and read bin (10.5.15).}a) proc 9 to bin = (ref file f, simplout x) [ ] char :c a value of mode 'row of character' whose lower bound is oneand whose upper bound depends on the value of 'book of f'and on the mode and the value of 'x'; furthermore,x = from bin (f, x, to bin (f, x)) c ;b) proc .~ from bin = (ref file f, simplout y, [ ] char c) simplout :c a value, if one exists, of the mode of the value yielded by 'y',such that c = to bin (f, from bin (f, y, c)) c ;
- 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 104 and 105: 206 van Wijngaa~den. et al.10.3.6.1
- 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