home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume38 / lout / part28 < prev    next >
Encoding:
Text File  |  1993-08-11  |  73.7 KB  |  1,931 lines

  1. Newsgroups: comp.sources.misc
  2. From: jeff@joyce.cs.su.oz.au (Jeff Kingston)
  3. Subject: v38i096:  lout - Lout document formatting system, v2.05, Part28/35
  4. Message-ID: <1993Aug10.132206.18785@sparky.sterling.com>
  5. X-Md4-Signature: fd1a7f87733ff0c261b01a1b047bb771
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 10 Aug 1993 13:22:06 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: jeff@joyce.cs.su.oz.au (Jeff Kingston)
  12. Posting-number: Volume 38, Issue 96
  13. Archive-name: lout/part28
  14. Environment: UNIX
  15. Supersedes: lout: Volume 37, Issue 99-128
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  doc/tr.fig/s5 doc/tr.lout/ch1.04 doc/tr.lout/ch2.06
  22. #   doc/tr.lout/ch4.03 doc/tr.lout/ch4.04 font/Symbo.AFM z27.c
  23. # Wrapped by kent@sparky on Sun Aug  8 12:29:32 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 28 (of 35)."'
  27. if test -f 'doc/tr.fig/s5' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'doc/tr.fig/s5'\"
  29. else
  30.   echo shar: Extracting \"'doc/tr.fig/s5'\" \(9154 characters\)
  31.   sed "s/^X//" >'doc/tr.fig/s5' <<'END_OF_FILE'
  32. X@Section
  33. X   @Title { Lengths, angles, and points }
  34. X@Begin
  35. X@PP
  36. XWe already know that two lengths placed side by side define a point.  This is 
  37. Xonly the simplest of a number of such geometrical combinations.
  38. X@PP
  39. XThe symbol @Code "@Distance" returns the length of the line joining two
  40. Xpoints:
  41. X@ID @Code "{0 0} @Distance {3 cm  4 cm}"
  42. Xis equivalent to the length {@Code "5 cm"}.  The result of @Code "@Distance"
  43. Xis never negative.  Notice that braces must enclose the two points.  The
  44. Xsymbol @Code "@XDistance" returns the distance in the @Eq { x } direction
  45. Xfrom one point to another:
  46. X@ID {
  47. X@Code "{" & @Eq { x sub 1 ``` y sub 1 } & @Code "}  @XDistance  {"
  48. X& @Eq { x sub 2 ``` y sub 2 } & @Code "}"
  49. X}
  50. Xhas for its result the length @Eq { x sub 2 - x sub 1 }, and so may be
  51. Xnegative.  There is an analogous @Code "@YDistance" symbol.
  52. X@PP
  53. XThe symbol @Code "@Angle" returns the angle @Eq {theta} from one point to
  54. Xanother:
  55. X@ID {
  56. X@Code "{" & @Eq { x sub 1 ``` y sub 1 } & @Code "}  @Angle  {"
  57. X& @Eq { x sub 2 ``` y sub 2 } & @Code "}"
  58. X||7ct
  59. X@Fig {
  60. X@Figure
  61. X   arrow { forward }
  62. X   shape { 4 cm 0 0 0 4 cm 3 cm }
  63. X{ 4c @Wide 3c @High }
  64. X// {4 cm 3 cm} ** 0.4 ++ { 0.5 cm 0 } @MarkOf @Eq { (x sub 1 & , y sub 1 & ) }
  65. X// {4 cm 3 cm} ** 0.4 @BaseOf @Circle margin { 0.05c } paint { black } {}
  66. X// {4 cm 3 cm} ** 0.8 ++ { 0.5 cm 0 } @MarkOf @Eq { (x sub 2 & , y sub 2 & ) }
  67. X// {4 cm 3 cm} ** 0.8 @BaseOf @Circle margin { 0.05c } paint { black } {}
  68. X// { 1 cm 0.2 cm } ** 0.7 @BaseOf @Eq { theta }
  69. X}
  70. X}
  71. XThe result will be 0 if the two points are equal.  The symbol @Code "<<"
  72. Xreturns the point at a given distance and angle from @Eq { (0, 0) }:
  73. X@ID {
  74. X@Code "{" & @Eq { length }  @Code "<<"  @Eq { theta } & @Code "}"
  75. X||7ct
  76. X@Fig {
  77. X@Figure
  78. X   arrow { forward }
  79. X   shape { 4 cm 0 0 0 4 cm 3 cm }
  80. X{ 4c @Wide 3c @High }
  81. X// {4 cm 3 cm} ** 0.5 -- {1.5 cm 0} @BaseOf @I length
  82. X// {4 cm 3 cm} ** 0.8 @BaseOf @Circle margin { 0.05c } paint { black } {}
  83. X// { 1 cm 0.2 cm } ** 0.7 @BaseOf @Eq { theta }
  84. X}
  85. X}
  86. XFor example, @Code "{ 5 cm << 45 dg }" is the point 5 cm
  87. Xfrom @Eq { (0, 0) } at 45 degrees.
  88. X@PP
  89. XPoints may be added, subtracted, and multiplied by a number:
  90. X@ID @Tab
  91. X     vmargin { 0.5vx }
  92. X     @Fmta { @Col A ! @Col is ! @Col B }
  93. X{
  94. X@Rowa
  95. X   A { @Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "}  ++  {" &
  96. X@Eq {x sub 2 ``` y sub 2} & @Code "}" }
  97. X   B { @Eq { (x sub 1 + x sub 2 & , y sub 1 + y sub 2 & ) } }
  98. X@Rowa
  99. X   A { @Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "}  --  {" &
  100. X@Eq {x sub 2 ``` y sub 2} & @Code "}" }
  101. X   B { @Eq { (x sub 1 - x sub 2 & , y sub 1 - y sub 2 & ) } }
  102. X@Rowa
  103. X   A { @Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "}  **  " & @Eq {k} }
  104. X   B { @Eq { (x sub 1 & k, y sub 1 & k) } }
  105. X}
  106. XFor example,
  107. X@ID {
  108. X@Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "} ** 0.2  ++  " &
  109. X@Code "{" & @Eq {x sub 2 ``` y sub 2} & @Code "} ** 0.8"
  110. X}
  111. Xis the point eight tenths of the way from 
  112. X@Eq { (x sub 1 & , y sub 1 & ) } to
  113. X@Eq { (x sub 2 & , y sub 2 & ) } on the line joining them:
  114. X@LP
  115. X@ID @Fig {
  116. X@Figure
  117. X   shape {
  118. X      {xsize 0} ** 0.3 ++ {0 ysize} @Label P1
  119. X      {xsize 0} ++ {0 ysize} ** 0.4 @Label P2
  120. X      P1 ** 0.2 @Label FP1
  121. X      P2 ** 0.8 @Label FP2
  122. X      0 0 P1 P2 0 0 [] FP1 FP1 ++ FP2 FP2
  123. X   }
  124. X{ 6c @High 9c @Wide }
  125. X// P1 ++ {0.3 cm 0} @BaseOf @Eq { (x sub 1 & , y sub 1 & ) }
  126. X// P2 ++ {0.3 cm 0} @BaseOf @Eq { (x sub 2 & , y sub 2 & ) }
  127. X// FP1 ++ FP2 ++ {0.3 cm 0} @BaseOf
  128. X@Eq { (0.2x sub 1 & + 0.8x sub 2 & , 0.2y sub 1 & + 0.8y sub 2 & ) }
  129. X}
  130. XWhen using {@Code "**"}, the point must be on the left and the number on
  131. Xthe right.  It would be more convenient to name these symbols
  132. X{@Code "+"}, {@Code "-"}, and {@Code "*"}, but these names
  133. Xare often taken by equation formatters, and @Code "-" appears in
  134. Xlengths, so we don't.  There are @Code "@Max" and @Code "@Min" symbols:
  135. X@ID @Tab
  136. X     vmargin { 0.5vx }
  137. X     @Fmta { @Col A ! @Col is ! @Col B }
  138. X{
  139. X@Rowa
  140. X  A { @Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "}  @Max  {" &
  141. X@Eq {x sub 2 ``` y sub 2} & @Code "}" }
  142. X  B { @Eq { (max(x sub 1 & , x sub 2 & ), max(y sub 1 & , y sub 2 & )) } }
  143. X@Rowa
  144. X  A { @Code "{" & @Eq {x sub 1 ``` y sub 1} & @Code "}  @Min  {" &
  145. X@Eq {x sub 2 ``` y sub 2} & @Code "}" }
  146. X  B { @Eq { (min(x sub 1 & , x sub 2 & ), min(y sub 1 & , y sub 2 & )) } }
  147. X}
  148. XNote carefully that these apply to points, not to numbers.
  149. X@PP
  150. XThe result of adding two points together depends on where the origin is
  151. Xat the time, as well as on the points themselves.  This can lead to
  152. Xunexpected results, as the author has found to his cost more than
  153. Xonce.  Within the @Code shape option of {@Code "@Figure"}, the origin is
  154. Xthe lower left corner of the result of the {@Code "@Figure"}.  In cases
  155. Xlike the example on page {@PageOf sumpoints}, where points are added
  156. Xoutside of any {@Code "@Figure"} symbol, the origin is usually at the
  157. Xbottom left corner of the figure as a whole.  A label always denotes a
  158. Xparticular point on the printed page, regardless of where the origin
  159. Xhappens to be.
  160. X@PP
  161. XThe symbol @Code "@Prev" within the @Code "shape" option of @Code
  162. X"@Figure" denotes the previous point of the shape, ignoring points within
  163. X{@Code {"[" &0.5s "]"}}.  This makes it easy to specify each point
  164. Xrelative to the previous one:
  165. X@ID {
  166. X@Code {
  167. X"   shape {"
  168. X"      0 0"
  169. X"      { 2 cm << 30 }"
  170. X"      @Prev ++ { 2 cm << 90 }"
  171. X"      @Prev ++ { 2 cm << 150 }"
  172. X"      @Prev ++ { 2 cm << 210 }"
  173. X"      @Prev ++ { 2 cm << 270 }"
  174. X"      0 0"
  175. X"   }"
  176. X}
  177. X||7ct
  178. X@Fig { ||2.5c
  179. X@Figure
  180. X   shape {
  181. X      0 0
  182. X      { 2 cm << 30 }
  183. X      @Prev ++ { 2 cm << 90 }
  184. X      @Prev ++ { 2 cm << 150 }
  185. X      @Prev ++ { 2 cm << 210 }
  186. X      @Prev ++ { 2 cm << 270 }
  187. X      0 0
  188. X   }
  189. X{ 4c @Wide 4c @High }
  190. X}
  191. X}
  192. X@PP
  193. XFig provides a @Code "@Label" symbol for attaching a label to a point in
  194. Xa shape, like this:
  195. X@ID @Code "{xsize ysize} ** 0.5 @Label CTR"
  196. XThe point may then be referred to more concisely by its label,
  197. X{@Code CTR}.  For example, the large arrow appearing in Section 2 was
  198. Xbuilt like this:
  199. X@ID {
  200. X@Code {
  201. X"@Figure"
  202. X"   shape {"
  203. X"      {0 ysize} ** 0.4 @Label SB"
  204. X"      {0 ysize} ** 0.6 @Label ST"
  205. X"      {xsize 0} ** 0.7 @Label HB"
  206. X"      SB"
  207. X"      SB ++ HB"
  208. X"      HB"
  209. X"      {xsize 0} ++ {0 ysize} ** 0.5"
  210. X"      HB ++ {0 ysize}"
  211. X"      HB ++ ST"
  212. X"      ST"
  213. X"      SB"
  214. X"   }"
  215. X"   paint { grey }"
  216. X"{ 6c @Wide 2c @High }"
  217. X}
  218. X||7ct
  219. X@Fig {
  220. X@Figure
  221. X   shape {
  222. X      {0 ysize} ** 0.4 @Label SB
  223. X      {0 ysize} ** 0.6 @Label ST
  224. X      {xsize 0} ** 0.7 @Label HB
  225. X      SB
  226. X      SB ++ HB
  227. X      HB
  228. X      {xsize 0} ++ {0 ysize} ** 0.5
  229. X      HB ++ {0 ysize}
  230. X      HB ++ ST
  231. X      ST
  232. X      SB
  233. X   }
  234. X   paint { grey }
  235. X{ 6c @Wide 2c @High }
  236. X// @ShowLabels
  237. X}
  238. X}
  239. XIncidentally, the labels of a figure can be displayed as above by putting
  240. Xthe symbol @Code "@ShowLabels" at the end of the figure.  Labels can
  241. Xsave a lot of effort.  They should contain only digits, upper-case
  242. Xletters and {@Code "@"}, because Fig and Lout use labels of their own
  243. Xmade from lower-case letters.
  244. X@PP
  245. XThe standard shapes have standard labels; for example, the labels
  246. Xof @Code "@Ellipse" are
  247. X@LP
  248. X@ID {
  249. X@Code {
  250. X"@Ellipse"
  251. X"{ 3c @Wide 2c @High }"
  252. X}
  253. X||7ct
  254. X@Fig {
  255. X@Ellipse { 3c @Wide 2c @High }
  256. X// @ShowLabels
  257. X}
  258. X}
  259. XThere is a symbol, {@Code "::"}, for @I relabelling an object.
  260. XEach label in the right parameter is relabelled in the following way:
  261. X@LP
  262. X@ID {
  263. X@Code {
  264. X"E1:: @Ellipse"
  265. X"{ 3c @Wide 2c @High }"
  266. X}
  267. X||7ct
  268. X@Fig {
  269. XE1:: @Ellipse { 3c @Wide 2c @High }
  270. X// @ShowLabels
  271. X}
  272. X}
  273. XWithin the right parameter of @Code "::" the original names hold sway;
  274. Xbut afterwards the names are changed by prefixing the label
  275. Xand @Code "@" to them.  These composite labels may be used exactly like
  276. Xother labels.  Relabelling can be nested to arbitrary depth:
  277. X@LP
  278. X@ID {
  279. X5c @Wide @Code {
  280. X"A::"
  281. X"{   1:: @Ellipse"
  282. X"    { 3c @Wide 2c @High }"
  283. X"    //1c"
  284. X"    2:: @Box"
  285. X"    { 3c @Wide 2c @High }"
  286. X"}"
  287. X}
  288. X||7ct
  289. X@Fig {
  290. XA::
  291. X{   1:: @Ellipse { 3c @Wide 2c @High }
  292. X    //1c
  293. X    2:: @Box { 3c @Wide 2c @High }
  294. X}
  295. X// @ShowLabels
  296. X}
  297. X}
  298. XThe right parameter of @Code "::" may be any object.
  299. X@PP
  300. XThe six standard shapes ({@Code "@Box"}, {@Code "@Square"},
  301. X{@Code "@Diamond"}, {@Code "@Polygon"}, {@Code "@Ellipse"}, and
  302. X{@Code "@Circle"}) have a special @Code CIRCUM label, not displayed by
  303. X{@Code "@ShowLabels"}.  The expression
  304. X@ID {
  305. X@Eq { "angle" } @Code CIRCUM
  306. X}
  307. Xyields the point on the boundary of the shape at the given angle from
  308. Xthe centre, in a coord&-inate system with the centre for origin.  Thus,
  309. Xgiven a labelled standard shape such as
  310. X@ID @Code "A :: @Ellipse ..."
  311. Xthe point on its boundary at an angle of 45 degrees from the centre is
  312. X@ID @Code "A@CTR ++ {45 A@CIRCUM}"
  313. XThe braces must be present.  Regrettably, there is no way to produce a
  314. X@Code CIRCUM label for shapes defined by the user in any reasonable time.
  315. X@PP
  316. XIf the same label is used twice, as is inevitable with unlabelled standard
  317. Xshapes, only the most recent value is remembered.  There is a limit on the
  318. Xmaximum number of distinct labels in any one figure, which
  319. Xcan be changed by means of an option to the @Code "@Fig" symbol:
  320. X@ID @Code {
  321. X"@Fig"
  322. X"   maxlabels { 500 }"
  323. X"{ ... }"
  324. X}
  325. XThe default value is 200.  Large values could cause the printing device
  326. Xto run out of memory.  Memory is reclaimed at the end of each figure.
  327. X@End @Section
  328. END_OF_FILE
  329.   if test 9154 -ne `wc -c <'doc/tr.fig/s5'`; then
  330.     echo shar: \"'doc/tr.fig/s5'\" unpacked with wrong size!
  331.   fi
  332.   # end of 'doc/tr.fig/s5'
  333. fi
  334. if test -f 'doc/tr.lout/ch1.04' -a "${1}" != "-c" ; then 
  335.   echo shar: Will not clobber existing file \"'doc/tr.lout/ch1.04'\"
  336. else
  337.   echo shar: Extracting \"'doc/tr.lout/ch1.04'\" \(10331 characters\)
  338.   sed "s/^X//" >'doc/tr.lout/ch1.04' <<'END_OF_FILE'
  339. X@Section
  340. X   @Title { Galleys }
  341. X   @Tag { galleys }
  342. X@Begin
  343. X@PP
  344. XIt is time to pause and ask ourselves how close we are to achieving our
  345. Xaim of producing neatly formatted documents.  We can certainly produce
  346. Xthe pieces of a document, using the page layout definitions from Section
  347. X{@NumberOf definitions}:
  348. X@ID {
  349. X
  350. Xnohyphen @Break @LittlePageColumn {
  351. X@DP
  352. X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  353. X@DP
  354. XIn the world of music England is supposed to be a mere province.  If she
  355. Xproduces an indifferent composer or performer, that is regarded
  356. Xelsewhere as perfectly normal and natural; but if foreign students of
  357. Xmusical history have to acknowledge a British musical genius, he is
  358. Xconsidered a freak.
  359. X@PP
  360. XSuch a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  361. Xthe world's musical classics, as here, we find that we cannot omit this
  362. XEnglish master.
  363. X}
  364. X
  365. X||1c
  366. X
  367. X@LittlePageColumn
  368. X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  369. X}
  370. X
  371. X||1c
  372. X
  373. X@Code {
  374. X       @LittlePage { "@TextPlace" //1rt "@FootSect" }
  375. X//     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  376. X//     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  377. X//0.2c 8p @Font "@PageList"
  378. X}
  379. X
  380. X}
  381. Xbut when we try to merge them together, we encounter two obstacles.
  382. X@PP
  383. XFirst, when an object is entered at a certain place in the document, it
  384. Xappears at that place.  But a footnote is naturally entered immediately
  385. Xafter the point it refers to (`{-2p @Font PURCELL}' in this case), yet it
  386. Xappears somewhere else: at the bottom of a page.
  387. X@PP
  388. XSecond, all our features build up larger objects out of smaller ones,
  389. Xbut the -2p @Font PURCELL object, for example, must be broken down into
  390. Xpage-sized pieces.  This occurs when the available space at the
  391. X`somewhere else' is insufficient to hold the entire object, so this
  392. Xsecond obstacle arises out of the first.
  393. X@PP
  394. XLout's last major feature, which we introduce to overcome these
  395. Xobstacles, is the @I galley
  396. Xgalley.feature @Index { Galleys }
  397. X(the name is borrowed from the galleys
  398. Xused in manual typesetting).  A galley is an object plus a cross
  399. Xreference which points to where the object is to appear.  The example
  400. Xabove has three galleys:
  401. X@ID {
  402. X
  403. X{
  404. X//0.1c
  405. X
  406. Xnohyphen @Break @LittlePageColumn {
  407. X@DP
  408. X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  409. X@DP
  410. XIn the world of music England is supposed to be a mere province.  If she
  411. Xproduces an indifferent composer or performer, that is regarded
  412. Xelsewhere as perfectly normal and natural; but if foreign students of
  413. Xmusical history have to acknowledge a British musical genius, he is
  414. Xconsidered a freak.
  415. X@PP
  416. XSuch a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  417. Xthe world's musical classics, as here, we find that we cannot omit this
  418. XEnglish master.
  419. X}  { //0.4c 180d @Rotate @Arrow 2.0c }
  420. X
  421. X}
  422. X
  423. X||0io ||4.8c
  424. X
  425. X@Code {
  426. X       @LittlePage { "@TextPlace" //1rt "@FootSect" }
  427. X//     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  428. X//     @LittlePage { "@TextPlace" //1rt "@FootSect" }
  429. X//0.2c 8p @Font "@PageList"
  430. X}  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  431. X
  432. X||0io ||2.0c
  433. X{
  434. X//3.9c
  435. X
  436. X{ @Arrow 1.7c }  nohyphen @Break @LittlePageColumn
  437. X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  438. X}
  439. X}
  440. X}
  441. XA galley replaces the invocation pointed to by its cross reference.  If
  442. Xspace is not sufficient there to hold it all, the remainder of the
  443. Xgalley is split off (the vertical concatenation symbol preceding it
  444. Xbeing discarded) and it replaces later invocations of the same symbol.
  445. XThis is exactly what is required to get text and footnotes onto pages.
  446. X@PP
  447. XTo create a galley, first define a symbol with a
  448. Xspecial @Code into
  449. Xinto @Index { @Code into clause }
  450. Xclause, like this:
  451. X@ID @Code {
  452. X"def @FootNote into { @FootPlace&&following }"
  453. X"   right x"
  454. X"{"
  455. X"   8p @Font x"
  456. X"}"
  457. X}
  458. XAn invocation of such a symbol will then be a galley whose object is the
  459. Xresult of the invocation, and whose cross reference is given by the
  460. X@Code into clause.  The right parameter of the cross reference must be
  461. Xeither @Code preceding or @Code following.
  462. X@PP
  463. XA symbol, like @Code "@FootPlace", which is the @I target of a galley,
  464. Xtarget @Index { Target of a galley }
  465. Xmust contain the special symbol @@Galley exactly once in its body; often
  466. Xthis is all that the body contains:
  467. X@ID @Code {
  468. X"def  @FootPlace  {  @Galley  }"
  469. X}
  470. XIt is this special symbol that is replaced by the incoming galley, in
  471. Xfact, not the @Code "@FootPlace" symbol as a whole.
  472. X@PP
  473. XA symbol which contains @@Galley, either directly within its body or
  474. Xindirectly within the body of a symbol it invokes, is called a @I receptive
  475. Xreceptive @Index { Receptive symbol }
  476. Xsymbol, meaning receptive to galleys.  @Code "@FootPlace" is receptive, which
  477. Xmakes @Code "@FootList", @Code "@FootSect" and @Code "@PageList"
  478. Xreceptive since they invoke @Code "@FootPlace".  If no galley replaces
  479. Xany @@Galley within some invocation of a receptive symbol, that
  480. Xinvocation is replaced by @@Null.  The advantages of this rule for page
  481. Xlayout were explained at the end of Section {@NumberOf definitions}.
  482. X@PP
  483. XLet us now follow through the construction of our example
  484. Xdocument.  Initially there is just the one @I root
  485. Xroot.galley @Index { Root galley }
  486. Xgalley, containing an unexpanded invocation of @Code "@PageList":
  487. X@ID { ||5c
  488. X10p @Font @Code "@PageList"  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  489. X}
  490. XThen the -2p @Font PURCELL galley appears, targeted to a @Code
  491. X"@TextPlace".  Lout knows that there is a @Code "@TextPlace" hidden
  492. Xinside @Code "@PageList", so it expands @Code "@PageList":
  493. X@ID {
  494. X
  495. X{
  496. X//0.1c
  497. X
  498. Xnohyphen @Break @LittlePageColumn {
  499. X@DP
  500. X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  501. X@DP
  502. XIn the world of music England is supposed to be a mere province.  If she
  503. Xproduces an indifferent composer or performer, that is regarded
  504. Xelsewhere as perfectly normal and natural; but if foreign students of
  505. Xmusical history have to acknowledge a British musical genius, he is
  506. Xconsidered a freak.
  507. X@PP
  508. XSuch a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  509. Xthe world's musical classics, as here, we find that we cannot omit this
  510. XEnglish master.
  511. X}  { //0.4c 180d @Rotate @Arrow 2.2c }
  512. X}
  513. X
  514. X||0io ||5c
  515. X
  516. X@Code {
  517. X       @LittlePage { "@TextPlace" //1rt "@FootSect" }
  518. X//0.2c 8p @Font "@PageList"
  519. X}  180d @Rotate @Arrow 1i @I -2p @Font {to printer}
  520. X
  521. X}
  522. XAfter promoting the first line into @Code "@TextPlace", the footnote
  523. Xgalley attached to it appears and demands an invocation of
  524. X@Code "@FootPlace" following its attachment point
  525. X(`{-2p @Font PURCELL}').  Such a @Code "@FootPlace" is found at
  526. Xthe bottom of the first page, inside @Code "@FootSect", which is
  527. Xaccordingly expanded, and the footnote is promoted onto the page:
  528. X@ID {
  529. X
  530. X{
  531. X//1.2c
  532. X
  533. Xnohyphen @Break @LittlePageColumn {
  534. XIn the world of music England is supposed to be a mere province.  If she
  535. Xproduces an indifferent composer or performer, that is regarded
  536. Xelsewhere as perfectly normal and natural; but if foreign
  537. Xstudents of musical history have to acknowledge a British musical genius,
  538. Xhe is considered a freak.
  539. X@PP
  540. XSuch a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  541. Xthe world's musical classics, as here, we find that we cannot omit this
  542. XEnglish master.
  543. X}  180d @Rotate @Arrow 2.2c
  544. X}
  545. X
  546. X||0io ||5c
  547. X
  548. X{
  549. Xnohyphen @Break @LittleDocument
  550. X//
  551. X@LittleText {
  552. X@DP
  553. X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  554. X@LittleFootNote
  555. X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  556. X//1vx @Code "@FootList"
  557. X}
  558. X//1vx @Code "@TextPlace" }
  559. X//
  560. X@LittleEndRun
  561. X//0.2c 8p @Font @Code "@PageList"
  562. X}  180d @Rotate @Arrow 1i -2p @Font @I {to printer}
  563. X
  564. X}
  565. XNow the promotion of the -2p @Font PURCELL galley resumes.  When the
  566. Xfirst page is filled, Lout searches forwards for another @Code "@TextPlace"
  567. Xto receive the remainder, once again expanding a @Code "@PageList":
  568. X@ID {
  569. X
  570. X{
  571. X//4.85c
  572. X
  573. Xnohyphen @Break @LittlePageColumn {
  574. Xperformer, that is regarded
  575. Xelsewhere as perfectly normal and natural; but if foreign
  576. Xstudents of musical history have to acknowledge a British musical genius,
  577. Xhe is considered a freak.
  578. X@PP
  579. XSuch a freak is Henry Purcell.  Yet if we make a choice of fifteen of
  580. Xthe world's musical classics, as here, we find that we cannot omit this
  581. XEnglish master.
  582. X}  180d @Rotate @Arrow 2.2c
  583. X}
  584. X
  585. X||0io ||5c
  586. X
  587. X{
  588. Xnohyphen @Break @LittleDocument
  589. X//
  590. X@LittleText {
  591. X@DP
  592. X|0.5rt {@B PURCELL}{ 0.8f @Font 1 ^//0.2v}
  593. X@LittleFootNote
  594. X{ { 0.8f @Font 1 ^//0.2v}Blom, Eric.  @I {Some Great Composers.}  Oxford, 1944.
  595. X}
  596. X@DP
  597. X      @HExpand {In the world of music}
  598. X//1vx @HExpand {England is supposed to}
  599. X//1vx @HExpand {be a mere province.  If}
  600. X//1vx @HExpand {she produces an indifferent composer or}
  601. X}
  602. X//
  603. X@LittleEndRun
  604. X//     @LittlePage { @Code "@TextPlace" //1rt @Code "@FootSect" }
  605. X//0.2c 8p @Font @Code "@PageList"
  606. X}  180d @Rotate @Arrow 1i -2p @Font @I {to printer}
  607. X
  608. X}
  609. Xand so on until the entire galley is promoted.  All these expansions and
  610. Xreplacements are done with total
  611. Xintegrity.  For example, if Lout finds after expanding @Code "@FootSect"
  612. Xthat the page is too full to accept even the first line of the footnote,
  613. X@Code "@FootSect" is reset to unexpanded and the search for a target for
  614. Xthe footnote moves on.  And the cross reference direction, @Code
  615. Xpreceding or @Code following, is always obeyed (although lack of space
  616. Xsometimes prevents Lout from choosing the nearest target).  Only the
  617. Xroot galley contains receptive symbols in our running example, but in
  618. Xfact any galley may contain them, without restriction.
  619. X@PP
  620. XWhen footnotes are placed at the bottom of a page, they appear there in
  621. Xfirst come, first served order.  To make galleys appear in sorted order, as
  622. Xsorted.galley @Index { Sorted galleys }
  623. Xis needed in bibliographies and indexes, a parameter or nested definition
  624. Xwith the special name @@Key
  625. Xkey. @Index { @@Key parameter }
  626. Xis added to the galley definition, like this:
  627. X@ID @Code {
  628. X"def @IndexEntry into { @IndexPlace&&following }"
  629. X"   left @Key"
  630. X"   right x"
  631. X"{ x }"
  632. X}
  633. XLike @@Tag, @@Key must be set to a simple word when the galley is invoked:
  634. X@ID @Code {
  635. X"cities @IndexEntry { cities, comparison of, 27 }"
  636. X}
  637. Xand this key is used to sort the galleys.  If several sorted galleys
  638. Xwith the same key are sent to the same place, only one of them is
  639. Xprinted, since the others are probably unwanted duplicates.
  640. X@PP
  641. XThe discussion of galleys is continued at a more detailed level in
  642. XSection {@NumberOf targets}.
  643. X@End @Section
  644. END_OF_FILE
  645.   if test 10331 -ne `wc -c <'doc/tr.lout/ch1.04'`; then
  646.     echo shar: \"'doc/tr.lout/ch1.04'\" unpacked with wrong size!
  647.   fi
  648.   # end of 'doc/tr.lout/ch1.04'
  649. fi
  650. if test -f 'doc/tr.lout/ch2.06' -a "${1}" != "-c" ; then 
  651.   echo shar: Will not clobber existing file \"'doc/tr.lout/ch2.06'\"
  652. else
  653.   echo shar: Extracting \"'doc/tr.lout/ch2.06'\" \(9965 characters\)
  654.   sed "s/^X//" >'doc/tr.lout/ch2.06' <<'END_OF_FILE'
  655. X@Section
  656. X   @Title { Galleys and targets }
  657. X   @Tag { targets }
  658. X@Begin
  659. X@PP
  660. XThe behaviour of galleys and their targets, as described in Section
  661. Xgalley.feature.in.detail @SubIndex { in detail }
  662. Xtargets.in.detail @SubIndex { in detail }
  663. X{@NumberOf galleys}, can be summarized in three laws:
  664. X@DP
  665. X{@I {First Law}}:  The first target is the closest invocation of the
  666. Xtarget symbol, either preceding or following the invocation point of the
  667. Xgalley as required, which has sufficient space to receive the first
  668. Xcomponent;
  669. X@DP
  670. X{@I {Second Law}}:  Each subsequent target is the closest invocation of
  671. Xthe target symbol, following the previous target and lying within the same
  672. Xgalley, which has sufficient space to receive the first remaining component;
  673. X@DP
  674. X{@I {Third Law}}:  A receptive symbol that does not receive at least one
  675. Xcomponent of any galley is replaced by @@Null.
  676. X@DP
  677. XThe terms `closest,' `preceding,' and `following' refer to position in
  678. Xthe final printed document.  This section explains the operation of
  679. Xthese laws in Basser Lout.
  680. X@PP
  681. XWhen a galley cannot be fitted into just one target, Lout must find
  682. Xpoints in the galley where it can be split in two.  The object lying
  683. Xbetween two neighbouring potential split points is called a @I component
  684. Xcomponent @Index { Components of a galley }
  685. Xof the galley.  By definition, a component cannot be split.
  686. X@PP
  687. XTo determine the components of a galley, expand all symbols other than
  688. Xrecursive and receptive ones, discard all @@Font, @@Break, and @@Space
  689. Xsymbols, perform paragraph breaking as required, and discard all
  690. Xredundant braces.  Then view the galley as a sequence of one or more
  691. Xobjects separated by vertical concatenation symbols; these are the
  692. Xcomponents and split points.  For example, given the definition
  693. X@ID @Code {
  694. X"def @Section into { @SectionPlace&&preceding }"
  695. X"    named @Title {}"
  696. X"    right @Body"
  697. X"{"
  698. X"    15p @Font { @Title //0.7f }"
  699. X"    //"
  700. X"    @Body"
  701. X"}"
  702. X}
  703. Xthe galley
  704. X@ID @Code {
  705. X"@Section"
  706. X"    @Title { Introduction }"
  707. X"{ This is a subject that really"
  708. X"needs no introduction. }"
  709. X}
  710. Xbecomes
  711. X@ID @Code {
  712. X"Introduction"
  713. X"//0.7f"
  714. X"{}"
  715. X"//"
  716. X"This is a subject that really needs"
  717. X"//1vx"
  718. X"no introduction."
  719. X}
  720. Xwith four components.  If @Code "@Body" was preceded by @Code "|1.0c" in
  721. Xthe definition, the result would be
  722. X@ID @Code {
  723. X"Introduction"
  724. X"//0.7f"
  725. X"{}"
  726. X"//"
  727. X"|1.0c { This is a subject that really needs //1vx no introduction. }"
  728. X}
  729. Xand now @Code "//1vx" is buried within one component and is not a
  730. Xpotential split point.  In fact, in this case the broken paragraph as
  731. Xa whole is enclosed in @@OneRow.  This highlights a deficiency of
  732. XBasser Lout:  an indented paragraph cannot be split.
  733. X@PP
  734. XThe lines of a paragraph become separate components if the paragraph
  735. Xoccupies an entire component before breaking; otherwise they are
  736. Xenclosed in a @@OneRow symbol within one component.  The same is true of
  737. Xincoming components of other galleys.  If a @@Galley symbol occupies an
  738. Xentire component by the rules above, then the incoming components that
  739. Xreplace it become components of their new home:
  740. X@ID @Tab
  741. X  @Fmta { @Col @Code A ! @Col lines @Break B ! @Col @Code C }
  742. X{
  743. X@Rowa
  744. X   A {
  745. X"An example"
  746. X"//0.5c"
  747. X"@Galley"
  748. X"//0.5c"
  749. X"@SomethingList"
  750. X}
  751. X  B {
  752. X""
  753. X@Eq { ==> }
  754. X}
  755. X   C {
  756. X"An example"
  757. X"//0.5c"
  758. X"Incoming components"
  759. X"//0.2c"
  760. X"from some other galley"
  761. X"//0.5c"
  762. X"@SomethingList"
  763. X}
  764. X}
  765. XOtherwise the incoming components are grouped within a @@OneRow symbol
  766. Xand lie within one component.
  767. X@PP
  768. XThis distinction has a marked effect on the vertical concatenation
  769. Xb.unit.use @SubIndex { use in @Code "//1.1b" }
  770. Xsymbol {@Code "//1.1b"}, which calls for more space than is available
  771. X(Section {@NumberOf concatenation}).  There is no room for this symbol
  772. Xwithin any component, so it will force a split and be discarded in that
  773. Xcase.  But it can be promoted to between two components.
  774. X@PP
  775. XComponents may be separated by @Code "/" as well as by {@Code "//"},
  776. Xgiving rise to column mark alignment between adjacent components:
  777. X@ID @ShowVMark {
  778. X@HContract @GreyBox { 1c @Wide ^| 1c @Wide 0.6c @High }
  779. X/0.3c
  780. X@HContract @GreyBox { 2c @Wide 0.6c @High }
  781. X/0.3c
  782. X@HContract @GreyBox { 0.5c @Wide ^| 0.8c @Wide 0.6c @High }
  783. X}
  784. XWhen aligned components are promoted into different targets, the meaning
  785. Xof alignment becomes very doubtful.  For example, what if the targets
  786. Xmark.alignment.in.detail @SubIndex { in detail }
  787. Xare in different columns of one page, or what if one lies within
  788. X{@Code "90d @Rotate"}?
  789. X@PP
  790. XThe truth is that @Code "/" causes all the objects that share a mark to
  791. Xhave equal width:
  792. X@ID @ShowVMark {
  793. X@Box @HContract @GreyBox { 1c @Wide ^| 1c @Wide 0.6c @High }
  794. X/0.3c
  795. X@Box @HContract @GreyBox { 2c @Wide 0.6c @High }
  796. X/0.3c
  797. X@Box @HContract @GreyBox { 0.5c @Wide ^| 0.8c @Wide 0.6c @High }
  798. X}
  799. XThis is a consequence of the `as wide as possible' rule (Section
  800. X{@NumberOf size}).  Mark alignment occurs {@I incidentally}, whenever
  801. Xthe fragments are placed into similar contexts.
  802. X@PP
  803. XIn this connection we must also consider the special case of a @@Galley
  804. Xsymbol which shares its column mark with some other object:
  805. X@ID @Code {
  806. X"@Galley"
  807. X"/0.2c"
  808. X"@SomethingList"
  809. X}
  810. X(The @@Galley may or may not occupy an entire component; that doesn't
  811. Xmatter here.)  If incoming components are separated by @Code "//" rather
  812. Xthan by {@Code "/"}, the meaning is so doubtful that this is forbidden.  In
  813. Xfact, a galley whose components replace such a @@Galley must have a
  814. Xsingle column mark running its full length; that is, its components must
  815. Xall share a single column mark.  This mark will be merged with the
  816. Xcolumn mark passing through each @@Galley that these components replace;
  817. Xall the objects on the resulting merged mark will have equal width.
  818. X@PP
  819. XThe root galley, where everything collects immediately prior to output,
  820. Xroot.galley.in.detail @SubIndex { in detail }
  821. Xis created automatically, not by a definition.  Its target is the output
  822. Xfile, and its object is the entire input, which typically looks like this:
  823. X@ID @Code {
  824. X"@PageList"
  825. X"//"
  826. X"@Text {"
  827. X"  Body text of the document ..."
  828. X"}"
  829. X}
  830. Xwhere @Code "@PageList" expands to a sequence of pages containing
  831. X@Code "@TextPlace" symbols (see Section {@NumberOf definitions}), and
  832. X@Code "@Text" is a galley:
  833. X@ID @Code {
  834. X"def @TextPlace { @Galley }"
  835. X""
  836. X"def @Text into { @TextPlace&&preceding }"
  837. X"    right x"
  838. X"{"
  839. X"    x"
  840. X"}"
  841. X}
  842. XThe spot vacated by a galley -- its invocation point -- becomes a @@Null
  843. Xobject, so this root galley is effectively @Code "@PageList" alone, as
  844. Xrequired.  The @Code "@Text" galley will find its first target preceding
  845. Xits invocation point, within {@Code "@PageList"}.
  846. X@PP
  847. XPrinting {@PageMark rootg} the root galley on the output file is somewhat problematical,
  848. Xroot.galley.printing @SubIndex { printing of }
  849. Xbecause Lout has no way of knowing how large the paper is.  Basser Lout
  850. Xsimply prints one root galley component per page (except it skips
  851. Xcomponents of height zero), and the user is responsible for ensuring
  852. Xthat each component is page-sized.
  853. X@PP
  854. XBasser Lout will promote a component only after any receptive symbols
  855. Xcomponents.promotion @SubIndex { promotion of }
  856. Xpromotion @Index { Promotion of components }
  857. Xwithin it have been replaced, either by galleys or by @@Null, since
  858. Xuntil then the component is not complete.  A component which shares a
  859. Xmark with following components is held up until they are all complete,
  860. Xsince until then their width is uncertain.
  861. X@PP
  862. XConsider a page with @Code "@TextPlace" and @Code "@FootSect" receptive
  863. Xsymbols.  The rule just given will prevent the page from being printed
  864. Xuntil @Code "@TextPlace" is replaced by body text, quite rightly; but
  865. X@Code "@FootSect" will also prevent its printing, even when there are no
  866. Xfootnotes.
  867. X@PP
  868. XBasser Lout is keen to write out pages as soon as possible, to save memory,
  869. Xand it cannot afford to wait forever for non-existent footnotes.  A variant
  870. Xof the galley concept, called a {@I {forcing galley}},
  871. Xforcing.galley @Index { Forcing galley } {@PageMark forcing}
  872. Xis introduced to solve this problem.  A forcing galley is defined like this:
  873. X@ID @Code {
  874. X"def @Text force into { @TextPlace&&preceding }"
  875. X"   ..."
  876. X}
  877. Xand so on.  When such a galley replaces a @@Galley symbol, Lout replaces
  878. Xevery receptive symbol preceding the @@Galley by @@Null, thus ensuring that
  879. Xas soon as text enters a page, for example, everything up to and including
  880. Xthe preceding page can be printed.  This does not take care of the very last
  881. Xpage, but Basser Lout replaces all receptive symbols by @@Null when it realizes
  882. Xthat its input has all been read, thus allowing the last page to print.
  883. X@PP
  884. XA forcing galley causes the Third Law to be applied earlier than
  885. Xexpected, and this creates two problems.  First, the replacement by
  886. X@@Null may be premature:  a galley may turn up later wanting one of the
  887. Xdefunct targets.  Such galleys (entries in tables of contents are
  888. Xtypical examples) are copied into the cross reference database and read
  889. Xin during the next run just before their targets are closed, and so they
  890. Xfind their targets in the end.  Care must be taken to ensure that
  891. Xlarge galleys such as chapters and sections do not have defunct targets,
  892. Xsince the cost of copying them to and from the database is unacceptably high.
  893. X@PP
  894. XA @Code "following" galley may fail to find a first target lying in a
  895. Xfollowing component of the same galley as its invocation point.  This is
  896. Xa deficiency of Basser Lout, which occurs if the target has not been
  897. Xread from input at the time the galley tries to find it.  A workaround
  898. Xis to use a @Code "preceding" galley instead, defined like this:
  899. X@ID @Code {
  900. X"def @AGalley into { @AGalleyPlace&&preceding }"
  901. X"    right @Body"
  902. X"{"
  903. X"    //1.1b"
  904. X"    @Body"
  905. X"}"
  906. X}
  907. Xand invoked like this:
  908. X@ID @Code {
  909. X"@AGalleyPlace | @AGalley { content of galley }"
  910. X"//"
  911. X"..."
  912. X"@AGalleyPlace"
  913. X}
  914. XThe first @Code "@AGalleyPlace" receives only the initial empty object,
  915. Xsince the @Code "//1.1b" forces a split; and the Second Law puts Basser
  916. XLout on the right track thereafter.
  917. X@End @Section
  918. END_OF_FILE
  919.   if test 9965 -ne `wc -c <'doc/tr.lout/ch2.06'`; then
  920.     echo shar: \"'doc/tr.lout/ch2.06'\" unpacked with wrong size!
  921.   fi
  922.   # end of 'doc/tr.lout/ch2.06'
  923. fi
  924. if test -f 'doc/tr.lout/ch4.03' -a "${1}" != "-c" ; then 
  925.   echo shar: Will not clobber existing file \"'doc/tr.lout/ch4.03'\"
  926. else
  927.   echo shar: Extracting \"'doc/tr.lout/ch4.03'\" \(9416 characters\)
  928.   sed "s/^X//" >'doc/tr.lout/ch4.03' <<'END_OF_FILE'
  929. X@Section
  930. X   @Title { Page layout }
  931. X   @Tag { pagelayout }
  932. X@Begin
  933. X@PP
  934. XThe page layout
  935. Xpage.layout.inpractice @SubIndex { in practice }
  936. Xdocument.layout.page.layout. @SubIndex { page layout }
  937. Xdefinitions given in Section {@NumberOf definitions},
  938. Xalthough correct, are very basic.  In this section we present the
  939. Xdefinitions used by the DocumentLayout package for laying out the pages
  940. Xof books, including running page headers and footers, different formats
  941. Xfor odd and even pages, and so on.  The present document is produced with
  942. Xthese definitions.
  943. X@PP
  944. XWe begin with a few definitions which permit the user to create cross
  945. Xreferences of the `see page 27' variety which will be kept up to date
  946. Xautomatically.  The user marks the target page by placing
  947. X@Code {"@PageMark intro"}, for example, at the point of interest, and
  948. Xrefers to the marked page as @Code "@PageOf intro" elsewhere:
  949. Xpageof.example @Index { @Code "@PageOf" example }
  950. X@IndentedList
  951. X@LI @Code {
  952. X"export @Tag"
  953. X"def @PageMarker right @Tag { @Null }"
  954. X}
  955. X@LI @Code {
  956. X"def @PageMark right x"
  957. X"{"
  958. X"    @PageMarker&&preceding @Tagged x"
  959. X"}"
  960. X}
  961. X@LI @Code {
  962. X"def @PageOf right x"
  963. X"{"
  964. X"    @PageMarker&&x @Open { @Tag }"
  965. X"}"
  966. X}
  967. X@EndList
  968. XWe will see below that an invocation of @Code "@PageMarker" appears before
  969. Xeach page, with @Code "@Tag" parameter equal to the
  970. Xpage number.  Suppose that {@Code "@PageMark intro"}, which expands to
  971. X@ID @Code "@PageMarker&&preceding @Tagged intro"
  972. Xhappens to fall on page 27 of the final printed document (of course, its
  973. Xvalue is @@Null which makes it invisible).  Then the effect of @@Tagged
  974. Xis to attach @Code "intro" as an extra tag to the first invocation of
  975. X{@Code "@PageMarker"} preceding that final point, and this must be
  976. X{@Code "@PageMarker 27"}.  Therefore the expression
  977. X@ID @Code "@PageMarker&&intro @Open { @Tag }"
  978. Xwill open the invocation {@Code "@PageMarker 27"} and yield the value of
  979. Xits @Code "@Tag" parameter, 27.  Thus, {@Code "@PageOf intro"} appearing
  980. Xanywhere in the document yields 27.
  981. X@PP
  982. XNext we have some little definitions for various parts of the
  983. Xpage.  {@Code "@FullPlace"} will be the target of full-width body text:
  984. X@ID @Code {
  985. X"def @FullPlace { @Galley }"
  986. X}
  987. X{@Code "@ColPlace"} will be the target of body text within one column:
  988. X@ID @Code {
  989. X"def @ColPlace { @Galley }"
  990. X}
  991. X{@Code "@TopList"} will be the target of figures and tables:
  992. X@ID @Code {
  993. X"export @Tag"
  994. X"def @TopList right @Tag"
  995. X"{"
  996. X"    @Galley"
  997. X"    //@TopGap @TopList @Next @Tag"
  998. X"}"
  999. X}
  1000. XWe have taken a shortcut here, avoiding an unnecessary @Code "@TopPlace"
  1001. Xsymbol.  @Code "@FootList" and {@Code "@FootSect"} define a sequence of
  1002. Xfull-width targets at the foot of the page for footnotes,
  1003. Xpreceded by a short horizontal line:
  1004. Xfootsect.example @Index { @Code "@FootSect" example }
  1005. X@IndentedList
  1006. X@LI @Code {
  1007. X"export @Tag"
  1008. X"def @FootList right @Tag"
  1009. X"{"
  1010. X"    @Galley"
  1011. X"    //@FootGap  @FootList @Next @Tag"
  1012. X"}"
  1013. X}
  1014. X@LI @Code {
  1015. X"def @FootSect"
  1016. X"{"
  1017. X"    @FootLen @Wide @HLine"
  1018. X"    //@FootGap  @FootList 1  ||@FootLen"
  1019. X"}"
  1020. X}
  1021. X@EndList
  1022. XSimilarly, @Code "@ColFootList" and @Code "@ColFootSect" provide a
  1023. Xsequence of targets for footnotes within one column:
  1024. X@ID @Code {
  1025. X"export @Tag"
  1026. X"def @ColFootList right @Tag"
  1027. X"{"
  1028. X"    @Galley"
  1029. X"    //@FootGap  @ColFootList @Next @Tag"
  1030. X"}"
  1031. X""
  1032. X"def @ColFootSect"
  1033. X"{"
  1034. X"    @ColFootLen @Wide @HLine"
  1035. X"    //@FootGap  @ColFootList 1  ||@ColFootLen"
  1036. X"}"
  1037. X}
  1038. XThe next definition provides a horizontal sequence of one or more columns:
  1039. Xcollist.example @Index { @Code "@ColList" example }
  1040. X@ID @Code {
  1041. X"def @ColList right col"
  1042. X"{"
  1043. X"    def @Column"
  1044. X"    {  @VExpand { @ColPlace //1rt @OneRow { //@MidGap @ColFootSect } }  }"
  1045. X""
  1046. X"    col @Case {"
  1047. X"        Single @Yield @Column"
  1048. X"        Double @Yield { @DoubleColWidth @Wide @Column  ||@ColGap  @ColList col }"
  1049. X"        Multi  @Yield { @MultiColWidth @Wide @Column  ||@ColGap  @ColList col }"
  1050. X"    }"
  1051. X"}"
  1052. X}
  1053. XEach column consists of a @Code "@ColPlace" at the top and a
  1054. X@Code "@FootSect" at the foot.  The @@VExpand symbol ensures that
  1055. Xwhenever a column comes into existence, it will expand vertically so
  1056. Xthat the bottom-justification @Code "//1rt" has as much space as
  1057. Xpossible to work within.  The @Code "col" parameter determines whether
  1058. Xthe result has a single column, double columns, or multiple columns.
  1059. X@PP
  1060. XThe {@Code "@Page"} symbol places its parameter in a page of fixed width,
  1061. Xheight, and margins:
  1062. Xpage.example @Index { @Code "@Page" example }
  1063. X@ID @Code {
  1064. X"def @Page right x"
  1065. X"{"
  1066. X"    @PageWidth @Wide @PageHeight @High {"
  1067. X"        //@PageMargin  ||@PageMargin"
  1068. X"        @HExpand @VExpand x"
  1069. X"        ||@PageMargin  //@PageMargin"
  1070. X"    }"
  1071. X"}"
  1072. X}
  1073. X@@HExpand and @@VExpand ensure that the right parameter occupies all the
  1074. Xavailable space; this is important when the right parameter is unusually
  1075. Xsmall.  The @@High symbol gives the page a single row mark, ensuring that
  1076. Xit will be printed on a single sheet of paper (page {@PageOf rootg}).
  1077. X@PP
  1078. XNext we have {@Code "@OnePage"}, defining a typical page of a book or
  1079. Xother document:
  1080. Xonepage.example @Index { @Code "@OnePage" example }
  1081. X@ID @Code {
  1082. X"def @OnePage"
  1083. X"    named @Columns {}"
  1084. X"    named @PageTop {}"
  1085. X"    named @PageFoot {}"
  1086. X"{"
  1087. X"    @Page {"
  1088. X"        @PageTop"
  1089. X"        //@MidGap  @TopList"
  1090. X"        //@MidGap  @FullPlace"
  1091. X"        //@MidGap  @ColList @Columns"
  1092. X"        // //1rt   @OneRow { //@MidGap @FootSect //@MidGap @PageFoot }"
  1093. X"    }"
  1094. X"}"
  1095. X}
  1096. XThe page top and page foot, and the number of columns, are parameters
  1097. Xthat will be given later when @Code "@OnePage" is invoked.  The body of
  1098. Xthe page is a straightforward combination of previous definitions.  The
  1099. X@Code "//" symbol protects the following @Code "//1rt" from deletion in
  1100. Xthe unlikely event that all the preceding symbols are replaced by
  1101. X@@Null.  The following object is enclosed in @@OneRow to ensure that
  1102. Xall of it is bottom-justified, not just its first component.
  1103. X@PP
  1104. XBefore presenting the definition of a sequence of pages, we must detour
  1105. Xto describe how running page headers and footers (like those in the
  1106. Xpresent document) are produced.  These are based on the
  1107. X@Code "@Runner" symbol:
  1108. Xrunner.example @Index { @Code "@Runner" example }
  1109. X@ID @Code {
  1110. X"export @TopOdd @TopEven @FootOdd @FootEven"
  1111. X"def @Runner"
  1112. X"    named @TopOdd right @PageNum { @Null }"
  1113. X"    named @TopEven right @PageNum { @Null }"
  1114. X"    named @FootOdd right @PageNum { @Null }"
  1115. X"    named @FootEven right @PageNum { @Null }"
  1116. X"    named @Tag {}"
  1117. X"{ @Null }"
  1118. X}
  1119. XThe four parameters control the format of running headers and footers on
  1120. Xodd and even pages respectively.  Invocations of {@Code "@Runner"}, for
  1121. Xexample
  1122. X@ID @Code {
  1123. X"@Runner"
  1124. X"    @TopEven { @B @PageNum |1rt @I { Chapter 4 } }"
  1125. X"    @TopOdd  { @I { Examples }   |1rt @B @PageNum }"
  1126. X}
  1127. Xwill be embedded in the body text of the document, and, as we will see
  1128. Xin a moment, are accessed by @Code "@Runner&&following" cross references
  1129. Xon the pages.  Notice how the @Code "@PageNum" parameter of each
  1130. Xparameter allows the format of the running header to be specified while
  1131. Xleaving the page number to be substituted later.
  1132. X@PP
  1133. XWe may now define {@Code "@OddPageList"}, whose result is a sequence of
  1134. Xpages beginning with an odd-numbered page:
  1135. Xoddpagelist.example @Index { @Code "@OddPageList" example }
  1136. X@ID @Code {
  1137. X"def @OddPageList"
  1138. X"    named @Columns {}"
  1139. X"    right @PageNum"
  1140. X"{"
  1141. X"    def @EvenPageList ..."
  1142. X""
  1143. X"        @PageMarker @PageNum"
  1144. X"    //  @Runner&&following @Open {"
  1145. X"            @OnePage"
  1146. X"                @Columns { @Columns }"
  1147. X"                @PageTop { @TopOdd @PageNum }"
  1148. X"                @PageFoot { @FootOdd @PageNum }"
  1149. X"        }"
  1150. X"    //  @EvenPageList"
  1151. X"            @Columns { @Columns }"
  1152. X"            @Next @PageNum"
  1153. X"}"
  1154. X}
  1155. XIgnoring @Code "@EvenPageList" for the moment, notice first that the
  1156. Xinvocation of @Code "@OnePage" is enclosed in
  1157. X{@Code "@Runner&&following @Open"}.  Since {@Code "@Runner&&following"}
  1158. Xrefers to the first invocation of @Code "@Runner" appearing after itself
  1159. Xin the final printed document, the symbols @Code "@TopOdd" and
  1160. X@Code "@FootOdd" will take their value from the first invocation of
  1161. X@Code "@Runner" following the top of the page, even though @Code "@FootOdd"
  1162. Xappears at the foot of the page.  Their @Code "@PageNum" parameters are
  1163. Xreplaced by {@Code "@PageNum"}, the actual page number parameter of
  1164. X{@Code "@OddPageList"}.
  1165. X@PP
  1166. XAfter producing the odd-numbered page, @Code "@OddPageList" invokes
  1167. X{@Code "@EvenPageList"}:
  1168. Xevenpagelist.example @Index { @Code "@EvenPageList" example }
  1169. X@ID @Code {
  1170. X"def @EvenPageList"
  1171. X"    named @Columns {}"
  1172. X"    right @PageNum"
  1173. X"{"
  1174. X"        @PageMarker @PageNum"
  1175. X"    //  @Runner&&following @Open {"
  1176. X"            @OnePage"
  1177. X"                @Columns { @Columns }"
  1178. X"                @PageTop { @TopEven @PageNum }"
  1179. X"                @PageFoot { @FootEven @PageNum }"
  1180. X"        }"
  1181. X"    //  @OddPageList"
  1182. X"            @Columns { @Columns }"
  1183. X"            @Next @PageNum"
  1184. X"}"
  1185. X}
  1186. XThis produces an even-numbered page, then passes the ball back to
  1187. X@Code "@OddPageList" -- a delightful example of what computer
  1188. Xscientists call mutual recursion.  The two page types differ only in
  1189. Xtheir running headers and footers, but other changes could easily be made.
  1190. X@PP
  1191. XIt was foreshadowed earlier that an invocation of @Code "@PageMarker"
  1192. Xwould precede each page, and this has been done.  Although this @Code
  1193. X"@PageMarker" is a component of the root galley, it will not cause a
  1194. Xpage to be printed, because Basser Lout skips components of height zero.
  1195. X@End @Section
  1196. END_OF_FILE
  1197.   if test 9416 -ne `wc -c <'doc/tr.lout/ch4.03'`; then
  1198.     echo shar: \"'doc/tr.lout/ch4.03'\" unpacked with wrong size!
  1199.   fi
  1200.   # end of 'doc/tr.lout/ch4.03'
  1201. fi
  1202. if test -f 'doc/tr.lout/ch4.04' -a "${1}" != "-c" ; then 
  1203.   echo shar: Will not clobber existing file \"'doc/tr.lout/ch4.04'\"
  1204. else
  1205.   echo shar: Extracting \"'doc/tr.lout/ch4.04'\" \(10583 characters\)
  1206.   sed "s/^X//" >'doc/tr.lout/ch4.04' <<'END_OF_FILE'
  1207. X@Section
  1208. X   @Title { Chapters and sections }
  1209. X   @Tag { chapters }
  1210. X@Begin
  1211. X@PP
  1212. XThe definitions of chapters and sections from the DocumentLayout package
  1213. Xchapters @Index { Chapters and sections }
  1214. Xform the subject of this section.  They allow a chapter to be entered
  1215. Xlike this:
  1216. Xdocument.layout.chapters @SubIndex { chapters and sections }
  1217. X@ID @Code {
  1218. X"@Chapter"
  1219. X"    @Title { ... }"
  1220. X"    @Tag { ... }"
  1221. X"@Begin"
  1222. X"    ..."
  1223. X"@End @Chapter"
  1224. X}
  1225. XWithin the chapter a sequence of sections may be included by writing
  1226. X@ID @Code {
  1227. X"@BeginSections"
  1228. X"@Section { ... }"
  1229. X"..."
  1230. X"@Section { ... }"
  1231. X"@EndSections"
  1232. X}
  1233. XThese are numbered automatically, and an entry is made for each in a
  1234. Xtable of contents.
  1235. X@PP
  1236. XThe user of the DocumentLayout package can find the number of the chapter or
  1237. Xsection with a given tag by writing @Code "@NumberOf tag" at any point
  1238. Xin the document.  This feature is based on the following definitions:
  1239. Xnumberof.example @Index { @Code "@NumberOf" example }
  1240. X@ID @Code {
  1241. X"export @Tag"
  1242. X"def @NumberMarker right @Tag { @Null }"
  1243. X""
  1244. X"def @NumberOf right x"
  1245. X"{  @NumberMarker&&x @Open { @Tag }  }"
  1246. X}
  1247. XEach chapter and section will contain one invocation of
  1248. X{@Code "@NumberMarker"}; a full explanation will be given later.
  1249. X@PP
  1250. XA sequence of places for receiving chapters is easily defined:
  1251. X@ID @Code {
  1252. X"export @Tag"
  1253. X"def @ChapterList right @Tag"
  1254. X"{"
  1255. X"    @Galley"
  1256. X"    //@ChapterGap  @ChapterList @Next @Tag"
  1257. X"}"
  1258. X}
  1259. X@Code "@ChapterGap" will usually be {@Code "1.1b"}, ensuring that each
  1260. Xchapter begins on a new page.  The @Code "@Chapter" galley itself is
  1261. Xdefined as follows:
  1262. Xchapter.example @Index { @Code "@Chapter" example }
  1263. X@IndentedList
  1264. X@LI @Code {
  1265. X"export @FootNote @BeginSections @EndSections @Section"
  1266. X"def @Chapter force into { @ChapterList&&preceding }"
  1267. X"    named @Tag {}"
  1268. X"    named @Title {}"
  1269. X"    named @RunningTitle { dft }"
  1270. X"    body @Body"
  1271. X"{"
  1272. X"    def @FootNote right x { @ColFootNote x }"
  1273. X""
  1274. X"    def @BeginSections ..."
  1275. X"    def @EndSections ..."
  1276. X"    def @Section ..."
  1277. X}
  1278. X@LI @Code {
  1279. X"    def @ChapterTitle"
  1280. X"    {"
  1281. X"        @ChapterNumbers @Case {"
  1282. X"            {Yes yes}  @Yield  { Chapter {@NumberOf @Tag}.  |2s  @Title }"
  1283. X"            else  @Yield  @Title"
  1284. X"        }"
  1285. X"    }"
  1286. X""
  1287. X"    def @ChapterNum"
  1288. X"    {"
  1289. X"        @ChapterNumbers @Case {"
  1290. X"            {Yes yes}  @Yield  { Chapter {@NumberOf @Tag} }"
  1291. X"            else  @Yield @Null"
  1292. X"        }"
  1293. X"    }"
  1294. X}
  1295. X@LI @Code {
  1296. X"        ragged @Break @BookTitleFormat @ChapterTitle"
  1297. X"    //  @NumberMarker {"
  1298. X"            @ChapterList&&@Tag @Open { @Tag }"
  1299. X"        }"
  1300. X"    //  @ChapterList&&preceding  @Tagged @Tag"
  1301. X"    //  @NumberMarker&&preceding @Tagged @Tag"
  1302. X"    //  @PageMarker&&preceding   @Tagged @Tag"
  1303. X"    //  { @ChapterTitle } @MajorContentsEntry {@PageOf @Tag}"
  1304. X"    //  @Runner"
  1305. X"            @FootEven { |0.5rt 0.8f @Font @B @PageNum }"
  1306. X"            @FootOdd  { |0.5rt 0.8f @Font @B @PageNum }"
  1307. X"    //  @Body"
  1308. X"    //@SectionGap @ChapRefSection"
  1309. X"    //  @Runner"
  1310. X"            @TopEven { @B @PageNum |1rt @I @ChapterNum }"
  1311. X"            @TopOdd  { @I {@RunningTitle @OrElse @Title} |1rt @B @PageNum }"
  1312. X"}"
  1313. X}
  1314. X@EndList
  1315. XWe will see the symbols for sections shortly.  Notice how their use has
  1316. Xbeen restricted to within the right parameter of {@Code "@Chapter"}, by
  1317. Xnesting them and using a body parameter.
  1318. X@PP
  1319. XThe meaning of @Code "@FootNote" within @Code "@Chapter" has been set
  1320. Xto {@Code "@ColFootNote"}, which produces a footnote targeted to
  1321. X{@Code "@ColFootList"} (see Section {@NumberOf pagelayout}).  In other
  1322. Xwords, footnotes within chapters go at the foot of the column, not at
  1323. Xthe foot of the page.  (Of course, in single-column books this
  1324. Xdistinction is insignificant.)  @Code "@ChapterTitle" and
  1325. X@Code "@ChapterNum" are trivial definitions which vary depending on
  1326. Xwhether the user has requested numbered chapters or not.
  1327. X@PP
  1328. XEach invocation of @Code "@Chapter" has its own unique {@Code "@Tag"},
  1329. Xeither supplied by the user or else inserted automatically by Lout.  We
  1330. Xnow trace the cross referencing of chapter numbers on a hypothetical
  1331. Xthird chapter whose tag is {@Code "euclid"}.
  1332. X@PP
  1333. X@Code "@ChapterList&&preceding @Tagged euclid" attaches @Code "euclid"
  1334. Xas an extra tag to the first invocation of @Code "@ChapterList"
  1335. Xpreceding itself in the final printed document.  But this
  1336. X@Code "@ChapterList" must be the target of the chapter, and so
  1337. X@ID @Code "@ChapterList&&euclid @Open { @Tag }"
  1338. Xis 3, the number of the chapter ({@Code "@Tag"} refers to the parameter
  1339. Xof {@Code "@ChapterList"}, not the parameter of {@Code "@Chapter"}).
  1340. X Consequently the invocation of
  1341. X@Code "@NumberMarker" within the chapter is equal to
  1342. X{@Code "@NumberMarker 3"}.
  1343. X@PP
  1344. X@Code "@NumberMarker&&preceding @Tagged euclid" attaches @Code "euclid"
  1345. Xto {@Code "@NumberMarker 3"} as an extra tag, and so
  1346. X{@Code "@NumberOf euclid"}, which expands to
  1347. X@ID @Code "@NumberMarker&&euclid @Open { @Tag }"
  1348. Xmust be equal to 3, as required.  This scheme could be simplified by
  1349. Xplacing the invocation of @Code "@NumberMarker" within
  1350. X@Code "@ChapterList" rather than within {@Code "@Chapter"}, but it turns
  1351. Xout that that scheme does not generalize well to sections and subsections.
  1352. X@PP
  1353. XThere is a trap for the unwary in the use of @Code preceding and
  1354. X{@Code following}.  Suppose that the invocation of @Code "@NumberMarker"
  1355. Xwithin @Code "@Chapter" is replaced by the seemingly equivalent
  1356. X@ID @Code "@NumberMarker { @ChapterList&&preceding @Open { @Tag } }"
  1357. XNow suppose that @Code "@NumberOf euclid" appears somewhere within
  1358. XChapter 7.  It will expand to
  1359. X@ID @Code "@NumberMarker&&euclid @Open { @Tag }"
  1360. Xwhich would now be equal to
  1361. X@ID @Code "@ChapterList&&preceding @Open { @Tag }"
  1362. Xwhose value, evaluated as it is within Chapter 7, is 7, not 3.  Use of
  1363. X@Code preceding or @Code following within the parameter
  1364. Xof a symbol, rather than within the body, is likely to be erroneous.
  1365. X@PP
  1366. XMuch of the remainder of the definition of @Code "@Chapter" is fairly
  1367. Xself-explanatory:  there is a heading, a tag sent to mark the page on
  1368. Xwhich the chapter begins, a @Code "@ContentsEntry" galley sent to the
  1369. Xtable of contents, galleys for the figures and tables of the chapter to
  1370. Xcollect in, @Code "@Body" where the body of the chapter goes, and
  1371. X@Code "@ChapRefSection" to hold a concluding list of references.  This
  1372. Xleaves only the two invocations of @Code "@Runner" to explain.
  1373. X@PP
  1374. XThe first @Code "@Runner" is just below the heading.  It will be the target
  1375. Xof the @Code "@Runner&&following" cross reference at the beginning of the
  1376. Xfirst page of the chapter (see Section {@NumberOf pagelayout}), which
  1377. Xconsequently will have null running headers and the given footers.
  1378. X@PP
  1379. XThe second @Code "@Runner" appears at the very end of the chapter, hence
  1380. Xon its last page.  Since no invocations of @Code "@Runner" lie between
  1381. Xit and the first {@Code "@Runner"}, it will be the target of
  1382. X@Code "@Runner&&following" on every page from the second page of the
  1383. Xchapter to the last, inclusive, and will supply the format of their
  1384. Xheaders and footers.
  1385. X@PP
  1386. XThe interested reader might care to predict the outcome in unusual
  1387. Xcases, such as when the heading occupies two pages, or when a chapter
  1388. Xoccupies only one, or (assuming a change to the gap between chapters)
  1389. Xwhen a chapter starts halfway down a page.  Such predictions can be made
  1390. Xwith great confidence.
  1391. X@PP
  1392. XThe expression @Code "@RunningTitle @OrElse @Title" appearing in the second
  1393. X@Code "@Runner" returns the value of the @Code "@RunningTitle" parameter
  1394. Xof @Code "@Chapter" if this is not equal to the default value
  1395. X{@Code "dft"}, or @Code "@Title" otherwise:
  1396. Xorelse.example @Index { @Code "@OrElse" example }
  1397. X@ID @Code {
  1398. X"def @OrElse"
  1399. X"    left x"
  1400. X"    right y"
  1401. X"{"
  1402. X"    x @Case {"
  1403. X"        dft  @Yield  y"
  1404. X"        else  @Yield  x"
  1405. X"    }"
  1406. X"}"
  1407. X}
  1408. XThis produces the effect of
  1409. X@ID @Code {
  1410. X"named  @RunningTitle  {  @Title  }"
  1411. X}
  1412. Xwhich unfortunately is not permissible as it stands, because @Code "@Title"
  1413. Xis not visible within the default value of {@Code "@RunningTitle"}.
  1414. X@PP
  1415. XFinally, the definitions for sections omitted earlier are as follows:
  1416. Xsection.example @Index { @Code "@Section" example }
  1417. X@IndentedList
  1418. X@LI @Code {
  1419. X"def @EndSectionsPlace { @Galley }"
  1420. X"def @EndSections force into { @EndSectionsPlace&&preceding } {}"
  1421. X"macro @BeginSections { //@SectionGap @SectionList 1 // @EndSectionsPlace // }"
  1422. X}
  1423. X@LI @Code {
  1424. X"def @Section force into { @SectionList&&preceding }"
  1425. X"    named @Tag {}"
  1426. X"    named @Title {}"
  1427. X"    named @RunningTitle { dft }"
  1428. X"    body @Body"
  1429. X"{"
  1430. X"    def @SectionTitle"
  1431. X"    {"
  1432. X"        @SectionNumbers @Case {"
  1433. X"            {Yes yes} @Yield { {@NumberOf @Tag}.  |2s  @Title }"
  1434. X"            else      @Yield @Title"
  1435. X"        }"
  1436. X"    }"
  1437. X""
  1438. X"        @Heading @Protect @SectionTitle"
  1439. X"    //  @NumberMarker {"
  1440. X"            {@ChapterList&&@Tag @Open { @Tag }}.{"
  1441. X"             @SectionList&&@Tag @Open { @Tag }}"
  1442. X"        }"
  1443. X"    //  @ChapterList&&preceding  @Tagged @Tag"
  1444. X"    //  @SectionList&&preceding  @Tagged @Tag"
  1445. X"    //  @NumberMarker&&preceding @Tagged @Tag"
  1446. X"    //  @PageMarker&&preceding   @Tagged @Tag"
  1447. X"    //  { &3f @SectionTitle } @ContentsEntry {@PageOf @Tag}"
  1448. X"    //0io @Body"
  1449. X"}"
  1450. X}
  1451. X@EndList
  1452. XThe @Code "@BeginSections" macro invokes {@Code "@SectionList"},
  1453. Xpreceded by the appropriate gap and followed by an @Code "@EndSectsPlace"
  1454. Xfor closing the list of sections when the @Code "@EndSections" symbol is
  1455. Xfound.  @Code "@Section" itself is just a copy of @Code "@Chapter" with
  1456. Xslight changes to the format.  The parameter of @Code "@NumberMarker" is
  1457. Xa simple generalization of the one within {@Code "@Chapter"}.  Notice
  1458. Xthat we have taken care that the value of this parameter be
  1459. Xa juxtaposition of simple words:  although
  1460. X@ID @Code {
  1461. X"{@ChapterList&&@Tag @Open { @Tag }}. &"
  1462. X"{@SectionList&&@Tag @Open { @Tag }}"
  1463. X}
  1464. Xis formally equivalent, @Code "&" is not permitted within a
  1465. X@Code "@Tag" parameter.
  1466. X@PP
  1467. XThe DocumentLayout package also contains definitions for subsections in the
  1468. Xsame style.  They raise the question of whether Lout is capable of
  1469. Xproducing subsections should the user place {@Code "@BeginSections"},
  1470. X{@Code "@Section"}, and {@Code "@EndSections"} within a {@I section},
  1471. Xand whether such nesting could proceed to arbitrary depth.  Arbitrary
  1472. Xnesting of sections within sections is available now, although the
  1473. Xnumbering would of course be wrong.  The author has worked out
  1474. Xdefinitions which provide correct numbering to arbitrary depth, with an
  1475. Xarbitrary format for each level.  These were not incorporated into
  1476. XDocumentLayout because the author considers sub-subsections to be poor
  1477. Xstyle, and he prefers separate names for the symbols at each level.
  1478. X@End @Section
  1479. END_OF_FILE
  1480.   if test 10583 -ne `wc -c <'doc/tr.lout/ch4.04'`; then
  1481.     echo shar: \"'doc/tr.lout/ch4.04'\" unpacked with wrong size!
  1482.   fi
  1483.   # end of 'doc/tr.lout/ch4.04'
  1484. fi
  1485. if test -f 'font/Symbo.AFM' -a "${1}" != "-c" ; then 
  1486.   echo shar: Will not clobber existing file \"'font/Symbo.AFM'\"
  1487. else
  1488.   echo shar: Extracting \"'font/Symbo.AFM'\" \(9486 characters\)
  1489.   sed "s/^X//" >'font/Symbo.AFM' <<'END_OF_FILE'
  1490. XStartFontMetrics 2.0
  1491. XComment Copyright (c) 1984 Adobe Systems Incorporated.     All Rights Reserved.
  1492. XComment Creation Date:Thu Apr 16 08:46:05 PST 1987
  1493. XFontName Symbol
  1494. XEncodingScheme FontSpecific
  1495. XFullName Symbol
  1496. XFamilyName Symbol
  1497. XWeight Medium
  1498. XItalicAngle 0.0
  1499. XIsFixedPitch false
  1500. XUnderlinePosition -98
  1501. XUnderlineThickness 54
  1502. XVersion 001.003
  1503. XFontBBox -180 -293 1090 1010
  1504. XStartCharMetrics 189
  1505. XC 32 ; WX 250 ; N space ; B 0 0 0 0 ;
  1506. XC 33 ; WX 333 ; N exclam ; B 128 -17 240 673 ;
  1507. XC 34 ; WX 713 ; N universal ; B 31 0 681 705 ;
  1508. XC 35 ; WX 500 ; N numbersign ; B 20 -17 481 673 ;
  1509. XC 36 ; WX 549 ; N existential ; B 25 0 478 707 ;
  1510. XC 37 ; WX 833 ; N percent ; B 63 -36 771 655 ;
  1511. XC 38 ; WX 778 ; N ampersand ; B 41 -18 750 661 ;
  1512. XC 39 ; WX 439 ; N suchthat ; B 48 -17 414 499 ;
  1513. XC 40 ; WX 333 ; N parenleft ; B 53 -191 300 673 ;
  1514. XC 41 ; WX 333 ; N parenright ; B 30 -191 277 674 ;
  1515. XC 42 ; WX 500 ; N asteriskmath ; B 65 134 427 551 ;
  1516. XC 43 ; WX 549 ; N plus ; B 10 0 539 533 ;
  1517. XC 44 ; WX 250 ; N comma ; B 56 -152 194 104 ;
  1518. XC 45 ; WX 549 ; N minus ; B 11 233 535 288 ;
  1519. XC 46 ; WX 250 ; N period ; B 69 -17 181 95 ;
  1520. XC 47 ; WX 278 ; N slash ; B 0 -17 254 646 ;
  1521. XC 48 ; WX 500 ; N zero ; B 23 -17 471 685 ;
  1522. XC 49 ; WX 500 ; N one ; B 117 0 390 673 ;
  1523. XC 50 ; WX 500 ; N two ; B 25 0 475 686 ;
  1524. XC 51 ; WX 500 ; N three ; B 39 -17 435 687 ;
  1525. XC 52 ; WX 500 ; N four ; B 16 0 469 685 ;
  1526. XC 53 ; WX 500 ; N five ; B 28 -17 443 685 ;
  1527. XC 54 ; WX 500 ; N six ; B 36 -17 467 685 ;
  1528. XC 55 ; WX 500 ; N seven ; B 24 -17 448 673 ;
  1529. XC 56 ; WX 500 ; N eight ; B 54 -18 440 686 ;
  1530. XC 57 ; WX 500 ; N nine ; B 31 -17 460 685 ;
  1531. XC 58 ; WX 278 ; N colon ; B 81 -17 193 460 ;
  1532. XC 59 ; WX 278 ; N semicolon ; B 83 -152 221 460 ;
  1533. XC 60 ; WX 549 ; N less ; B 26 0 523 522 ;
  1534. XC 61 ; WX 549 ; N equal ; B 11 141 537 390 ;
  1535. XC 62 ; WX 549 ; N greater ; B 26 0 523 522 ;
  1536. XC 63 ; WX 444 ; N question ; B 70 -17 412 685 ;
  1537. XC 64 ; WX 549 ; N congruent ; B 11 0 537 475 ;
  1538. XC 65 ; WX 722 ; N Alpha ; B 4 0 684 673 ;
  1539. XC 66 ; WX 667 ; N Beta ; B 29 0 592 672 ;
  1540. XC 67 ; WX 722 ; N Chi ; B -9 0 704 673 ;
  1541. XC 68 ; WX 612 ; N Delta ; B 6 0 608 688 ;
  1542. XC 69 ; WX 611 ; N Epsilon ; B 32 0 617 673 ;
  1543. XC 70 ; WX 763 ; N Phi ; B 26 0 741 672 ;
  1544. XC 71 ; WX 603 ; N Gamma ; B 24 0 609 673 ;
  1545. XC 72 ; WX 722 ; N Eta ; B 39 0 729 673 ;
  1546. XC 73 ; WX 333 ; N Iota ; B 32 0 316 673 ;
  1547. XC 74 ; WX 631 ; N theta1 ; B 18 -17 623 689 ;
  1548. XC 75 ; WX 722 ; N Kappa ; B 35 0 722 672 ;
  1549. XC 76 ; WX 686 ; N Lambda ; B 6 0 680 688 ;
  1550. XC 77 ; WX 889 ; N Mu ; B 28 0 887 673 ;
  1551. XC 78 ; WX 722 ; N Nu ; B 29 -8 720 673 ;
  1552. XC 79 ; WX 722 ; N Omicron ; B 41 -17 715 685 ;
  1553. XC 80 ; WX 768 ; N Pi ; B 25 0 745 673 ;
  1554. XC 81 ; WX 741 ; N Theta ; B 41 -17 715 685 ;
  1555. XC 82 ; WX 556 ; N Rho ; B 28 0 563 673 ;
  1556. XC 83 ; WX 592 ; N Sigma ; B 5 0 589 673 ;
  1557. XC 84 ; WX 611 ; N Tau ; B 33 0 607 673 ;
  1558. XC 85 ; WX 690 ; N Upsilon ; B -8 0 694 673 ;
  1559. XC 86 ; WX 439 ; N sigma1 ; B 40 -233 436 500 ;
  1560. XC 87 ; WX 768 ; N Omega ; B 34 0 736 688 ;
  1561. XC 88 ; WX 645 ; N Xi ; B 40 0 599 672 ;
  1562. XC 89 ; WX 795 ; N Psi ; B 15 0 781 683 ;
  1563. XC 90 ; WX 611 ; N Zeta ; B 44 0 636 673 ;
  1564. XC 91 ; WX 333 ; N bracketleft ; B 86 -155 299 673 ;
  1565. XC 92 ; WX 863 ; N therefore ; B 163 0 701 478 ;
  1566. XC 93 ; WX 333 ; N bracketright ; B 33 -155 246 673 ;
  1567. XC 94 ; WX 658 ; N perpendicular ; B 15 0 652 674 ;
  1568. XC 95 ; WX 500 ; N underscore ; B -2 -252 502 -206 ;
  1569. XC 96 ; WX 500 ; N radicalex ; B 480 881 1090 917 ;
  1570. XC 97 ; WX 631 ; N alpha ; B 41 -17 622 500 ;
  1571. XC 98 ; WX 549 ; N beta ; B 61 -222 515 741 ;
  1572. XC 99 ; WX 549 ; N chi ; B 12 -231 522 500 ;
  1573. XC 100 ; WX 494 ; N delta ; B 40 -17 481 740 ;
  1574. XC 101 ; WX 439 ; N epsilon ; B 22 -19 427 502 ;
  1575. XC 102 ; WX 521 ; N phi ; B 27 -224 490 670 ;
  1576. XC 103 ; WX 411 ; N gamma ; B 5 -225 484 499 ;
  1577. XC 104 ; WX 603 ; N eta ; B 0 -202 527 514 ;
  1578. XC 105 ; WX 329 ; N iota ; B 0 -18 301 503 ;
  1579. XC 106 ; WX 603 ; N phi1 ; B 36 -224 587 499 ;
  1580. XC 107 ; WX 549 ; N kappa ; B 33 0 558 502 ;
  1581. XC 108 ; WX 549 ; N lambda ; B 24 -18 548 739 ;
  1582. XC 109 ; WX 576 ; N mu ; B 33 -223 567 500 ;
  1583. XC 110 ; WX 521 ; N nu ; B -9 -17 475 507 ;
  1584. XC 111 ; WX 549 ; N omicron ; B 35 -19 501 499 ;
  1585. XC 112 ; WX 549 ; N pi ; B 10 -20 530 486 ;
  1586. XC 113 ; WX 521 ; N theta ; B 43 -18 485 690 ;
  1587. XC 114 ; WX 549 ; N rho ; B 50 -230 490 499 ;
  1588. XC 115 ; WX 603 ; N sigma ; B 30 -21 588 500 ;
  1589. XC 116 ; WX 439 ; N tau ; B 10 -18 418 500 ;
  1590. XC 117 ; WX 576 ; N upsilon ; B 7 -17 535 507 ;
  1591. XC 118 ; WX 713 ; N omega1 ; B 12 -17 671 583 ;
  1592. XC 119 ; WX 686 ; N omega ; B 42 -17 684 500 ;
  1593. XC 120 ; WX 493 ; N xi ; B 27 -224 469 766 ;
  1594. XC 121 ; WX 686 ; N psi ; B 12 -228 701 500 ;
  1595. XC 122 ; WX 494 ; N zeta ; B 60 -225 467 756 ;
  1596. XC 123 ; WX 480 ; N braceleft ; B 58 -183 397 673 ;
  1597. XC 124 ; WX 200 ; N bar ; B 65 -177 135 673 ;
  1598. XC 125 ; WX 480 ; N braceright ; B 79 -183 418 673 ;
  1599. XC 126 ; WX 549 ; N similar ; B 17 203 529 307 ;
  1600. XC 161 ; WX 620 ; N Upsilon1 ; B -2 0 610 684 ;
  1601. XC 162 ; WX 247 ; N minute ; B 27 459 228 735 ;
  1602. XC 163 ; WX 549 ; N lessequal ; B 29 0 526 639 ;
  1603. XC 164 ; WX 167 ; N fraction ; B -180 -12 340 677 ;
  1604. XC 165 ; WX 713 ; N infinity ; B 25 124 689 404 ;
  1605. XC 166 ; WX 500 ; N florin ; B 2 -193 494 687 ;
  1606. XC 167 ; WX 753 ; N club ; B 86 -26 660 533 ;
  1607. XC 168 ; WX 753 ; N diamond ; B 142 -36 600 550 ;
  1608. XC 169 ; WX 753 ; N heart ; B 117 -33 631 532 ;
  1609. XC 170 ; WX 753 ; N spade ; B 113 -36 629 548 ;
  1610. XC 171 ; WX 1042 ; N arrowboth ; B 24 -15 1024 511 ;
  1611. XC 172 ; WX 987 ; N arrowleft ; B 32 -15 942 511 ;
  1612. XC 173 ; WX 603 ; N arrowup ; B 45 0 571 910 ;
  1613. XC 174 ; WX 987 ; N arrowright ; B 49 -15 959 511 ;
  1614. XC 175 ; WX 603 ; N arrowdown ; B 45 -22 571 888 ;
  1615. XC 176 ; WX 400 ; N degree ; B 50 385 350 684 ;
  1616. XC 177 ; WX 549 ; N plusminus ; B 10 0 539 645 ;
  1617. XC 178 ; WX 411 ; N second ; B 20 459 413 737 ;
  1618. XC 179 ; WX 549 ; N greaterequal ; B 29 0 526 639 ;
  1619. XC 180 ; WX 549 ; N multiply ; B 17 8 533 524 ;
  1620. XC 181 ; WX 713 ; N proportional ; B 27 123 639 404 ;
  1621. XC 182 ; WX 494 ; N partialdiff ; B 26 -20 462 746 ;
  1622. XC 183 ; WX 460 ; N bullet ; B 50 113 410 473 ;
  1623. XC 184 ; WX 549 ; N divide ; B 10 71 536 456 ;
  1624. XC 185 ; WX 549 ; N notequal ; B 15 -25 540 549 ;
  1625. XC 186 ; WX 549 ; N equivalence ; B 14 82 538 443 ;
  1626. XC 187 ; WX 549 ; N approxequal ; B 14 135 527 394 ;
  1627. XC 188 ; WX 1000 ; N ellipsis ; B 111 -17 889 95 ;
  1628. XC 189 ; WX 603 ; N arrowvertex ; B 280 -120 336 1010 ;
  1629. XC 190 ; WX 1000 ; N arrowhorizex ; B -60 220 1050 276 ;
  1630. XC 191 ; WX 658 ; N carriagereturn ; B 15 -16 602 629 ;
  1631. XC 192 ; WX 823 ; N aleph ; B 175 -18 661 658 ;
  1632. XC 193 ; WX 686 ; N Ifraktur ; B 10 -53 578 740 ;
  1633. XC 194 ; WX 795 ; N Rfraktur ; B 26 -15 759 734 ;
  1634. XC 195 ; WX 987 ; N weierstrass ; B 159 -211 870 573 ;
  1635. XC 196 ; WX 768 ; N circlemultiply ; B 43 -17 733 673 ;
  1636. XC 197 ; WX 768 ; N circleplus ; B 43 -15 733 675 ;
  1637. XC 198 ; WX 823 ; N emptyset ; B 39 -24 781 719 ;
  1638. XC 199 ; WX 768 ; N intersection ; B 40 0 732 509 ;
  1639. XC 200 ; WX 768 ; N union ; B 40 -17 732 492 ;
  1640. XC 201 ; WX 713 ; N propersuperset ; B 20 0 673 470 ;
  1641. XC 202 ; WX 713 ; N reflexsuperset ; B 20 -125 673 470 ;
  1642. XC 203 ; WX 713 ; N notsubset ; B 36 -70 690 540 ;
  1643. XC 204 ; WX 713 ; N propersubset ; B 37 0 690 470 ;
  1644. XC 205 ; WX 713 ; N reflexsubset ; B 37 -125 690 470 ;
  1645. XC 206 ; WX 713 ; N element ; B 45 0 505 468 ;
  1646. XC 207 ; WX 713 ; N notelement ; B 45 -58 505 555 ;
  1647. XC 208 ; WX 768 ; N angle ; B 26 0 738 673 ;
  1648. XC 209 ; WX 713 ; N gradient ; B 36 -19 681 718 ;
  1649. XC 210 ; WX 790 ; N registerserif ; B 50 -20 740 670 ;
  1650. XC 211 ; WX 790 ; N copyrightserif ; B 51 -15 741 675 ;
  1651. XC 212 ; WX 890 ; N trademarkserif ; B 18 293 855 673 ;
  1652. XC 213 ; WX 823 ; N product ; B 25 -101 803 751 ;
  1653. XC 214 ; WX 549 ; N radical ; B 10 -38 515 917 ;
  1654. XC 215 ; WX 250 ; N dotmath ; B 69 210 169 310 ;
  1655. XC 216 ; WX 713 ; N logicalnot ; B 15 0 680 288 ;
  1656. XC 217 ; WX 603 ; N logicaland ; B 23 0 583 454 ;
  1657. XC 218 ; WX 603 ; N logicalor ; B 30 0 578 477 ;
  1658. XC 219 ; WX 1042 ; N arrowdblboth ; B 27 -20 1023 510 ;
  1659. XC 220 ; WX 987 ; N arrowdblleft ; B 30 -15 939 513 ;
  1660. XC 221 ; WX 603 ; N arrowdblup ; B 39 2 567 911 ;
  1661. XC 222 ; WX 987 ; N arrowdblright ; B 45 -20 954 508 ;
  1662. XC 223 ; WX 603 ; N arrowdbldown ; B 44 -19 572 890 ;
  1663. XC 224 ; WX 494 ; N lozenge ; B 18 0 466 745 ;
  1664. XC 225 ; WX 329 ; N angleleft ; B 25 -198 306 746 ;
  1665. XC 226 ; WX 790 ; N registersans ; B 50 -20 740 670 ;
  1666. XC 227 ; WX 790 ; N copyrightsans ; B 49 -15 739 675 ;
  1667. XC 228 ; WX 786 ; N trademarksans ; B 5 293 725 673 ;
  1668. XC 229 ; WX 713 ; N summation ; B 14 -108 695 752 ;
  1669. XC 230 ; WX 384 ; N parenlefttp ; B 40 -293 436 926 ;
  1670. XC 231 ; WX 384 ; N parenleftex ; B 40 -85 92 925 ;
  1671. XC 232 ; WX 384 ; N parenleftbt ; B 40 -293 436 926 ;
  1672. XC 233 ; WX 384 ; N bracketlefttp ; B 0 -80 341 926 ;
  1673. XC 234 ; WX 384 ; N bracketleftex ; B 0 -79 55 925 ;
  1674. XC 235 ; WX 384 ; N bracketleftbt ; B 0 -80 340 926 ;
  1675. XC 236 ; WX 494 ; N bracelefttp ; B 201 -75 439 926 ;
  1676. XC 237 ; WX 494 ; N braceleftmid ; B 14 -85 255 935 ;
  1677. XC 238 ; WX 494 ; N braceleftbt ; B 201 -70 439 926 ;
  1678. XC 239 ; WX 494 ; N braceex ; B 201 -80 255 935 ;
  1679. XC 241 ; WX 329 ; N angleright ; B 21 -198 302 746 ;
  1680. XC 242 ; WX 274 ; N integral ; B 2 -107 291 916 ;
  1681. XC 243 ; WX 686 ; N integraltp ; B 332 -83 715 922 ;
  1682. XC 244 ; WX 686 ; N integralex ; B 332 -88 415 975 ;
  1683. XC 245 ; WX 686 ; N integralbt ; B 39 -81 415 921 ;
  1684. XC 246 ; WX 384 ; N parenrighttp ; B 54 -293 450 926 ;
  1685. XC 247 ; WX 384 ; N parenrightex ; B 398 -85 450 925 ;
  1686. XC 248 ; WX 384 ; N parenrightbt ; B 54 -293 450 926 ;
  1687. XC 249 ; WX 384 ; N bracketrighttp ; B 22 -80 360 926 ;
  1688. XC 250 ; WX 384 ; N bracketrightex ; B 305 -79 360 925 ;
  1689. XC 251 ; WX 384 ; N bracketrightbt ; B 20 -80 360 926 ;
  1690. XC 252 ; WX 494 ; N bracerighttp ; B 17 -75 255 926 ;
  1691. XC 253 ; WX 494 ; N bracerightmid ; B 201 -85 442 935 ;
  1692. XC 254 ; WX 494 ; N bracerightbt ; B 17 -70 255 926 ;
  1693. XC -1 ; WX 790 ; N apple ; B 56 -3 733 808 ;
  1694. XEndCharMetrics
  1695. XEndFontMetrics
  1696. END_OF_FILE
  1697.   if test 9486 -ne `wc -c <'font/Symbo.AFM'`; then
  1698.     echo shar: \"'font/Symbo.AFM'\" unpacked with wrong size!
  1699.   fi
  1700.   # end of 'font/Symbo.AFM'
  1701. fi
  1702. if test -f 'z27.c' -a "${1}" != "-c" ; then 
  1703.   echo shar: Will not clobber existing file \"'z27.c'\"
  1704. else
  1705.   echo shar: Extracting \"'z27.c'\" \(10261 characters\)
  1706.   sed "s/^X//" >'z27.c' <<'END_OF_FILE'
  1707. X/*@z27.c:Debug Service:Debug flags@*******************************************/
  1708. X/*                                                                           */
  1709. X/*  LOUT: A HIGH-LEVEL LANGUAGE FOR DOCUMENT FORMATTING (VERSION 2.05)       */
  1710. X/*  COPYRIGHT (C) 1993 Jeffrey H. Kingston                                   */
  1711. X/*                                                                           */
  1712. X/*  Jeffrey H. Kingston (jeff@cs.su.oz.au)                                   */
  1713. X/*  Basser Department of Computer Science                                    */
  1714. X/*  The University of Sydney 2006                                            */
  1715. X/*  AUSTRALIA                                                                */
  1716. X/*                                                                           */
  1717. X/*  This program is free software; you can redistribute it and/or modify     */
  1718. X/*  it under the terms of the GNU General Public License as published by     */
  1719. X/*  the Free Software Foundation; either version 1, or (at your option)      */
  1720. X/*  any later version.                                                       */
  1721. X/*                                                                           */
  1722. X/*  This program is distributed in the hope that it will be useful,          */
  1723. X/*  but WITHOUT ANY WARRANTY; without even the implied warranty of           */
  1724. X/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            */
  1725. X/*  GNU General Public License for more details.                             */
  1726. X/*                                                                           */
  1727. X/*  You should have received a copy of the GNU General Public License        */
  1728. X/*  along with this program; if not, write to the Free Software              */
  1729. X/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
  1730. X/*                                                                           */
  1731. X/*  FILE:         z27.c                                                      */
  1732. X/*  MODULE:       Debug Service                                              */
  1733. X/*  EXTERNS:      dbg[], DebugInit(), Debug()                                */
  1734. X/*                ProfileOn(), ProfileOff(), ProfilePrint()                  */
  1735. X/*                                                                           */
  1736. X/*****************************************************************************/
  1737. X#include "externs"
  1738. X
  1739. X#if DEBUG_ON
  1740. Xstruct dbs  dbg[] = {
  1741. X    "zz",    0, 0, 0,        /* - unused -                */
  1742. X    "sp",    0, 0, 0,        /* Supervise                 */
  1743. X    "la",    0, 0, 0,        /* Lexical Analyser          */
  1744. X    "fs",    0, 0, 0,        /* File Service              */
  1745. X    "ts",    0, 0, 0,        /* Token Service             */
  1746. X    "rd",    0, 0, 0,        /* Read Definitions          */
  1747. X    "op",    0, 0, 0,        /* Object Parser             */
  1748. X    "os",    0, 0, 0,        /* Object Service            */
  1749. X    "om",    0, 0, 0,        /* Object Manifest           */
  1750. X    "ce",    0, 0, 0,        /* Closure Expansion         */
  1751. X    "cr",    0, 0, 0,        /* Cross References          */
  1752. X    "ss",    0, 0, 0,        /* Style Service             */
  1753. X    "sf",    0, 0, 0,        /* Size Finder               */
  1754. X    "ob",    0, 0, 0,        /* Object Breaking           */
  1755. X    "of",    0, 0, 0,        /* Object Filling            */
  1756. X    "sc",    0, 0, 0,        /* Size Constraints          */
  1757. X    "sa",    0, 0, 0,        /* Size Adjustments          */
  1758. X    "gw",    0, 0, 0,        /* Gap Widths                */
  1759. X    "gt",    0, 0, 0,        /* Galley Transfer           */
  1760. X    "ga",    0, 0, 0,        /* Galley Attaching          */
  1761. X    "gf",    0, 0, 0,        /* Galley Flusher            */
  1762. X    "gm",    0, 0, 0,        /* Galley Maker              */
  1763. X    "gs",    0, 0, 0,        /* Galley Service            */
  1764. X    "gp",    0, 0, 0,        /* Galley Printer            */
  1765. X    "ps",    0, 0, 0,        /* Print Service             */
  1766. X    "oe",    0, 0, 0,        /* Object Echo               */
  1767. X    "es",    0, 0, 0,        /* Echo Service              */
  1768. X    "zz",    0, 0, 0,        /* Debug Service (unused)    */
  1769. X    "yy",    0, 0, 0,        /* Error Service             */
  1770. X    "st",    0, 0, 0,        /* Symbol Table              */
  1771. X    "su",    0, 0, 0,        /* Symbol Uses               */
  1772. X    "ma",    0, 0, 0,        /* Memory Allocator          */
  1773. X    "cs",    0, 0, 0,        /* Counter Service           */
  1774. X    "bs",    0, 0, 0,        /* Database Service          */
  1775. X    "rs",    0, 0, 0,        /* Rotation Service          */
  1776. X    "tk",    0, 0, 0,        /* Time Keeper               */
  1777. X    "hy",    0, 0, 0,        /* Hyphenation               */
  1778. X    "ft",    0, 0, 0,        /* Font Tables               */
  1779. X    "ev",    0, 0, 0,        /* Encoding Vextors          */
  1780. X    "sh",    0, 0, 0,        /* String Handler            */
  1781. X    "pp",    0, 0, 0,        /* Profiling                 */
  1782. X    "",      0, 0, 0,        /* any                       */
  1783. X};
  1784. X
  1785. X/*@::DebugInit(), Debug()@****************************************************/
  1786. X/*                                                                           */
  1787. X/*  DebugInit(str)                                                           */
  1788. X/*                                                                           */
  1789. X/*  Turn on the debug flag given by str.                                     */
  1790. X/*                                                                           */
  1791. X/*****************************************************************************/
  1792. X
  1793. XDebugInit(str)
  1794. XFULL_CHAR *str;
  1795. X{ int j, urg;
  1796. X  for( urg = 0;  urg < 2 && str[urg+2] == CH_FLAG_DEBUG;  urg++ );
  1797. X  for( j = 1;  ;  j++ )
  1798. X  { if( StringEqual(AsciiToFull(dbg[j].flag), &str[urg+2]) )  break;
  1799. X    if( StringEqual(AsciiToFull(dbg[j].flag), STR_EMPTY) )
  1800. X      Error(FATAL, no_fpos, "unknown debug flag %s", str);
  1801. X  }
  1802. X  for( ;  urg >= 0;  urg-- )  dbg[j].on[urg] = dbg[ANY].on[urg] = TRUE;
  1803. X} /* end DebugInit */
  1804. X
  1805. X
  1806. X/*****************************************************************************/
  1807. X/*                                                                           */
  1808. X/*  Debug(category, urgency, str, p1, p2, p3, p4, p5, p6, p7, p8)            */
  1809. X/*                                                                           */
  1810. X/*  Print str on debug output, if the flag corresponding to the given        */
  1811. X/*  debug category and urgency is on.                                        */
  1812. X/*                                                                           */
  1813. X/*****************************************************************************/
  1814. X
  1815. X/*VARARGS3*/
  1816. XDebug(category, urgency, str, p1, p2, p3, p4, p5, p6, p7, p8)
  1817. Xint category, urgency;  char *str;  int p1, p2, p3, p4, p5, p6, p7, p8;
  1818. X{ static BOOLEAN first_message = TRUE;
  1819. X  if( first_message )
  1820. X  { fprintf(stderr, "\nLout Debug Output:\n");
  1821. X    first_message = FALSE;
  1822. X  }
  1823. X  fprintf(stderr, "%2s: ", dbg[category].flag);
  1824. X  fprintf(stderr, str, p1, p2, p3, p4, p5, p6, p7, p8);
  1825. X  fprintf(stderr, "\n");
  1826. X  fflush(stderr);
  1827. X} /* end Debug */
  1828. X
  1829. X
  1830. X/*@::ProfileOn(), ProfileOff(), ProfilePrint()@*******************************/
  1831. X/*                                                                           */
  1832. X/*  ProfileOn(str)                                                           */
  1833. X/*                                                                           */
  1834. X/*  Start profiling label str.                                               */
  1835. X/*                                                                           */
  1836. X/*****************************************************************************/
  1837. X#define MAXPROF    20
  1838. X#include <time.h>
  1839. X
  1840. Xstruct profrec
  1841. X{ char *label;            /* label of the profile              */
  1842. X  int calls;            /* number of calls with this label   */
  1843. X  long time;            /* total time of this label          */
  1844. X};
  1845. X
  1846. Xstatic struct profrec profstack[MAXPROF];
  1847. Xstatic struct profrec profstore[MAXPROF];
  1848. Xstatic int proftop = 0, profsize = 0;
  1849. X
  1850. XProfileOn(str)
  1851. Xchar *str;
  1852. X{ int i;  long raw_time;
  1853. X  for( i = 0;  i < proftop;  i++ )
  1854. X  { if( strcmp(profstack[i].label, str) == 0 )
  1855. X    { for( i = 0;  i < proftop;  i++ )
  1856. X    fprintf(stderr, "profstack[%d] = %s\n", i, profstack[i].label);
  1857. X      Error(INTERN, no_fpos, "ProfileOn: %s restarted", str);
  1858. X    }
  1859. X  }
  1860. X  if( proftop == MAXPROF )  Error(INTERN, no_fpos, "ProfileOn: overflow");
  1861. X  time(&raw_time);  profstack[proftop].label = str;
  1862. X  profstack[proftop++].time  = raw_time;
  1863. X} /* end ProfileOn */
  1864. X
  1865. X
  1866. X/*****************************************************************************/
  1867. X/*                                                                           */
  1868. X/*  ProfileOff(str)                                                          */
  1869. X/*                                                                           */
  1870. X/*  Stop profiling label str.                                                */
  1871. X/*                                                                           */
  1872. X/*****************************************************************************/
  1873. X
  1874. XProfileOff(str)
  1875. Xchar *str;
  1876. X{ int i;  long raw_time;
  1877. X  if( proftop == 0 || strcmp(profstack[proftop-1].label, str) != 0 )
  1878. X    Error(INTERN, no_fpos, "ProfileOff: %s is not the current label", str);
  1879. X  for( i = 0;  i < profsize && strcmp(profstore[i].label, str) != 0; i++ );
  1880. X  if( i >= profsize )
  1881. X  { if( profsize++ == MAXPROF )  Error(INTERN, no_fpos, "ProfileOff: overflow");
  1882. X    profstore[i].label = str;
  1883. X    profstore[i].calls = 0;
  1884. X    profstore[i].time  = 0;
  1885. X  }
  1886. X  time(&raw_time);  profstore[i].calls += 1;
  1887. X  profstore[i].time  += (raw_time - profstack[--proftop].time);
  1888. X} /* end ProfileOff */
  1889. X
  1890. X
  1891. X/*****************************************************************************/
  1892. X/*                                                                           */
  1893. X/*  ProfilePrint()                                                           */
  1894. X/*                                                                           */
  1895. X/*  Print results of profiling.                                              */
  1896. X/*                                                                           */
  1897. X/*****************************************************************************/
  1898. X
  1899. XProfilePrint()
  1900. X{ int i;
  1901. X  for( i = 0;  i < profsize;  i++ )
  1902. X  { fprintf(stderr, "Profile %-20s  %6d secs, %3d calls, %6.2f secs/call\n",
  1903. X    profstore[i].label, profstore[i].time, profstore[i].calls,
  1904. X    (float) profstore[i].time / profstore[i].calls );
  1905. X  }
  1906. X} /* end ProfilePrint */
  1907. X#endif
  1908. END_OF_FILE
  1909.   if test 10261 -ne `wc -c <'z27.c'`; then
  1910.     echo shar: \"'z27.c'\" unpacked with wrong size!
  1911.   fi
  1912.   # end of 'z27.c'
  1913. fi
  1914. echo shar: End of archive 28 \(of 35\).
  1915. cp /dev/null ark28isdone
  1916. MISSING=""
  1917. 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 31 32 33 34 35 ; do
  1918.     if test ! -f ark${I}isdone ; then
  1919.     MISSING="${MISSING} ${I}"
  1920.     fi
  1921. done
  1922. if test "${MISSING}" = "" ; then
  1923.     echo You have unpacked all 35 archives.
  1924.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1925. else
  1926.     echo You still must unpack the following archives:
  1927.     echo "        " ${MISSING}
  1928. fi
  1929. exit 0
  1930. exit 0 # Just in case...
  1931.