___________________________________ LAYOUT: DOCUMENT PRODUCTION PROGRAM The basic function of LAYOUT is to produce an appropriately paged and formatted document from a source file in which the required layout is indicated by __________ directives interspersed with the text; in general, the spacing and line-structure of the source are not significant. A secondary function is to output an updated source file similar to the original except that the line-structure follows that of the formatted document (subject to limitations of line length). In addition the program optionally provides for the application of shift conventions to the source (and updated source) to permit the representation of upper and lower case letters and underlined characters within a restricted character set. Code conversion is understood to be carried out outside the layout program proper, which uses a character set in which both upper and lower case letters and underlined characters are represented by single codes. This character set is full ASCII extended to 8 bits, with the eighth bit signifying underlining, and it is an acceptable code for the source (and updated source) where a system permits it. The input source file is treated as a sequence of ____ text atoms separated by __________ delimiters; a delimiter is any number of spaces, newlines and/or directives. The basic operation of the program is to read text atoms from the source file and place them - separated by single spaces - in a line buffer, until the next text atom would exceed the line length defined for the formatted document. At this point the program may insert additional spaces in the line if justification is requested. The line is then output and a new line is built up. A (non-empty) line is also terminated on reading most directives; justification is not applied to a line terminated in this way. The Tab and Column directives explicitly control the placing of text atoms in the line buffer by defining the column position at which the next atom is to start. Whenever a new line is started, the current column position is set to 1, unless indentation is in force, in which case the column position is set to the tab setting associated with the current indentation level. Column positions are numbered from 1 up to the line length. The effect of most directives and certain aspects of the automatic operation of the program depend in part on the values of a number of layout __________ parameters. The value of any parameter may be altered dynamically by means of the Assign directive. Some parameters are scalars and some are vectors (tab-settings, for example). An individual parameter takes either numeric values, or symbol values, or boolean values - depending on the significance of the parameter. The initial value of each parameter is shown in parentheses in the following lists. 1 __________________ NUMERIC PARAMETERS TOP (2) blank lines at top of page BOTTOM (4) blank lines at bottom of page LEFT (0) spaces at left of page PAGE (60) page size (exclusive of TOP and BOTTOM) LINE (72) line length (exclusive of LEFT) SLINE (80) source line length (for updated output) NLS (1) physical line spacing (newlines per line ) SGAP (2) spaces between sentences PGAP (3) spaces at start of paragraph SECTNO (0) section number (not yet implemented) PAGENO (0) page number (printed and updated only if non-zero) START (1) actual page number at which printing of document is to start _________________ SYMBOL PARAMETERS ESCAPE ('$') [followed by letter] - directive marker [otherwise] - causes immediately following source symbol to be treated literally (ie not as marker or separator) CAP ('@') capital marker - single character UND ('_') underline marker - single character CAPSH ('.') capital shift - complete atom (recognized at start of source atom only) UNDSH ('%') underline shift - (remainder of) atom (excluding terminal punctuation) CAPO ('@') capital marker for output (updated source) UNDO ('_') underline marker for output CAPSHO ('.') capital shift for output UNDSHO ('%') underline shift for output 2 __________________ BOOLEAN PARAMETERS ASCII (on) on - formatted output is to be in ASCII code with underlining implemented by Carriage Return and overprinting JUST (off) on - formatted output is to be justified off - not justified MARK (off) on - page separation markers are to be printed at the head of each page of the formatted document off - no page separation markers _________________ VECTOR PARAMETERS TAB tab settings 3 __________ DIRECTIVES All directives apart from Column and Tab imply termination of a (non-empty) line. For directives which have a numeric argument, a value of 1 is assumed if the argument is omitted. $C Column: set column position (absolute or relative) $Cn: set column position $C+n: increase column position by n $C-n: decrease column position by n $T Tab: move to tab setting (absolute or relative) $Tn: set column position to TAB(n) $T+n: tab forward n times (at least one space for each) $T-n: tab backward n times (at least one space for each) $I Indent: set indentation level (absolute or relative to current value of INDENT) for one line $In: indent to TAB(n) $I+n: indent to TAB(INDENT+n) $I-n: indent to TAB(INDENT-n) $Bn Blank: leave n blank lines $Pn Paragraph: take new paragraph (that is, leave n blank lines, indent if applicable, and increment column position by PGAP); a new page is taken if fewer than n+2 lines remain on the current page; blank lines are not inserted at the top of a page $N Newpage: take new page (unless current page is empty) $Vn Verify: take new page if fewer than n lines are left on the current page $Ln Lines: follow explicit line-structure of source for n lines. After the numeric argument, if present, one or more _________ modifiers may be placed to indicate operations to be applied to each of the n lines. The complete $Lnm directive should always occur at the end of a source line; the n lines are the n _________ following lines. The spacing of atoms within the n lines is preserved, no justification is performed, and directives are illegal (but code conversion is carried out as usual). The modifiers are: C: capitalise all letters U: underline all symbols (including spaces) M: centre the text of each line I: apply indentation (if any) to each line 4 $A Assign: assign values to parameters. The rest of the source line consists of a number of parameter assignment statements separated by semi-colons. The form of the assignment statement is illustrated in the following examples. It is not required that the representation of a value should match the type of the parameter (for example, quoted symbol for symbol parameter). Boolean parameters are defined to be true (or on) if they have a non-zero value, and false (or off) if they have a zero value. If the number of values specified in a vector assignment is less than the vector bound, the remaining elements in the vector are not altered. Code conversion operations can be disabled by setting the associated parameter(s) to zero. $A LEFT=4; PAGE=64; LINE=80; JUST=1 $A CAP=0; ESCAPE=UND; UND='#' %A TAB=4,10,18,20; INDENT=2 $E End: marks end of source document _____________ ERROR REPORTS If an error is detected in the source file, an explanatory comment is printed on the report stream, followed by the offending source line as it appears in the _______ updated source file. ______________ IMPLEMENTATION PDP-9/15 command: .LAYOUT source / document , updated-source error reports are output to stream zero EMAS COMMAND: LAYOUT (source/document,updated source) error reports are output to .TT 5 ____________ NOTES ON USE When preparing a source file from a manuscript or normal typescript, it will be found that the use of the code conversion markers soon becomes automatic. Note the following valid combinations: capital shift, underline shift: .% capital shift, underline marker: ._ underline shift, capital marker: %@ underline marker, capital marker: _@ The insertion of Paragraph directives and Blank directives as required is also fairly straightforward. There is no point at this stage in seeking to maintain a uniform line length in the source file. It is always necessary to bear in mind that if a newline is required in the formatted document, some directive will be required to get it there (apart from lines following a Lines directive). When dealing with source material other than running text, it is usually easier to work out what assignments and directives are required in advance and mark up the manuscript accordingly. Headings can often be handled most conveniently by using the Lines directive with some selection of the Capitalise(C), Underline(U), Centre(M), and Indent(I) modifiers. For tables and other special layouts, it is first necessary to establish how many different fields are involved and an approximate starting position for each field. An Assign directive can then be inserted before the text of the table to set the TAB vector to the required column positions, and Tab directives can be used within the text to select the appropriate fields. The hope is that if a test run shows that the layout is not quite right, it should be possible to correct it simply by altering the tab settings. Indentation is handled by the use of an Assign directive specifying the required indentation level (often accompanied by new values for TAB), for example: $A INDENT=2; TAB=4,10. When it is necessary to override the automatic indentation for single lines (for example, when numbering points) appropriate Indent __________ directives may be placed at the start of the lines concerned. Indentation is cancelled by setting INDENT to zero. 6 _______________________________ Changes to EMAS LAYOUT APRIL 76 1. New parameter INVO (output case invert) distinct from INVERT, which now applies only to input. This permits proper treatment of the situation where different case conventions are required in the input and updated output. The default settings assume upper-case letters plus case markers, with the letters signifying lower-case unless governed by a marker. Normal upper and lower-case representation is achieved by $A CAP=0; CAPSH=0; INVERT=0 (for input) and $A CAPO=0; CAPSHO=0; INVO=0 (for output). 2. $L0 is interpreted as introducing an indefinite number of explicit lines. The effect extends to the next directive. 3. $P never causes blank lines to be introduced at the top of a page; $B never causes blank lines at the top of a page except immediately after $N or $V. 4. Setting PAGE (page size) to zero has the effect of suppressing page-turns (and consequential effects). 5. Variants of the assignment directive permit parameter values to be selectively saved and restored (on a pushdown basis; each parameter has its own nest). Saving (e.g.) : $A INDENT<; TAB< Restoring (e.g.) : $A LEFT>; TOP> Saving & assigning :$A INDENT<=4; TAB<=1,5,10,15 This facility obsoletes the temporary vectors TEMPA and TEMPB which have been removed. 6. The specification of the value to be assigned in an assignement (right-hand-side) may be relative - understood to mean relative to the existing value of the parameter being altered (left-hand-side). e.g. $A INDENT = +1; TAB = -1,-1,-1,-1,-1 7. Spaces are freely permitted in assignments, but not immediately before commas or semi-colons. 8. If the ASCII parameter is non-zero, underlining in the output document is achieved by means of Carriage Return and overprinting. If the parameter is zero, underlining is represented by 8th bit set. (On EMAS, and any other systems which have difficulty in handling bytes properly, the effect may be to ignore underlining). 9. New directive $J to terminate current line with justification (provided JUST is set). 10. New parameter FINISH to go together with START to limit the extent of the output document. Note that the program terminates immediately after dealing with the physical page numbered FINISH An updated source should not normally be generated on a partial run, as it will be incomplete. 11. A question-mark is treated as equivalent to a period for determining th end of sentence. 12. If the MARK parameter is other than zero or 1, a Form Feed character is printed as the marker. This allows correct aligment on EMAS lineprinter listings (if PAGE+TOP+BOTTOM<64). 7