home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-19 | 82.6 KB | 2,237 lines |
- Newsgroups: comp.sources.misc
- From: jeff@joyce.cs.su.oz.au (Jeff Kingston)
- Subject: v37i121: lout - Lout document formatting system, v2, Part23/30
- Message-ID: <1993Jun2.030436.28741@sparky.imd.sterling.com>
- X-Md4-Signature: 1c5dc73ebcbdf9e0a18048b70904d879
- Sender: kent@sparky.imd.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Wed, 2 Jun 1993 03:04:36 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: jeff@joyce.cs.su.oz.au (Jeff Kingston)
- Posting-number: Volume 37, Issue 121
- Archive-name: lout/part23
- Environment: UNIX
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: lout/doc/tr.fig/s8 lout/doc/tr.impl/s2.4
- # lout/doc/tr.lout/ch1.04 lout/doc/tr.lout/ch3.02
- # lout/doc/tr.lout/ch4.04 lout/font0/Symbo.AFM lout/z27.c
- # Wrapped by kent@sparky on Sun May 30 19:44:00 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 23 (of 30)."'
- if test -f 'lout/doc/tr.fig/s8' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/doc/tr.fig/s8'\"
- else
- echo shar: Extracting \"'lout/doc/tr.fig/s8'\" \(12131 characters\)
- sed "s/^X//" >'lout/doc/tr.fig/s8' <<'END_OF_FILE'
- X@Section
- X @Title { A Concise Reference for Fig }
- X@Begin
- X@PP
- XThe options to the @Code "@Fig" symbol, and their
- Xdefault values, are as follows. The complete range of options is shown
- Xat right:
- X@ID @Tab
- X hmargin { 1s }
- X vmargin { 0.5vx }
- X @Fmth { @Col @Code A ! @Col @Code " " ! @Col @Code B ! @Col @Code " " !
- X @Col 1.0c @Wide ! @Col C }
- X @Fmta { @Col @Code A ! @Col @Code "{" ! @Col @Code B ! @Col @Code "}" !
- X @Col 1.0c @Wide ! @Col C }
- X{
- X@Rowh
- X A { "@Fig" }
- X@Rowa
- X A { " maxlabels" }
- X B { 200 }
- X C { any whole number }
- X@Rowa
- X A { " linestyle" }
- X B { solid }
- X C { @Code "solid dashed cdashed dotted noline" }
- X@Rowa
- X A { " linewidth" }
- X B { 0.5 pt }
- X C { any Fig length (see below) }
- X@Rowa
- X A { " linecap" }
- X B { round }
- X C { @Code "butt round project" }
- X@Rowa
- X A { " dashlength"}
- X B { 0.15 cm }
- X C { any Fig length }
- X@Rowa
- X A { " paint" }
- X B { nopaint }
- X C { @Code "nopaint white light grey gray dark black" }
- X@Rowa
- X A { " margin" }
- X B { 0.4c }
- X C { any Lout length }
- X@Rowa
- X A { " arrow" }
- X B { noarrow }
- X C { @Code "noarrow forward back both" }
- X@Rowa
- X A { " headstyle" }
- X B { open }
- X C { @Code "open halfopen closed" }
- X@Rowa
- X A { " headwidth" }
- X B { 0.05 cm }
- X C { any Fig length }
- X@Rowa
- X A { " headlength"}
- X B { 0.15 cm }
- X C { any Fig length }
- X}
- XThe @Code "linecap" option determines the shape of the ends of lines:
- X@Code "round" puts a round cap on them, which is the most useful in
- XFig; @Code "butt" is a square end; and @Code "project" is a square end
- Xprojecting half a line width past the end of the line; it is useful for
- Xgetting sharp corners on rectangles and square dots in dotted lines.
- X@FootNote {
- XThe line joining options of PostScript are not reflected in Fig options
- Xbecause Fig strokes paths segment by segment, not all at once, and so
- Xthere are no line joins in the PostScript sense. This was done to
- Ximprove the appearance of dashed and dotted lines.
- X}
- X@PP
- XThe following standard shapes take the same options as {@Code "@Fig"},
- Xexcept that they do not have @Code "maxlabels" or the last four
- X(arrow-drawing) options,
- Xand occasionally they have other options. In most cases the default
- Xvalues of these options are taken from the enclosing {@Code "@Fig"}.
- XWhere there are extra options, or where a different default value is
- Xused, the option and its default value are shown. The list also shows
- Xthe shape's labels, and how it is superimposed on its right parameter
- X(shown as a grey rectangle). A larger margin will enlarge the right
- Xparameter and hence the shape as well. Squares, polygons and circles
- Xhave a diameter equal to the larger of @Code xsize and {@Code ysize}.
- X@LP
- X@ID {
- X5c @Wide @Code "@Box"
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Box margin { 0c }
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@LP
- X@ID {
- X5c @Wide @Code "@Square"
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Square margin { 0c }
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X@LP
- X
- X@ID {
- X5c @Wide @Code "@Diamond"
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Diamond margin { 0c }
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@LP
- X@ID {
- X5c @Wide @Code {
- X"@Polygon"
- X" sides { 3 }"
- X" angle { 180/sides }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Polygon margin { 0c }
- X{ 2c @Wide 1c @High }
- X|| @ShowLabels ||0.5c ... ||0.5c
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Polygon sides { 12 } margin { 0c }
- X{ 2c @Wide 1c @High }
- X||1c ...
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code "@Ellipse"
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Ellipse margin { 0c }
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@LP
- X@ID {
- X5c @Wide @Code "@Circle"
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Circle margin { 0c }
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X@LP
- X
- XThe following standard shapes have the same options as
- X{@Code "@Fig"}, including the four arrow-drawing options,
- Xand occasionally they have others. In each case the only difference
- Xbetween the line and arrow symbols is the default value of
- X{@Code "arrow"}, which lines take from {@Code "@Fig"} and arrows set
- Xto {@Code "forward"}. The first four draw a line along the mark of the
- Xright parameter, which is not necessarily the same as its left or top
- Xedge.
- X@LP
- X@ID {
- X5c @Wide @Code {
- X"@HLine"
- X" margin { 0c }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@HLine
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@HArrow"
- X" margin { 0c }"
- X" arrow { forward }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@HArrow
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@VLine"
- X" margin { 0c }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@VLine
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@VArrow"
- X" margin { 0c }"
- X" arrow { forward }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@VArrow
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@Line"
- X" from { 0 ysize }"
- X" to { xsize 0 }"
- X" margin { 0c }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Line
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@Arrow"
- X" from { 0 ysize }"
- X" to { xsize 0 }"
- X" margin { 0c }"
- X" arrow { forward }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Arrow
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- X@ID {
- X5c @Wide @Code {
- X"@Arc"
- X" from { 0 ysize }"
- X" to { xsize 0 }"
- X" ctr { 0 0 }"
- X" direction { clockwise }"
- X" margin { 0c }"
- X}
- X||7ct
- X@Fig {
- X@Figure shape { 0 0 xsize 0 xsize ysize 0 ysize 0 0 } paint { grey }
- Xlinestyle { noline } margin { 0c }
- X@Arc
- X{ 2c @Wide 1c @High }
- X// @ShowLabels
- X}
- X}
- X
- XMore generally, the @Code "@Figure" symbol takes all the options of
- X@Code "@Fig" except {@Code "maxlabels"}, together with a @Code shape
- Xoption containing a sequence of points, and it connects each pair of
- Xpoints by a line or curve as specified by the following:
- X@ID @Tab
- X vmargin { 0.5vx }
- X @Fmta { @Col A ! @Col B }
- X{
- X@Rowa
- X A { @I { point point } }
- X B { Straight line }
- X@Rowa
- X A { @I { point } @Code "[" &0.5s @Code "]" @I { point } }
- X B { Draw nothing }
- X@Rowa
- X A { @I { point } @Code "[" @I point @Code "]" @I { point } }
- X B { Anticlockwise circular or elliptical arc }
- X@Rowa
- X A { @I { point } @Code "[" @I point @Code "clockwise ]" @I { point } }
- X B { Clockwise circular or elliptical arc }
- X@Rowa
- X A { @I { point } @Code "[" @I {point point} @Code "]" @I { point } }
- X B { Bezier curve with two control points }
- X}
- X@LP
- XThe remaining symbols do not draw shapes. They are
- X@ID lines @Break {
- X@I colour @Code "@Colour" @I object
- X@I colour @Code "@Color" @I object
- X}
- XPrint @I object in {@I colour}, which may be {@Code "white"},
- X{@Code "grey"}, {@Code "gray"}, {@Code "black"}, {@Code "red"},
- X{@Code "green"}, or {@Code "blue"} at least.
- X@ID lines @Break {
- X@Code "{" @I {number number number} @Code "} @RGBColour" @I object
- X@Code "{" @I {number number number} @Code "} @RGBColor" @I object
- X@Code "{" @I {number number number} @Code "} @HSBColour" @I object
- X@Code "{" @I {number number number} @Code "} @HSBColor" @I object
- X}
- XPrint @I object in the colour defined by the three numbers, using the
- Xred-green-blue or hue-saturation-brightness colour models.
- X@ID {
- X@I point @Code "@Label" @I label
- X}
- XWithin a shape, makes @I label stand for the point on the page denoted
- Xby {@I point}, which is not made part of the shape. The label applies
- Xfrom here onwards until some other point is given this label, a
- Xrelabelling occurs, or the figure ends.
- X@ID {
- X@I label @Code "::" @I object
- X}
- XRelabel every labelled point in the right parameter (which may be an
- Xarbitrary Lout object), by adding {@I label}{@Code "@"} to the front of
- Xeach label.
- X@ID {
- X@Code "@Frame" @I object
- X}
- XEquivalent to @Code "@Figure shape {xsize 0 @Label X 0 ysize @Label Y}"
- X@I object & .
- X@ID {
- X@I point @Code "@BaseOf" @I object
- X}
- XTranslate @I object so that its bottom left-hand corner appears at
- X{@I point}. Lout thinks that the result is an empty object.
- X@ID {
- X@I point @Code "@MarkOf" @I object
- X}
- XTranslate @I object so that the point where its marks cross appears at
- X{@I point}. Lout thinks that the result is an empty object.
- X@ID {
- X@Code "@ShowLabels"
- X}
- XDisplay all the labels of the figure created up to this point.
- X@PP
- XThe following lists define all the ways to specify lengths, angles and
- Xpoints.
- X@FootNote {
- XA length is represented in PostScript by a single number on the operand
- Xstack; so is an angle. A point is represented by two numbers on the
- Xstack. Those familiar with PostScript and willing to sacrifice portability
- Xand increase their risk of error can therefore write, for example,
- X@OneCol {@I length @Code "sqrt"} within a shape, to obtain a length which
- Xis the square root of another length, or @OneCol { @I point @Code "exch" }
- Xto obtain the reflection of a point about the main diagonal, and so on.
- X}
- XBrief explanations appear to the right, with the symbols' precedences in
- Xparentheses where appropriate.
- X@DP
- X@Tab
- X vmargin { 0.5vx }
- X @Fmth { @Col { &@DispIndent A } ! @Col }
- X @Fmta { @Col { &@DispIndent &2s A } ! @Col B }
- X{
- X@Rowh A { @I length } vmargin { 0.2vx }
- X@Rowh
- X@Rowa
- X A { 0 }
- X B { zero }
- X@Rowa
- X A { @Code xmark }
- X B { distance to column mark }
- X@Rowa
- X A { @Code ymark }
- X B { distance to row mark }
- X@Rowa
- X A { @Code xsize }
- X B { distance to right boundary }
- X@Rowa
- X A { @Code ysize }
- X B { distance to top boundary }
- X@Rowa
- X A { @I number @Code in }
- X B { @I number inches (39) }
- X@Rowa
- X A { @I number @Code cm }
- X B { @I number centimetres (39) }
- X@Rowa
- X A { @I number @Code pt }
- X B { @I number points (39) }
- X@Rowa
- X A { @I number @Code em }
- X B { @I number ems (39) }
- X@Rowa
- X A { @I number @Code sp }
- X B { 1 sp is the current width of a space (39) }
- X@Rowa
- X A { @I number @Code vs }
- X B { 1 vs is the current inter-line space (39) }
- X@Rowa
- X A { @I number @Code ft }
- X B { 1 ft is the size of the current font (39) }
- X@Rowa
- X A { @I point @Code "@Distance" @I point }
- X B { distance between two points (35) }
- X@Rowa
- X A { @I point @Code "@XDistance" @I point }
- X B { horizontal distance between two points (35) }
- X@Rowa
- X A { @I point @Code "@YDistance" @I point }
- X B { vertical distance between two points (35) }
- X@Rowh
- X@Rowh
- X@Rowh A { @I angle } vmargin { 0.2vx }
- X@Rowh
- X@Rowa
- X A { @I number @Code dg }
- X B { @I number degrees (39) }
- X@Rowa
- X A { @I number }
- X B { @I number degrees (@Code dg is optional) }
- X@Rowa
- X A { @I point @Code "@Angle" @I point }
- X B { angle from first point to second (35) }
- X@Rowh
- X@Rowh
- X@Rowh A { @I point } vmargin { 0.2vx }
- X@Rowh
- X@Rowa
- X A { @I {length length} }
- X B { @I x and @I y distance from origin (5) }
- X@Rowa
- X A { @I length @Code "<<" @I angle }
- X B { distance and angle from origin (38) }
- X@Rowa
- X A { @I point @Code "++" @I point }
- X B { vector sum of two points (36) }
- X@Rowa
- X A { @I point @Code "--" @I point }
- X B { vector difference of two points (36) }
- X@Rowa
- X A { @I point @Code "@Max" @I point }
- X B { vector maximum of two points (36) }
- X@Rowa
- X A { @I point @Code "@Min" @I point }
- X B { vector minimum of two points (36) }
- X@Rowa
- X A { @I point @Code "**" @I number }
- X B { multiplication of point by number (37) }
- X@Rowa
- X A { @I label }
- X B { a previously defined label }
- X@Rowa
- X A { @Code "@Prev" }
- X B { the previous point in a shape }
- X}
- X@End @Section
- END_OF_FILE
- if test 12131 -ne `wc -c <'lout/doc/tr.fig/s8'`; then
- echo shar: \"'lout/doc/tr.fig/s8'\" unpacked with wrong size!
- fi
- # end of 'lout/doc/tr.fig/s8'
- fi
- if test -f 'lout/doc/tr.impl/s2.4' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/doc/tr.impl/s2.4'\"
- else
- echo shar: Extracting \"'lout/doc/tr.impl/s2.4'\" \(12152 characters\)
- sed "s/^X//" >'lout/doc/tr.impl/s2.4' <<'END_OF_FILE'
- X@SubSection
- X @Tag { objects.impl }
- X @Title { Implementation of objects and concatenation }
- X@Begin
- X@PP
- XIn this section we discuss the implementation of objects and concatenation,
- Xand especially mark alignment. The first step is to use an operator
- Xprecedence parser to convert input such as
- X@ID @Code "a |0.5i b /0.2i c | d"
- Xinto parse trees such as
- X@ID @Eq {
- X@Fig {
- X@Tree {
- X@Node @FCircle fraction
- X@FirstSub {
- X @Node @FCircle bar
- X @FirstSub { @Node @FCircle a }
- X @NextSub { @Node @FEllipse 0.5i }
- X @NextSub { @Node @FCircle b }
- X}
- X@NextSub { @Node @FEllipse 0.2i }
- X@NextSub {
- X @Node @FCircle bar
- X @FirstSub { @Node @FCircle c }
- X @NextSub { @Node @FCircle }
- X @NextSub { @Node @FCircle d }
- X}
- X}
- X}
- X}
- XMissing objects are replaced by empty objects, and sequences of
- Xconcatenation operators are consolidated:
- X@ID @Eq {
- X@Fig {
- X@Tree {
- X@Node @FCircle bar
- X@FirstSub { @Node @FCircle a }
- X@NextSub { @Node @FEllipse 0.2i }
- X@NextSub {
- X @Node @FCircle bar
- X @FirstSub { @Node @FCircle c }
- X @NextSub { @Node @FEllipse 0.3i }
- X @NextSub { @Node @FCircle d }
- X}
- X}
- X}
- X&2m ==> &2m
- X@Fig {
- X@Tree {
- X@Node @FCircle bar
- X@FirstSub { @Node @FCircle a }
- X@NextSub { @Node @FEllipse 0.2i }
- X@NextSub { @Node @FCircle c }
- X@NextSub { @Node @FEllipse 0.3i }
- X@NextSub { @Node @FCircle d }
- X}
- X}
- X}
- Xto make manifest their associativity and reduce the depth of the tree
- Xfor efficiency later.
- X@PP
- XThe required semantic information is the size of each subobject,
- Xconsisting of four integers: width to left and right of the
- Xdistinguished column mark, and height above and below the distinguished
- Xrow mark. These numbers are always non-negative in Basser Lout, but
- Xthis restriction is unnecessary and should be dropped.
- X@PP
- XFor the leaves, which are simple words, the numbers are obtained from
- Xfont tables. For the higher levels we apply recursive rules. Suppose
- Xthat @Eq { hgap(x, g, y) } returns the desired distance between the
- Xcolumn marks of objects @Eq { x } and @Eq { y } when they are separated by
- Xgap @Eq { g }: @Eq { right(x) + length(g) + left(y) } when the gap mode is
- Xedge-to-edge, the larger of @Eq { length(g) } and
- X@Eq { right(x) + left(y) } when the mode is mark-to-mark, and so on. Given
- Xan object
- X@ID @Eq {
- XX = x sub 1 ````` bar g sub 1 ````` ... ````` { "-2p" @Font "^"}bar g sub i-1
- X````` x sub i ````` ... ````` bar g sub n-1 ````` x sub n
- X}
- Xwe may calculate its size as follows:
- X@ID @Eq {
- Xleft(X) ^= left( x sub 1 ) + hgap( x sub 1 , g sub 1 , x sub 2 )
- X+ ... + hgap( x sub i-1 , g sub i-1 , x sub i )
- X/1.4vx
- Xright(X) ^= hgap( x sub i , g sub i , x sub i+1 )
- X+ ... + hgap( x sub n-1 , g sub n-1 , x sub n ) + right( x sub n )
- X/1.4vx
- X"above"(X) ^= "above"(x sub 1 ) up ... up "above"(x sub n )
- X/1.4vx
- X"below"(X) ^= "below"(x sub 1 ) up ... up "below"(x sub n )
- X}
- Xwhere @Eq { non up } returns the larger of its two parameters. Similar
- Xformulas are easily derived for the other operators.
- X@PP
- XFor purposes of exposition we will now make the simplifying
- Xassumptions that all gaps are {@Code "0i"}, all column marks lie at
- Xthe left edge, and all row marks lie at the top edge. Then the size
- Xof each object can be expressed by just two numbers, width and
- Xheight, and the four formulas reduce to
- X@ID @Eq {
- Xwidth( x sub 1 rel bar ... rel bar x sub n ) ^=
- Xwidth( x sub 1 ) + ... + width( x sub n )
- X/1.4vx
- Xheight( x sub 1 rel bar ... rel bar x sub n ) ^=
- Xheight( x sub 1 ) up ... up height( x sub n )
- X}
- XThe corresponding formulas for vertical concatenation are
- X@ID @Eq {
- Xwidth( x sub 1 rel "/" ... rel "/" x sub n ) ^=
- Xwidth( x sub 1 ) up ... up width( x sub n )
- X/1.4vx
- Xheight( x sub 1 rel "/" ... rel "/" x sub n ) ^=
- Xheight( x sub 1 ) + ... + height( x sub n )
- X}
- XAccording to these formulas, the height of
- X@ID @Eq { @Fig { @Tree {
- X@Node @FCircle fraction
- X@LeftSub {
- X @Node @FCircle bar
- X @LeftSub { @Node @FCircle a }
- X @RightSub { @Node @FCircle b }
- X}
- X@RightSub {
- X @Node @FCircle bar
- X @LeftSub { @Node @FCircle c }
- X @RightSub { @Node @FCircle d }
- X}
- X}}}
- Xis
- X@ID @Eq {
- X[ height(a) up height(b)] + [ height(c) up height(d)]
- X}
- Xwhich is correct, but for width they yield
- X@ID @Eq {
- X[ width(a) + width(b)] up [ width(c) + width(d)]
- X}
- Xwhich is not, since it does not take the merging of column marks into
- Xaccount. The asymmetry between horizontal and vertical has come
- Xabout because the row entries, such as @Eq {a} and {@Eq {b}}, are
- Xadjacent in the tree, but the column entries, such as @Eq {a} and
- X{@Eq {c}}, are not. It would be possible to solve this cross-linking
- Xproblem by augmenting the size information stored in each node to
- Xrecord the number of marks and the size of each, but the author has
- Xpreferred the following method which makes structural changes to the
- Xtree instead.
- X@PP
- XIf @Eq { a } and @Eq { c } share a column mark, they each might as well
- Xhave width { @Eq {width(a) up width(c) }}, since all width calculations
- Xapply to entire columns. Accordingly, we introduce a new operator,
- X@Eq {COL}, defined by
- X@ID @Eq { width( x sub 1 bin COL ... bin COL x sub n ) =
- Xwidth( x sub 1 ) up ... up width( x sub n )
- X}
- Xand replace both @Eq { a } and @Eq { c } by {@Eq { a bin COL c }}. To
- Xprevent @Eq { COL } operators from disturbing height calculations, we
- Xdefine a binary operator called @Eq { SPLIT } by
- X@ID @Eq { width( x bin SPLIT y) ^= width(x)
- X/1.4vx
- Xheight( x bin SPLIT y) ^= height(y) }
- Xwhich switches height and width calculations onto different
- Xsubtrees. Then the transformation
- X@ID @Eq {
- X@Fig { @Tree {
- X @Node @FCircle a
- X}}
- X&2m ==> &2m
- X@Fig { @Tree {
- X @Node @FEllipse SPLIT
- X @LeftSub {
- X @Node @FEllipse COL
- X @LeftSub { @Node @FCircle a }
- X @RightSub { @Node @FCircle c }
- X }
- X @RightSub { @Node @FCircle a }
- X}}
- X}
- X# where @Eq { S } denotes a @Eq { SPLIT } node and @Eq { C } denotes a
- X# @Eq { COL } node,
- Xwidens @Eq { a } to @Eq {width(a) up width(c) } without affecting its height;
- Xit is applied to every object that shares its column mark with at least
- Xone other object. A similar transformation involving a @Eq { ROW } operator
- Xdeals with shared row marks. The effect on our little table is to replace
- X@ID @Eq { @Fig { @Tree {
- X@Node @FCircle fraction
- X@LeftSub {
- X @Node @FCircle bar
- X @LeftSub { @Node @FCircle a }
- X @RightSub { @Node @FCircle b }
- X}
- X@RightSub {
- X @Node @FCircle bar
- X @LeftSub { @Node @FCircle c }
- X @RightSub { @Node @FCircle d }
- X}
- X}}}
- Xby
- X@ID @Eq { @Fig maxlabels { "70" } { @Tree hmargin { "0.1c" } {
- X@Node @FCircle fraction
- X@FirstSub {
- X @Node @FCircle bar
- X @FirstSub {
- X @Node @FEllipse SPLIT
- X @FirstSub {
- X @Node @FEllipse COL
- X @FirstSub { @Node @FCircle a }
- X @NextSub { @Node @FCircle c }
- X }
- X @NextSub {
- X @Node @FEllipse ROW
- X @FirstSub { @Node @FCircle a }
- X @NextSub { @Node @FCircle b }
- X }
- X }
- X @NextSub {
- X @Node @FEllipse SPLIT
- X @FirstSub {
- X @Node @FEllipse COL
- X @FirstSub { @Node @FCircle b }
- X @NextSub { @Node @FCircle d }
- X }
- X @NextSub {
- X @Node @FEllipse ROW
- X @FirstSub { @Node @FCircle a }
- X @NextSub { @Node @FCircle b }
- X }
- X }
- X}
- X@NextSub {
- X @Node @FCircle bar
- X @FirstSub {
- X @Node @FEllipse SPLIT
- X @FirstSub {
- X @Node @FEllipse COL
- X @FirstSub { @Node @FCircle a }
- X @NextSub { @Node @FCircle c }
- X }
- X @NextSub {
- X @Node @FEllipse ROW
- X @FirstSub { @Node @FCircle c }
- X @NextSub { @Node @FCircle d }
- X }
- X }
- X @NextSub {
- X @Node @FEllipse SPLIT
- X @FirstSub {
- X @Node @FEllipse COL
- X @FirstSub { @Node @FCircle b }
- X @NextSub { @Node @FCircle d }
- X }
- X @NextSub {
- X @Node @FEllipse ROW
- X @FirstSub { @Node @FCircle c }
- X @NextSub { @Node @FCircle d }
- X }
- X }
- X}
- X}}}
- XIn fact, common subexpressions are identified (trivially) and the result
- Xis a directed acyclic graph; each affected leaf has two parents, one for
- Xwidth and one for height; and each @Eq { COL } or @Eq { ROW } node has
- Xone parent and one child for each object lying on the corresponding
- Xmark. The data structure roughly doubles in size, and this occurs only
- Xrarely in practice.
- X@PP
- XThis method can cope with any legal input, including
- X@ID @Code {
- X"{ a // c | d } | { b / e }"
- X"/ { f / i } | { g | h // j }"
- X}
- Xwhich produces overlapping spanning columns:
- X@ID @I @Fig {
- X @FBox margin { 0.2c } width { 1.6c } 1.2f @Font a |
- X @FBox margin { 0.2c } width { 0.6c } 1.2f @Font b |
- X// @FBox margin { 0.2c } width { 0.6c } 1.2f @Font c |
- X @FBox margin { 0.2c } width { 0.6c } 1.2f @Font d |
- X @FBox margin { 0.2c } width { 0.6c } 1.2f @Font e |
- X// @FBox margin { 0.2c } width { 0.6c } 1.2f @Font f |
- X @FBox margin { 0.2c } width { 0.6c } 1.2f @Font g |
- X @FBox margin { 0.2c } width { 0.6c } 1.2f @Font h |
- X// @FBox margin { 0.2c } width { 0.6c } 1.2f @Font i |
- X @FBox margin { 0.2c } width { 1.6c } 1.2f @Font j |
- X}
- XThe boxes have been added to clarify the structure. The width of this
- Xobject is formally
- X@ID @Eq { ((width(a) up (x + y)) + z) up (x + ((y + z) up width(j))) }
- Xwhere
- X@IL
- X@ListItem @Eq { x = width(c) up width(`f`) up width(i) }
- X@ListItem @Eq { y = width(d`) up width(g) }
- X@ListItem @Eq { z = width(b) up width(e) up width(h) }
- X@EL
- XIt seems clear that @Eq { y } at least must appear twice in any
- Xexpression for the width of this object made out of simple addition
- Xand maxing operations, showing that an ordinary tree
- Xstructure is insufficient for overlapping spanning columns. The Basser
- XLout interpreter actually rejects such structures, owing to the author's
- Xdoubts about the implementability of @I Constrained and @I AdjustSize
- X(Section {@NumberOf constraints}) on them; but with hindsight this caution
- Xwas unnecessary.
- X@PP
- XThe directed acyclic graph is ordered in the sense that the order of
- Xthe edges entering and leaving each node matters. The structure is
- Xhighly dynamic, and traversals both with and against the arrows are
- Xrequired. After a few ad-hoc attempts to extend the usual tree
- Xrepresentation had failed, the author developed a representation based
- Xon doubly linked lists of records denoting links, whose flexibility more
- Xthan compensated for the somewhat excessive memory consumption. For example,
- X@ID @Eq { @Fig {
- X A:: @FCircle a |2c |2c B:: @FCircle b
- X/1.5c C:: @FCircle c | D:: @FCircle d
- X// A @JoinFigures arrow { forward } C
- X// A @JoinFigures arrow { forward } D
- X// B @JoinFigures arrow { forward } D
- X}}
- Xis represented by
- X@CD @Eq { @Fig maxlabels { "300" } {
- XA:: @DagBox mid { @BlackDot } base { a } |2c |2c |2c |2c
- XB:: @DagBox mid { @BlackDot } base { b }
- X/1c L:: @DagBox top { @BlackDot } mid { @BlackDot } base { LK }
- X| M:: @DagBox top { @BlackDot } mid { @BlackDot } base { LK }
- X| | N:: @DagBox top { @BlackDot } mid { @BlackDot } base { LK }
- X/1c
- XC:: @DagBox top { @BlackDot } base { c } | |
- XD:: @DagBox top { @BlackDot } base { d }
- X// @TVShape nw { A@MID@CTR } ne { A@MID@CTR } sw {L@MID@CTR } se { M@MID@CTR }
- X// @TVShape nw { L@TOP@CTR } ne { L@TOP@CTR } sw {C@TOP@CTR } se { C@TOP@CTR }
- X// @TVShape nw { M@TOP@CTR } ne { N@TOP@CTR } sw {D@TOP@CTR } se { D@TOP@CTR }
- X// @TVShape nw { B@MID@CTR } ne { B@MID@CTR } sw {N@MID@CTR } se { N@MID@CTR }
- X}}
- Xwhere @Eq { LK } tags a record representing a link. The first list
- Xin any node contains all the incoming links, the second contains the
- Xoutgoing ones. The node serves as the header for both lists. The
- Xrequired operations reduce to simple appends, deletes, and traversals
- Xof doubly linked lists, all having small constant cost. There is a
- Xhighly tuned memory allocator, and care is taken to dispose of each node
- Xwhen the last incoming link is deleted, so that there is no need for
- Xgarbage collection.
- X@PP
- XIn normal use the number of nodes at higher levels of the dag is small
- Xin comparison with the leaves and their incoming links, so we may
- Xestimate the space complexity at about 60 bytes per input word (20 bytes
- Xper link, 40 per leaf node). Careful optimization could easily halve
- Xthis, but since memory is reclaimed after printing each page there is
- Xlittle need.
- X@End @SubSection
- END_OF_FILE
- if test 12152 -ne `wc -c <'lout/doc/tr.impl/s2.4'`; then
- echo shar: \"'lout/doc/tr.impl/s2.4'\" unpacked with wrong size!
- fi
- # end of 'lout/doc/tr.impl/s2.4'
- fi
- if test -f 'lout/doc/tr.lout/ch1.04' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/doc/tr.lout/ch1.04'\"
- else
- echo shar: Extracting \"'lout/doc/tr.lout/ch1.04'\" \(10331 characters\)
- sed "s/^X//" >'lout/doc/tr.lout/ch1.04' <<'END_OF_FILE'
- X@Section
- X @Title { Galleys }
- X @Tag { galleys }
- X@Begin
- X@PP
- XIt is time to pause and ask ourselves how close we are to achieving our
- Xaim of producing neatly formatted documents. We can certainly produce
- Xthe pieces of a document, using the page layout definitions from Section
- X{@NumberOf definitions}:
- X@ID {
- X
- Xnohyphen @Break @LittlePageColumn {
- X@DP
- X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
- X@DP
- XIn the world of music England is supposed to be a mere province. If she
- Xproduces an indifferent composer or performer, that is regarded
- Xelsewhere as perfectly normal and natural; but if foreign students of
- Xmusical history have to acknowledge a British musical genius, he is
- Xconsidered a freak.
- X@PP
- XSuch a freak is Henry Purcell. Yet if we make a choice of fifteen of
- Xthe world's musical classics, as here, we find that we cannot omit this
- XEnglish master.
- X}
- X
- X||1c
- X
- X@LittlePageColumn
- X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric. @I {Some Great Composers.} Oxford, 1944.
- X}
- X
- X||1c
- X
- X@Code {
- X @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X// @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X// @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X//0.2c 8p @Font "@PageList"
- X}
- X
- X}
- Xbut when we try to merge them together, we encounter two obstacles.
- X@PP
- XFirst, when an object is entered at a certain place in the document, it
- Xappears at that place. But a footnote is naturally entered immediately
- Xafter the point it refers to (`{-2p @Font PURCELL}' in this case), yet it
- Xappears somewhere else: at the bottom of a page.
- X@PP
- XSecond, all our features build up larger objects out of smaller ones,
- Xbut the -2p @Font PURCELL object, for example, must be broken down into
- Xpage-sized pieces. This occurs when the available space at the
- X`somewhere else' is insufficient to hold the entire object, so this
- Xsecond obstacle arises out of the first.
- X@PP
- XLout's last major feature, which we introduce to overcome these
- Xobstacles, is the @I galley
- Xgalley.feature @Index { Galleys }
- X(the name is borrowed from the galleys
- Xused in manual typesetting). A galley is an object plus a cross
- Xreference which points to where the object is to appear. The example
- Xabove has three galleys:
- X@ID {
- X
- X{
- X//0.1c
- X
- Xnohyphen @Break @LittlePageColumn {
- X@DP
- X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
- X@DP
- XIn the world of music England is supposed to be a mere province. If she
- Xproduces an indifferent composer or performer, that is regarded
- Xelsewhere as perfectly normal and natural; but if foreign students of
- Xmusical history have to acknowledge a British musical genius, he is
- Xconsidered a freak.
- X@PP
- XSuch a freak is Henry Purcell. Yet if we make a choice of fifteen of
- Xthe world's musical classics, as here, we find that we cannot omit this
- XEnglish master.
- X} { //0.4c 180d @Rotate @Arrow 2.0c }
- X
- X}
- X
- X||0io ||4.8c
- X
- X@Code {
- X @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X// @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X// @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X//0.2c 8p @Font "@PageList"
- X} 180d @Rotate @Arrow 1i @I -2p @Font {to printer}
- X
- X||0io ||2.0c
- X{
- X//3.9c
- X
- X{ @Arrow 1.7c } nohyphen @Break @LittlePageColumn
- X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric. @I {Some Great Composers.} Oxford, 1944.
- X}
- X}
- X}
- XA galley replaces the invocation pointed to by its cross reference. If
- Xspace is not sufficient there to hold it all, the remainder of the
- Xgalley is split off (the vertical concatenation symbol preceding it
- Xbeing discarded) and it replaces later invocations of the same symbol.
- XThis is exactly what is required to get text and footnotes onto pages.
- X@PP
- XTo create a galley, first define a symbol with a
- Xspecial @Code into
- Xinto @Index { @Code into clause }
- Xclause, like this:
- X@ID @Code {
- X"def @FootNote into { @FootPlace&&following }"
- X" right x"
- X"{"
- X" 8p @Font x"
- X"}"
- X}
- XAn invocation of such a symbol will then be a galley whose object is the
- Xresult of the invocation, and whose cross reference is given by the
- X@Code into clause. The right parameter of the cross reference must be
- Xeither @Code preceding or @Code following.
- X@PP
- XA symbol, like @Code "@FootPlace", which is the @I target of a galley,
- Xtarget @Index { Target of a galley }
- Xmust contain the special symbol @@Galley exactly once in its body; often
- Xthis is all that the body contains:
- X@ID @Code {
- X"def @FootPlace { @Galley }"
- X}
- XIt is this special symbol that is replaced by the incoming galley, in
- Xfact, not the @Code "@FootPlace" symbol as a whole.
- X@PP
- XA symbol which contains @@Galley, either directly within its body or
- Xindirectly within the body of a symbol it invokes, is called a @I receptive
- Xreceptive @Index { Receptive symbol }
- Xsymbol, meaning receptive to galleys. @Code "@FootPlace" is receptive, which
- Xmakes @Code "@FootList", @Code "@FootSect" and @Code "@PageList"
- Xreceptive since they invoke @Code "@FootPlace". If no galley replaces
- Xany @@Galley within some invocation of a receptive symbol, that
- Xinvocation is replaced by @@Null. The advantages of this rule for page
- Xlayout were explained at the end of Section {@NumberOf definitions}.
- X@PP
- XLet us now follow through the construction of our example
- Xdocument. Initially there is just the one @I root
- Xroot.galley @Index { Root galley }
- Xgalley, containing an unexpanded invocation of @Code "@PageList":
- X@ID { ||5c
- X10p @Font @Code "@PageList" 180d @Rotate @Arrow 1i @I -2p @Font {to printer}
- X}
- XThen the -2p @Font PURCELL galley appears, targeted to a @Code
- X"@TextPlace". Lout knows that there is a @Code "@TextPlace" hidden
- Xinside @Code "@PageList", so it expands @Code "@PageList":
- X@ID {
- X
- X{
- X//0.1c
- X
- Xnohyphen @Break @LittlePageColumn {
- X@DP
- X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
- X@DP
- XIn the world of music England is supposed to be a mere province. If she
- Xproduces an indifferent composer or performer, that is regarded
- Xelsewhere as perfectly normal and natural; but if foreign students of
- Xmusical history have to acknowledge a British musical genius, he is
- Xconsidered a freak.
- X@PP
- XSuch a freak is Henry Purcell. Yet if we make a choice of fifteen of
- Xthe world's musical classics, as here, we find that we cannot omit this
- XEnglish master.
- X} { //0.4c 180d @Rotate @Arrow 2.2c }
- X}
- X
- X||0io ||5c
- X
- X@Code {
- X @LittlePage { "@TextPlace" //1rt "@FootSect" }
- X//0.2c 8p @Font "@PageList"
- X} 180d @Rotate @Arrow 1i @I -2p @Font {to printer}
- X
- X}
- XAfter promoting the first line into @Code "@TextPlace", the footnote
- Xgalley attached to it appears and demands an invocation of
- X@Code "@FootPlace" following its attachment point
- X(`{-2p @Font PURCELL}'). Such a @Code "@FootPlace" is found at
- Xthe bottom of the first page, inside @Code "@FootSect", which is
- Xaccordingly expanded, and the footnote is promoted onto the page:
- X@ID {
- X
- X{
- X//1.2c
- X
- Xnohyphen @Break @LittlePageColumn {
- XIn the world of music England is supposed to be a mere province. If she
- Xproduces an indifferent composer or performer, that is regarded
- Xelsewhere as perfectly normal and natural; but if foreign
- Xstudents of musical history have to acknowledge a British musical genius,
- Xhe is considered a freak.
- X@PP
- XSuch a freak is Henry Purcell. Yet if we make a choice of fifteen of
- Xthe world's musical classics, as here, we find that we cannot omit this
- XEnglish master.
- X} 180d @Rotate @Arrow 2.2c
- X}
- X
- X||0io ||5c
- X
- X{
- Xnohyphen @Break @LittleDocument
- X//
- X@LittleText {
- X@DP
- X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
- X@LittleFootNote
- X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric. @I {Some Great Composers.} Oxford, 1944.
- X//1vx @Code "@FootList"
- X}
- X//1vx @Code "@TextPlace" }
- X//
- X@LittleEndRun
- X//0.2c 8p @Font @Code "@PageList"
- X} 180d @Rotate @Arrow 1i -2p @Font @I {to printer}
- X
- X}
- XNow the promotion of the -2p @Font PURCELL galley resumes. When the
- Xfirst page is filled, Lout searches forwards for another @Code "@TextPlace"
- Xto receive the remainder, once again expanding a @Code "@PageList":
- X@ID {
- X
- X{
- X//4.85c
- X
- Xnohyphen @Break @LittlePageColumn {
- Xperformer, that is regarded
- Xelsewhere as perfectly normal and natural; but if foreign
- Xstudents of musical history have to acknowledge a British musical genius,
- Xhe is considered a freak.
- X@PP
- XSuch a freak is Henry Purcell. Yet if we make a choice of fifteen of
- Xthe world's musical classics, as here, we find that we cannot omit this
- XEnglish master.
- X} 180d @Rotate @Arrow 2.2c
- X}
- X
- X||0io ||5c
- X
- X{
- Xnohyphen @Break @LittleDocument
- X//
- X@LittleText {
- X@DP
- X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
- X@LittleFootNote
- X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric. @I {Some Great Composers.} Oxford, 1944.
- X}
- X@DP
- X @HExpand {In the world of music}
- X//1vx @HExpand {England is supposed to}
- X//1vx @HExpand {be a mere province. If}
- X//1vx @HExpand {she produces an indifferent composer or}
- X}
- X//
- X@LittleEndRun
- X// @LittlePage { @Code "@TextPlace" //1rt @Code "@FootSect" }
- X//0.2c 8p @Font @Code "@PageList"
- X} 180d @Rotate @Arrow 1i -2p @Font @I {to printer}
- X
- X}
- Xand so on until the entire galley is promoted. All these expansions and
- Xreplacements are done with total
- Xintegrity. For example, if Lout finds after expanding @Code "@FootSect"
- Xthat the page is too full to accept even the first line of the footnote,
- X@Code "@FootSect" is reset to unexpanded and the search for a target for
- Xthe footnote moves on. And the cross reference direction, @Code
- Xpreceding or @Code following, is always obeyed (although lack of space
- Xsometimes prevents Lout from choosing the nearest target). Only the
- Xroot galley contains receptive symbols in our running example, but in
- Xfact any galley may contain them, without restriction.
- X@PP
- XWhen footnotes are placed at the bottom of a page, they appear there in
- Xfirst come, first served order. To make galleys appear in sorted order, as
- Xsorted.galley @Index { Sorted galleys }
- Xis needed in bibliographies and indexes, a parameter or nested definition
- Xwith the special name @@Key
- Xkey. @Index { @@Key parameter }
- Xis added to the galley definition, like this:
- X@ID @Code {
- X"def @IndexEntry into { @IndexPlace&&following }"
- X" left @Key"
- X" right x"
- X"{ x }"
- X}
- XLike @@Tag, @@Key must be set to a simple word when the galley is invoked:
- X@ID @Code {
- X"cities @IndexEntry { cities, comparison of, 27 }"
- X}
- Xand this key is used to sort the galleys. If several sorted galleys
- Xwith the same key are sent to the same place, only one of them is
- Xprinted, since the others are probably unwanted duplicates.
- X@PP
- XThe discussion of galleys is continued at a more detailed level in
- XSection {@NumberOf targets}.
- X@End @Section
- END_OF_FILE
- if test 10331 -ne `wc -c <'lout/doc/tr.lout/ch1.04'`; then
- echo shar: \"'lout/doc/tr.lout/ch1.04'\" unpacked with wrong size!
- fi
- # end of 'lout/doc/tr.lout/ch1.04'
- fi
- if test -f 'lout/doc/tr.lout/ch3.02' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/doc/tr.lout/ch3.02'\"
- else
- echo shar: Extracting \"'lout/doc/tr.lout/ch3.02'\" \(12202 characters\)
- sed "s/^X//" >'lout/doc/tr.lout/ch3.02' <<'END_OF_FILE'
- X@Section
- X @Title { Concatenation symbols and paragraphs }
- X @Tag { concatenation }
- X@Begin
- X@PP
- XThere are ten concatenation symbols, in three families:
- Xconcatenation. @Index { Concatenation symbols }
- X@ID @Tab
- X vmargin { 0.5vx }
- X @Fmta { @Col @Code A ! @Col @Code B ! @Col @Code C ! @Col @Code D ! @Col E }
- X{
- X@Rowa A { "/" } B { "^/" } C { "//" } D { "^//" } E { Vertical concatenation }
- X@Rowa A { "|" } B { "^|" } C { "||" } D { "^||" } E { Horizontal concatenation }
- X@Rowa A { "&" } B { "^&" } C { } D { } E {In-paragraph concatenation}
- X}
- XEach symbol produces an object which combines together the two
- Xparameters. The right parameter must be separated from the symbol by at
- Xleast one white space character.
- X@PP
- XThe vertical concatenation symbol @Code "/" places its left parameter
- Xvertical.concatenation @Index { Vertical concatenation }
- Xabove its right parameter with their column marks aligned. If one
- Xparameter has more column marks than the other, empty columns are
- Xinserted at the right to equalize the numbers. The variant @Code "//"
- Xignores column marks and left-justifies the objects.
- X@PP
- XThe horizontal concatenation symbols @Code "|" and @Code "||" are horizontal
- Xhorizontal.concatenation @Index { Horizontal concatenation }
- Xanalogues of @Code "/" and {@Code "//"}: they place their two parameters side
- Xby side, with row mark alignment or top-justification respectively. The
- Xin.paragraph.concatenation @Index { In-paragraph concatenation }
- Xin-paragraph concatenation symbol @Code "&" produces horizontal concatenation
- Xwithin a paragraph; its special properties are treated in detail at the
- Xend of this section.
- X@PP
- XThe concatenation symbols in any one family are {@I{mutually associative}},
- Xwhich means that
- X@ID {
- X@Code "{" @I x {@Code "|"}{@I p} @I y @Code "}" {@Code "|"}{@I q} @I z
- X}
- Xis always the same as
- X@ID {
- X@I x {@Code "|"}{@I p} @Code "{" @I y {@Code "|"}{@I q} @I z @Code "}"
- X}
- Xfor any objects {@I x}, {@I y}, and {@I z}, any gaps @I p and @I q (defined
- Xbelow), and any choice of {@Code "|"}, {@Code "^|"}, {@Code "||"}, and
- X{@Code "^||"}. In practice we always omit such braces, since they are
- Xredundant and can be misleading. The result of the complete sequence of
- Xconcatenations will be called the {@I{whole concatenation object}}, and
- Xthe objects which make it up will be called the {@I components}.
- X@PP
- XOne mark is designated as the {@I {principal mark}}, usually the mark of
- Xprincipal.mark @Index { Principal mark }
- Xthe first component. A later mark can be chosen for this honour by
- Xattaching {@Code "^"} to the preceding concatenation symbol. See Section
- X{@NumberOf onerow} for examples.
- X@PP
- XA {@I gap},
- Xgap @Index Gap
- Xspecifying the distance between the two
- Xparameters, may follow any concatenation symbol. There may be no spaces
- Xbetween a concatenation symbol and its gap. A missing gap is taken
- Xto be {@Code 0ie}. The gap is effectively a third parameter of the
- Xconcatenation symbol, and it may be an arbitrary object provided that it
- Xevaluates to a juxtaposition of simple words. In general, the gap must
- Xbe enclosed in braces, like this:
- X@ID @Code {
- X"//{ @Style&&mystyle @Open { @TopMargin } }"
- X}
- Xbut the braces may be omitted when the object is a juxtaposition of
- Xsimple words or an invocation of a symbol without parameters, as in
- X@Code "//0.3vx" and {@Code "||@Indent"}.
- X@PP
- XA gap consists of a length plus a gap mode. A @I length
- Xlength @Index { Length }
- Xis represented by an unsigned decimal number followed
- Xby a unit of measurement. For example, @Code "2.5c" represents the
- Xlength 2.5 centimetres. Figure {@NumberOf units} gives the full range
- Xof eleven units of measurement.
- Xc.unit @Index { @Code c unit }
- Xp.unit @Index { @Code p unit }
- Xm.unit @Index { @Code m unit }
- Xf.unit @Index { @Code f unit }
- Xs.unit @Index { @Code s unit }
- Xv.unit @Index { @Code v unit }
- Xw.unit @Index { @Code w unit }
- Xb.unit @Index { @Code b unit }
- Xr.unit @Index { @Code r unit }
- Xd.unit @Index { @Code d unit }
- X
- X@BeginFigures
- X@Figure
- X @Caption { The eleven units of measurement provided by Lout. }
- X @Tag { units }
- X@Begin
- X @Tab
- X vmargin { 0.3v }
- X side { yes }
- X @Fmta { @Col @Code A ! @Col B }
- X {
- X @Rowa above { yes } A { c } B { Centimetres. }
- X @Rowa A { i } B { Inches.
- X}
- X @Rowa A { p } B { Points ({@Code 72p} = {@Code 1i}).
- X}
- X @Rowa A { m } B { Ems ({@Code 12m} = {@Code 1i}).
- X}
- X @Rowa A { f } B {
- XOne @Code f equals the size of the current font, as specified by
- Xthe @@Font symbol (Section {@NumberOf font}). This unit is
- Xappropriate for lengths that should change with the font size.
- X}
- X @Rowa A { s } B {
- XOne @Code s equals the preferred gap between two words in the
- Xcurrent font, as specified in the definition of the font, or by the
- X@@Space symbol (Section {@NumberOf break}).
- X}
- X @Rowa A { v } B {
- XOne @Code v equals the current gap between lines introduced during
- Xparagraph breaking, as specified by the @@Break symbol (Section
- X{@NumberOf break}). This unit is appropriate for lengths, such as the
- Xspaces between paragraphs, which should change with the inter-line gap.
- X}
- X @Rowa A { w } B {
- XOne @Code w equals the width of the following component, or its height if the
- Xsymbol is vertical concatenation.
- X}
- X @Rowa A { b } B {
- XOne @Code b equals the width of the whole concatenation object,
- Xor its height if the symbol is vertical concatenation.
- X}
- X @Rowa A { r } B {
- XOne @Code r equals one @Code b minus one {@Code w}. This unit is used
- Xfor centring and right justification.
- X}
- X @Rowa below { yes } A { d } B {
- XDegrees. This unit may only be used with the @Code "@Rotate" symbol.
- X}
- X }
- X@End @Figure
- X
- X@PP
- XA gap concludes with a {@I {gap mode}},
- Xgap.mode @Index { Gap mode }
- Xwhich is a single letter following the length, indicating how the length
- Xis to be measured. As shown in Figure {@NumberOf gapmodes},
- X
- X@Figure
- X @Tag { gapmodes }
- X @Caption { The six gap modes provided by Lout. }
- X@Begin
- X@Fig {
- X{ /2.5vx Edge-to-edge |0.3i {@Code "|"} &1p {@I l} &1p {@Code e}
- X /4vx Hyphenation |0.3i {@Code "|"} &1p {@I l} &1p {@Code h}
- X /4vx Overstrike |0.3i {@Code "|"} &1p {@I l} &1p {@Code o}
- X /4vx Mark-to-mark |0.3i {@Code "|"} &1p {@I l} &1p {@Code x}
- X /4vx Kerning |0.3i {@Code "|"} &1p {@I l} &1p {@Code k}
- X /4vx Tabulation |0.3i {@Code "|"} &1p {@I l} &1p {@Code t}
- X}
- X||0.5i
- X@Box margin { 0c } 6c @Wide 13.2c @High 9p @Font
- X{
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 2.2c @Wide 1.4c @High } @Put { @DoubleArrow 1.8c }
- X @At { 2.2c @Wide 1.6c @High } @Put { 1.8c @Wide { &0.5rt @I l } }
- X }
- X //4vx
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 2.2c @Wide 1.4c @High } @Put { @DoubleArrow 1.8c }
- X @At { 2.2c @Wide 1.6c @High } @Put { 1.8c @Wide { &0.5rt @I l } }
- X }
- X //4vx
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 1.2c @Wide 1.5c @High } @Put { @DoubleArrow 3.3c }
- X @At { 1.2c @Wide 1.7c @High } @Put { 3.3c @Wide { &0.5rt @I l } }
- X }
- X //4vx
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 1.2c @Wide 1.5c @High } @Put { @DoubleArrow 3.3c }
- X @At { 1.2c @Wide 1.7c @High }
- X @Put 3.3c @Wide { |0.5rt { max( {@I {l, a+b}}) } }
- X @At { 1.2c @Wide 0.4c @High } @Put { @DoubleArrow 1.0c }
- X @At { 1.2c @Wide 0.2c @High } @Put { 1.0c @Wide { &0.5rt @I a } }
- X @At { 4c @Wide 0.4c @High } @Put { @DoubleArrow 0.5c }
- X @At { 4c @Wide 0.2c @High } @Put { 0.5c @Wide { &0.5rt @I b } }
- X }
- X //4vx
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 1.2c @Wide 1.5c @High } @Put { @DoubleArrow 3.3c }
- X @At { 1.2c @Wide 1.7c @High }
- X @Put { 3.3c @Wide { |0.5rt max( {@I {l, a, b}})}}
- X @At { 1.2c @Wide 0.4c @High } @Put { @DoubleArrow 1.0c }
- X @At { 1.2c @Wide 0.2c @High } @Put { 1.0c @Wide { &0.5rt @I a } }
- X @At { 4c @Wide 0.4c @High } @Put { @DoubleArrow 0.5c }
- X @At { 4c @Wide 0.2c @High } @Put { 0.5c @Wide { &0.5rt @I b } }
- X }
- X //4vx
- X @OneRow {
- X @At { 1c @Wide 0.5c @High } @Put { @LBox 0.2co }
- X @At { 4c @Wide 0.5c @High } @Put { @LBox 0.5co }
- X @At { 0.0c @Wide 1.6c @High } @Put { @DoubleArrow 4.0c }
- X @At { 2.8c @Wide 1.8c @High } @Put { @I l }
- X }
- X //5vx
- X @DoubleArrow 6c
- X //0.1c |0.5rt @I { current bound }
- X}
- X
- X}
- X@End @Figure
- X@EndFigures
- Xwith edge-to-edge gap mode
- Xedge.to.edge @Index { Edge-to-edge gap mode }
- Xe.gap.mode @Index { @Code e gap mode }
- Xthe length @I l is measured from the trailing edge
- Xof the first object to the leading edge of the second. Edge-to-edge is the
- Xdefault mode: the @Code e may be omitted. Hyphenation gap mode is
- Xhyphenation.gap @Index { Hyphenation gap mode }
- Xh.gap.mode @Index { @Code h gap mode }
- Xsimilar, except as explained at the end of this section.
- X@PP
- XMark-to-mark,
- Xmark.to.mark @Index { Mark-to-mark gap mode }
- Xx.gap.mode @Index { @Code x gap mode }
- Xoverstrike,
- Xoverstrike @Index { Overstrike gap mode }
- Xo.gap.mode @Index { @Code o gap mode }
- Xand kerning
- Xkerning @Index { Kerning gap mode }
- Xk.gap.mode @Index { @Code k gap mode }
- Xmeasure the length from the last mark
- Xof the first object to the first mark of the second. In the case of
- Xmark-to-mark, if the length is too small to prevent the objects
- Xoverlapping, it is widened until they no longer do. Kerning also
- Xwidens, with the aim of preventing the mark of either object from
- Xoverlapping the other object; this mode is used for subscripts and
- Xsuperscripts.
- X@PP
- Xtabulation @Index { Tabulation gap mode }
- Xt.gap.mode @Index { @Code t gap mode }
- Xcentring @Index { Centring }
- Xright.justif @Index { Right justification }
- XTabulation ignores the first object and places the leading edge of the
- Xsecond object at a distance @I l from the left edge of the whole
- Xconcatenation object. It is the main user of the @Code b and @Code r
- Xunits of measurement; for example, @Code "|1rt" will right-justify the
- Xfollowing component, and @Code "|0.5rt" will centre it.
- X@PP
- XWhen two objects are separated only by zero or more white space
- Xwhite.space.when @SubIndex { when significant }
- Xspace.f.when @SubIndex { when significant }
- Xcharacters (spaces, tabs, and newlines), Lout inserts
- X{@Code "&"}{@I k}{@Code "s"} between the two objects, where @I k is the
- Xnumber of spaces. Precisely, @I k is determined by discarding all space
- Xcharacters and tabs that precede newlines (these are invisible so are
- Xbetter ignored), then counting 1 for each newline or space, and 8 for
- Xeach tab character.
- X@PP
- XA sequence of two or more objects separated by @Code "&" symbols is a
- Xparagraph.breaking.in.detail @SubIndex { in detail }
- X{@I paragraph}. Lout breaks paragraphs into lines automatically as
- Xrequired, by converting some of the @Code "&" symbols into
- X{@Code "//1vx"}. Gaps of length 0 (other than hyphenation gaps) are not
- Xeligible for this conversion. `Optimal' line breaks are chosen, using a
- Xmethod adapted from @TeX [{@Ref knuth84}].
- Xtex @RawIndex { @TeX }
- Xtex.optimal @SubIndex { optimal paragraph breaking }
- X@PP
- XIf an @Code "&" symbol whose gap has hyphenation mode
- Xhyphenation @Index { Hyphenation gap mode }
- Xtex.hyphenation @SubIndex { hyphenation }
- Xis chosen for replacement by {@Code "//1vx"}, a hyphen will be appended to
- Xthe preceding object, unless that object is a word which already ends with
- Xa hyphen. For example,
- X@ID @Code {
- XLong words may be "hyph &0ih enat &0ih ed."
- X}
- Xcould have the following result, depending where the line breaks fall:
- X@ID 2i @Wide {
- XLong words may be hyph &0ih enat &0ih ed.
- X}
- XBasser Lout inserts hyphenation gaps automatically as required, again
- Xfollowing the method of @TeX, which approximates the hyphenations in
- XWebster's dictionary. To prevent the hyphenation of a single word,
- Xenclose it in quotes. Further control over paragraph breaking and
- Xhyphenation is provided by the @@Break and @@Space symbols (Sections
- X{@NumberOf break} and {@NumberOf space}).
- X@End @Section
- END_OF_FILE
- if test 12202 -ne `wc -c <'lout/doc/tr.lout/ch3.02'`; then
- echo shar: \"'lout/doc/tr.lout/ch3.02'\" unpacked with wrong size!
- fi
- # end of 'lout/doc/tr.lout/ch3.02'
- fi
- if test -f 'lout/doc/tr.lout/ch4.04' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/doc/tr.lout/ch4.04'\"
- else
- echo shar: Extracting \"'lout/doc/tr.lout/ch4.04'\" \(10583 characters\)
- sed "s/^X//" >'lout/doc/tr.lout/ch4.04' <<'END_OF_FILE'
- X@Section
- X @Title { Chapters and sections }
- X @Tag { chapters }
- X@Begin
- X@PP
- XThe definitions of chapters and sections from the DocumentLayout package
- Xchapters @Index { Chapters and sections }
- Xform the subject of this section. They allow a chapter to be entered
- Xlike this:
- Xdocument.layout.chapters @SubIndex { chapters and sections }
- X@ID @Code {
- X"@Chapter"
- X" @Title { ... }"
- X" @Tag { ... }"
- X"@Begin"
- X" ..."
- X"@End @Chapter"
- X}
- XWithin the chapter a sequence of sections may be included by writing
- X@ID @Code {
- X"@BeginSections"
- X"@Section { ... }"
- X"..."
- X"@Section { ... }"
- X"@EndSections"
- X}
- XThese are numbered automatically, and an entry is made for each in a
- Xtable of contents.
- X@PP
- XThe user of the DocumentLayout package can find the number of the chapter or
- Xsection with a given tag by writing @Code "@NumberOf tag" at any point
- Xin the document. This feature is based on the following definitions:
- Xnumberof.example @Index { @Code "@NumberOf" example }
- X@ID @Code {
- X"export @Tag"
- X"def @NumberMarker right @Tag { @Null }"
- X""
- X"def @NumberOf right x"
- X"{ @NumberMarker&&x @Open { @Tag } }"
- X}
- XEach chapter and section will contain one invocation of
- X{@Code "@NumberMarker"}; a full explanation will be given later.
- X@PP
- XA sequence of places for receiving chapters is easily defined:
- X@ID @Code {
- X"export @Tag"
- X"def @ChapterList right @Tag"
- X"{"
- X" @Galley"
- X" //@ChapterGap @ChapterList @Next @Tag"
- X"}"
- X}
- X@Code "@ChapterGap" will usually be {@Code "1.1b"}, ensuring that each
- Xchapter begins on a new page. The @Code "@Chapter" galley itself is
- Xdefined as follows:
- Xchapter.example @Index { @Code "@Chapter" example }
- X@IndentedList
- X@LI @Code {
- X"export @FootNote @BeginSections @EndSections @Section"
- X"def @Chapter force into { @ChapterList&&preceding }"
- X" named @Tag {}"
- X" named @Title {}"
- X" named @RunningTitle { dft }"
- X" body @Body"
- X"{"
- X" def @FootNote right x { @ColFootNote x }"
- X""
- X" def @BeginSections ..."
- X" def @EndSections ..."
- X" def @Section ..."
- X}
- X@LI @Code {
- X" def @ChapterTitle"
- X" {"
- X" @ChapterNumbers @Case {"
- X" {Yes yes} @Yield { Chapter {@NumberOf @Tag}. |2s @Title }"
- X" else @Yield @Title"
- X" }"
- X" }"
- X""
- X" def @ChapterNum"
- X" {"
- X" @ChapterNumbers @Case {"
- X" {Yes yes} @Yield { Chapter {@NumberOf @Tag} }"
- X" else @Yield @Null"
- X" }"
- X" }"
- X}
- X@LI @Code {
- X" ragged @Break @BookTitleFormat @ChapterTitle"
- X" // @NumberMarker {"
- X" @ChapterList&&@Tag @Open { @Tag }"
- X" }"
- X" // @ChapterList&&preceding @Tagged @Tag"
- X" // @NumberMarker&&preceding @Tagged @Tag"
- X" // @PageMarker&&preceding @Tagged @Tag"
- X" // { @ChapterTitle } @MajorContentsEntry {@PageOf @Tag}"
- X" // @Runner"
- X" @FootEven { |0.5rt 0.8f @Font @B @PageNum }"
- X" @FootOdd { |0.5rt 0.8f @Font @B @PageNum }"
- X" // @Body"
- X" //@SectionGap @ChapRefSection"
- X" // @Runner"
- X" @TopEven { @B @PageNum |1rt @I @ChapterNum }"
- X" @TopOdd { @I {@RunningTitle @OrElse @Title} |1rt @B @PageNum }"
- X"}"
- X}
- X@EndList
- XWe will see the symbols for sections shortly. Notice how their use has
- Xbeen restricted to within the right parameter of {@Code "@Chapter"}, by
- Xnesting them and using a body parameter.
- X@PP
- XThe meaning of @Code "@FootNote" within @Code "@Chapter" has been set
- Xto {@Code "@ColFootNote"}, which produces a footnote targeted to
- X{@Code "@ColFootList"} (see Section {@NumberOf pagelayout}). In other
- Xwords, footnotes within chapters go at the foot of the column, not at
- Xthe foot of the page. (Of course, in single-column books this
- Xdistinction is insignificant.) @Code "@ChapterTitle" and
- X@Code "@ChapterNum" are trivial definitions which vary depending on
- Xwhether the user has requested numbered chapters or not.
- X@PP
- XEach invocation of @Code "@Chapter" has its own unique {@Code "@Tag"},
- Xeither supplied by the user or else inserted automatically by Lout. We
- Xnow trace the cross referencing of chapter numbers on a hypothetical
- Xthird chapter whose tag is {@Code "euclid"}.
- X@PP
- X@Code "@ChapterList&&preceding @Tagged euclid" attaches @Code "euclid"
- Xas an extra tag to the first invocation of @Code "@ChapterList"
- Xpreceding itself in the final printed document. But this
- X@Code "@ChapterList" must be the target of the chapter, and so
- X@ID @Code "@ChapterList&&euclid @Open { @Tag }"
- Xis 3, the number of the chapter ({@Code "@Tag"} refers to the parameter
- Xof {@Code "@ChapterList"}, not the parameter of {@Code "@Chapter"}).
- X Consequently the invocation of
- X@Code "@NumberMarker" within the chapter is equal to
- X{@Code "@NumberMarker 3"}.
- X@PP
- X@Code "@NumberMarker&&preceding @Tagged euclid" attaches @Code "euclid"
- Xto {@Code "@NumberMarker 3"} as an extra tag, and so
- X{@Code "@NumberOf euclid"}, which expands to
- X@ID @Code "@NumberMarker&&euclid @Open { @Tag }"
- Xmust be equal to 3, as required. This scheme could be simplified by
- Xplacing the invocation of @Code "@NumberMarker" within
- X@Code "@ChapterList" rather than within {@Code "@Chapter"}, but it turns
- Xout that that scheme does not generalize well to sections and subsections.
- X@PP
- XThere is a trap for the unwary in the use of @Code preceding and
- X{@Code following}. Suppose that the invocation of @Code "@NumberMarker"
- Xwithin @Code "@Chapter" is replaced by the seemingly equivalent
- X@ID @Code "@NumberMarker { @ChapterList&&preceding @Open { @Tag } }"
- XNow suppose that @Code "@NumberOf euclid" appears somewhere within
- XChapter 7. It will expand to
- X@ID @Code "@NumberMarker&&euclid @Open { @Tag }"
- Xwhich would now be equal to
- X@ID @Code "@ChapterList&&preceding @Open { @Tag }"
- Xwhose value, evaluated as it is within Chapter 7, is 7, not 3. Use of
- X@Code preceding or @Code following within the parameter
- Xof a symbol, rather than within the body, is likely to be erroneous.
- X@PP
- XMuch of the remainder of the definition of @Code "@Chapter" is fairly
- Xself-explanatory: there is a heading, a tag sent to mark the page on
- Xwhich the chapter begins, a @Code "@ContentsEntry" galley sent to the
- Xtable of contents, galleys for the figures and tables of the chapter to
- Xcollect in, @Code "@Body" where the body of the chapter goes, and
- X@Code "@ChapRefSection" to hold a concluding list of references. This
- Xleaves only the two invocations of @Code "@Runner" to explain.
- X@PP
- XThe first @Code "@Runner" is just below the heading. It will be the target
- Xof the @Code "@Runner&&following" cross reference at the beginning of the
- Xfirst page of the chapter (see Section {@NumberOf pagelayout}), which
- Xconsequently will have null running headers and the given footers.
- X@PP
- XThe second @Code "@Runner" appears at the very end of the chapter, hence
- Xon its last page. Since no invocations of @Code "@Runner" lie between
- Xit and the first {@Code "@Runner"}, it will be the target of
- X@Code "@Runner&&following" on every page from the second page of the
- Xchapter to the last, inclusive, and will supply the format of their
- Xheaders and footers.
- X@PP
- XThe interested reader might care to predict the outcome in unusual
- Xcases, such as when the heading occupies two pages, or when a chapter
- Xoccupies only one, or (assuming a change to the gap between chapters)
- Xwhen a chapter starts halfway down a page. Such predictions can be made
- Xwith great confidence.
- X@PP
- XThe expression @Code "@RunningTitle @OrElse @Title" appearing in the second
- X@Code "@Runner" returns the value of the @Code "@RunningTitle" parameter
- Xof @Code "@Chapter" if this is not equal to the default value
- X{@Code "dft"}, or @Code "@Title" otherwise:
- Xorelse.example @Index { @Code "@OrElse" example }
- X@ID @Code {
- X"def @OrElse"
- X" left x"
- X" right y"
- X"{"
- X" x @Case {"
- X" dft @Yield y"
- X" else @Yield x"
- X" }"
- X"}"
- X}
- XThis produces the effect of
- X@ID @Code {
- X"named @RunningTitle { @Title }"
- X}
- Xwhich unfortunately is not permissible as it stands, because @Code "@Title"
- Xis not visible within the default value of {@Code "@RunningTitle"}.
- X@PP
- XFinally, the definitions for sections omitted earlier are as follows:
- Xsection.example @Index { @Code "@Section" example }
- X@IndentedList
- X@LI @Code {
- X"def @EndSectionsPlace { @Galley }"
- X"def @EndSections force into { @EndSectionsPlace&&preceding } {}"
- X"macro @BeginSections { //@SectionGap @SectionList 1 // @EndSectionsPlace // }"
- X}
- X@LI @Code {
- X"def @Section force into { @SectionList&&preceding }"
- X" named @Tag {}"
- X" named @Title {}"
- X" named @RunningTitle { dft }"
- X" body @Body"
- X"{"
- X" def @SectionTitle"
- X" {"
- X" @SectionNumbers @Case {"
- X" {Yes yes} @Yield { {@NumberOf @Tag}. |2s @Title }"
- X" else @Yield @Title"
- X" }"
- X" }"
- X""
- X" @Heading @Protect @SectionTitle"
- X" // @NumberMarker {"
- X" {@ChapterList&&@Tag @Open { @Tag }}.{"
- X" @SectionList&&@Tag @Open { @Tag }}"
- X" }"
- X" // @ChapterList&&preceding @Tagged @Tag"
- X" // @SectionList&&preceding @Tagged @Tag"
- X" // @NumberMarker&&preceding @Tagged @Tag"
- X" // @PageMarker&&preceding @Tagged @Tag"
- X" // { &3f @SectionTitle } @ContentsEntry {@PageOf @Tag}"
- X" //0io @Body"
- X"}"
- X}
- X@EndList
- XThe @Code "@BeginSections" macro invokes {@Code "@SectionList"},
- Xpreceded by the appropriate gap and followed by an @Code "@EndSectsPlace"
- Xfor closing the list of sections when the @Code "@EndSections" symbol is
- Xfound. @Code "@Section" itself is just a copy of @Code "@Chapter" with
- Xslight changes to the format. The parameter of @Code "@NumberMarker" is
- Xa simple generalization of the one within {@Code "@Chapter"}. Notice
- Xthat we have taken care that the value of this parameter be
- Xa juxtaposition of simple words: although
- X@ID @Code {
- X"{@ChapterList&&@Tag @Open { @Tag }}. &"
- X"{@SectionList&&@Tag @Open { @Tag }}"
- X}
- Xis formally equivalent, @Code "&" is not permitted within a
- X@Code "@Tag" parameter.
- X@PP
- XThe DocumentLayout package also contains definitions for subsections in the
- Xsame style. They raise the question of whether Lout is capable of
- Xproducing subsections should the user place {@Code "@BeginSections"},
- X{@Code "@Section"}, and {@Code "@EndSections"} within a {@I section},
- Xand whether such nesting could proceed to arbitrary depth. Arbitrary
- Xnesting of sections within sections is available now, although the
- Xnumbering would of course be wrong. The author has worked out
- Xdefinitions which provide correct numbering to arbitrary depth, with an
- Xarbitrary format for each level. These were not incorporated into
- XDocumentLayout because the author considers sub-subsections to be poor
- Xstyle, and he prefers separate names for the symbols at each level.
- X@End @Section
- END_OF_FILE
- if test 10583 -ne `wc -c <'lout/doc/tr.lout/ch4.04'`; then
- echo shar: \"'lout/doc/tr.lout/ch4.04'\" unpacked with wrong size!
- fi
- # end of 'lout/doc/tr.lout/ch4.04'
- fi
- if test -f 'lout/font0/Symbo.AFM' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/font0/Symbo.AFM'\"
- else
- echo shar: Extracting \"'lout/font0/Symbo.AFM'\" \(9486 characters\)
- sed "s/^X//" >'lout/font0/Symbo.AFM' <<'END_OF_FILE'
- XStartFontMetrics 2.0
- XComment Copyright (c) 1984 Adobe Systems Incorporated. All Rights Reserved.
- XComment Creation Date:Thu Apr 16 08:46:05 PST 1987
- XFontName Symbol
- XEncodingScheme FontSpecific
- XFullName Symbol
- XFamilyName Symbol
- XWeight Medium
- XItalicAngle 0.0
- XIsFixedPitch false
- XUnderlinePosition -98
- XUnderlineThickness 54
- XVersion 001.003
- XFontBBox -180 -293 1090 1010
- XStartCharMetrics 189
- XC 32 ; WX 250 ; N space ; B 0 0 0 0 ;
- XC 33 ; WX 333 ; N exclam ; B 128 -17 240 673 ;
- XC 34 ; WX 713 ; N universal ; B 31 0 681 705 ;
- XC 35 ; WX 500 ; N numbersign ; B 20 -17 481 673 ;
- XC 36 ; WX 549 ; N existential ; B 25 0 478 707 ;
- XC 37 ; WX 833 ; N percent ; B 63 -36 771 655 ;
- XC 38 ; WX 778 ; N ampersand ; B 41 -18 750 661 ;
- XC 39 ; WX 439 ; N suchthat ; B 48 -17 414 499 ;
- XC 40 ; WX 333 ; N parenleft ; B 53 -191 300 673 ;
- XC 41 ; WX 333 ; N parenright ; B 30 -191 277 674 ;
- XC 42 ; WX 500 ; N asteriskmath ; B 65 134 427 551 ;
- XC 43 ; WX 549 ; N plus ; B 10 0 539 533 ;
- XC 44 ; WX 250 ; N comma ; B 56 -152 194 104 ;
- XC 45 ; WX 549 ; N minus ; B 11 233 535 288 ;
- XC 46 ; WX 250 ; N period ; B 69 -17 181 95 ;
- XC 47 ; WX 278 ; N slash ; B 0 -17 254 646 ;
- XC 48 ; WX 500 ; N zero ; B 23 -17 471 685 ;
- XC 49 ; WX 500 ; N one ; B 117 0 390 673 ;
- XC 50 ; WX 500 ; N two ; B 25 0 475 686 ;
- XC 51 ; WX 500 ; N three ; B 39 -17 435 687 ;
- XC 52 ; WX 500 ; N four ; B 16 0 469 685 ;
- XC 53 ; WX 500 ; N five ; B 28 -17 443 685 ;
- XC 54 ; WX 500 ; N six ; B 36 -17 467 685 ;
- XC 55 ; WX 500 ; N seven ; B 24 -17 448 673 ;
- XC 56 ; WX 500 ; N eight ; B 54 -18 440 686 ;
- XC 57 ; WX 500 ; N nine ; B 31 -17 460 685 ;
- XC 58 ; WX 278 ; N colon ; B 81 -17 193 460 ;
- XC 59 ; WX 278 ; N semicolon ; B 83 -152 221 460 ;
- XC 60 ; WX 549 ; N less ; B 26 0 523 522 ;
- XC 61 ; WX 549 ; N equal ; B 11 141 537 390 ;
- XC 62 ; WX 549 ; N greater ; B 26 0 523 522 ;
- XC 63 ; WX 444 ; N question ; B 70 -17 412 685 ;
- XC 64 ; WX 549 ; N congruent ; B 11 0 537 475 ;
- XC 65 ; WX 722 ; N Alpha ; B 4 0 684 673 ;
- XC 66 ; WX 667 ; N Beta ; B 29 0 592 672 ;
- XC 67 ; WX 722 ; N Chi ; B -9 0 704 673 ;
- XC 68 ; WX 612 ; N Delta ; B 6 0 608 688 ;
- XC 69 ; WX 611 ; N Epsilon ; B 32 0 617 673 ;
- XC 70 ; WX 763 ; N Phi ; B 26 0 741 672 ;
- XC 71 ; WX 603 ; N Gamma ; B 24 0 609 673 ;
- XC 72 ; WX 722 ; N Eta ; B 39 0 729 673 ;
- XC 73 ; WX 333 ; N Iota ; B 32 0 316 673 ;
- XC 74 ; WX 631 ; N theta1 ; B 18 -17 623 689 ;
- XC 75 ; WX 722 ; N Kappa ; B 35 0 722 672 ;
- XC 76 ; WX 686 ; N Lambda ; B 6 0 680 688 ;
- XC 77 ; WX 889 ; N Mu ; B 28 0 887 673 ;
- XC 78 ; WX 722 ; N Nu ; B 29 -8 720 673 ;
- XC 79 ; WX 722 ; N Omicron ; B 41 -17 715 685 ;
- XC 80 ; WX 768 ; N Pi ; B 25 0 745 673 ;
- XC 81 ; WX 741 ; N Theta ; B 41 -17 715 685 ;
- XC 82 ; WX 556 ; N Rho ; B 28 0 563 673 ;
- XC 83 ; WX 592 ; N Sigma ; B 5 0 589 673 ;
- XC 84 ; WX 611 ; N Tau ; B 33 0 607 673 ;
- XC 85 ; WX 690 ; N Upsilon ; B -8 0 694 673 ;
- XC 86 ; WX 439 ; N sigma1 ; B 40 -233 436 500 ;
- XC 87 ; WX 768 ; N Omega ; B 34 0 736 688 ;
- XC 88 ; WX 645 ; N Xi ; B 40 0 599 672 ;
- XC 89 ; WX 795 ; N Psi ; B 15 0 781 683 ;
- XC 90 ; WX 611 ; N Zeta ; B 44 0 636 673 ;
- XC 91 ; WX 333 ; N bracketleft ; B 86 -155 299 673 ;
- XC 92 ; WX 863 ; N therefore ; B 163 0 701 478 ;
- XC 93 ; WX 333 ; N bracketright ; B 33 -155 246 673 ;
- XC 94 ; WX 658 ; N perpendicular ; B 15 0 652 674 ;
- XC 95 ; WX 500 ; N underscore ; B -2 -252 502 -206 ;
- XC 96 ; WX 500 ; N radicalex ; B 480 881 1090 917 ;
- XC 97 ; WX 631 ; N alpha ; B 41 -17 622 500 ;
- XC 98 ; WX 549 ; N beta ; B 61 -222 515 741 ;
- XC 99 ; WX 549 ; N chi ; B 12 -231 522 500 ;
- XC 100 ; WX 494 ; N delta ; B 40 -17 481 740 ;
- XC 101 ; WX 439 ; N epsilon ; B 22 -19 427 502 ;
- XC 102 ; WX 521 ; N phi ; B 27 -224 490 670 ;
- XC 103 ; WX 411 ; N gamma ; B 5 -225 484 499 ;
- XC 104 ; WX 603 ; N eta ; B 0 -202 527 514 ;
- XC 105 ; WX 329 ; N iota ; B 0 -18 301 503 ;
- XC 106 ; WX 603 ; N phi1 ; B 36 -224 587 499 ;
- XC 107 ; WX 549 ; N kappa ; B 33 0 558 502 ;
- XC 108 ; WX 549 ; N lambda ; B 24 -18 548 739 ;
- XC 109 ; WX 576 ; N mu ; B 33 -223 567 500 ;
- XC 110 ; WX 521 ; N nu ; B -9 -17 475 507 ;
- XC 111 ; WX 549 ; N omicron ; B 35 -19 501 499 ;
- XC 112 ; WX 549 ; N pi ; B 10 -20 530 486 ;
- XC 113 ; WX 521 ; N theta ; B 43 -18 485 690 ;
- XC 114 ; WX 549 ; N rho ; B 50 -230 490 499 ;
- XC 115 ; WX 603 ; N sigma ; B 30 -21 588 500 ;
- XC 116 ; WX 439 ; N tau ; B 10 -18 418 500 ;
- XC 117 ; WX 576 ; N upsilon ; B 7 -17 535 507 ;
- XC 118 ; WX 713 ; N omega1 ; B 12 -17 671 583 ;
- XC 119 ; WX 686 ; N omega ; B 42 -17 684 500 ;
- XC 120 ; WX 493 ; N xi ; B 27 -224 469 766 ;
- XC 121 ; WX 686 ; N psi ; B 12 -228 701 500 ;
- XC 122 ; WX 494 ; N zeta ; B 60 -225 467 756 ;
- XC 123 ; WX 480 ; N braceleft ; B 58 -183 397 673 ;
- XC 124 ; WX 200 ; N bar ; B 65 -177 135 673 ;
- XC 125 ; WX 480 ; N braceright ; B 79 -183 418 673 ;
- XC 126 ; WX 549 ; N similar ; B 17 203 529 307 ;
- XC 161 ; WX 620 ; N Upsilon1 ; B -2 0 610 684 ;
- XC 162 ; WX 247 ; N minute ; B 27 459 228 735 ;
- XC 163 ; WX 549 ; N lessequal ; B 29 0 526 639 ;
- XC 164 ; WX 167 ; N fraction ; B -180 -12 340 677 ;
- XC 165 ; WX 713 ; N infinity ; B 25 124 689 404 ;
- XC 166 ; WX 500 ; N florin ; B 2 -193 494 687 ;
- XC 167 ; WX 753 ; N club ; B 86 -26 660 533 ;
- XC 168 ; WX 753 ; N diamond ; B 142 -36 600 550 ;
- XC 169 ; WX 753 ; N heart ; B 117 -33 631 532 ;
- XC 170 ; WX 753 ; N spade ; B 113 -36 629 548 ;
- XC 171 ; WX 1042 ; N arrowboth ; B 24 -15 1024 511 ;
- XC 172 ; WX 987 ; N arrowleft ; B 32 -15 942 511 ;
- XC 173 ; WX 603 ; N arrowup ; B 45 0 571 910 ;
- XC 174 ; WX 987 ; N arrowright ; B 49 -15 959 511 ;
- XC 175 ; WX 603 ; N arrowdown ; B 45 -22 571 888 ;
- XC 176 ; WX 400 ; N degree ; B 50 385 350 684 ;
- XC 177 ; WX 549 ; N plusminus ; B 10 0 539 645 ;
- XC 178 ; WX 411 ; N second ; B 20 459 413 737 ;
- XC 179 ; WX 549 ; N greaterequal ; B 29 0 526 639 ;
- XC 180 ; WX 549 ; N multiply ; B 17 8 533 524 ;
- XC 181 ; WX 713 ; N proportional ; B 27 123 639 404 ;
- XC 182 ; WX 494 ; N partialdiff ; B 26 -20 462 746 ;
- XC 183 ; WX 460 ; N bullet ; B 50 113 410 473 ;
- XC 184 ; WX 549 ; N divide ; B 10 71 536 456 ;
- XC 185 ; WX 549 ; N notequal ; B 15 -25 540 549 ;
- XC 186 ; WX 549 ; N equivalence ; B 14 82 538 443 ;
- XC 187 ; WX 549 ; N approxequal ; B 14 135 527 394 ;
- XC 188 ; WX 1000 ; N ellipsis ; B 111 -17 889 95 ;
- XC 189 ; WX 603 ; N arrowvertex ; B 280 -120 336 1010 ;
- XC 190 ; WX 1000 ; N arrowhorizex ; B -60 220 1050 276 ;
- XC 191 ; WX 658 ; N carriagereturn ; B 15 -16 602 629 ;
- XC 192 ; WX 823 ; N aleph ; B 175 -18 661 658 ;
- XC 193 ; WX 686 ; N Ifraktur ; B 10 -53 578 740 ;
- XC 194 ; WX 795 ; N Rfraktur ; B 26 -15 759 734 ;
- XC 195 ; WX 987 ; N weierstrass ; B 159 -211 870 573 ;
- XC 196 ; WX 768 ; N circlemultiply ; B 43 -17 733 673 ;
- XC 197 ; WX 768 ; N circleplus ; B 43 -15 733 675 ;
- XC 198 ; WX 823 ; N emptyset ; B 39 -24 781 719 ;
- XC 199 ; WX 768 ; N intersection ; B 40 0 732 509 ;
- XC 200 ; WX 768 ; N union ; B 40 -17 732 492 ;
- XC 201 ; WX 713 ; N propersuperset ; B 20 0 673 470 ;
- XC 202 ; WX 713 ; N reflexsuperset ; B 20 -125 673 470 ;
- XC 203 ; WX 713 ; N notsubset ; B 36 -70 690 540 ;
- XC 204 ; WX 713 ; N propersubset ; B 37 0 690 470 ;
- XC 205 ; WX 713 ; N reflexsubset ; B 37 -125 690 470 ;
- XC 206 ; WX 713 ; N element ; B 45 0 505 468 ;
- XC 207 ; WX 713 ; N notelement ; B 45 -58 505 555 ;
- XC 208 ; WX 768 ; N angle ; B 26 0 738 673 ;
- XC 209 ; WX 713 ; N gradient ; B 36 -19 681 718 ;
- XC 210 ; WX 790 ; N registerserif ; B 50 -20 740 670 ;
- XC 211 ; WX 790 ; N copyrightserif ; B 51 -15 741 675 ;
- XC 212 ; WX 890 ; N trademarkserif ; B 18 293 855 673 ;
- XC 213 ; WX 823 ; N product ; B 25 -101 803 751 ;
- XC 214 ; WX 549 ; N radical ; B 10 -38 515 917 ;
- XC 215 ; WX 250 ; N dotmath ; B 69 210 169 310 ;
- XC 216 ; WX 713 ; N logicalnot ; B 15 0 680 288 ;
- XC 217 ; WX 603 ; N logicaland ; B 23 0 583 454 ;
- XC 218 ; WX 603 ; N logicalor ; B 30 0 578 477 ;
- XC 219 ; WX 1042 ; N arrowdblboth ; B 27 -20 1023 510 ;
- XC 220 ; WX 987 ; N arrowdblleft ; B 30 -15 939 513 ;
- XC 221 ; WX 603 ; N arrowdblup ; B 39 2 567 911 ;
- XC 222 ; WX 987 ; N arrowdblright ; B 45 -20 954 508 ;
- XC 223 ; WX 603 ; N arrowdbldown ; B 44 -19 572 890 ;
- XC 224 ; WX 494 ; N lozenge ; B 18 0 466 745 ;
- XC 225 ; WX 329 ; N angleleft ; B 25 -198 306 746 ;
- XC 226 ; WX 790 ; N registersans ; B 50 -20 740 670 ;
- XC 227 ; WX 790 ; N copyrightsans ; B 49 -15 739 675 ;
- XC 228 ; WX 786 ; N trademarksans ; B 5 293 725 673 ;
- XC 229 ; WX 713 ; N summation ; B 14 -108 695 752 ;
- XC 230 ; WX 384 ; N parenlefttp ; B 40 -293 436 926 ;
- XC 231 ; WX 384 ; N parenleftex ; B 40 -85 92 925 ;
- XC 232 ; WX 384 ; N parenleftbt ; B 40 -293 436 926 ;
- XC 233 ; WX 384 ; N bracketlefttp ; B 0 -80 341 926 ;
- XC 234 ; WX 384 ; N bracketleftex ; B 0 -79 55 925 ;
- XC 235 ; WX 384 ; N bracketleftbt ; B 0 -80 340 926 ;
- XC 236 ; WX 494 ; N bracelefttp ; B 201 -75 439 926 ;
- XC 237 ; WX 494 ; N braceleftmid ; B 14 -85 255 935 ;
- XC 238 ; WX 494 ; N braceleftbt ; B 201 -70 439 926 ;
- XC 239 ; WX 494 ; N braceex ; B 201 -80 255 935 ;
- XC 241 ; WX 329 ; N angleright ; B 21 -198 302 746 ;
- XC 242 ; WX 274 ; N integral ; B 2 -107 291 916 ;
- XC 243 ; WX 686 ; N integraltp ; B 332 -83 715 922 ;
- XC 244 ; WX 686 ; N integralex ; B 332 -88 415 975 ;
- XC 245 ; WX 686 ; N integralbt ; B 39 -81 415 921 ;
- XC 246 ; WX 384 ; N parenrighttp ; B 54 -293 450 926 ;
- XC 247 ; WX 384 ; N parenrightex ; B 398 -85 450 925 ;
- XC 248 ; WX 384 ; N parenrightbt ; B 54 -293 450 926 ;
- XC 249 ; WX 384 ; N bracketrighttp ; B 22 -80 360 926 ;
- XC 250 ; WX 384 ; N bracketrightex ; B 305 -79 360 925 ;
- XC 251 ; WX 384 ; N bracketrightbt ; B 20 -80 360 926 ;
- XC 252 ; WX 494 ; N bracerighttp ; B 17 -75 255 926 ;
- XC 253 ; WX 494 ; N bracerightmid ; B 201 -85 442 935 ;
- XC 254 ; WX 494 ; N bracerightbt ; B 17 -70 255 926 ;
- XC -1 ; WX 790 ; N apple ; B 56 -3 733 808 ;
- XEndCharMetrics
- XEndFontMetrics
- END_OF_FILE
- if test 9486 -ne `wc -c <'lout/font0/Symbo.AFM'`; then
- echo shar: \"'lout/font0/Symbo.AFM'\" unpacked with wrong size!
- fi
- # end of 'lout/font0/Symbo.AFM'
- fi
- if test -f 'lout/z27.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'lout/z27.c'\"
- else
- echo shar: Extracting \"'lout/z27.c'\" \(10847 characters\)
- sed "s/^X//" >'lout/z27.c' <<'END_OF_FILE'
- X/*@z27.c:Debug Service:DebugInit(), Debug()@**********************************/
- X/* */
- X/* LOUT: A HIGH-LEVEL LANGUAGE FOR DOCUMENT FORMATTING (VERSION 2.03) */
- X/* COPYRIGHT (C) 1993 Jeffrey H. Kingston */
- X/* */
- X/* Jeffrey H. Kingston (jeff@cs.su.oz.au) */
- X/* Basser Department of Computer Science */
- X/* The University of Sydney 2006 */
- X/* AUSTRALIA */
- X/* */
- X/* This program is free software; you can redistribute it and/or modify */
- X/* it under the terms of the GNU General Public License as published by */
- X/* the Free Software Foundation; either version 1, or (at your option) */
- X/* any later version. */
- X/* */
- X/* This program is distributed in the hope that it will be useful, */
- X/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
- X/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
- X/* GNU General Public License for more details. */
- X/* */
- X/* You should have received a copy of the GNU General Public License */
- X/* along with this program; if not, write to the Free Software */
- X/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
- X/* */
- X/* FILE: z27.c */
- X/* MODULE: Debug Service */
- X/* EXTERNS: dbg[], DebugInit(), Debug() */
- X/* ProfileOn(), ProfileOff(), ProfilePrint() */
- X/* */
- X/*****************************************************************************/
- X#include "externs"
- X
- X#if DEBUG_ON
- X
- Xstruct dbs dbg[] = {
- X (unsigned char *) "zz", 0, 0, 0, /* - unused - */
- X (unsigned char *) "sp", 0, 0, 0, /* Supervise */
- X (unsigned char *) "la", 0, 0, 0, /* Lexical Analyser */
- X (unsigned char *) "fs", 0, 0, 0, /* File Service */
- X (unsigned char *) "ts", 0, 0, 0, /* Token Service */
- X (unsigned char *) "rd", 0, 0, 0, /* Read Definitions */
- X (unsigned char *) "op", 0, 0, 0, /* Object Parser */
- X (unsigned char *) "os", 0, 0, 0, /* Object Service */
- X (unsigned char *) "om", 0, 0, 0, /* Object Manifest */
- X (unsigned char *) "ce", 0, 0, 0, /* Closure Expansion */
- X (unsigned char *) "cr", 0, 0, 0, /* Cross References */
- X (unsigned char *) "ss", 0, 0, 0, /* Style Service */
- X (unsigned char *) "sf", 0, 0, 0, /* Size Finder */
- X (unsigned char *) "ob", 0, 0, 0, /* Object Breaking */
- X (unsigned char *) "of", 0, 0, 0, /* Object Filling */
- X (unsigned char *) "sc", 0, 0, 0, /* Size Constraints */
- X (unsigned char *) "sa", 0, 0, 0, /* Size Adjustments */
- X (unsigned char *) "gw", 0, 0, 0, /* Gap Widths */
- X (unsigned char *) "gt", 0, 0, 0, /* Galley Transfer */
- X (unsigned char *) "ga", 0, 0, 0, /* Galley Attaching */
- X (unsigned char *) "gf", 0, 0, 0, /* Galley Flusher */
- X (unsigned char *) "gm", 0, 0, 0, /* Galley Maker */
- X (unsigned char *) "gs", 0, 0, 0, /* Galley Service */
- X (unsigned char *) "gp", 0, 0, 0, /* Galley Printer */
- X (unsigned char *) "ft", 0, 0, 0, /* Font Tables */
- X (unsigned char *) "oe", 0, 0, 0, /* Object Echo */
- X (unsigned char *) "es", 0, 0, 0, /* Echo Service */
- X (unsigned char *) "zz", 0, 0, 0, /* Debug Service (unused) */
- X (unsigned char *) "yy", 0, 0, 0, /* Error Service */
- X (unsigned char *) "st", 0, 0, 0, /* Symbol Table */
- X (unsigned char *) "su", 0, 0, 0, /* Symbol Uses */
- X (unsigned char *) "ma", 0, 0, 0, /* Memory Allocator */
- X (unsigned char *) "cs", 0, 0, 0, /* Counter Service */
- X (unsigned char *) "bs", 0, 0, 0, /* Database Service */
- X (unsigned char *) "rs", 0, 0, 0, /* Rotation Service */
- X (unsigned char *) "tk", 0, 0, 0, /* Time Keeper */
- X (unsigned char *) "hy", 0, 0, 0, /* Hyphenation */
- X (unsigned char *) "pp", 0, 0, 0, /* Profiling */
- X (unsigned char *) "", 0, 0, 0, /* any */
- X};
- X
- X
- X/*****************************************************************************/
- X/* */
- X/* DebugInit(str) */
- X/* */
- X/* Turn on the debug flag given by str. */
- X/* */
- X/*****************************************************************************/
- X
- XDebugInit(str)
- Xunsigned char *str;
- X{ int j, urg;
- X for( urg = 0; urg < 2 && str[urg+2] == 'd'; urg++ );
- X for( j = 1; ; j++ )
- X { if( strcmp(dbg[j].flag, &str[urg+2]) == 0 ) break;
- X if( strcmp(dbg[j].flag, "" ) == 0 )
- X Error(FATAL, no_fpos, "unknown debug flag %s", str);
- X }
- X for( ; urg >= 0; urg-- ) dbg[j].on[urg] = dbg[ANY].on[urg] = TRUE;
- X} /* end DebugInit */
- X
- X
- X/*@@**************************************************************************/
- X/* */
- X/* Debug(category, urgency, str, p1, p2, p3, p4, p5, p6, p7, p8) */
- X/* */
- X/* Print str on debug output, if the flag corresponding to the given */
- X/* debug category and urgency is on. */
- X/* */
- X/*****************************************************************************/
- X
- X/*VARARGS3*/
- XDebug(category, urgency, str, p1, p2, p3, p4, p5, p6, p7, p8)
- Xint category, urgency; unsigned char *str; int p1, p2, p3, p4, p5, p6, p7, p8;
- X{ static BOOLEAN first_message = TRUE;
- X if( first_message )
- X { fprintf(stderr, "\nLout Debug Output:\n");
- X first_message = FALSE;
- X }
- X fprintf(stderr, "%2s: ", dbg[category].flag);
- X fprintf(stderr, str, p1, p2, p3, p4, p5, p6, p7, p8);
- X fprintf(stderr, "\n");
- X fflush(stderr);
- X} /* end Debug */
- X
- X
- X#define MAXPROF 20
- X#include <time.h>
- X
- Xstruct profrec
- X{ unsigned char *label; /* label of the profile */
- X int calls; /* number of calls with this label */
- X long time; /* total time of this label */
- X};
- X
- Xstatic struct profrec profstack[MAXPROF];
- Xstatic struct profrec profstore[MAXPROF];
- Xstatic int proftop = 0, profsize = 0;
- X
- X/*****************************************************************************/
- X/* */
- X/* ProfileOn(str) */
- X/* */
- X/* Start profiling label str. */
- X/* */
- X/*****************************************************************************/
- X
- XProfileOn(str)
- Xunsigned char *str;
- X{ int i; long raw_time;
- X for( i = 0; i < proftop; i++ )
- X { if( strcmp(profstack[i].label, str) == 0 )
- X { for( i = 0; i < proftop; i++ )
- X fprintf(stderr, "profstack[%d] = %s\n", i, profstack[i].label);
- X Error(INTERN, no_fpos, "ProfileOn: %s restarted", str);
- X }
- X }
- X if( proftop == MAXPROF ) Error(INTERN, no_fpos, "ProfileOn: overflow");
- X time(&raw_time);
- X profstack[proftop].label = str;
- X profstack[proftop].time = raw_time;
- X proftop++;
- X} /* end ProfileOn */
- X
- X
- X/*****************************************************************************/
- X/* */
- X/* ProfileOff(str) */
- X/* */
- X/* Stop profiling label str. */
- X/* */
- X/*****************************************************************************/
- X
- XProfileOff(str)
- Xunsigned char *str;
- X{ int i; long raw_time;
- X if( proftop == 0 || strcmp(profstack[proftop-1].label, str) != 0 )
- X Error(INTERN, no_fpos, "ProfileOff: %s is not the current label", str);
- X for( i = 0; i < profsize && strcmp(profstore[i].label, str) != 0; i++ );
- X if( i >= profsize )
- X { if( profsize == MAXPROF ) Error(INTERN, no_fpos, "ProfileOff: overflow");
- X profsize++;
- X profstore[i].label = str;
- X profstore[i].calls = 0;
- X profstore[i].time = 0;
- X }
- X time(&raw_time);
- X profstore[i].calls += 1;
- X profstore[i].time += (raw_time - profstack[proftop-1].time);
- X proftop--;
- X} /* end ProfileOff */
- X
- X
- X/*****************************************************************************/
- X/* */
- X/* ProfilePrint() */
- X/* */
- X/* Print results of profiling. */
- X/* */
- X/*****************************************************************************/
- X
- XProfilePrint()
- X{ int i;
- X for( i = 0; i < profsize; i++ )
- X { fprintf(stderr, "Profile %-20s %6d secs, %3d calls, %6.2f secs/call\n",
- X profstore[i].label, profstore[i].time, profstore[i].calls,
- X (float) profstore[i].time / profstore[i].calls );
- X }
- X} /* end ProfilePrint */
- X#endif
- END_OF_FILE
- if test 10847 -ne `wc -c <'lout/z27.c'`; then
- echo shar: \"'lout/z27.c'\" unpacked with wrong size!
- fi
- # end of 'lout/z27.c'
- fi
- echo shar: End of archive 23 \(of 30\).
- cp /dev/null ark23isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 30 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-