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.

190 van Wijngaarden, etal.composed of a procedure-yielding-FORMAT-NEST-routine.text whoseunit U is a new unit akin {1.1.3.2.k} to the meek-FORMAT-ENCLOSEDclauseof P, together with the environ necessary for U in E.10.3.4.10. General patterns10.3.4.10.1. Syntaxa) NEST general pattern{A341c} : NEST insertion{A341d},letter g{94a} symbol, NEST width specification{b} option.b) NEST width specification{a} : brief begin{94f} token,meek integral NEST unit{32d},NEST after specification{e} option, brief end{94f} token,pragment{92a} sequence option.c) NEST after specification{b} :and also{94f} token, meek integral NEST unit{32d},NEST exponent specification{d} option.d) NEST exponent specification{c} ..and also{94f} token, meek integral NEST unit{32d}.{Examples:a) g • g (-18, 12, -3) b) -18, 12, -3c) ,12,-3 d) ,-3}{aa) A value Y is output using a picture P whose pattern Q was yieldedby a general-pattern G as follows:• P is staticized;• the insertion of Q is performed;If Q is not parametrized (i.e., G contains no width-specification),then Y is output using put;otherwise, if the mode of V is specified by Lint or L real,then• if Q contains one (two, three) parameter(s), Y is converted to astring using whole (fixed, float);• the string is written using put;otherwise,• the event routine corresponding to on value error is called;• if this returns false, V is output using put, and undefined is called;• the insertion of P is performed.bb) A value is input to a name N using a picture P whose pattern is a'general' pattern as follows:• P is staticized;• (any parameters are ignored and) the value is input to N using get.}10.3.4.10.2. SemanticsThe yield, in an environ E, of a NEST-general-pattern P is a structuredvalue whose mode is 'GPATTERN' and whose fields, taken in order, are• {i} the yield of the insertion of P;ALGOL <strong>68</strong> Revised Report 191• {spec} a multiple value W whose mode is 'row of procedure yieldingintegral', having a descriptor ((1, n)), where n is the number ofconstituent meek-integral-units of the width-specification-option of P,and n elements determined as follows:For i = 1 ..... n,• the i-th element of W is a routine, whose mode is 'procedure "yielding integral', composed of a procedure.yieiding.integral-NESTroutine-textwhose unit U is a new unit akin {1.1.3.2.k} to the i-th ofthose meek-integral-units, together with the environ necessary for Uin E.10.3.5. Formatted transputa) mode format = struct (flex [1 : O} piece F);mode ~ piece = struct (int cp ¢ pointer to current collection ¢,count ¢ number of times piece is to be repeated ¢,bp ¢ back pointer ¢,flex [ 1 : 0 ] collection c) ;mode .~ collection = union (picture, collitem) ;mode .~ collitem = struct (insertion il,proc int rep ¢ replicator ¢,int p ¢ pointer to another piece ¢, insertion i2) ;mode .~ insertion = flex [1 : O] struct (proc int rep ¢ replicator ¢,union (string, char) sa) ;mode .~ picture =struct (union (pattern, cpattern, fpattern, gpattern, void)p, insertion i) ;mode .~ pattern = struct (int type ¢ of pattern ¢,flex [1 : O} frame frames);mode .~ frame = struct (insertion i,proc int rep ¢ replicator ¢,bool supp ¢ true if suppressed ¢,char marker) ;mode .~ cpattern = struct (insertion i,int type ¢ boolean or integral ¢,flex [ 1 : 0 ] insertion c) ;mode .~ fpattern = struct (insertion i, proc format pf) ;mode ~ gpattern = struct (insertion i, flex [1 : O] proc int spec) ;b)proc .~ get next picture = (ref file f, bool read, ref picture picture) void :beginbool picture found := false, format ended:= false;while - picture founddo ifforp off= 0 thenif format endedthen undefinedelif - (format mended off) (f)then ref int (forp off) := 1;cpof(Fofformatoff) [1] := 1;

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

Saved successfully!

Ooh no, something went wrong!