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.

1<strong>68</strong>10.3.3.2. Formatless inputvan Wijngaarden, et al.[For formatless input, get (a) and read (10.5.l.e) may be used. Valuesfrom the book are assigned to each straightened name N from the data listas follows:aa) If the mode of N is specified by refL int, then first, the book issearched for the first character that is not a space (finding good positionson subsequent lines as necessary); next, the largest string is read fromthe book that could be "indited" (10.3.4.1.l.kk) under the control of somepicture of the form +n(kl)"."n(k2)dd or n(k2)dd (where kl and k2 yieldarbitrary nonnegative integers); this string is converted to an integer andassigned to N; if the conversion is unsuccessful, the event routinecorresponding to on value error is called.bb) If the mode of N is specified by refL real, then first, the book issearched for the first character that is not a space (finding good positionson subsequent lines as necessary); next, the largest string is read fromthe book that could be indited under the control of some picture of theform + n(kl)"._" n(k2)d or n(k2)d followed by . n(k3)d d or by ds., possiblyfollowed again by e n(k4)"." + n(k5)"." n(k6)d d or by e n(k5)"." n(k6)d d;this string is converted to a real number and assigned to N; if theconversion is unsuccessful, the event routine corresponding to on valueerror is called.cc) If the mode of N is specified by refL compl, then first, a realnumber is input (as in bb) and assigned to the first subname of N; next,the book is searched for the first character that is not a space; next, acharacter is input and, if it is not ".L" or "i", then the event routinecorresponding to on char error (10.3.1.3.cc) is called, the suggestion being"J_"; finally, a real number is input and assigned to the second subnameof N.dd) If the mode of N is specified by refbool, then first, the book issearched for the first character that is not a space (finding good positionson subsequent lines as necessary); next, a character is read; if thischaracter is the same as that yielded by flip (flop), then true (false) isassigned to N; otherwise, the event routine corresponding to on char erroris called, the suggestion being flop.ee) If the mode of N is specified by refL bits, then input takes place(as in dd) to the subnames of N one after the other (with new lines beingtaken as required).ff) If the mode of N is specified by ref char, then first, if the currentline is exhausted, a good position is found on a subsequent line; next, acharacter is read and assigned to N.gg) If the mode of N is specified by ref[ ] char, then input takes place(as in if) to the subnames of N one after the other (with new lines beingtaken as required)./ALGOL <strong>68</strong> Revised Report 169hh) If the mode of N is specified by refstring, then characters are readuntil either(i) a character is encountered which is contained in the stringassociated with the file by a call of the routine make term, or(ii) the current line is exhausted, whereupon the event routinecorresponding to on line end (or, where appropriate, to on page end, onphysical file end or on logical file end) is called; if the event routinemoves the current position to a good position (see 10.3.3), then input ofcharacters is resumed.The string consisting of the characters read is assigned to N (note that, ifthe current line has already been exhausted, or if the current position is atthe start of an empty line or outside the logical file, then an empty stringis assigned to N).}a) proc get = (ref file f, [ ] union tintype, proc (ref file) void) x) void :if opened off thenfor i to upb xdo case set read mood (f); set char mood (f); x [i] in(proc (ref file) void pf): pf (f) ,(intype it):begin[ ] simplin y = straightin it; char k; bool k emPtY;op ? = (string s) bool :¢ true if the next character, if any, in the current lineis contained in 's' (the character is assigned to 'k')and false otherwise ¢ilk empty ^ (line ended (f) v logical file ended (f))then falseelse (k empty l get char (f, k));k empty := char in string (k, Ioc int, s)fi;op ? = (char c) bool : ? string (c);prio ! -- 8;op ! = (string s, char c) char:¢ expects a character contained in 's'; if the characterread is not in 's', the event routine corresponding to'on char error' is called with the suggestion 'c'¢if (k empty I. check pos (f); get char (f, k));k empty : = true;char in string (k, Ioc int, s)then kelse char sugg : = c;if (char error mended of f) (f, sugg) then(char in string (sugg, Ioc int, s)I suggI undefined; c)

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

Saved successfully!

Ooh no, something went wrong!