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.

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 ;

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

Saved successfully!

Ooh no, something went wrong!