$A ESCAPE='@';INVERT=0;PAGE=60 @A TAB=4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72 @A CAPO=0;CAPSHO=0;MARK=2 @A CAP=0;CAPSH=0 @A PAGENO=1;BOTTOM=3; LINE=80 @C21 EDINBURGH REGIONAL COMPUTING CENTRE@C67 September 1977 @B3 @L1CMU layout: a document formatting program @P2 LAYOUT is a document formatting program, written in IMP. Its input is a character file consisting for the most part of the text of the document to be produced. This source file is read once by LAYOUT and the output document file is produced as it is read. Optionally, LAYOUT can also produce an updated source file, the purpose of which is described later. @P1The source file is treated as a sequence of 'text atoms' separated by delimiters, a delimiter being any number of spaces or newlines or both. A text atom thus corresponds to a normal word, possibly followed by punctuation. The program reads the text atoms and places them one by one, separated by %single spaces, in a line buffer until the next text atom would exceed the line length defined by the parameter LINE (parameters are described below). At this point, if right-justification has been requested (parameter JUST), the program inserts additional spaces in the line so that the last text atom in the line finishes at the right hand margin. The line is then output and the next line is built up in the same way. @B3%Example @B1 Source file: @A ESCAPE='&'; LEFT=4 &B1&L0 $A INVERT=0 $A TAB=4,9,13,17,21,25,29,33,37,41,45,49,53 $A LINE=75 $A CAP=0; CAPSH=0 $L1U Conventional storage allocation $P1 All computers have some form of storage for programs that are currently being executed and for the operands they access. This storage, referred to here as main store, has to be allocated in some way. In a simple single-programming computer all the main store can be allocated to one program (figure 1). In a multi-programming computer main store has to be shared between more than one program according to the requirements of the programs. Even when the number of programs being multi-programmed is small there are problems: $a INDENT=1 $B1$C-2 * Available programs may not conveniently fit into store; for example, if the store has 500K bytes available and all user programs currently awaiting execution require 200K bytes then 100K bytes of store will be wasted. $B1$C-2* If programs have a wide variety of storage requirements the main store may quickly become &%fragmented; for example, if in figure 2 program A terminates and the only available programs to run require 250K bytes, one will be loaded as in figure 3, leaving a gap of 50K bytes at the top of the store. If program B now terminates there will be a total of 250K bytes of store free, but a single program requiring 250K bytes will not be able to run because the store which is free is not in one contiguous area. &N&L0 $A TAB=+1 $B2$T13 50Kb unused $B2 USER PROGRAM A $T7 USER PROGRAM A $T13 USER PROGRAM C $B0 500Kb $T7 300Kb $T13 250Kb $B2$T7 USER PROGRAM B $B0$T7 200Kb $T13 200Kb unused $B2 operating system $T7 operating system $T13 operating system $B2 Figure 1 $T7 Figure 2 $T13 Figure 3 $A INDENT=0 $E &A LEFT=0 &B2 Output file (artwork added): &A LEFT=4 &B1&L0 %Conventional& storage& allocation All computers have some form of storage for programs that are currently being executed and for the operands they access. This storage, referred to here as main store, has to be allocated in some way. In a simple single-programming computer all the main store can be allocated to one program (figure 1). In a multi-programming computer main store has to be shared between more than one program according to the requirements of the programs. Even when the number of programs being multi-programmed is small there are problems: * Available programs may not conveniently fit into store; for example, if the store has 500K bytes available and all user programs currently awaiting execution require 200K bytes then 100K bytes of store will be wasted. * If programs have a wide variety of storage requirements the main store may quickly become %fragmented; for example, if in figure 2 program A terminates and the only available programs to run require 250K bytes, one will be loaded as in figure 3, leaving a gap of 50K bytes at the top of the store. If program B now terminates there will be a total of 250K bytes of store free, but a single program requiring 250K bytes will not be able to run because the store which is free is not in one contiguous area. 50Kb unused USER PROGRAM A USER PROGRAM A USER PROGRAM C 500Kb 300Kb 250Kb USER PROGRAM B 200Kb 200Kb unused operating system operating system operating system Figure 1 Figure 2 Figure 3 &A LEFT=0 &N The same output would be produced by LAYOUT from the following source file: &A LEFT=4 &B1&L0 $A TAB=4,9,13,17,21,25,29,33,37,41,45,49,53 $A LINE=75 $L1U @CONVENTIONAL STORAGE ALLOCATION $P1 @ALL COMPUTERS HAVE SOME FORM OF STORAGE FOR PROGRAMS THAT ARE CURRENTLY BEING EXECUTED AND FOR THE OPERANDS THEY ACCESS. @THIS STORAGE, REFERRED TO HERE AS MAIN STORE, HAS TO BE ALLOCATED IN SOME WAY. @IN A SIMPLE SINGLE-PROGRAMMING COMPUTER ALL THE MAIN STORE CAN BE ALLOCATED TO ONE PROGRAM (FIGURE 1). @IN A MULTI-PROGRAMMING COMPUTER MAIN STORE HAS TO BE SHARED BETWEEN MORE THAN ONE PROGRAM ACCORDING TO THE REQUIREMENTS OF THE PROGRAMS. @EVEN WHEN THE NUMBER OF PROGRAMS BEING MULTI-PROGRAMMED IS SMALL THERE ARE PROBLEMS: $A INDENT=1 $B1$C-2 * @AVAILABLE PROGRAMS MAY NOT CONVENIENTLY FIT INTO STORE; FOR EXAMPLE, IF THE STORE HAS 500@K BYTES AVAILABLE AND ALL USER PROGRAMS CURRENTLY AWAITING EXECUTION REQUIRE 200@K BYTES THEN 100@K BYTES OF STORE WILL BE WASTED. $B1 $C-2* @IF PROGRAMS HAVE A WIDE VARIETY OF STORAGE REQUIREMENTS THE MAIN STORE MAY QUICKLY BECOME &%FRAGMENTED; FOR EXAMPLE, IF IN FIGURE 2 PROGRAM @A TERMINATES AND THE ONLY AVAILABLE PROGRAMS TO RUN REQUIRE 250@K BYTES, ONE WILL BE LOADED AS IN FIGURE 3, LEAVING A GAP OF 50@K BYTES AT THE TOP OF THE STORE. @IF PROGRAM @B NOW TERMINATES THERE WILL BE A TOTAL OF 250@K BYTES OF STORE FREE, BUT A SINGLE PROGRAM REQUIRING 250@K BYTES WILL NOT BE ABLE TO RUN BECAUSE THE STORE WHICH IS FREE IS NOT IN ONE CONTIGUOUS AREA. $A TAB=+1 $B2$T13 50@KB UNUSED $B2 .USER .PROGRAM @A $T7 .USER .PROGRAM @A $T13 .USER .PROGRAM @C $B0 500@KB $T7 300@KB $T13 250@KB $B2$T7 .USER .PROGRAM @B $B0 $T7 200@KB $T13 200@KB UNUSED $B2 OPERATING SYSTEM $T7 OPERATING SYSTEM $T13 OPERATING SYSTEM $B2 @FIGURE 1 $T7 @FIGURE 2$T13@FIGURE 3 $A INDENT=0 $E &A ESCAPE='@'; LEFT=0 @B2 Notes @A INDENT=1 @B1@C-2* The first file is in upper and lower case; the parameters INVERT, CAP and CAPSH are all set to zero to indicate this (parameters are described in detail below). The second source file is all in upper case. LAYOUT provides for the application of case shift conventions to permit the representation of upper and lower case within a restricted character set. @B1@C-2 * An effect can often be achieved in different ways: for example, the figures at the end could have been produced using a $L directive (see below). @B1@C-2* Spaces in a source file serve only to separate words, or words and directives (if necessary). Unnecessary spaces are ignored; for example, '$C-2@ *' and '$C-2*' have the same effect. @B1@C-2 * The newline positions in the output do not in general correspond to those in the source. @N@C-2* The '@%' in front of 'fragmented;' causes the word to be underlined, but not the ';'. @B1@C-2* To improve readability, it is usual to structure the source file so that each directive or group of directives (other than $T or $C) appears at the start of a line. This is not necessary however. @A INDENT=0 @B3%Parameters @P1 LAYOUT's behaviour depends on the values of program parameters, each of which controls some aspect of the production of the document file. The program assigns initial values to the parameters, but the user can assign new values at any stage of the processing. The parameters and their meanings are listed below, with their initial values in brackets. @A INDENT=6 @B2@T1 TOP @T4 (2) @T6 Blank lines output at the top of each document page. @B1@T1 BOTTOM @T4 (4) @T6 Blank lines output at the bottom of each document page. @B1@T1 LEFT @T4 (0) @T6 Spaces inserted to the left of each document line. @B1@T1 PAGE @T4 (60) @T6 Document page size (exclusive of TOP and BOTTOM). If set to 0, all page turns (and consequential effects) are suppressed. @B1@T1 LINE @T4 (72) @T6 Document line length (exclusive of LEFT). @B1@T1 SLINE @T4 (80) @T6 Updated source line length (used by LAYOUT when generating the updated source file). @B1@T1 NLS @T4 (1) @T6 Physical line spacing (i.e. new lines per output line). @B1@T1 SGAP @T4 (2) @T6 Spaces between sentences. @B1@T1 PGAP @T4 (3) @T6 Spaces at the start of each paragraph. @B1@T1 PAGENO @T4 (0) @T6 Page number: if non-zero, updated and printed centrally on the middle line of the BOTTOM lines - nearer the foot if BOTTOM is even. @B1@T1 START @T4 (1) @T6 (START-1) pages are constructed by LAYOUT but are not sent to the document file: thus the STARTth page generated is the first one output. The setting of PAGENO is not relevant to the operation of START. @B1@T1 FINISH@T4 (9999)@T6 LAYOUT stops after generating (FINISH-START+1) pages, unless it has been stopped earlier by a $E directive (see below). @B1@T1 JUST @T4 (0) @T6 non-zero - output is right-justified: that is, extra @B0@C+3spaces are inserted so that each line has exactly the @B0@C+3 length specified by parameter LINE. @B0zero - output is not right-justified. @N@T1 MARK @T4 (0) @T6 Specifies the type of page separation marker, to be printed at the head of each page of the output document: @V =0 No page separation marker @V =1 Separation marker is a line with an '=' sign printed @B0@C+3 at each end @B0All other values: Separation marker is the new page (Form @B0@C+3 Feed) character. @B1@T1 TAB @T4 (9,17,25,33,41,49,...) @C+2 Tab settings. Up to 25 can be specified. @B1@T1 INDENT @T4 (0) @T6 Indentation level: the number of the tab whose value gives the column at which each new output line starts. @B1@T1 INVERT @T4 (1) @T6 Case inversion of the source file: @Vnon-zero - LAYOUT treats upper case source as @B0@C+3 representing lower case (and lower case as upper case) @V zero - no inversion of the source file text. @B1@T1 INVO@T4 (1)@T6 Case inversion. Similar to INVERT, but used by LAYOUT when generating the updated source file. @B1@T1 IGNORE@T4(0)@T6If IGNORE is set non-zero, LAYOUT generates a new page in the output file, and thereafter ignores the contents of the source file, apart from occurrences of the $A directive and the $E directive (see below), which are obeyed. @B1@T1 ASCII@T4(1)@T6 When ASCII is non-zero, LAYOUT achieves underlining in the document file by use of the Carriage Return (CR) character and overprinting. If ASCII is zero, LAYOUT represents the underlining of a character in the document file by setting the eighth bit of its code. On most systems this bit is ignored. Note that underlining can also be represented in the %source file by use of the eighth bit. @A INDENT=0 @B2%Symbol@ parameters @P1 There are also parameters whose values are symbols rather than numbers. They relate to LAYOUT's interpretation of the source text, and generation of the updated source, rather than its generation of the document file. @P1 For example, it is possible to produce a document containing upper and lower case from a source file containing only upper case text (see the example at the start). This is done using the INVERT parameter: if it is non-zero, all the source text is inverted to the other case (usually upper case changed to lower case). If however a source text atom starts with the symbol which is the value of the symbol parameter 'CAPSH' (capital shift), then that text atom will be converted back to upper case. In the same way, the 'CAP' symbol, or the 'UND' symbol, causes the letter following to be capitalised, or underlined, respectively. The other symbol parameters work similarly. @P1 The following is a complete list of symbol parameters, with their meanings and default values: @B1 @A INDENT=5 @N@T-4 CAP @T3 ('@@') @T5 Capital marker - single character. @B1@T-4 UND @T3 ('@_') @T5 Underline marker - single character. @B1@T-4 CAPSH @T3 ('.') @T5 Capital shift - complete atom (recognised at the start of a text atom only). @B1@T-4 UNDSH @T3 ('@%') @T5 Underline shift - (remainder of) text atom, excluding any terminal punctuation symbol. @B1@T-4 CAPO @T3 ('@@') @T5 Symbol used by LAYOUT as capital marker in updated source file. @B1@T-4 UNDO @T3 ('@_') @T5 Symbol used by LAYOUT as underline marker in updated source file. @B1@T-4 CAPSHO @T3 ('.') @T5 Symbol used by LAYOUT as capital shift in updated source file. @B1@T-4 UNDSHO @T3 ('@%') @T5 Symbol used by LAYOUT as underline shift in updated source file. @B1@T-4 ESCAPE @T3 ('$') @T5 Directive marker, if immediately followed by a letter (directives are described below). If followed by a symbol other than a letter, ESCAPE causes the symbol to be treated literally - it suppresses any special significance which the symbol might have. @A INDENT=0 @P2 Further details of the parameters are given under 'Notes on the use of LAYOUT', below. @B3%Directives @P1 The overall behaviour of the program is controlled by the parameters. However, it is sometimes necessary to indicate that a particular action should be taken at some specified point during the production of the document. It is also necessary to be able to assign values to the program parameters. Both requirements are catered for by directives, which can be interspersed with the text in the source file. @P1When a directive is encountered in the source, it causes a specific action to be taken at that point; e.g. take a new page or paragraph, move to the third tab position, take two blank lines. It should be noted that values of program parameters can affect the actions invoked by some of the directives; e.g. the effect of the directive $T depends on the value of the parameter TAB. @P1 The action caused by the use of the Assign directive ($A) is to change the values of specified program parameters. Thus: @B@T3 $A INVERT=0; TAB=4,8,12,20,45,50; INDENT=2 @Bmight appear in the source file (the format of directives is described below). @P1In summary then, the program's behaviour is controlled by the values of %parameters. The user can include %directives in the source text to carry out specific actions; some of their effects are dependent on program parameters. The parameters themselves can be altered by use of the Assign ($A) directive. @N@P1As explained above, directives can be interspersed with the source text. Normally, each directive is made up of the directive marker (the value of the ESCAPE parameter, by default '$') followed immediately by a letter, followed optionally by a number which may be signed. For directives which can have a number specified, a value of 1 is assumed if the number is omitted. @A INDENT=5 @B2@V6 @T1 $C @T2 Column: @T5 Set column position (absolute or relative). @B0 @T3 $Cn @T5 Set next print position on the current line of the output document file to column n. @B0 @T3 $C+n @T5 Increase column position by n. @B0 @T3 $C-n @T5 Decrease column position by n. @B1@T5 Note that the first print position on each line is column 1. @B@T1 $T @T2 Tab: @T5 Move to tab setting (absolute or relative). @B0 @T3 $Tn @T5 Set column position to tab n. @B0 @T3 $T+n @T5 Tab forward n times (at least one space for each). @B0 @T3 $T-n @T5 Tab backwards n times (at least one space for each). @B1Note that tab 0 can be used, explicitly or implicitly. It is always equivalent to column 1. @B@T1 $In @T2 Indent: @T5 Take a new line, and start it at tab position n. @C+2 $In is thus equivalent to $B0$Tn. @B@T1 $Bn @T2 Blank: @T5 Leave n blank lines, or take a new page if less than n lines remain on the current page. In the latter case, blank lines are not then inserted at the top of the new page. If a new page was generated just prior to the $B being encountered in the source file, blank lines are only generated by the $B if the new page was caused by a $N or $V directive (see below). @B0 Note that $B0 ('no blank lines') causes a new line to be taken in the output file. @B@T1 $Pn @T2 Paragraph: @T5 Take a new paragraph: that is, leave n blank lines, indent if applicable, and increment the column position by PGAP. A new page is taken if fewer than n+2 lines remain on the current page; blank lines are not then inserted at the top of the new page. @B@T1 $N @T2 New page: @T5 Take a new page, unless the current page is empty; however the inclusion of any line, including a blank one, is sufficient to make a page non-empty (so that $N$B$N would result in a blank page). No numeric value is required, and is ignored if given. @B@T1 $Vn @T2 Verify: @T5 Take a new page if fewer than n lines are left on the current page. This directive can be used to ensure that there is sufficient space on the current page before starting a new section, say, or a table which is not to be broken by a page turn. It can also be used in combination with $B: for example, $V10$B10 guarantees that 10 blank lines, unbroken by a page turn, will be generated in the output file. @N@T1 $Ln @T2 Lines: @T5 Follow the explicit line structure of the source file for n lines. After the numeric value, if present, one or more modifiers may be added to indicate operations to be applied to each of the n lines. The complete directive should be at the end of a source line or on a line by itself; the n lines are the n %following lines. @BThe spacing of text atoms within the n lines is preserved, no right justification is performed, and directives are illegal (but code conversion is carried out as usual). @b1 If n is given as 0, this implies that an %indefinite number of source lines is to be treated in this way. The effect extends to the next directive encountered, which must be at the start of a source line. @BThe modifiers, which can be given in upper or lower case, are: @B0 @T7 C: capitalise all letters @B0 @T7 U: underline all symbols (including spaces) @B0 @T7 M: 'middle' (centre) the text of each line @B0 @T7 I: apply indentation to each line (if INDENT is @V @T7@C+3 currently non-zero) @B1@T1 $J @T2 Justify:@T5 Terminate the current output line, and right-justify it if parameter JUST is non-zero. @B1@T1 $E @T2 End: @T5 Stop processing the source text. This directive must be given. @B@T1 $A @T2 Assign: @T5 Assign values to parameters. The rest of the source line consists of a number of parameter assignment statements separated by semi-colons. The semi-colons may be followed, but not preceded, by one or more spaces. Trailing spaces in the line are not permitted. The form of the assignment statement is illustrated in the examples below. @B1 The assignment operator can be '=', '<', '<=' or '>'. The existing value of any parameter can be stored (by the use of '<') and later retrieved (by the use of '>'). Further, a series of values for any parameter can be stored, by repeated use of '<'; the '>' operator then retrieves them on a 'last-in first-out' basis. @B1 The '<=' operator indicates that the current value of the parameter is to be stored and a new value is to be assigned. If only '<' is used then no new value is assigned - the parameter retains its current value. @B1 The right-hand side of an assignment (the new value) can be: a numeric value (e.g. 10); a signed numeric value (e.g. +2) - this is %added to the parameter's current value; a symbol constant (e.g. '@@'); or a parameter (e.g@. CAP) - indicating that the parameter on the left-hand side is to be given the current value of the parameter on the right. @B1 In the case of the TAB parameter, up to 25 values may be specified. If, in an assignment of TAB, the number of values specified is less than before, the remaining elements of the TAB setting are not altered. @N Code conversion operations can be disabled by setting the associated parameter(s) to zero. @BExamples:@T8 $A LEFT=4; PAGE=64; LINE=80; JUST=1 @B1 @T8 $A CAP=0; ESCAPE=UND; UND='#' @B1 @T8 $A TAB<=4,10,18,20; INDENT=2 @B1@T8 $A TAB>; INDENT=-1 @A INDENT=1;TAB=5 @B1@T-1 %Notes@ on@ the@ use@ of@ LAYOUT @B@C2 1) The source file is read (an atom at a time) by LAYOUT, which uses internally a character set in which upper and lower case letters and underlined characters are represented by single codes. This character set is full ASCII extended to eight bits, with the eighth bit signifying underlining, and it is an acceptable code for the source file and the updated source file. @B1 In order to decide how each character input is to be represented, the program first examines the value of the parameter INVERT. If INVERT is greater than zero, upper case letters are converted to lower case (and lower case letters to upper case); if INVERT is zero, no such conversion takes place. Any case shift or underline parameters associated with the character are applied %after INVERT is used. @B@C2 2) A directive in the source file has the effect of delimiting text atoms and, except for $T and $C, also causes a new line to be taken at the correspond- ing point in the output file. Right justification is not applied to an output line terminated in this way unless the directive in question is $J. @B1@C2 3) As explained earlier, LAYOUT treats a delimiter, be it one or a number of spaces or new lines, simply as a gap between text atoms. Thus the line structure of the source file will not be preserved unless special action is taken. For example, it should be borne in mind that if a newline is required in the final document, some directive will be needed to get it there (apart from the newlines following a $L directive). A newline can be forced using, for example, $B0 or $V. @B@C2 4) A sentence is assumed to end when a text atom is encountered which finishes with a full stop or a question mark or exclamation mark, and the next text atom starts with a capital letter. By default, LAYOUT takes two spaces after the end of a sentence, although this can be changed (SGAP parameter). See also note 10 below. @B@C2 5) The main purpose of the Lines directive is to simplify the handling of titles and headings. Note that when underlining has been requested (using the U modifier), each %complete line, including any spaces, is underlined. Similarly, when the M modifier is used, each complete line is 'middled', so that if a line starts with some spaces, the text of the line will appear off-centre. @B@C2 6) Directives can be given in upper or lower case, as can the $L directive modifiers. @B@C2 7) A directive need not be followed by a space or newline unless the text immediately following could be taken as part of the directive: @B1@T+1 e.g.@C+4 $T4 24 items were ... @N@C2 8) Combinations of the capitalise and underline parameters. @B1 The following combinations of capitalise and underline parameters are valid. The use of CAP and CAPSH in the examples assume that INVERT is non-zero. @B1@T+1 .@% capital shift, underline shift @C+4.@%IMP->%IMP @B1@T+1 .@_ capital shift, underline marker @C+3.@_IMP->_IMP @B1@T+1 @%@@ underline shift, capital marker @C+3@%@@IMP->%Imp @B1@T+1 @_@@ underline marker, capital marker @C+2@_@@IMP->_Imp @B1@C2 9) Where the text of a document contains symbols which are by default the values of symbol parameters, an Assign directive can be used to assign other values to the parameters in question, or to disable them; e.g. @B1@T+2 $A CAP=0; UNDSH=0; UND=0 @B0@T+2 $A CAPO=0; UNDSHO=0; UNDO=0 @B0@T+2 $A INVERT=0; INVO=0 @B0@T+2 $A INDENT=3 @B0@T+2 $B2 @%BEGIN @B0@T+2$B0 @%RECORDFORMAT RF(@%REAL A,B) @B0@T+2$B0 @%RECORDARRAY FILE(1:20) (RF) @B0@T+2$B0 FILE(1)@_A=17@@-2 @B0@T+3 . @B0@T+3 . @BNote in this example that INVERT was set to 0 to suppress the upper case to lower case conversion on input. Note also the use of $B0 to cause newlines to be taken in the output file. @B@C1 10) The ESCAPE parameter, by default '$', will cause the immediately following symbol, if not a letter, to be treated literally, i.e. without any special significance which it might otherwise have. Thus it could have been used repeatedly in the example above, instead of disabling the capitalise and underline parameters. It can also be used to prevent the erroneous recognition of the end of a sentence, or to cause two text atoms to be treated as one. @B1@C+4e.g.@T+1 e.g$@. Ian and Fred,@C+3 A.N$@. Other, @C+3@%Part$ One @B1 In the first two examples, '$' is used to prevent an end of sentence from being recognised. In the third example, it removes the space character's significance as an atom delimiter, thus causing the two words to be treated as one text atom, so that the '@%' (UNDSH) underlines both words and the intervening space. @B@C1 11) Partial processing. @B1Suppose that a large document file of thirty pages is found to have mistakes on four non-contiguous pages. It would be wasteful, after correcting the errors, to reprocess the whole source file by LAYOUT, although extracting the corrected pages and creating a separate LAYOUT source file from them is time-consuming and prone to error. @B1 The technique suggested is to edit the source file as follows: @A INDENT=2 @N@C-2* Correct the errors. @B1@C-2* Insert an assignment of the parameter IGNORE to a non-zero value at the start of the file. @B1@C-2* Insert assignments of IGNORE before and after the source corresponding to each complete page required, setting it respectively zero and non-zero. If the pages are to be numbered, it is also necessary to assign PAGENO when IGNORE is turned off (set to zero). @A INDENT=1 @B1 After the edited file has been processed by LAYOUT to obtain the corrected pages, it should be re-edited to remove all occurrences of IGNORE. @B1 When IGNORE is set non-zero (i.e. activated), LAYOUT takes a new page in the output file if the current page is non-blank, and thereafter ignores the contents of the source file, %apart from occurrences of $A or $E. Thus settings of TAB, INDENT, etc are obeyed, as is any setting of IGNORE to zero. After such a setting, LAYOUT processes the source in the usual way. @B1 The parameters START or FINISH or both can also be used to specify partial processing of a source file. Note in this case that if there is unwanted text at the start of the file it is nonetheless processed by LAYOUT - it is merely not output. @B1 A simple method for suppressing the processing of the end of a source file is to insert $E at the required stopping point. @B1 An updated source file should not normally be generated when IGNORE or FINISH is used, as it will in general be incomplete. @B1@T0 12) Use of $T and $C. @B1 The effect of the Tab directive ($T) is determined by the value of the vector parameter TAB. By default the nth tab is set to 8*n+1, so that, if TAB had not been reset, $T5 in the source file would cause the next text atom to start at column position 41. The TAB parameter can of course be changed by use of the Assign directive, but note that the $T0 position corresponds to column 1, and there is no way of changing this. @B1 For tables and other special layouts, it is first necessary to work out how many different fields are involved and find an approximate starting position for each. An Assign directive can then be inserted before the start of the table, to set the TAB parameter to the required column positions, and Tab directives can be used within the text to select the appropriate fields. Any subsequent adjustments can usually be done merely by altering the TAB parameter setting. @B1 When it is necessary to move an item in a table a few spaces left or right, a $C directive can be used: $C+1, $C-2, etc. @B1@T+2 e.g.@T5@C-2 $B0$T2 8 $T3 9 $T4$C-1 10 @B0@T5@C-2 $B0$T2 A $T3 B $T4 C @Bwould give @B0@T+5 8 @T+1 9 @T+1 @C-1 10 @B0@T+5 A @T+1 B @T+1 C @BNote that, when $C+n is used after a text atom, n spaces %in@ total are inserted between it and the next text atom. Thus if two spaces, instead of the usual one, were required between two text atoms, $C+2 could be used. @NThe $C and $T shifts backwards are only valid when the columns thus traversed are all blank. @B1@T+2 e.g.@C+2 $T3CAT $T2THE $T4SAT @C+2 is not valid. @BAny attempt to move from right to left over text on a line by use of the $T or $C directive causes the error: * OVER TEXT @C+3 (A list of errors is given below). @BIndentation is handled by setting the value of the parameter INDENT to the tab number specifying the column to be treated as the left hand margin. The indentation level can be overridden using $T or $C directives. The example at the start uses this technique when printing the asterisks to the left of each sub-paragraph ('$C-2 *'). @B1 Note that when right-justification is switched on (i.e@. when JUST is non-zero), the extra spaces required to pad out the line are distributed within the section of the line %following the last column specified by a $C or $T directive. Thus any text positioned explicitly is not moved as a result of right-justification. However the '$C-2 *' technique used in the example at the start is not satisfactory when right-justification is switched on, as the text following the asterisk may be shifted. @B0 '$C-2 * $C+1' could be used instead. @B1@T0 13) @T1 When the parameter PAGE is set to zero, all page turns are suppressed. This can be helpful when a large document is being prepared, as the resulting output is similar to a 'galley proof', and pagination details can be worked out simply by using a ruler on a listing of the output file. @A INDENT=0;TAB=4 @B3%Updated@ Source@ File @P1A secondary function of LAYOUT is to produce an updated source file, if one is specified in the command invoking LAYOUT. @P1The updated source file has the same effect as the user's original file: using it instead of the original, the same output file would be produced by LAYOUT. In addition, however, the updated source file has a line structure similar to that of the output file, subject to restrictions of line length imposed by parameter SLINE. Thus the facility is useful when the original file's line structure has become fragmented as a result of editing. @P1 Further, since separate parameters are provided for the treatment of the source file and of the updated source file (INVERT/INVO, CAP/CAPO, UND/UNDO, etc), it is possible to obtain an updated source file in upper case only from an original file in upper and lower case, and vice versa. Note that it is then necessary to change the symbol parameter assignments at the start of the updated source file, before processing %it by LAYOUT. @B3%Faults @P1If an error is detected in the source file an explanatory message is printed on the user's terminal, followed by the offending source line as it would appear in the updated source file. The messages are: @A INDENT=8 @N@T1 * Faulty format at Z @T8 'Z' is the first invalid symbol. @B1@T1 * Unknown name @T8 An unknown parameter is given in a $A directive. @B@T1 * Unknown directive Z @T8 'Z' being the invalid letter. @B@T1 * Spurious directive Z @T8 'Z' is the directive involved. Caused by a directive in the lines following a $L directive. @B@T1 * Out of bounds Z @T8 Tab number given or implied is greater than 25. @B@T1 * Off page Z @T8 'Z' is the directive involved (T or C). Attempt to exceed right hand margin. @B@T1 * Over text Z @T8 'Z' is the directive involved (T or C). Attempt to move from right to left over text on the current output line. @B@T1 * Too many parameter values @T8 LAYOUT has run out of space for stored parameter @B0@T1@C+2 nested - run abandoned@T8 values. @B1@T1 * No value stored @T8 '>' has been used in a $A directive but no value is stored for the relevant parameter. @B1@T1 * E directive missing @T8 End-of-file has been reached without a $E directive being encountered. @A INDENT=0 @B3%Implementation @P1 The program is held on EMAS in the library CONLIB.DOCLIB. The command to invoke LAYOUT is of the form: @B@T2 LAYOUT (source file / output file, updated source file) @BThe updated source file need not be given. Its presence implies that the generation of updated source is required. @P1 LAYOUT is also available on the RCO 2980, under VME/B, by use of the macro LAYOUT, with parameters SOURCE, DOCUMENT and UPDATEDSOURCE nominating the files accordingly. The first two parameters must be specified. @P1 These implementations are not supported by the ERCC Advisory Service; however, queries or suspected faults should be directed to John Murison, ERCC. @P1 Versions of LAYOUT have also been implemented on some other computer systems with IMP compilers; contact the relevant systems staff regarding availability and support. @B3%Author @P1LAYOUT was written by Hamish Dewar, formerly of the Department of Computer Science, University of Edinburgh. @B2@C66 John M@. Murison @E