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.

176 van Wijngaarden, etal.[The positions where pragments (9.2.1.a) may occur in format-texts arerestricted. In general (as elsewhere in the language}, a pragment may notoccur between two DIGIT- or LETTER-symbols.}[aa) For formatted output, putf (10.3.5.1.a) and printf (or writer)(10.5.l.f) may be used and, for formatted input, getf (10.3.5.2.a) and readf(10.5.1.g). Each element in the data list (cf. 10.3.3) is either a format to beassociated with the file or a value to be transput {thus a format may beincluded in the data list immediately before the values to be transputusing that format).bb) During a call of putf or getf, transput proceeds as follows:For each element of the data list, considered in turn,If it is a format,then it is made to be the current format of the file by associate format(10.3.5.k) ;otherwise, the element is straightened (10.3.2.3.c) and each element ofthe resulting multiple value is output (hh) or input (if) using thenext "picture" (cc, gg) from the current format.cc) A "picture" is the yield of a picture. It is composed of a "pattern"of some specific 'TYPE' (according to the syntax of the TYPE-pattern ofthat picture), followed by an "insertion" (ee). Patterns, apart from'choice', 'format' and "general" patterns, are composed of "frames",possibly "suppressed", each of which has an insertion, a "replicator" (dd),and a "marker" to indicate whether it is a "d", "z", "i" etc. frame. Theframes of each pattern may be grouped into "sign moulds", "integralmoulds", etc., according to the syntax of the corresponding pattern.dd) A "replicator" is a routine, returning an integer, constructed froma replicator (10.3.4.1.2.c). For example, the replicator 10 gives rise to aroutine composed from int: 10; moreover, n(lim-1) is a "dynamic"replicator and gives rise to int: (lim-1). Note that the scope of areplicator restricts the scope of any format containing it, and thus it maybe necessary to take a local copy of a file before associating a format withit (see, e.g., 11.13}. A replicator which returns a negative value is treatedas if it had returned zero Ck" alignments apart).When a picture is "staticized", all of its replicators and other routines(including those contained in its insertions) are called collaterally. Astaticized pattern may be said to "control" a string, and there is then acorrespondence between the frames of that pattern, taken in order, andthe characters of the string. Each frame controls n consecutive charactersof the string, where n is 0 for an "r" frame and, otherwise, is the integerreturned by the replicator of the frame (which is always 1 for a "+", .....,".", "e", "i" or "b" frame). Each controlled character must be one of alimited set appropriate to that frame.ALGOL <strong>68</strong> Revised Report 177ee) An "insertion", which is the yield of an insertion (10.3.4.1.2.d), is asequence of replicated "alignments" and strings; an insertion containingno alignments is termed a "literal". An insertion is "performed" byperforming its alignments (ff) and on output (input) writing ("expecting"(11)) each character of its replicated strings (a string is replicated byrepeating it the number of times returned by its replicator).ff) An "alignment" is the character yielded by an alignment-code(10.3.4.1.2.d). An alignment which has been replicated n times isperformed as follows:• "k" causes set char number to be called, with n as its secondparameter;• "x" causes space to be called n times;• "y" causes backspace to be called n times;• "l" causes newline to be called n times;• "p" causes newpage to be called n times;• "q" on output (input) causes the character blank to be written(expected) n times.gg) A format may consist of a sequence of pictures, each of which isselected in turn by get next picture (10.3.5.b). In addition, a set of picturesmay be grouped together to form a replicated "collection" (which maycontain further such collections). When the last picture in a collection hasbeen selected, its first picture is selected again, and so on until the wholecollection has been repeated n times, where n is the integer returned byits replicator. A collection may be provided with two insertions, the first tobe performed before the collection, the second afterwards.A format may also invoke other formats by means of 'format" patterns(10.3.4.9.1).When a format has been exhausted, the event routine corresponding toon format end is called; if this returns false, the format is repeated;otherwise, if the event routine has failed to provide a new format,undefined is called.hh) A value V is output, using a picture P, as follows:If the pattern Q of P is a "choice" or "general' pattern,then Y is output using P (see 10.3.4.8.1.aa,dd, 10.3.4.10.1.aa);otherwise, Y is output as follows:• P is staticized;If the mode of V is "output compatible" with Q (see the separatesection dealing with each type of pattern),then• Y is converted into a string controlled (dd) by 0 (see theappropriate section) ;If the mode is not output compatible, or if the conversion isunsuccessful,

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

Saved successfully!

Ooh no, something went wrong!