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

  1. Newsgroups: comp.sources.misc
  2. From: jeff@joyce.cs.su.oz.au (Jeff Kingston)
  3. Subject: v38i083:  lout - Lout document formatting system, v2.05, Part15/35
  4. Message-ID: <1993Aug10.032724.17211@sparky.sterling.com>
  5. X-Md4-Signature: 176c9313a8fc7ad923b53f03088d6898
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Tue, 10 Aug 1993 03:27:24 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 83
  13. Archive-name: lout/part15
  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:  font/TimesBolIta.AFM z12.c z13.c z18.c
  22. # Wrapped by kent@sparky on Sun Aug  8 12:29:25 1993
  23. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  24. echo If this archive is complete, you will see the following message:
  25. echo '          "shar: End of archive 15 (of 35)."'
  26. if test -f 'font/TimesBolIta.AFM' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'font/TimesBolIta.AFM'\"
  28. else
  29.   echo shar: Extracting \"'font/TimesBolIta.AFM'\" \(14435 characters\)
  30.   sed "s/^X//" >'font/TimesBolIta.AFM' <<'END_OF_FILE'
  31. XStartFontMetrics 2.0
  32. XComment Copyright (c) 1984 Adobe Systems Incorporated.  All Rights Reserved.
  33. XComment Creation Date:Wed May 27 16:42:35 PDT 1987
  34. XFontName Times-BoldItalic
  35. XEncodingScheme AdobeStandardEncoding
  36. XFullName Times Bold Italic
  37. XFamilyName Times
  38. XWeight Bold
  39. XItalicAngle -15.0
  40. XIsFixedPitch false
  41. XUnderlinePosition -98
  42. XUnderlineThickness 54
  43. XVersion 001.004
  44. XNotice Times is a registered trademark of Allied Corporation.
  45. XFontBBox -168 -232 1014 894
  46. XCapHeight 662
  47. XXHeight 458
  48. XDescender -203
  49. XAscender 682
  50. XStartCharMetrics 228
  51. XC 32 ; WX 250 ; N space ; B 0 0 0 0 ;
  52. XC 33 ; WX 389 ; N exclam ; B 66 -13 367 676 ;
  53. XC 34 ; WX 555 ; N quotedbl ; B 142 367 549 693 ;
  54. XC 35 ; WX 500 ; N numbersign ; B 4 0 496 662 ;
  55. XC 36 ; WX 500 ; N dollar ; B -20 -101 492 723 ;
  56. XC 37 ; WX 833 ; N percent ; B 39 -8 784 685 ;
  57. XC 38 ; WX 778 ; N ampersand ; B 41 -19 727 676 ;
  58. XC 39 ; WX 333 ; N quoteright ; B 80 362 282 675 ;
  59. XC 40 ; WX 333 ; N parenleft ; B 28 -179 340 676 ;
  60. XC 41 ; WX 333 ; N parenright ; B -44 -179 268 676 ;
  61. XC 42 ; WX 500 ; N asterisk ; B 56 244 445 676 ;
  62. XC 43 ; WX 570 ; N plus ; B 33 0 537 505 ;
  63. XC 44 ; WX 250 ; N comma ; B -10 -181 192 132 ;
  64. XC 45 ; WX 333 ; N hyphen ; B 33 167 299 282 ;
  65. XC 46 ; WX 250 ; N period ; B 23 -13 170 133 ;
  66. XC 47 ; WX 278 ; N slash ; B -11 -18 289 682 ;
  67. XC 48 ; WX 500 ; N zero ; B 17 -13 472 676 ;
  68. XC 49 ; WX 500 ; N one ; B 5 0 415 676 ;
  69. XC 50 ; WX 500 ; N two ; B -27 0 441 676 ;
  70. XC 51 ; WX 500 ; N three ; B -15 -13 445 676 ;
  71. XC 52 ; WX 500 ; N four ; B -15 0 498 676 ;
  72. XC 53 ; WX 500 ; N five ; B -11 -13 482 662 ;
  73. XC 54 ; WX 500 ; N six ; B 23 -13 504 676 ;
  74. XC 55 ; WX 500 ; N seven ; B 51 0 519 662 ;
  75. XC 56 ; WX 500 ; N eight ; B 3 -13 471 676 ;
  76. XC 57 ; WX 500 ; N nine ; B -12 -13 470 676 ;
  77. XC 58 ; WX 333 ; N colon ; B 52 -13 291 458 ;
  78. XC 59 ; WX 333 ; N semicolon ; B 13 -181 291 458 ;
  79. XC 60 ; WX 570 ; N less ; B 31 -14 540 524 ;
  80. XC 61 ; WX 570 ; N equal ; B 33 116 537 401 ;
  81. XC 62 ; WX 570 ; N greater ; B 31 -14 540 524 ;
  82. XC 63 ; WX 500 ; N question ; B 78 -13 465 676 ;
  83. XC 64 ; WX 832 ; N at ; B -9 -150 838 691 ;
  84. XC 65 ; WX 667 ; N A ; B -51 0 602 676 ;
  85. XC 66 ; WX 667 ; N B ; B -24 0 618 662 ;
  86. XC 67 ; WX 667 ; N C ; B 22 -18 660 677 ;
  87. XC 68 ; WX 722 ; N D ; B -31 0 693 662 ;
  88. XC 69 ; WX 667 ; N E ; B -27 0 646 662 ;
  89. XC 70 ; WX 667 ; N F ; B -20 0 646 662 ;
  90. XC 71 ; WX 722 ; N G ; B 21 -18 699 676 ;
  91. XC 72 ; WX 778 ; N H ; B -24 0 791 662 ;
  92. XC 73 ; WX 389 ; N I ; B -22 0 412 662 ;
  93. XC 74 ; WX 500 ; N J ; B -45 -98 519 662 ;
  94. XC 75 ; WX 667 ; N K ; B -31 0 685 662 ;
  95. XC 76 ; WX 611 ; N L ; B -22 0 584 662 ;
  96. XC 77 ; WX 889 ; N M ; B -29 -12 907 662 ;
  97. XC 78 ; WX 722 ; N N ; B -27 -18 740 662 ;
  98. XC 79 ; WX 722 ; N O ; B 27 -18 684 676 ;
  99. XC 80 ; WX 611 ; N P ; B -27 0 608 662 ;
  100. XC 81 ; WX 722 ; N Q ; B 27 -203 684 676 ;
  101. XC 82 ; WX 667 ; N R ; B -29 0 616 662 ;
  102. XC 83 ; WX 556 ; N S ; B 6 -18 524 676 ;
  103. XC 84 ; WX 611 ; N T ; B 39 0 632 662 ;
  104. XC 85 ; WX 722 ; N U ; B 66 -18 736 662 ;
  105. XC 86 ; WX 667 ; N V ; B 48 -18 692 662 ;
  106. XC 87 ; WX 889 ; N W ; B 48 -18 914 662 ;
  107. XC 88 ; WX 667 ; N X ; B -24 0 687 662 ;
  108. XC 89 ; WX 611 ; N Y ; B 46 0 625 662 ;
  109. XC 90 ; WX 611 ; N Z ; B -1 0 594 662 ;
  110. XC 91 ; WX 333 ; N bracketleft ; B -7 -157 388 682 ;
  111. XC 92 ; WX 278 ; N backslash ; B 1 0 465 682 ;
  112. XC 93 ; WX 333 ; N bracketright ; B -65 -157 330 682 ;
  113. XC 94 ; WX 570 ; N asciicircum ; B 34 259 536 662 ;
  114. XC 95 ; WX 500 ; N underscore ; B 0 -127 500 -89 ;
  115. XC 96 ; WX 333 ; N quoteleft ; B 117 363 319 676 ;
  116. XC 97 ; WX 500 ; N a ; B 9 -14 480 458 ;
  117. XC 98 ; WX 500 ; N b ; B 20 -13 473 682 ;
  118. XC 99 ; WX 444 ; N c ; B 25 -13 418 458 ;
  119. XC 100 ; WX 500 ; N d ; B 9 -13 541 682 ;
  120. XC 101 ; WX 444 ; N e ; B 25 -13 413 458 ;
  121. XC 102 ; WX 333 ; N f ; B -146 -203 460 682 ; L i fi ; L l fl ;
  122. XC 103 ; WX 500 ; N g ; B -27 -203 498 458 ;
  123. XC 104 ; WX 556 ; N h ; B 12 -13 518 682 ;
  124. XC 105 ; WX 278 ; N i ; B 24 -13 283 676 ;
  125. XC 106 ; WX 278 ; N j ; B -152 -203 311 676 ;
  126. XC 107 ; WX 500 ; N k ; B 10 -13 511 682 ;
  127. XC 108 ; WX 278 ; N l ; B 30 -13 311 682 ;
  128. XC 109 ; WX 778 ; N m ; B 16 -13 744 458 ;
  129. XC 110 ; WX 556 ; N n ; B 24 -13 518 458 ;
  130. XC 111 ; WX 500 ; N o ; B 27 -13 467 458 ;
  131. XC 112 ; WX 500 ; N p ; B -79 -203 481 458 ;
  132. XC 113 ; WX 500 ; N q ; B 21 -203 486 459 ;
  133. XC 114 ; WX 389 ; N r ; B 9 0 415 458 ;
  134. XC 115 ; WX 389 ; N s ; B 16 -13 364 459 ;
  135. XC 116 ; WX 278 ; N t ; B 15 -14 304 592 ;
  136. XC 117 ; WX 556 ; N u ; B 47 -13 520 458 ;
  137. XC 118 ; WX 444 ; N v ; B 50 -13 432 458 ;
  138. XC 119 ; WX 667 ; N w ; B 50 -13 642 458 ;
  139. XC 120 ; WX 500 ; N x ; B -5 -13 498 458 ;
  140. XC 121 ; WX 444 ; N y ; B -60 -203 423 458 ;
  141. XC 122 ; WX 389 ; N z ; B -24 -58 394 448 ;
  142. XC 123 ; WX 348 ; N braceleft ; B 30 -154 380 686 ;
  143. XC 124 ; WX 220 ; N bar ; B 70 0 151 682 ;
  144. XC 125 ; WX 348 ; N braceright ; B -31 -161 319 679 ;
  145. XC 126 ; WX 570 ; N asciitilde ; B 33 158 537 353 ;
  146. XC 161 ; WX 389 ; N exclamdown ; B 20 -232 320 458 ;
  147. XC 162 ; WX 500 ; N cent ; B 50 -142 443 570 ;
  148. XC 163 ; WX 500 ; N sterling ; B -32 -13 505 676 ;
  149. XC 164 ; WX 167 ; N fraction ; B -161 0 327 662 ;
  150. XC 165 ; WX 500 ; N yen ; B -15 0 565 662 ;
  151. XC 166 ; WX 500 ; N florin ; B -86 -154 530 682 ;
  152. XC 167 ; WX 500 ; N section ; B 36 -143 454 676 ;
  153. XC 168 ; WX 500 ; N currency ; B -3 110 503 612 ;
  154. XC 169 ; WX 278 ; N quotesingle ; B 126 367 295 693 ;
  155. XC 170 ; WX 500 ; N quotedblleft ; B 57 363 513 676 ;
  156. XC 171 ; WX 500 ; N guillemotleft ; B 21 33 474 416 ;
  157. XC 172 ; WX 333 ; N guilsinglleft ; B 42 33 310 416 ;
  158. XC 173 ; WX 333 ; N guilsinglright ; B 22 38 290 421 ;
  159. XC 174 ; WX 556 ; N fi ; B -157 -203 538 682 ;
  160. XC 175 ; WX 556 ; N fl ; B -149 -203 577 682 ;
  161. XC 177 ; WX 500 ; N endash ; B -11 176 511 266 ;
  162. XC 178 ; WX 500 ; N dagger ; B 90 -146 489 676 ;
  163. XC 179 ; WX 500 ; N daggerdbl ; B 11 -143 487 675 ;
  164. XC 180 ; WX 250 ; N periodcentered ; B 51 179 200 328 ;
  165. XC 182 ; WX 500 ; N paragraph ; B 61 -189 592 682 ;
  166. XC 183 ; WX 350 ; N bullet ; B 50 175 300 425 ;
  167. XC 184 ; WX 333 ; N quotesinglbase ; B 66 -181 268 132 ;
  168. XC 185 ; WX 500 ; N quotedblbase ; B -57 -181 398 132 ;
  169. XC 186 ; WX 500 ; N quotedblright ; B 56 362 509 675 ;
  170. XC 187 ; WX 500 ; N guillemotright ; B 20 38 473 421 ;
  171. XC 188 ; WX 1000 ; N ellipsis ; B 93 -13 906 133 ;
  172. XC 189 ; WX 1000 ; N perthousand ; B 7 -49 985 699 ;
  173. XC 191 ; WX 500 ; N questiondown ; B 30 -203 417 487 ;
  174. XC 193 ; WX 333 ; N grave ; B 115 511 325 690 ;
  175. XC 194 ; WX 333 ; N acute ; B 168 511 405 690 ;
  176. XC 195 ; WX 333 ; N circumflex ; B 70 510 394 682 ;
  177. XC 196 ; WX 333 ; N tilde ; B 69 530 424 648 ;
  178. XC 197 ; WX 333 ; N macron ; B 81 547 420 616 ;
  179. XC 198 ; WX 333 ; N breve ; B 98 511 413 671 ;
  180. XC 199 ; WX 333 ; N dotaccent ; B 180 519 308 648 ;
  181. XC 200 ; WX 333 ; N dieresis ; B 85 519 424 648 ;
  182. XC 202 ; WX 333 ; N ring ; B 141 466 352 676 ;
  183. XC 203 ; WX 333 ; N cedilla ; B 32 -216 264 5 ;
  184. XC 205 ; WX 333 ; N hungarumlaut ; B 28 538 339 750 ;
  185. XC 206 ; WX 333 ; N ogonek ; B -36 -173 193 44 ;
  186. XC 207 ; WX 333 ; N caron ; B 109 511 437 683 ;
  187. XC 208 ; WX 1000 ; N emdash ; B -14 176 1014 266 ;
  188. XC 225 ; WX 944 ; N AE ; B -41 0 931 662 ;
  189. XC 227 ; WX 266 ; N ordfeminine ; B -24 286 291 676 ;
  190. XC 232 ; WX 611 ; N Lslash ; B -22 0 584 662 ;
  191. XC 233 ; WX 722 ; N Oslash ; B 27 -124 684 754 ;
  192. XC 234 ; WX 944 ; N OE ; B 23 -8 936 670 ;
  193. XC 235 ; WX 300 ; N ordmasculine ; B 1 286 300 676 ;
  194. XC 241 ; WX 722 ; N ae ; B 15 -13 685 458 ;
  195. XC 245 ; WX 278 ; N dotlessi ; B 27 -13 260 458 ;
  196. XC 248 ; WX 278 ; N lslash ; B 12 -13 326 682 ;
  197. XC 249 ; WX 500 ; N oslash ; B 27 -118 467 556 ;
  198. XC 250 ; WX 722 ; N oe ; B 26 -13 687 458 ;
  199. XC 251 ; WX 500 ; N germandbls ; B -168 -203 497 682 ;
  200. XC -1 ; WX 667 ; N Aacute ; B -51 0 602 894 ;
  201. XC -1 ; WX 667 ; N Acircumflex ; B -51 0 602 886 ;
  202. XC -1 ; WX 667 ; N Adieresis ; B -51 0 602 852 ;
  203. XC -1 ; WX 667 ; N Agrave ; B -51 0 602 894 ;
  204. XC -1 ; WX 667 ; N Aring ; B -51 0 602 880 ;
  205. XC -1 ; WX 667 ; N Atilde ; B -51 0 602 852 ;
  206. XC -1 ; WX 667 ; N Ccedilla ; B 22 -216 660 677 ;
  207. XC -1 ; WX 667 ; N Eacute ; B -27 0 646 894 ;
  208. XC -1 ; WX 667 ; N Ecircumflex ; B -27 0 646 886 ;
  209. XC -1 ; WX 667 ; N Edieresis ; B -27 0 646 852 ;
  210. XC -1 ; WX 667 ; N Egrave ; B -27 0 646 894 ;
  211. XC -1 ; WX 722 ; N Eth ; B -31 0 693 662 ;
  212. XC -1 ; WX 389 ; N Iacute ; B -22 0 433 894 ;
  213. XC -1 ; WX 389 ; N Icircumflex ; B -22 0 422 886 ;
  214. XC -1 ; WX 389 ; N Idieresis ; B -22 0 452 852 ;
  215. XC -1 ; WX 389 ; N Igrave ; B -22 0 412 894 ;
  216. XC -1 ; WX 722 ; N Ntilde ; B -27 -18 740 852 ;
  217. XC -1 ; WX 722 ; N Oacute ; B 27 -18 684 894 ;
  218. XC -1 ; WX 722 ; N Ocircumflex ; B 27 -18 684 886 ;
  219. XC -1 ; WX 722 ; N Odieresis ; B 27 -18 684 852 ;
  220. XC -1 ; WX 722 ; N Ograve ; B 27 -18 684 894 ;
  221. XC -1 ; WX 722 ; N Otilde ; B 27 -18 684 852 ;
  222. XC -1 ; WX 556 ; N Scaron ; B 6 -18 549 887 ;
  223. XC -1 ; WX 611 ; N Thorn ; B -27 0 572 662 ;
  224. XC -1 ; WX 722 ; N Uacute ; B 66 -18 736 894 ;
  225. XC -1 ; WX 722 ; N Ucircumflex ; B 66 -18 736 886 ;
  226. XC -1 ; WX 722 ; N Udieresis ; B 66 -18 736 852 ;
  227. XC -1 ; WX 722 ; N Ugrave ; B 66 -18 736 894 ;
  228. XC -1 ; WX 611 ; N Yacute ; B 46 0 625 894 ;
  229. XC -1 ; WX 611 ; N Ydieresis ; B 46 0 625 852 ;
  230. XC -1 ; WX 611 ; N Zcaron ; B -1 0 594 887 ;
  231. XC -1 ; WX 500 ; N aacute ; B 9 -14 489 690 ;
  232. XC -1 ; WX 500 ; N acircumflex ; B 9 -14 480 682 ;
  233. XC -1 ; WX 500 ; N adieresis ; B 9 -14 508 648 ;
  234. XC -1 ; WX 500 ; N agrave ; B 9 -14 480 690 ;
  235. XC -1 ; WX 500 ; N aring ; B 9 -14 480 676 ;
  236. XC -1 ; WX 500 ; N atilde ; B 9 -14 508 648 ;
  237. XC -1 ; WX 220 ; N brokenbar ; B 70 0 151 682 ;
  238. XC -1 ; WX 444 ; N ccedilla ; B 25 -216 418 458 ;
  239. XC -1 ; WX 747 ; N copyright ; B 23 -18 723 676 ;
  240. XC -1 ; WX 400 ; N degree ; B 70 376 370 676 ;
  241. XC -1 ; WX 570 ; N divide ; B 33 0 537 505 ;
  242. XC -1 ; WX 444 ; N eacute ; B 25 -13 461 690 ;
  243. XC -1 ; WX 444 ; N ecircumflex ; B 25 -13 450 682 ;
  244. XC -1 ; WX 444 ; N edieresis ; B 25 -13 480 648 ;
  245. XC -1 ; WX 444 ; N egrave ; B 25 -13 413 690 ;
  246. XC -1 ; WX 500 ; N eth ; B 27 -13 498 682 ;
  247. XC -1 ; WX 278 ; N iacute ; B 27 -13 378 690 ;
  248. XC -1 ; WX 278 ; N icircumflex ; B 27 -13 367 682 ;
  249. XC -1 ; WX 278 ; N idieresis ; B 27 -13 397 648 ;
  250. XC -1 ; WX 278 ; N igrave ; B 27 -13 298 690 ;
  251. XC -1 ; WX 606 ; N logicalnot ; B 51 120 555 401 ;
  252. XC -1 ; WX 606 ; N minus ; B 51 210 555 300 ;
  253. XC -1 ; WX 576 ; N mu ; B -62 -210 522 458 ;
  254. XC -1 ; WX 570 ; N multiply ; B 33 0 537 504 ;
  255. XC -1 ; WX 556 ; N ntilde ; B 24 -13 536 648 ;
  256. XC -1 ; WX 500 ; N oacute ; B 27 -13 489 690 ;
  257. XC -1 ; WX 500 ; N ocircumflex ; B 27 -13 478 682 ;
  258. XC -1 ; WX 500 ; N odieresis ; B 27 -13 508 648 ;
  259. XC -1 ; WX 500 ; N ograve ; B 27 -13 467 690 ;
  260. XC -1 ; WX 750 ; N onehalf ; B 30 0 720 676 ;
  261. XC -1 ; WX 750 ; N onequarter ; B 30 0 720 676 ;
  262. XC -1 ; WX 300 ; N onesuperior ; B 17 270 283 676 ;
  263. XC -1 ; WX 500 ; N otilde ; B 27 -13 508 648 ;
  264. XC -1 ; WX 570 ; N plusminus ; B 33 0 537 665 ;
  265. XC -1 ; WX 747 ; N registered ; B 23 -18 723 676 ;
  266. XC -1 ; WX 389 ; N scaron ; B 16 -13 465 683 ;
  267. XC -1 ; WX 500 ; N thorn ; B -79 -203 474 682 ;
  268. XC -1 ; WX 750 ; N threequarters ; B 30 0 720 676 ;
  269. XC -1 ; WX 300 ; N threesuperior ; B 0 263 299 676 ;
  270. XC -1 ; WX 1000 ; N trademark ; B 40 272 980 676 ;
  271. XC -1 ; WX 300 ; N twosuperior ; B -2 270 302 676 ;
  272. XC -1 ; WX 556 ; N uacute ; B 47 -13 520 690 ;
  273. XC -1 ; WX 556 ; N ucircumflex ; B 47 -13 520 682 ;
  274. XC -1 ; WX 556 ; N udieresis ; B 47 -13 536 648 ;
  275. XC -1 ; WX 556 ; N ugrave ; B 47 -13 520 690 ;
  276. XC -1 ; WX 444 ; N yacute ; B -60 -203 461 690 ;
  277. XC -1 ; WX 444 ; N ydieresis ; B -60 -203 480 648 ;
  278. XC -1 ; WX 389 ; N zcaron ; B -24 -58 465 683 ;
  279. XEndCharMetrics
  280. XStartKernData
  281. XStartKernPairs 108
  282. X
  283. XKPX A y -74
  284. XKPX A w -74
  285. XKPX A v -74
  286. XKPX A space -55
  287. XKPX A quoteright -74
  288. XKPX A Y -55
  289. XKPX A W -92
  290. XKPX A V -74
  291. XKPX A T -55
  292. X
  293. XKPX F space -18
  294. XKPX F period -129
  295. XKPX F comma -129
  296. XKPX F A -92
  297. X
  298. XKPX L y -37
  299. XKPX L space -37
  300. XKPX L quoteright -55
  301. XKPX L Y -37
  302. XKPX L W -37
  303. XKPX L V -37
  304. XKPX L T -18
  305. X
  306. XKPX P space -37
  307. XKPX P period -129
  308. XKPX P comma -129
  309. XKPX P A -74
  310. X
  311. XKPX R y -18
  312. XKPX R Y -18
  313. XKPX R W -18
  314. XKPX R V -18
  315. X
  316. XKPX T y -37
  317. XKPX T w -37
  318. XKPX T u -37
  319. XKPX T semicolon -74
  320. XKPX T s -92
  321. XKPX T r -37
  322. XKPX T period -92
  323. XKPX T o -92
  324. XKPX T i -37
  325. XKPX T hyphen -92
  326. XKPX T e -92
  327. XKPX T comma -92
  328. XKPX T colon -74
  329. XKPX T c -92
  330. XKPX T a -92
  331. XKPX T O -18
  332. XKPX T A -55
  333. X
  334. XKPX V y -74
  335. XKPX V u -55
  336. XKPX V space -18
  337. XKPX V semicolon -74
  338. XKPX V r -55
  339. XKPX V period -129
  340. XKPX V o -111
  341. XKPX V i -55
  342. XKPX V hyphen -55
  343. XKPX V e -111
  344. XKPX V comma -129
  345. XKPX V colon -74
  346. XKPX V a -111
  347. XKPX V A -74
  348. X
  349. XKPX W y -55
  350. XKPX W u -55
  351. XKPX W space -18
  352. XKPX W semicolon -55
  353. XKPX W r -74
  354. XKPX W period -74
  355. XKPX W o -74
  356. XKPX W i -37
  357. XKPX W hyphen -37
  358. XKPX W e -74
  359. XKPX W comma -74
  360. XKPX W colon -55
  361. XKPX W a -74
  362. XKPX W A -74
  363. X
  364. XKPX Y v -92
  365. XKPX Y u -92
  366. XKPX Y space -37
  367. XKPX Y semicolon -92
  368. XKPX Y q -111
  369. XKPX Y period -74
  370. XKPX Y p -74
  371. XKPX Y o -111
  372. XKPX Y i -55
  373. XKPX Y hyphen -92
  374. XKPX Y e -111
  375. XKPX Y comma -92
  376. XKPX Y colon -92
  377. XKPX Y a -92
  378. XKPX Y A -74
  379. X
  380. XKPX f quoteright 55
  381. XKPX f f -18
  382. X
  383. XKPX one one -55
  384. X
  385. XKPX quoteleft quoteleft -74
  386. X
  387. XKPX quoteright t -37
  388. XKPX quoteright space -74
  389. XKPX quoteright s -74
  390. XKPX quoteright quoteright -74
  391. X
  392. XKPX r quoteright 37
  393. XKPX r period -55
  394. XKPX r comma -55
  395. X
  396. XKPX space Y -18
  397. XKPX space W -18
  398. XKPX space A -37
  399. X
  400. XKPX v period -37
  401. XKPX v comma -37
  402. X
  403. XKPX w period -37
  404. XKPX w comma -37
  405. X
  406. XKPX y period -37
  407. XKPX y comma -37
  408. XEndKernPairs
  409. XEndKernData
  410. XStartComposites 58
  411. XCC Zcaron 2 ; PCC Z 0 0 ; PCC caron 139 204 ;
  412. XCC zcaron 2 ; PCC z 0 0 ; PCC caron 28 0 ;
  413. XCC Scaron 2 ; PCC S 0 0 ; PCC caron 111 204 ;
  414. XCC scaron 2 ; PCC s 0 0 ; PCC caron 28 0 ;
  415. XCC Ccedilla 2 ; PCC C 0 0 ; PCC cedilla 167 0 ;
  416. XCC ccedilla 2 ; PCC c 0 0 ; PCC cedilla 55 0 ;
  417. XCC Yacute 2 ; PCC Y 0 0 ; PCC acute 139 204 ;
  418. XCC yacute 2 ; PCC y 0 0 ; PCC acute 55 0 ;
  419. XCC Ydieresis 2 ; PCC Y 0 0 ; PCC dieresis 139 204 ;
  420. XCC ydieresis 2 ; PCC y 0 0 ; PCC dieresis 55 0 ;
  421. XCC Uacute 2 ; PCC U 0 0 ; PCC acute 194 204 ;
  422. XCC Ucircumflex 2 ; PCC U 0 0 ; PCC circumflex 194 204 ;
  423. XCC Udieresis 2 ; PCC U 0 0 ; PCC dieresis 194 204 ;
  424. XCC Ugrave 2 ; PCC U 0 0 ; PCC grave 194 204 ;
  425. XCC uacute 2 ; PCC u 0 0 ; PCC acute 111 0 ;
  426. XCC ucircumflex 2 ; PCC u 0 0 ; PCC circumflex 111 0 ;
  427. XCC udieresis 2 ; PCC u 0 0 ; PCC dieresis 111 0 ;
  428. XCC ugrave 2 ; PCC u 0 0 ; PCC grave 111 0 ;
  429. XCC Iacute 2 ; PCC I 0 0 ; PCC acute 28 204 ;
  430. XCC Icircumflex 2 ; PCC I 0 0 ; PCC circumflex 28 204 ;
  431. XCC Idieresis 2 ; PCC I 0 0 ; PCC dieresis 28 204 ;
  432. XCC Igrave 2 ; PCC I 0 0 ; PCC grave 28 204 ;
  433. XCC iacute 2 ; PCC dotlessi 0 0 ; PCC acute -27 0 ;
  434. XCC icircumflex 2 ; PCC dotlessi 0 0 ; PCC circumflex -27 0 ;
  435. XCC idieresis 2 ; PCC dotlessi 0 0 ; PCC dieresis -27 0 ;
  436. XCC igrave 2 ; PCC dotlessi 0 0 ; PCC grave -27 0 ;
  437. XCC Eacute 2 ; PCC E 0 0 ; PCC acute 167 204 ;
  438. XCC Ecircumflex 2 ; PCC E 0 0 ; PCC circumflex 167 204 ;
  439. XCC Edieresis 2 ; PCC E 0 0 ; PCC dieresis 167 204 ;
  440. XCC Egrave 2 ; PCC E 0 0 ; PCC grave 167 204 ;
  441. XCC eacute 2 ; PCC e 0 0 ; PCC acute 55 0 ;
  442. XCC ecircumflex 2 ; PCC e 0 0 ; PCC circumflex 55 0 ;
  443. XCC edieresis 2 ; PCC e 0 0 ; PCC dieresis 55 0 ;
  444. XCC eg
  445. END_OF_FILE
  446.   echo shar: appended 1 NEWLINEs to \"'font/TimesBolIta.AFM'\"
  447.   if test 14436 -ne `wc -c <'font/TimesBolIta.AFM'`; then
  448.     echo shar: \"'font/TimesBolIta.AFM'\" unpacked with wrong size!
  449.   fi
  450.   # end of 'font/TimesBolIta.AFM'
  451. fi
  452. if test -f 'z12.c' -a "${1}" != "-c" ; then 
  453.   echo shar: Will not clobber existing file \"'z12.c'\"
  454. else
  455.   echo shar: Extracting \"'z12.c'\" \(18580 characters\)
  456.   sed "s/^X//" >'z12.c' <<'END_OF_FILE'
  457. X/*@z12.c:Size Finder:MinSize()@***********************************************/
  458. X/*                                                                           */
  459. X/*  LOUT: A HIGH-LEVEL LANGUAGE FOR DOCUMENT FORMATTING (VERSION 2.05)       */
  460. X/*  COPYRIGHT (C) 1993 Jeffrey H. Kingston                                   */
  461. X/*                                                                           */
  462. X/*  Jeffrey H. Kingston (jeff@cs.su.oz.au)                                   */
  463. X/*  Basser Department of Computer Science                                    */
  464. X/*  The University of Sydney 2006                                            */
  465. X/*  AUSTRALIA                                                                */
  466. X/*                                                                           */
  467. X/*  This program is free software; you can redistribute it and/or modify     */
  468. X/*  it under the terms of the GNU General Public License as published by     */
  469. X/*  the Free Software Foundation; either version 1, or (at your option)      */
  470. X/*  any later version.                                                       */
  471. X/*                                                                           */
  472. X/*  This program is distributed in the hope that it will be useful,          */
  473. X/*  but WITHOUT ANY WARRANTY; without even the implied warranty of           */
  474. X/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            */
  475. X/*  GNU General Public License for more details.                             */
  476. X/*                                                                           */
  477. X/*  You should have received a copy of the GNU General Public License        */
  478. X/*  along with this program; if not, write to the Free Software              */
  479. X/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
  480. X/*                                                                           */
  481. X/*  FILE:         z12.c                                                      */
  482. X/*  MODULE:       Size Finder                                                */
  483. X/*  EXTERNS:      MinSize()                                                  */
  484. X/*                                                                           */
  485. X/*****************************************************************************/
  486. X#include "externs"
  487. X#define IG_LOOKING    0
  488. X#define IG_NOFILE    1
  489. X#define IG_BADFILE    2
  490. X#define IG_BADSIZE    3
  491. X#define    IG_OK        4
  492. X
  493. X
  494. X/*****************************************************************************/
  495. X/*                                                                           */
  496. X/*  OBJECT MinSize(x, dim, extras)                                           */
  497. X/*                                                                           */
  498. X/*  Set fwd(x, dim) and back(x, dim) to their minimum possible values.       */
  499. X/*  If dim == ROW, construct an extras list and return it in *extras.        */
  500. X/*                                                                           */
  501. X/*****************************************************************************/
  502. X
  503. XOBJECT MinSize(x, dim, extras)
  504. XOBJECT x;  int dim;  OBJECT *extras;
  505. X{ OBJECT y, z, link, prev, t, g, full_name;
  506. X  int b, f, dble_fwd, llx, lly, urx, ury, status;
  507. X  float fllx, flly, furx, fury;
  508. X  BOOLEAN dble_found, found, will_expand, first_line;
  509. X  FILE *fp;  FULL_CHAR buff[MAX_LINE];
  510. X
  511. X  debug2(DSF, DD, "[ MinSize( %s, %s, extras )", EchoObject(x), dimen(dim));
  512. X  ifdebug(DSF, DDD, DebugObject(x));
  513. X
  514. X  switch( type(x) )
  515. X  {
  516. X
  517. X    case WORD:
  518. X    case QWORD:
  519. X    
  520. X      if( dim == COL )  FontWordSize(x);
  521. X      break;
  522. X
  523. X
  524. X    case CROSS:
  525. X
  526. X      /* add index to the cross-ref */
  527. X      if( dim == ROW )
  528. X      {    z = New(cross_type(x));
  529. X    actual(z) = x;
  530. X    Link(*extras, z);
  531. X    debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  532. X      }
  533. X      back(x, dim) = fwd(x, dim) = 0;
  534. X      break;
  535. X
  536. X
  537. X    case NULL_CLOS:
  538. X    
  539. X      back(x, dim) = fwd(x, dim) = 0;
  540. X      break;
  541. X
  542. X
  543. X    case HEAD:
  544. X
  545. X      if( dim == ROW )
  546. X      {    
  547. X    /* replace the galley x by a dummy closure y */
  548. X    y = New(NULL_CLOS);
  549. X    FposCopy(fpos(y), fpos(x));
  550. X    ReplaceNode(y, x);
  551. X
  552. X    if( has_key(actual(x)) )
  553. X    {
  554. X      /* galley is sorted, make insinuated cross-reference */
  555. X      z = backward(x) ? New(GALL_PREC) : New(GALL_FOLL);
  556. X      Child(t, Down(x));
  557. X      actual(z) = CrossMake(whereto(x), t, (int) type(z));
  558. X      Link(*extras, z);
  559. X      DisposeObject(x);
  560. X      debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  561. X    }
  562. X    else
  563. X    {
  564. X      /* galley is following, make UNATTACHED */
  565. X      z = New(UNATTACHED);  Link(z, x);
  566. X      Link(*extras, z);
  567. X      debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  568. X    }
  569. X    x = y;    /* now sizing y, not x */
  570. X      }
  571. X      else external(x) = FALSE;
  572. X      back(x, dim) = fwd(x, dim) = 0;
  573. X      break;
  574. X
  575. X
  576. X    case CLOSURE:
  577. X
  578. X      assert( !has_target(actual(x)), "MinSize: CLOSURE has target!" );
  579. X      if( dim == ROW )
  580. X      { if( indefinite(actual(x)) )
  581. X    { z = New(RECEPTIVE);
  582. X      actual(z) = x;
  583. X      Link(*extras, z);
  584. X      debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  585. X    }
  586. X    else if( recursive(actual(x)) )
  587. X    { z = New(RECURSIVE);
  588. X      actual(z) = x;
  589. X      Link(*extras, z);
  590. X      debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  591. X    }
  592. X    else Error(INTERN,&fpos(x), "MinSize: definite non-recursive CLOSURE!");
  593. X      }
  594. X      else external(x) = FALSE;        /*  nb must be done just here! */
  595. X      back(x, dim) = fwd(x, dim) = 0;
  596. X      break;
  597. X
  598. X
  599. X    case ONE_COL:
  600. X    case ONE_ROW:
  601. X    case PADJUST:
  602. X    case HADJUST:
  603. X    case VADJUST:
  604. X    case HCONTRACT:
  605. X    case VCONTRACT:
  606. X    
  607. X      Child(y, Down(x));
  608. X      y = MinSize(y, dim, extras);
  609. X      back(x, dim) = back(y, dim);
  610. X      fwd(x, dim)  = fwd(y, dim);
  611. X      break;
  612. X
  613. X
  614. X    case HEXPAND:
  615. X    case VEXPAND:
  616. X
  617. X      Child(y, Down(x));
  618. X      y = MinSize(y, dim, extras);
  619. X      back(x, dim) = back(y, dim);
  620. X      fwd(x, dim)  = fwd(y, dim);
  621. X
  622. X      /* insert index into *extras for expanding later */
  623. X      if( dim == ROW )
  624. X      {    z = New(EXPAND_IND);
  625. X    actual(z) = x;
  626. X    Link(*extras, z);
  627. X    debug1(DCR, DDD, "  MinSize: %s", EchoObject(z));
  628. X      }    
  629. X      break;
  630. X
  631. X
  632. X    case GRAPHIC:
  633. X    
  634. X      Child(y, LastDown(x));
  635. X      y = MinSize(y, dim, extras);
  636. X      back(x, dim) = back(y, dim);
  637. X      fwd(x, dim)  = fwd(y, dim);
  638. X      break;
  639. X
  640. X
  641. X    case HSCALE:
  642. X    case VSCALE:
  643. X
  644. X      /* work out size and set to 0 if parallel */
  645. X      Child(y, Down(x));
  646. X      y = MinSize(y, dim, extras);
  647. X      if( (dim == COL) == (type(x) == HSCALE) )
  648. X    back(x, dim) = fwd(x, dim) = 0;
  649. X      else
  650. X      {    back(x, dim) = back(y, dim);
  651. X    fwd(x, dim)  = fwd(y, dim);
  652. X      }
  653. X      break;
  654. X
  655. X
  656. X    case ROTATE:
  657. X    
  658. X      Child(y, Down(x));
  659. X      if( dim == COL )
  660. X      {    y = MinSize(y, COL, extras);
  661. X    whereto(x) = New(ACAT);
  662. X    y = MinSize(y, ROW, &whereto(x));
  663. X    RotateSize(&back(x, COL), &fwd(x, COL), &back(x, ROW), &fwd(x, ROW),
  664. X      y, sparec(constraint(x)));
  665. X      }
  666. X      else
  667. X      {    TransferLinks(Down(whereto(x)), whereto(x), *extras);
  668. X    Dispose(whereto(x));
  669. X      }
  670. X      break;
  671. X    
  672. X
  673. X    case SCALE:
  674. X
  675. X      Child(y, Down(x));
  676. X      y = MinSize(y, dim, extras);
  677. X      if( dim == COL )
  678. X      { back(x, dim) = (back(y, dim) * bc(constraint(x))) / SF;
  679. X        fwd(x, dim)  = (fwd(y, dim)  * bc(constraint(x))) / SF;
  680. X      }
  681. X      else
  682. X      { back(x, dim) = (back(y, dim) * fc(constraint(x))) / SF;
  683. X        fwd(x, dim)  = (fwd(y, dim)  * fc(constraint(x))) / SF;
  684. X      }
  685. X      break;
  686. X
  687. X
  688. X    case WIDE:
  689. X
  690. X      Child(y, Down(x));
  691. X      y = MinSize(y, dim, extras);
  692. X      if( dim == COL )
  693. X      { y = BreakObject(y, &constraint(x));
  694. X        assert( FitsConstraint(back(y, dim), fwd(y, dim), constraint(x)),
  695. X        "MinSize: BreakObject failed to fit!" );
  696. X        back(x, dim) = back(y, dim);
  697. X    fwd(x, dim)  = fwd(y, dim);
  698. X    EnlargeToConstraint(&back(x, dim), &fwd(x, dim), &constraint(x));
  699. X      }
  700. X      else
  701. X      {    back(x, dim) = back(y, dim);
  702. X    fwd(x, dim)  = fwd(y, dim);
  703. X      }
  704. X      break;
  705. X
  706. X
  707. X    case HIGH:
  708. X    
  709. X      Child(y, Down(x));
  710. X      y = MinSize(y, dim, extras);
  711. X      if( dim == ROW )
  712. X      { if( !FitsConstraint(back(y, dim), fwd(y, dim), constraint(x)) )
  713. X        { Error(WARN, &fpos(x), "forced to enlarge %s", KW_HIGH);
  714. X      debug0(DSF, D, "offending object was:");
  715. X      ifdebug(DSF, D, DebugObject(y));
  716. X      SetConstraint(constraint(x), MAX_LEN, size(y, dim), MAX_LEN);
  717. X        }
  718. X        back(x, dim) = back(y, dim);
  719. X    fwd(x, dim)  = fwd(y, dim);
  720. X    EnlargeToConstraint(&back(x, dim), &fwd(x, dim), &constraint(x));
  721. X      }
  722. X      else
  723. X      {    back(x, dim) = back(y, dim);
  724. X    fwd(x, dim)  = fwd(y, dim);
  725. X      }
  726. X      break;
  727. X
  728. X
  729. X    case SPLIT:
  730. X    
  731. X      link = DownDim(x, dim);  Child(y, link);
  732. X      y = MinSize(y, dim, extras);
  733. X      back(x, dim) = back(y, dim);
  734. X      fwd(x, dim)  = fwd(y, dim);
  735. X      break;
  736. X
  737. X
  738. X    case ACAT:
  739. X    case HCAT:
  740. X    case VCAT:
  741. X    
  742. X      if( (dim == ROW) == (type(x) == VCAT) )
  743. X      {
  744. X    /********************************************************************/
  745. X    /*                                                                  */
  746. X    /*  Calculate sizes parallel to join direction; loop invariant is:  */
  747. X    /*                                                                  */
  748. X    /*     If prev == nil, there are no definite children equal to or   */
  749. X    /*        to the left of Child(link).                               */
  750. X    /*     If prev != nil, prev is the rightmost definite child to the  */
  751. X    /*        left of Child(link), and (b, f) is the total size up to   */
  752. X    /*        the mark of prev i.e. not including fwd(prev).            */
  753. X    /*     g is the most recent gap, or nil if none found yet.          */
  754. X    /*     will_expand == TRUE when a gap is found that is likely to    */
  755. X    /*        enlarge when ActualGap is called later on.                */
  756. X    /*                                                                  */
  757. X    /********************************************************************/
  758. X
  759. X    prev = g = nil;  will_expand = FALSE;  must_expand(x) = FALSE;
  760. X    for( link = Down(x);  link != x;  link = NextDown(link) )
  761. X    { Child(y, link);
  762. X      if( is_index(type(y)) )
  763. X      { if( dim == ROW )
  764. X        { link = PrevDown(link);
  765. X          MoveLink(NextDown(link), *extras, PARENT);
  766. X        }
  767. X        continue;
  768. X      }
  769. X      else if( type(y) == type(x) )
  770. X      { link = PrevDown(link);
  771. X        TransferLinks(Down(y), y, NextDown(link));
  772. X        DisposeChild(Up(y));
  773. X        continue;
  774. X      }
  775. X      else if( type(y) == GAP_OBJ )  g = y;
  776. X      else /* calculate size of y and accumulate it */
  777. X      { if( is_word(type(y)) )
  778. X        { if( dim == COL )
  779. X          {    FontWordSize(y);
  780. X        debug4(DSF, DD, "FontWordSize( %s ) font %d = %s,%s",
  781. X        EchoObject(y), word_font(y),
  782. X        EchoLength(back(y, COL)), EchoLength(fwd(y, COL)));
  783. X          }
  784. X        }
  785. X        else y = MinSize(y, dim, extras);
  786. X
  787. X        if( is_indefinite(type(y)) )
  788. X        {
  789. X          /* error if preceding gap has mark */
  790. X          if( g != nil && mark(gap(g)) )
  791. X          {    Error(WARN, &fpos(y), "catenation modifier ^ deleted (%s)",
  792. X            "it may not precede this object");
  793. X        mark(gap(g)) = FALSE;
  794. X          }
  795. X
  796. X          /* error if next unit is used in preceding gap */
  797. X          if( g != nil && units(gap(g)) == NEXT_UNIT )
  798. X          {    Error(WARN, &fpos(y), "gap replaced by 0i (%s)",
  799. X            "unit n may not precede this object");
  800. X        units(gap(g)) = FIXED_UNIT;
  801. X        width(gap(g)) = 0;
  802. X          }
  803. X        }
  804. X        else
  805. X        {
  806. X          /* calculate running total length */
  807. X          if( prev == nil )  b = back(y, dim), f = 0;
  808. X          else
  809. X          {
  810. X        assert( g!=nil && mode(gap(g))!=NO_MODE, "MinSize: NO_MODE!" );
  811. X        f += MinGap(fwd(prev, dim), back(y, dim), fwd(y, dim), &gap(g));
  812. X        if( units(gap(g)) == FRAME_UNIT && width(gap(g)) > FR )
  813. X            will_expand = TRUE;
  814. X        if( mark(gap(g)) )  b += f, f = 0;
  815. X          }
  816. X          prev = y;
  817. X        }
  818. X        debug2(DSF,DD,"  b = %s, f = %s",EchoLength(b),EchoLength(f));
  819. X      }
  820. X    } /* end for */
  821. X
  822. X    if( prev == nil )  b = f = 0;
  823. X    else f += fwd(prev, dim);
  824. X    back(x, dim) = min(MAX_LEN, b);
  825. X    fwd(x, dim)  = min(MAX_LEN, f);
  826. X
  827. X    if( type(x) == ACAT && will_expand )  fwd(x, COL) = MAX_LEN;
  828. X      }
  829. X      else
  830. X      {
  831. X    /********************************************************************/
  832. X    /*                                                                  */
  833. X    /*  Calculate sizes perpendicular to join direction                 */
  834. X    /*                                                                  */
  835. X    /*  Loop invariant:                                                 */
  836. X    /*                                                                  */
  837. X    /*     if found, (b, f) is the size of x, from the last // or from  */
  838. X    /*     the start, up to link exclusive.  Else no children yet.      */
  839. X    /*     If dble_found, a previous // exists, and (0, dble_fwd) is    */
  840. X    /*     the size of x from the start up to that //.                  */
  841. X    /*                                                                  */
  842. X    /********************************************************************/
  843. X
  844. X    dble_found = found = FALSE;  dble_fwd = 0;
  845. X    for( link = Down(x);  link != x;  link = NextDown(link) )
  846. X    { Child(y, link);
  847. X      if( is_index(type(y)) )
  848. X      { if( dim == ROW )
  849. X        { link = PrevDown(link);
  850. X          MoveLink(NextDown(link), *extras, PARENT);
  851. X        }
  852. X        continue;
  853. X      }
  854. X      else if( type(y) == type(x) )
  855. X      { link = PrevDown(link);
  856. X        TransferLinks(Down(y), y, NextDown(link));
  857. X        DisposeChild(Up(y));
  858. X        continue;
  859. X      }
  860. X      else if( type(y) == GAP_OBJ )
  861. X      { assert( found, "MinSize/VCAT/perp: !found!" );
  862. X        if( !join(gap(y)) )
  863. X        {
  864. X          /* found // or || operator, so end current group */
  865. X          dble_found = TRUE;
  866. X          dble_fwd = max(dble_fwd, b + f);
  867. X          debug1(DSF, DD, "  endgroup, dble_fwd: %s", EchoLength(dble_fwd));
  868. X          found = FALSE;
  869. X        }
  870. X      }
  871. X      else /* found object */
  872. X      {
  873. X        /* calculate size of subobject y */
  874. X        if( is_word(type(y)) )
  875. X        { if( dim == COL )  FontWordSize(y);
  876. X        }
  877. X        else y = MinSize(y, dim, extras);
  878. X        if( found )
  879. X        { b = max(b, back(y, dim));
  880. X          f = max(f, fwd(y, dim));
  881. X        }
  882. X        else
  883. X        { b = back(y, dim);
  884. X          f = fwd(y, dim);
  885. X          found = TRUE;
  886. X        }
  887. X        debug2(DSF,DD, "  b: %s, f: %s", EchoLength(b), EchoLength(f));
  888. X      }
  889. X    } /* end for */
  890. X    assert( found, "MinSize/VCAT/perp: !found (2)!" );
  891. X
  892. X    /* finish off last group */
  893. X    if( dble_found )
  894. X    { back(x, dim) = 0;
  895. X      dble_fwd = max(dble_fwd, b + f);
  896. X      fwd(x, dim) = min(MAX_LEN, dble_fwd);
  897. X      debug1(DSF, DD, "  end group, dble_fwd: %s", EchoLength(dble_fwd));
  898. X    }
  899. X    else
  900. X    { back(x, dim) = b;
  901. X      fwd(x, dim)  = f;
  902. X    }
  903. X      } /* end else */
  904. X      break;
  905. X
  906. X
  907. X    case COL_THR:
  908. X    case ROW_THR:
  909. X
  910. X      assert( (type(x) == COL_THR) == (dim == COL), "Manifest/COL_THR: dim!" );
  911. X      if( thr_state(x) == NOTSIZED )
  912. X      {    assert( Down(x) != x, "Manifest/COL_THR: Down(x)!" );
  913. X    Child(y, Down(x));
  914. X    y = MinSize(y, dim, extras);
  915. X    b = back(y, dim);
  916. X    f = fwd(y, dim);
  917. X    for( link = NextDown(Down(x));  link != x;  link = NextDown(link) )
  918. X    { Child(y, link);
  919. X      assert( type(y) != GAP_OBJ, "Manifest/COL_THR: GAP_OBJ!" );
  920. X      y = MinSize(y, dim, extras);
  921. X      b = max(b, back(y, dim));
  922. X      f = max(f, fwd(y, dim));
  923. X    }
  924. X    back(x, dim) = b;
  925. X    fwd(x, dim)  = f;
  926. X    thr_state(x) = SIZED;
  927. X      }
  928. X      break;
  929. X
  930. X
  931. X    case INCGRAPHIC:
  932. X    case SINCGRAPHIC:
  933. X
  934. X      /* open file, check for initial %!, and hunt for %%BoundingBox line */
  935. X      /* according to DSC Version 3.0, the BoundingBox parameters must be */
  936. X      /* integers; but we read them as floats and truncate since files    */
  937. X      /* with fractional values seem to be common in the real world       */
  938. X      if( dim == ROW )  break;
  939. X      status = IG_LOOKING;
  940. X      Child(y, Down(x));
  941. X      fp = OpenIncGraphicFile(string(y), type(x), &full_name, &fpos(y));
  942. X      /* *** fp = OpenFile(fnum = sparec(constraint(x)), FALSE); */
  943. X      if( fp == NULL )  status = IG_NOFILE;
  944. X      first_line = TRUE;
  945. X      while( status == IG_LOOKING && StringFGets(buff, MAX_LINE, fp) != NULL )
  946. X      {
  947. X    if( first_line && !StringBeginsWith(buff, AsciiToFull("%!")) )
  948. X      status = IG_BADFILE;
  949. X    else
  950. X    { first_line = FALSE;
  951. X      if( buff[0] == '%'
  952. X          && StringBeginsWith(buff, AsciiToFull("%%BoundingBox:"))
  953. X          && !StringContains(buff, AsciiToFull("(atend)")) )
  954. X      { if( sscanf( (char *) buff, "%%%%BoundingBox: %f %f %f %f",
  955. X        &fllx, &flly, &furx, &fury) == 4 )
  956. X        {
  957. X          status = IG_OK;
  958. X          llx = fllx;
  959. X          lly = flly;
  960. X          urx = furx;
  961. X          ury = fury;
  962. X        }
  963. X        else status = IG_BADSIZE;
  964. X      }
  965. X    }
  966. X      }
  967. X
  968. X      /* report error or calculate true size, depending on status */
  969. X      switch( status )
  970. X      {
  971. X    case IG_LOOKING:
  972. X
  973. X      Error(WARN, &fpos(x), "%s given zero size: format error in file %s%s",
  974. X        type(x) == INCGRAPHIC ? KW_INCGRAPHIC : KW_SINCGRAPHIC,
  975. X        string(full_name), " (missing %%BoundingBox: line)");
  976. X      back(y, COL) = fwd(y, COL) = back(y, ROW) = fwd(y, ROW) = 0;
  977. X      back(x, COL) = fwd(x, COL) = back(x, ROW) = fwd(x, ROW) = 0;
  978. X      sparec(constraint(x)) = TRUE;
  979. X      fclose(fp);
  980. X      break;
  981. X
  982. X    case IG_NOFILE:
  983. X
  984. X      Error(WARN, &fpos(x), "%s deleted: cannot open file %s",
  985. X        type(x) == INCGRAPHIC ? KW_INCGRAPHIC : KW_SINCGRAPHIC,
  986. X        string(full_name));
  987. X      sparec(constraint(x)) = FALSE;
  988. X      back(x, COL) = fwd(x, COL) = back(x, ROW) = fwd(x, ROW) = 0;
  989. X      break;
  990. X
  991. X    case IG_BADFILE:
  992. X
  993. X      Error(WARN, &fpos(x), "%s deleted: format error in file %s %s",
  994. X        type(x) == INCGRAPHIC ? KW_INCGRAPHIC : KW_SINCGRAPHIC,
  995. X        string(full_name), "(bad first line)");
  996. X      sparec(constraint(x)) = FALSE;
  997. X      back(x, COL) = fwd(x, COL) = back(x, ROW) = fwd(x, ROW) = 0;
  998. X      fclose(fp);
  999. X      break;
  1000. X    
  1001. X    case IG_BADSIZE:
  1002. X
  1003. X      Error(WARN, &fpos(x), "%s given zero size: format error in file %s%s",
  1004. X        type(x) == INCGRAPHIC ? KW_INCGRAPHIC : KW_SINCGRAPHIC,
  1005. X        string(full_name), " (bad %%BoundingBox: line)");
  1006. X      back(y, COL) = fwd(y, COL) = back(y, ROW) = fwd(y, ROW) = 0;
  1007. X      back(x, COL) = fwd(x, COL) = back(x, ROW) = fwd(x, ROW) = 0;
  1008. X      sparec(constraint(x)) = TRUE;
  1009. X      fclose(fp);
  1010. X      break;
  1011. X
  1012. X    case IG_OK:
  1013. X
  1014. X      Child(y, Down(x));
  1015. X      back(y, COL) = llx;  fwd(y, COL) = urx;
  1016. X      back(y, ROW) = lly;  fwd(y, ROW) = ury;
  1017. X      b = (urx - llx) * PT;
  1018. X      b = max(0, min(b, MAX_LEN));
  1019. X      back(x, COL) = fwd(x, COL) = b / 2;
  1020. X      b = (ury - lly) * PT;
  1021. X      b = max(0, min(b, MAX_LEN));
  1022. X      back(x, ROW) = fwd(x, ROW) = b / 2;
  1023. X      sparec(constraint(x)) = TRUE;
  1024. X      fclose(fp);
  1025. X      break;
  1026. X
  1027. X      }
  1028. X      DisposeObject(full_name);
  1029. X      break;
  1030. X
  1031. X
  1032. X    default:
  1033. X    
  1034. X      Error(INTERN, &fpos(x), "MinSize: type(x): %s", Image(type(x)));
  1035. X      break;
  1036. X
  1037. X
  1038. X  } /* end switch */
  1039. X  debug1(DSF, DD,  "] MinSize returning, x = %s", EchoObject(x));
  1040. X  debug3(DSF, DD, "  (%s size is %s, %s)", dimen(dim),
  1041. X        EchoLength(back(x, dim)), EchoLength(fwd(x, dim)) );
  1042. X  ifdebug(DSF, DDD, DebugObject(x));
  1043. X
  1044. X  assert( back(x, dim) >= 0, "MinSize: back(x, dim) < 0!" );
  1045. X  assert( fwd(x, dim)  >= 0, "MinSize: fwd(x, dim)  < 0!" );
  1046. X
  1047. X  return x;
  1048. X} /* end MinSize */
  1049. END_OF_FILE
  1050.   if test 18580 -ne `wc -c <'z12.c'`; then
  1051.     echo shar: \"'z12.c'\" unpacked with wrong size!
  1052.   fi
  1053.   # end of 'z12.c'
  1054. fi
  1055. if test -f 'z13.c' -a "${1}" != "-c" ; then 
  1056.   echo shar: Will not clobber existing file \"'z13.c'\"
  1057. else
  1058.   echo shar: Extracting \"'z13.c'\" \(19888 characters\)
  1059.   sed "s/^X//" >'z13.c' <<'END_OF_FILE'
  1060. X/*@z13.c:Object Breaking:BreakJoinedGroup()@**********************************/
  1061. X/*                                                                           */
  1062. X/*  LOUT: A HIGH-LEVEL LANGUAGE FOR DOCUMENT FORMATTING (VERSION 2.05)       */
  1063. X/*  COPYRIGHT (C) 1993 Jeffrey H. Kingston                                   */
  1064. X/*                                                                           */
  1065. X/*  Jeffrey H. Kingston (jeff@cs.su.oz.au)                                   */
  1066. X/*  Basser Department of Computer Science                                    */
  1067. X/*  The University of Sydney 2006                                            */
  1068. X/*  AUSTRALIA                                                                */
  1069. X/*                                                                           */
  1070. X/*  This program is free software; you can redistribute it and/or modify     */
  1071. X/*  it under the terms of the GNU General Public License as published by     */
  1072. X/*  the Free Software Foundation; either version 1, or (at your option)      */
  1073. X/*  any later version.                                                       */
  1074. X/*                                                                           */
  1075. X/*  This program is distributed in the hope that it will be useful,          */
  1076. X/*  but WITHOUT ANY WARRANTY; without even the implied warranty of           */
  1077. X/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            */
  1078. X/*  GNU General Public License for more details.                             */
  1079. X/*                                                                           */
  1080. X/*  You should have received a copy of the GNU General Public License        */
  1081. X/*  along with this program; if not, write to the Free Software              */
  1082. X/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
  1083. X/*                                                                           */
  1084. X/*  FILE:         z13.c                                                      */
  1085. X/*  MODULE:       Object Breaking                                            */
  1086. X/*  EXTERNS:      BreakObject()                                              */
  1087. X/*                                                                           */
  1088. X/*****************************************************************************/
  1089. X#include "externs"
  1090. X
  1091. X
  1092. X/*****************************************************************************/
  1093. X/*                                                                           */
  1094. X/*  static BreakJoinedGroup(start, stop, m, c, res_back, res_fwd)            */
  1095. X/*                                                                           */
  1096. X/*  Break joined group of components of a VCAT, beginning from Child(start)  */
  1097. X/*  inclusive and ending at Child(stop) inclusive.  Break component m first  */
  1098. X/*  because it is the widest.                                                */
  1099. X/*                                                                           */
  1100. X/*****************************************************************************/
  1101. X
  1102. Xstatic BreakJoinedGroup(start, stop, m, c, res_back, res_fwd)
  1103. XOBJECT start, stop, m;  CONSTRAINT *c;  LENGTH *res_back, *res_fwd;
  1104. X{ OBJECT y, link, z;  LENGTH b, f;  CONSTRAINT yc;
  1105. X  ifdebug(DOB, D, Child(y, start));
  1106. X  ifdebug(DOB, D, Child(z, stop));
  1107. X  debug3(DOB, D, "BreakJoinedGroup( -> %s, -> %s, %s, -, -)",
  1108. X    EchoObject(y), EchoObject(z), EchoConstraint(c));
  1109. X  CopyConstraint(yc, *c);
  1110. X  if( m != nil )
  1111. X  { m = BreakObject(m, &yc);
  1112. X    b = back(m, COL);
  1113. X    f = fwd(m, COL);
  1114. X    SetConstraint(yc, min(bc(yc), bfc(yc)-f), bfc(yc), min(fc(yc), bfc(yc)-b));
  1115. X  }
  1116. X  else b = f = 0;
  1117. X  for( link = start;  link != NextDown(stop);  link = NextDown(link) )
  1118. X  { Child(y, link);
  1119. X    if( !is_definite(type(y)) || y == m )  continue;
  1120. X    y = BreakObject(y, &yc);
  1121. X    b = max(b, back(y, COL));
  1122. X    f = max(f, fwd(y, COL));
  1123. X    SetConstraint(yc, min(bc(yc), bfc(yc)-f), bfc(yc), min(fc(yc), bfc(yc)-b));
  1124. X  }
  1125. X  assert( FitsConstraint(b, f, *c), "BreakJoinedGroup: result does not fit!" );
  1126. X  *res_back = b;  *res_fwd = f;
  1127. X  debug2(DOB,D,"BreakJoinedGroup returning (%s, %s)",
  1128. X    EchoLength(b), EchoLength(f));
  1129. X} /* end BreakJoinedGroup */
  1130. X
  1131. X
  1132. X/*@::BreakVcat()@*************************************************************/
  1133. X/*                                                                           */
  1134. X/*  static OBJECT BreakVcat(x, c)                                            */
  1135. X/*                                                                           */
  1136. X/*  Break a VCAT to satisfy constraint c.  This is tedious because every     */
  1137. X/*  group of components between //  ...  // must be broken separately.       */
  1138. X/*                                                                           */
  1139. X/*****************************************************************************/
  1140. X
  1141. XOBJECT BreakVcat(x, c)
  1142. XOBJECT x;  CONSTRAINT *c;
  1143. X{ OBJECT y, link, start_group, m;  LENGTH b, f; int dble_fwd;  CONSTRAINT tc;
  1144. X  BOOLEAN dble_found;
  1145. X  debug2(DOB, D, "[ BreakVcat(%s, %s)", EchoObject(x), EchoConstraint(c));
  1146. X  assert(Down(x) != x, "BreakVcat: Down(x) == x!" );
  1147. X  SetConstraint(tc, MAX_LEN, min(bfc(*c), fc(*c)), MAX_LEN);
  1148. X  
  1149. X  dble_found = FALSE;  dble_fwd = 0;  start_group = nil;
  1150. X  for( link = Down(x);  link != x;  link = NextDown(link) )
  1151. X  { Child(y, link);
  1152. X    if( is_index(type(y)) )  continue;
  1153. X    if( type(y) == GAP_OBJ )
  1154. X    { assert( start_group != nil, "BreakVcat: start_group == nil!" );
  1155. X      if( !join(gap(y)) )
  1156. X      {
  1157. X    /* finish off and break this group */
  1158. X    if( !FitsConstraint(b, f, tc) )
  1159. X      BreakJoinedGroup(start_group, link, m, &tc, &b, &f);
  1160. X    dble_found = TRUE;
  1161. X    dble_fwd = max(dble_fwd, b + f);
  1162. X    start_group = nil;
  1163. X    debug1(DOB, D, "  end group, dble_fwd: %s", EchoLength(dble_fwd));
  1164. X      }
  1165. X    }
  1166. X    else if( start_group == nil )
  1167. X    {    
  1168. X      /* start new group */
  1169. X      b = back(y, COL);  f = fwd(y, COL);
  1170. X      start_group = link;  m = y;
  1171. X      debug3(DOB, D, "  starting group: %s (%s, %s)",
  1172. X    EchoObject(y), EchoLength(b), EchoLength(f));
  1173. X    }
  1174. X    else
  1175. X    {
  1176. X      /* continue with current group */
  1177. X      b = max(b, back(y, COL));  f = max(f, fwd(y, COL));
  1178. X      if( fwd(y, COL) > fwd(m, COL) )  m = y;
  1179. X      debug4(DOB, D, "  in group: %s%s (%s, %s)", m == y ? "new max " : "",
  1180. X    EchoObject(y), EchoLength(b), EchoLength(f));
  1181. X    }
  1182. X  }
  1183. X  assert( start_group != nil, "BreakVcat: start_group == nil (2)!" );
  1184. X
  1185. X  if( dble_found )
  1186. X  {    
  1187. X    /* finish off and break this last group, and set sizes of x */
  1188. X    if( !FitsConstraint(b, f, tc) )
  1189. X      BreakJoinedGroup(start_group, LastDown(x), m, &tc, &b, &f);
  1190. X    dble_fwd = max(dble_fwd, b + f);
  1191. X    debug1(DOB, D, "  ending last group, dble_fwd: %s",EchoLength(dble_fwd));
  1192. X    back(x, COL) = 0;  fwd(x, COL) = min(MAX_LEN, dble_fwd);
  1193. X  }
  1194. X  else
  1195. X  {
  1196. X    /* finish off and break this last and only group, and set sizes of x */
  1197. X    debug2(DOB, D, "  BreakVcat ending last and only group (%s, %s)",
  1198. X    EchoLength(b), EchoLength(f));
  1199. X    BreakJoinedGroup(start_group, LastDown(x), m, c, &b, &f);
  1200. X    back(x, COL) = b;  fwd(x, COL) = f;
  1201. X  }
  1202. X
  1203. X  debug1(DOB, D, "] BreakVcat returning %s", EchoObject(x));
  1204. X  debug2(DOB, D, "  (size is %s, %s)",
  1205. X    EchoLength(back(x, COL)), EchoLength(fwd(x, COL)));
  1206. X  return x;
  1207. X} /* end BreakVcat */
  1208. X
  1209. X
  1210. X/*@::BreakTable()@************************************************************/
  1211. X/*                                                                           */
  1212. X/*  static OBJECT BreakTable(x, c)                                           */
  1213. X/*                                                                           */
  1214. X/*  Break table (HCAT) x to satisfy constraint c.                            */
  1215. X/*                                                                           */
  1216. X/*  Outline of algorithm:                                                    */
  1217. X/*                                                                           */
  1218. X/*     bcount = number of components to left of mark;                        */
  1219. X/*     fcount = no. of components on and right of mark;                      */
  1220. X/*     bwidth = what back(x) would be if all components had size (0, 0);     */
  1221. X/*     fwidth = what fwd(x) would be if all components had size (0, 0);      */
  1222. X/*     Set all components of x to Unbroken (broken(y) holds this flag);      */
  1223. X/*     while( an Unbroken component of x exists )                            */
  1224. X/*     {   my = the Unbroken component of x of minimum width;                */
  1225. X/*         mc = desirable constraint for my (see below);                     */
  1226. X/*         BreakObject(my, &mc);                                             */
  1227. X/*         Set my to Broken and update bcount, fcount, bwidth, fwidth        */
  1228. X/*            to reflect the actual size of my, now broken;                  */
  1229. X/*     }                                                                     */
  1230. X/*                                                                           */
  1231. X/*  The constraint mc is chosen in an attempt to ensure that:                */
  1232. X/*                                                                           */
  1233. X/*     a)  Any sufficiently narrow components will not break;                */
  1234. X/*     b)  All broken components will have the same bfc(mc), if possible;    */
  1235. X/*     c)  All available space is used.                                      */
  1236. X/*                                                                           */
  1237. X/*****************************************************************************/
  1238. X
  1239. Xstatic OBJECT BreakTable(x, c)
  1240. XOBJECT x;  CONSTRAINT *c;
  1241. X{ LENGTH bwidth, fwidth;    /* running back(x) and fwd(x)             */
  1242. X  int    bcount, fcount;    /* running no. of components             */
  1243. X  OBJECT mlink, my;        /* minimum-width unbroken component         */
  1244. X  BOOLEAN ratm;            /* TRUE when my has a mark to its right      */
  1245. X  int    mside;            /* side of the mark my is on: BACK, ON, FWD  */
  1246. X  LENGTH msize;            /* size of my (minimal among unbroken)         */
  1247. X  CONSTRAINT mc;        /* desirable constraint for my             */
  1248. X  OBJECT pg, prec_def;        /* preceding definite object of my           */
  1249. X  OBJECT sg, succ_def;        /* succeeding definite object of my          */
  1250. X  LENGTH pd_extra, sd_extra;    /* space availiable for free each side of my */
  1251. X  LENGTH av_colsize;        /* the size of each unbroken component       */
  1252. X                /* if they are all assigned equal width      */
  1253. X  LENGTH fwd_max, back_max;    /* maximum space available forward of or     */
  1254. X                /* back of the mark, when columns are even   */
  1255. X  LENGTH col_size;        /* the column size actually used in breaking */
  1256. X  LENGTH beffect, feffect;    /* the amount bwidth, fwidth must increase   */
  1257. X                /* when my is broken                 */
  1258. X  OBJECT link, y, prev, g;  LENGTH tmp, tmp2;
  1259. X
  1260. X  debug2(DOB, DD, "[ BreakTable( %s, %s )", EchoObject(x), EchoConstraint(c));
  1261. X
  1262. X  /* Initialise csize, bcount, fcount, bwidth, fwidth and broken(y) */
  1263. X  bcount = fcount = 0;  bwidth = fwidth = 0;  prev = nil;
  1264. X  Child(y, Down(x));
  1265. X  assert( type(y) != GAP_OBJ, "BreakTable: GAP_OBJ!" );
  1266. X  assert( !is_index(type(y)), "BreakTable: index!" );
  1267. X  broken(y) = is_indefinite(type(y));
  1268. X  if( !broken(y) )  prev = y, fcount = 1;
  1269. X
  1270. X  for( link = NextDown(Down(x));  link != x;  link = NextDown(NextDown(link)) )
  1271. X  {
  1272. X    /* find the next gap g and following child y */
  1273. X    Child(g, link);
  1274. X    assert( type(g) == GAP_OBJ, "BreakTable: GAP_OBJ!" );
  1275. X    assert( NextDown(link) != x, "BreakTable: GAP_OBJ is last!" );
  1276. X    Child(y, NextDown(link));
  1277. X
  1278. X    assert( type(y) != GAP_OBJ, "BreakTable: GAP_OBJ!" );
  1279. X    assert( !is_index(type(y)), "BreakTable: index!" );
  1280. X    broken(y) = is_indefinite(type(y));
  1281. X    if( !broken(y) )
  1282. X    { if( prev == nil )  fcount = 1;
  1283. X      else if( mark(gap(g)) )
  1284. X      {    bcount += fcount;
  1285. X    bwidth += fwidth + MinGap(0, 0, 0, &gap(g));
  1286. X    fcount  = 1;  fwidth = 0;
  1287. X      }
  1288. X      else
  1289. X      {    fwidth += MinGap(0, 0, 0, &gap(g));
  1290. X    fcount += 1;
  1291. X      }
  1292. X      prev = y;
  1293. X    }
  1294. X  }
  1295. X
  1296. X  /* if column gaps alone are too wide, kill them all */
  1297. X  if( !FitsConstraint(bwidth, fwidth, *c) )
  1298. X  { Error(WARN, &fpos(x), "object too wide: reducing column gaps to 0i");
  1299. X    for( link = Down(x);  link != x;  link = NextDown(link) )
  1300. X    { Child(g, link);
  1301. X      if( type(g) == GAP_OBJ )
  1302. X      {    SetGap(gap(g), mark(gap(g)), join(gap(g)), FIXED_UNIT, EDGE_MODE, 0);
  1303. X      }
  1304. X    }
  1305. X    bwidth = fwidth = 0;
  1306. X  }
  1307. X
  1308. X  /* break each column, from smallest to largest */
  1309. X  while( bcount + fcount > 0 && FitsConstraint(bwidth, fwidth, *c) )
  1310. X  {
  1311. X    debug2(DOB,DD, "bcount: %d;  bwidth: %s", bcount, EchoLength(bwidth));
  1312. X    debug2(DOB,DD, "fcount: %d;  fwidth: %s", fcount, EchoLength(fwidth));
  1313. X
  1314. X    /* find a minimal-width unbroken component my */
  1315. X    my = nil;  msize = size(x, COL);       /* an upper bound for size(y) */
  1316. X    for( link = Down(x);  ;  link = NextDown(link) )
  1317. X    { Child(y, link);
  1318. X      assert( type(y) != GAP_OBJ, "BreakTable: type(y) == GAP_OBJ!" );
  1319. X      if( !broken(y) && (size(y, COL) < msize || my == nil) )
  1320. X      {    msize = size(y, COL);
  1321. X    my = y;  mlink = link;
  1322. X    ratm = FALSE;
  1323. X      }
  1324. X
  1325. X      /* next gap */
  1326. X      link = NextDown(link);
  1327. X      if( link == x )  break;
  1328. X      Child(g, link);
  1329. X      assert( type(g) == GAP_OBJ, "BreakTable: type(g) != GAP_OBJ!" );
  1330. X      if( mark(gap(g)) )  ratm = TRUE;
  1331. X    }
  1332. X
  1333. X    /* find neighbouring definite objects and resulting pd_extra and sd_extra */
  1334. X    SetNeighbours(mlink, ratm, &pg, &prec_def, &sg, &succ_def, &mside);
  1335. X    debug2(DOB, DD, "my (%s): %s", Image(mside), EchoObject(my));
  1336. X    pd_extra = pg == nil ? 0 :
  1337. X      ExtraGap(broken(prec_def) ? fwd(prec_def,COL) : 0, 0, &gap(pg), BACK);
  1338. X    sd_extra = sg == nil ? 0 :
  1339. X      ExtraGap(0, broken(succ_def) ? back(succ_def,COL) : 0, &gap(sg), FWD);
  1340. X    debug2(DOB, DD, "pd_extra:   %s;  sd_extra:      %s",
  1341. X        EchoLength(pd_extra), EchoLength(sd_extra) );
  1342. X
  1343. X    /* calculate desirable constraints for my */
  1344. X    av_colsize = (bfc(*c) - bwidth - fwidth) / (bcount + fcount);
  1345. X    debug1(DOB, DD, "av_colsize = %s", EchoLength(av_colsize));
  1346. X    switch( mside )
  1347. X    {
  1348. X
  1349. X      case BACK:
  1350. X      
  1351. X    back_max = min(bc(*c), bwidth + av_colsize * bcount);
  1352. X    col_size = (back_max - bwidth) / bcount;
  1353. X    SetConstraint(mc, col_size + pd_extra, col_size + pd_extra + sd_extra,
  1354. X            col_size + sd_extra );
  1355. X    break;
  1356. X
  1357. X
  1358. X      case ON:
  1359. X      
  1360. X    fwd_max = min(fc(*c), fwidth + av_colsize * fcount);
  1361. X    col_size = (fwd_max - fwidth) / fcount;
  1362. X    SetConstraint(mc, pd_extra + back(my, COL), MAX_LEN, col_size + sd_extra);
  1363. X    break;
  1364. X
  1365. X
  1366. X      case FWD:
  1367. X      
  1368. X    fwd_max = min(fc(*c), fwidth + av_colsize * fcount);
  1369. X    col_size = (fwd_max - fwidth) / fcount;
  1370. X    SetConstraint(mc, col_size + pd_extra, col_size + pd_extra + sd_extra,
  1371. X            col_size + sd_extra );
  1372. X    break;
  1373. X
  1374. X
  1375. X      default:
  1376. X      
  1377. X    Error(INTERN, no_fpos, "BreakTable found illegal side");
  1378. X    break;
  1379. X    }
  1380. X
  1381. X    /* now break my according to these constraints, and accept it */
  1382. X    my = BreakObject(my, &mc);  broken(my) = TRUE;
  1383. X
  1384. X    /* calculate the effect of accepting my on bwidth and fwidth */
  1385. X    if( pg != nil )
  1386. X    { tmp = broken(prec_def) ? fwd(prec_def, COL) : 0;
  1387. X      beffect = MinGap(tmp, back(my, COL), fwd(my, COL), &gap(pg)) -
  1388. X            MinGap(tmp, 0,             0,            &gap(pg));
  1389. X    }
  1390. X    else beffect = back(my, COL);
  1391. X
  1392. X    if( sg != nil )
  1393. X    { tmp = broken(succ_def) ? back(succ_def, COL) : 0;
  1394. X      tmp2 = broken(succ_def) ? fwd(succ_def, COL) : 0;
  1395. X      feffect = MinGap(fwd(my, COL), tmp, tmp2, &gap(sg)) -
  1396. X            MinGap(0,            tmp, tmp2, &gap(sg));
  1397. X    }
  1398. X    else feffect = fwd(my, COL);
  1399. X
  1400. X    switch( mside )
  1401. X    {
  1402. X    case BACK:    bwidth += beffect + feffect;
  1403. X            bcount--;
  1404. X            break;
  1405. X    
  1406. X    case ON:    bwidth += beffect;  fwidth += feffect;
  1407. X            fcount--;
  1408. X            break;
  1409. X
  1410. X    case FWD:    fwidth += beffect + feffect;
  1411. X            fcount--;
  1412. X            break;
  1413. X    
  1414. X    default:    Error(INTERN, no_fpos, "BreakTable: illegal side");
  1415. X            break;
  1416. X    }
  1417. X
  1418. X  } /* end while */
  1419. X
  1420. X  back(x, COL) = bwidth;
  1421. X  fwd(x, COL) = fwidth;
  1422. X
  1423. X  debug1(DOB, DD,  "] BreakTable returning %s", EchoObject(x));
  1424. X  debug2(DOB, DD, "  (size is %s, %s)", EchoLength(bwidth),EchoLength(fwidth));
  1425. X  return x;
  1426. X} /* end BreakTable */
  1427. X
  1428. X
  1429. X/*@::BreakObject()@***********************************************************/
  1430. X/*                                                                           */
  1431. X/*  OBJECT BreakObject(x, c)                                                 */
  1432. X/*                                                                           */
  1433. X/*  Break lines of object x so that it satisfies constraint c.               */
  1434. X/*                                                                           */
  1435. X/*****************************************************************************/
  1436. X
  1437. XOBJECT BreakObject(x, c)
  1438. XOBJECT x;  CONSTRAINT *c;
  1439. X{ OBJECT y;  CONSTRAINT yc;
  1440. X  debug3(DOB, DD,  "[ BreakObject(x (%s,%s),  %s), x =",
  1441. X    EchoLength(back(x, COL)), EchoLength(fwd(x, COL)), EchoConstraint(c));
  1442. X  ifdebug(DOB, DD, DebugObject(x));
  1443. X
  1444. X  if( FitsConstraint(back(x, COL), fwd(x, COL), *c) )
  1445. X  { debug0(DOB, DD, "] BreakObject returning (fits).");
  1446. X    return x;
  1447. X  }
  1448. X  switch( type(x) )
  1449. X  {
  1450. X
  1451. X    case ROTATE:
  1452. X    
  1453. X      Error(WARN, &fpos(x), "%s deleted (too wide; cannot break %s)",
  1454. X    KW_ROTATE, KW_ROTATE);
  1455. X      y = MakeWord(WORD, STR_EMPTY, &fpos(x));
  1456. X      back(y, COL) = fwd(y, COL) = 0;
  1457. X      ReplaceNode(y, x);
  1458. X      DisposeObject(x);
  1459. X      x = y;
  1460. X      break;
  1461. X
  1462. X
  1463. X    case SCALE:
  1464. X
  1465. X      InvScaleConstraint(&yc, bc(constraint(x)), c);
  1466. X      Child(y, Down(x));
  1467. X      y = BreakObject(y, &yc);
  1468. X      back(x, COL) = (back(y, COL) * bc(constraint(x))) / SF;
  1469. X      fwd(x, COL) =  (fwd(y, COL)  * bc(constraint(x))) / SF;
  1470. X      break;
  1471. X
  1472. X
  1473. X    case WORD:
  1474. X    case QWORD:
  1475. X    
  1476. X      Error(WARN, &fpos(x), "word %s deleted (too wide)",string(x));
  1477. X      y = MakeWord(WORD, STR_EMPTY, &fpos(x));
  1478. X      back(y, COL) = fwd(y, COL) = 0;
  1479. X      ReplaceNode(y, x);
  1480. X      DisposeObject(x);
  1481. X      x = y;
  1482. X      break;
  1483. X
  1484. X
  1485. X    case WIDE:
  1486. X    
  1487. X      Error(WARN, &fpos(x), "%s %s reduced (too wide)",
  1488. X    EchoLength(bfc(constraint(x))), KW_WIDE);
  1489. X      MinConstraint(&constraint(x), c);
  1490. X      Child(y, Down(x));
  1491. X      y = BreakObject(y, &constraint(x));
  1492. X      back(x, COL) = back(y, COL);
  1493. X      fwd(x, COL) = fwd(y, COL);
  1494. X      EnlargeToConstraint(&back(x, COL), &fwd(x, COL), &constraint(x));
  1495. X      break;
  1496. X
  1497. X
  1498. X    case INCGRAPHIC:
  1499. X    case SINCGRAPHIC:
  1500. X
  1501. X      Error(WARN, &fpos(x), "%s or %s deleted (too wide)", KW_INCGRAPHIC,
  1502. X    KW_SINCGRAPHIC);
  1503. X      y = MakeWord(WORD, STR_EMPTY, &fpos(x));
  1504. X      back(y, COL) = fwd(y, COL) = 0;
  1505. X      ReplaceNode(y, x);
  1506. X      DisposeObject(x);
  1507. X      x = y;
  1508. X      break;
  1509. X
  1510. X
  1511. X    case HIGH:
  1512. X    case VSCALE:
  1513. X    case HCONTRACT: 
  1514. X    case VCONTRACT:
  1515. X    case HEXPAND: 
  1516. X    case VEXPAND:
  1517. X    case PADJUST: 
  1518. X    case HADJUST: 
  1519. X    case VADJUST:
  1520. X    case ONE_ROW:
  1521. X    case ONE_COL:
  1522. X    
  1523. X      assert( Down(x) == LastDown(x), "BreakObject: downs!" );
  1524. X      Child(y, Down(x));
  1525. X      y = BreakObject(y, c);
  1526. X      back(x, COL) = back(y, COL);
  1527. X      fwd(x, COL) = fwd(y, COL);
  1528. X      break;
  1529. X
  1530. X
  1531. X    case GRAPHIC:
  1532. X    
  1533. X      Child(y, LastDown(x));
  1534. X      y = BreakObject(y, c);
  1535. X      back(x, COL) = back(y, COL);
  1536. X      fwd(x, COL) = fwd(y, COL);
  1537. X      break;
  1538. X
  1539. X
  1540. X    case SPLIT:
  1541. X    
  1542. X      Child(y, DownDim(x, COL));
  1543. X      y = BreakObject(y, c);
  1544. X      back(x, COL) = back(y, COL);
  1545. X      fwd(x, COL) = fwd(y, COL);
  1546. X      break;
  1547. X
  1548. X
  1549. X    case ACAT:
  1550. X    
  1551. X      x = FillObject(x, c);
  1552. X      break;
  1553. X
  1554. X
  1555. X    case HCAT:
  1556. X    
  1557. X      x = BreakTable(x, c);
  1558. X      break;
  1559. X
  1560. X
  1561. X    case COL_THR:
  1562. X    
  1563. X      BreakJoinedGroup(Down(x), LastDown(x), nil, c, &back(x,COL), &fwd(x,COL));
  1564. X      break;
  1565. X
  1566. X
  1567. X    case VCAT:
  1568. X    
  1569. X      x = BreakVcat(x, c);
  1570. X      break;
  1571. X            
  1572. X
  1573. X    default:
  1574. X    
  1575. X      Error(INTERN, &fpos(x), "BreakObject: %s!", Image(type(x)) );
  1576. X      break;
  1577. X
  1578. X  }
  1579. X  assert( back(x, COL) >= 0, "BreakObject: back(x, COL) < 0!" );
  1580. X  assert( fwd(x, COL) >= 0, "BreakObject: fwd(x, COL) < 0!" );
  1581. X  debug1(DOB, DD,  "] BreakObject returning %s", EchoObject(x));
  1582. X  debug2(DOB, DD, "  (size is %s, %s)",
  1583. X    EchoLength(back(x, COL)), EchoLength(fwd(x, COL)));
  1584. X  return x;
  1585. X} /* end BreakObject */
  1586. END_OF_FILE
  1587.   if test 19888 -ne `wc -c <'z13.c'`; then
  1588.     echo shar: \"'z13.c'\" unpacked with wrong size!
  1589.   fi
  1590.   # end of 'z13.c'
  1591. fi
  1592. if test -f 'z18.c' -a "${1}" != "-c" ; then 
  1593.   echo shar: Will not clobber existing file \"'z18.c'\"
  1594. else
  1595.   echo shar: Extracting \"'z18.c'\" \(16805 characters\)
  1596.   sed "s/^X//" >'z18.c' <<'END_OF_FILE'
  1597. X/*@z18.c:Galley Transfer:Declarations@****************************************/
  1598. X/*                                                                           */
  1599. X/*  LOUT: A HIGH-LEVEL LANGUAGE FOR DOCUMENT FORMATTING (VERSION 2.05)       */
  1600. X/*  COPYRIGHT (C) 1993 Jeffrey H. Kingston                                   */
  1601. X/*                                                                           */
  1602. X/*  Jeffrey H. Kingston (jeff@cs.su.oz.au)                                   */
  1603. X/*  Basser Department of Computer Science                                    */
  1604. X/*  The University of Sydney 2006                                            */
  1605. X/*  AUSTRALIA                                                                */
  1606. X/*                                                                           */
  1607. X/*  This program is free software; you can redistribute it and/or modify     */
  1608. X/*  it under the terms of the GNU General Public License as published by     */
  1609. X/*  the Free Software Foundation; either version 1, or (at your option)      */
  1610. X/*  any later version.                                                       */
  1611. X/*                                                                           */
  1612. X/*  This program is distributed in the hope that it will be useful,          */
  1613. X/*  but WITHOUT ANY WARRANTY; without even the implied warranty of           */
  1614. X/*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            */
  1615. X/*  GNU General Public License for more details.                             */
  1616. X/*                                                                           */
  1617. X/*  You should have received a copy of the GNU General Public License        */
  1618. X/*  along with this program; if not, write to the Free Software              */
  1619. X/*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
  1620. X/*                                                                           */
  1621. X/*  FILE:         z18.c                                                      */
  1622. X/*  MODULE:       Galley Transfer                                            */
  1623. X/*  EXTERNS:      TransferInit(), TransferBegin(), TransferComponent(),      */
  1624. X/*                TransferEnd(), TransferClose()                             */
  1625. X/*                                                                           */
  1626. X/*****************************************************************************/
  1627. X#include "externs"
  1628. X
  1629. X#define    MAX_DEPTH      30            /* max depth of galleys      */
  1630. Xstatic OBJECT        root_galley = nil;    /* the root galley           */
  1631. Xstatic OBJECT        targets[MAX_DEPTH];    /* currently open \Inputs    */
  1632. Xstatic CONSTRAINT    constraints[MAX_DEPTH];    /* their COL constraints     */
  1633. Xstatic int        itop;            /* stack top                 */
  1634. Xstatic CONSTRAINT    initial_constraint;    /* initial COL constraint    */
  1635. Xstatic STYLE        InitialStyle;        /* initial style             */
  1636. X
  1637. X#if DEBUG_ON
  1638. Xstatic debug_targets()
  1639. X{ int i;  OBJECT tmp;
  1640. X  for( i = 0;  i <= itop;  i++ )
  1641. X  { if( targets[i] == nil || Down(targets[i]) == targets[i] )  tmp = nil;
  1642. X    else Child(tmp, Down(targets[i]));
  1643. X    debug3(DGT, D, "  target[%d] %s = %s", i,
  1644. X      EchoConstraint(&constraints[i]), EchoObject(tmp));
  1645. X  }
  1646. X} /* end debug_targets */
  1647. X#endif
  1648. X
  1649. X
  1650. X/*@::TransferInit()@**********************************************************/
  1651. X/*                                                                           */
  1652. X/*  TransferInit(InitEnv)                                                    */
  1653. X/*                                                                           */
  1654. X/*  Initialise this module.  The initial environment is InitEnv.             */
  1655. X/*                                                                           */
  1656. X/*****************************************************************************/
  1657. X
  1658. XTransferInit(InitEnv)
  1659. XOBJECT InitEnv;
  1660. X{ OBJECT dest, x, y, recs, inners, nothing, dest_index, up_hd;
  1661. X  debug1(DGT, D, "TransferInit( %s )", EchoObject(InitEnv));
  1662. X  SetConstraint(initial_constraint, MAX_LEN-1, MAX_LEN-1, MAX_LEN-1);
  1663. X
  1664. X  /* save initial environment and style */
  1665. X  SetGap( line_gap(InitialStyle), FALSE, FALSE, FIXED_UNIT, MARK_MODE, 18*PT);
  1666. X  SetGap(space_gap(InitialStyle), FALSE, TRUE,  FIXED_UNIT, EDGE_MODE,  1*EM);
  1667. X  font(InitialStyle)            = 0;
  1668. X  hyph_style(InitialStyle)      = HYPH_UNDEF;
  1669. X  fill_style(InitialStyle)      = FILL_UNDEF;
  1670. X  display_style(InitialStyle)   = DISPLAY_UNDEF;
  1671. X
  1672. X  /* construct destination for root galley */
  1673. X  up_hd = New(HEAD);
  1674. X  dest_index = New(RECEIVING);
  1675. X  dest = New(CLOSURE);  actual(dest) = PrintSym;
  1676. X  actual(dest_index) = dest;
  1677. X  external(dest) = TRUE;
  1678. X  threaded(dest) = FALSE;
  1679. X  blocked(dest_index) = FALSE;
  1680. X  Link(up_hd, dest_index);
  1681. X
  1682. X  /* construct root galley */
  1683. X  root_galley = New(HEAD);
  1684. X  FposCopy(fpos(root_galley), *no_fpos);
  1685. X  actual(root_galley) = whereto(root_galley) = ready_galls(root_galley) = nil;
  1686. X  backward(root_galley) = must_expand(root_galley) = sized(root_galley) = FALSE;
  1687. X  x = New(CLOSURE);  actual(x) = InputSym;
  1688. X  Link(root_galley, x);
  1689. X  SizeGalley(root_galley, InitEnv, TRUE, FALSE, FALSE, FALSE, &InitialStyle,
  1690. X        &initial_constraint, nil, ¬hing, &recs, &inners);
  1691. X  assert( recs   == nil , "TransferInit: recs   != nil!" );
  1692. X  assert( inners == nil , "TransferInit: inners != nil!" );
  1693. X  Link(dest_index, root_galley);
  1694. X
  1695. X  /* initialise target and constraint stacks */
  1696. X  Child(y, Down(root_galley));
  1697. X  assert( type(y) == RECEPTIVE && type(actual(y)) == CLOSURE &&
  1698. X    actual(actual(y)) == InputSym, "TransferInit: initial galley!" );
  1699. X  assert( external(actual(y)), "TransferInit: input sym not external!" );
  1700. X  blocked(y) = TRUE;
  1701. X  targets[itop = 0] = New(ACAT);
  1702. X  Link(targets[itop], y);
  1703. X  Constrained(actual(y), &constraints[itop], COL);
  1704. X  debug2(DSC, D, "Constrained( %s, COL ) = %s",
  1705. X    EchoObject(y), EchoConstraint(&constraints[itop]));
  1706. X
  1707. X  debug0(DGT, D, "TransferInit returning.");
  1708. X  ifdebug(DGT, DD, debug_targets());
  1709. X} /* end TransferInit */
  1710. X
  1711. X
  1712. X/*@::TransferBegin()@*********************************************************/
  1713. X/*                                                                           */
  1714. X/*  OBJECT TransferBegin(x)                                                  */
  1715. X/*                                                                           */
  1716. X/*  Commence the transfer of a new galley whose header is invokation x.      */
  1717. X/*                                                                           */
  1718. X/*****************************************************************************/
  1719. X
  1720. XOBJECT TransferBegin(x)
  1721. XOBJECT x;
  1722. X{ OBJECT xsym, index, y, link, env, new_env, hold_env, res, hd, target;
  1723. X  CONSTRAINT c;
  1724. X  debug1(DGT, D, "TransferBegin( %s )", EchoObject(x));
  1725. X  ifdebug(DGT, DD, debug_targets());
  1726. X  assert( type(x) == CLOSURE, "TransferBegin: non-CLOSURE!" );
  1727. X
  1728. X  /* add an automatically generated @Tag parameter to x if required */
  1729. X  CrossAddTag(x);
  1730. X
  1731. X  /* construct new (inner) env chain */
  1732. X  if( Down(targets[itop]) == targets[itop] )
  1733. X      Error(FATAL, &fpos(x), "cannot attach galley %s", SymName(actual(x)));
  1734. X  Child(target, Down(targets[itop]));
  1735. X  xsym = actual(x);
  1736. X  env = GetEnv(actual(target));
  1737. X  debug1(DGT, DD, "  current env chain: %s", EchoObject(env));
  1738. X  if( has_body(xsym) )
  1739. X  {
  1740. X    /* prepare a copy of x for inclusion in environment */
  1741. X    y = CopyObject(x, no_fpos);
  1742. X
  1743. X    /* attach its environment */
  1744. X    AttachEnv(env, y);
  1745. X
  1746. X    /* now the new environment is y catenated with the old one */
  1747. X    debug0(DCR, DD, "calling SetEnv from TransferBegin (a)");
  1748. X    new_env = SetEnv(y, nil);
  1749. X  }
  1750. X  else new_env = env;
  1751. X  hold_env = New(ACAT);  Link(hold_env, new_env);
  1752. X  debug1(DGT, DD, "  new env chain: %s", EchoObject(new_env));
  1753. X
  1754. X  /* convert x into an unsized galley called hd */
  1755. X  index = New(UNATTACHED);
  1756. X  hd = New(HEAD);
  1757. X  FposCopy(fpos(hd), fpos(x));
  1758. X  actual(hd) = xsym;
  1759. X  backward(hd) = TargetSymbol(x, &whereto(hd));
  1760. X  ready_galls(hd) = nil;
  1761. X  must_expand(hd) = TRUE;
  1762. X  sized(hd) = FALSE;
  1763. X  Link(index, hd);
  1764. X  Link(hd, x);
  1765. X  AttachEnv(env, x);
  1766. X
  1767. X  /* search for destination for hd and release it */
  1768. X  Link(Up(target), index);
  1769. X  debug0(DGF, D, "  calling FlushGalley from TransferBegin");
  1770. X  FlushGalley(hd);
  1771. X
  1772. X  /* if failed to flush, undo everything and exit */
  1773. X  Parent(index, Up(hd));
  1774. X  if( type(index) == UNATTACHED && !sized(hd) )
  1775. X  { DeleteNode(index);
  1776. X    DisposeObject(hold_env);
  1777. X    if( LastDown(x) != x )
  1778. X    { Child(env, LastDown(x));
  1779. X      if( type(env) == ENV )  DisposeChild(LastDown(x));
  1780. X    }
  1781. X    debug1(DGT,D, "TransferBegin returning failed, x: %s", EchoObject(x));
  1782. X    return x;
  1783. X  }
  1784. X
  1785. X  if( has_rpar(actual(hd)) )
  1786. X  {
  1787. X    /* set up new target to be inner \InputSym, or nil if none */
  1788. X    if( ++itop >= MAX_DEPTH ) Error(FATAL, &fpos(x),
  1789. X    "galley nested too deeply (max is %d)", MAX_DEPTH);
  1790. X    targets[itop] = New(ACAT);  target = nil;
  1791. X    for( link = Down(hd);  link != hd;  link = NextDown(link) )
  1792. X    { Child(y, link);
  1793. X      if( type(y) == RECEPTIVE && actual(actual(y)) == InputSym )
  1794. X      {
  1795. X    Constrained(actual(y), &constraints[itop], COL);
  1796. X    if( FitsConstraint(0, 0, constraints[itop]) )
  1797. X    { Link(targets[itop], y);  target = y;
  1798. X      debug2(DSC, D, "Constrained( %s, COL ) = %s",
  1799. X        EchoObject(y), EchoConstraint(&constraints[itop]));
  1800. X      env = DetachEnv(actual(y));
  1801. X      AttachEnv(new_env, actual(y));
  1802. X    }
  1803. X    else
  1804. X    { Error(WARN, &fpos(hd), "galley %s deleted (target too narrow)",
  1805. X        SymName(actual(hd)));
  1806. X    }
  1807. X    break;
  1808. X      }
  1809. X    }
  1810. X
  1811. X    /* return a token appropriate to the new target */
  1812. X    if( target == nil || external(actual(target)) )
  1813. X      res = NewToken(GSTUB_EXT, no_fpos, 0, 0, precedence(xsym), nil);
  1814. X    else
  1815. X    { Constrained(actual(target), &c, ROW);
  1816. X      if( constrained(c) )  Error(FATAL, &fpos(target),
  1817. X        "right parameter of %s is vertically constrained", SymName(xsym));
  1818. X      else res = NewToken(GSTUB_INT, no_fpos, 0, 0, precedence(xsym), nil);
  1819. X    }
  1820. X  }
  1821. X  else res = NewToken(GSTUB_NONE, no_fpos, 0, 0, precedence(xsym), nil);
  1822. X
  1823. X  DisposeObject(hold_env);
  1824. X  debug1(DGT, D, "TransferBegin returning %s", Image(type(res)));
  1825. X  ifdebug(DGT, DD, debug_targets());
  1826. X  return res;
  1827. X} /* end TransferBegin */
  1828. X
  1829. X
  1830. X/*@::TransferComponent()@*****************************************************/
  1831. X/*                                                                           */
  1832. X/*  TransferComponent(x)                                                     */
  1833. X/*                                                                           */
  1834. X/*  Transfer component x of a galley.                                        */
  1835. X/*                                                                           */
  1836. X/*****************************************************************************/
  1837. X
  1838. XTransferComponent(x)
  1839. XOBJECT x;
  1840. X{ OBJECT y, env, start_search, recs, inners, nothing, hd, dest, dest_index;
  1841. X  debug1(DGT, D, "TransferComponent( %s )", EchoObject(x));
  1842. X  ifdebug(DGT, DD, debug_targets());
  1843. X
  1844. X  /* if no dest_index, discard x and exit */
  1845. X  if( Down(targets[itop]) == targets[itop] )
  1846. X  { DisposeObject(x);
  1847. X    debug0(DGT, D, "TransferComponent returning (no target).");
  1848. X    return;
  1849. X  }
  1850. X  Child(dest_index, Down(targets[itop]));
  1851. X  assert( external(actual(dest_index)), "TransferComponent: internal!" );
  1852. X
  1853. X  /* make the component into a galley */
  1854. X  hd = New(HEAD);
  1855. X  FposCopy(fpos(hd), fpos(x));
  1856. X  actual(hd) = whereto(hd) = ready_galls(hd) = nil;
  1857. X  backward(hd) = must_expand(hd) = sized(hd) = FALSE;
  1858. X  Link(hd, x);
  1859. X  dest = actual(dest_index);
  1860. X  env = GetEnv(dest);
  1861. X  debug1(DGT, DD, "  current env chain: %s", EchoObject(env));
  1862. X  SizeGalley(hd, env, TRUE, threaded(dest), FALSE, TRUE, &save_style(dest),
  1863. X    &constraints[itop], nil, ¬hing, &recs, &inners);
  1864. X  if( recs != nil )  ExpandRecursives(recs);
  1865. X
  1866. X  /* promote the components, remembering where old spot was */
  1867. X  start_search = PrevDown(Up(dest_index));
  1868. X  debug0(DSA, D, "  calling AdjustSize from TransferComponent");
  1869. X  AdjustSize(dest, back(hd, COL), fwd(hd, COL), COL);
  1870. X  Promote(hd, hd, dest_index);
  1871. X  DeleteNode(hd);
  1872. X
  1873. X  /* flush any widowed galleys attached to \Input */
  1874. X  if( Down(dest_index) != dest_index )
  1875. X  { OBJECT tinners, index;
  1876. X    tinners = New(ACAT);
  1877. X    while( Down(dest_index) != dest_index )
  1878. X    { Child(y, Down(dest_index));
  1879. X      assert( type(y) == HEAD, "TransferComponent: input child!" );
  1880. X      DetachGalley(y);
  1881. X      Parent(index, Up(y));
  1882. X      MoveLink(Up(index), NextDown(start_search), PARENT);
  1883. X      Link(tinners, index);
  1884. X    }
  1885. X    FlushInners(tinners, nil);
  1886. X  }
  1887. X
  1888. X  /* flush any galleys inside hd */
  1889. X  if( inners != nil )  FlushInners(inners, nil);
  1890. X
  1891. X  /* flush parent galley, if needed */
  1892. X  if( blocked(dest_index) )
  1893. X  { blocked(dest_index) = FALSE;
  1894. X    Parent(y, Up(dest_index));
  1895. X    debug0(DGF, D, "  calling FlushGalley from TransferComponent");
  1896. X    FlushGalley(y);
  1897. X  }
  1898. X  
  1899. X  debug0(DGT, D, "TransferComponent returning.");
  1900. X  ifdebug(DGT, DD, debug_targets());
  1901. X} /* end TransferComponent */
  1902. X
  1903. X
  1904. X/*@::TransferEnd()@***********************************************************/
  1905. X/*                                                                           */
  1906. X/*  TransferEnd(x)                                                           */
  1907. X/*                                                                           */
  1908. X/*  End the transfer of a galley.                                            */
  1909. X/*                                                                           */
  1910. X/*****************************************************************************/
  1911. X
  1912. XTransferEnd(x)
  1913. XOBJECT x;
  1914. X{ OBJECT recs, inners, nothing, z, env, dest, hd, dest_index, y, start_search;
  1915. X  debug1(DGT, D, "TransferEnd( %s )", EchoObject(x));
  1916. X  ifdebug(DGT, DD, debug_targets());
  1917. X
  1918. X  /* if no dest_index, discard x and exit */
  1919. X  if( Down(targets[itop]) == targets[itop] )
  1920. X  { DisposeObject(x);  DisposeObject(targets[itop--]);
  1921. X    debug0(DGT, D, "TransferEnd returning: no dest_index");
  1922. X    return;
  1923. X  }
  1924. X  Child(dest_index, Down(targets[itop]));
  1925. X
  1926. X  /* make the component into a galley */
  1927. X  hd = New(HEAD);  FposCopy(fpos(hd), fpos(x));
  1928. X  actual(hd) = whereto(hd) = ready_galls(hd) = nil;
  1929. X  backward(hd) = must_expand(hd) = sized(hd) = FALSE;
  1930. X  Link(hd, x);  dest = actual(dest_index);  env = GetEnv(dest);
  1931. X  debug1(DGT, DD, "  current env chain: %s", EchoObject(env));
  1932. X  SizeGalley(hd, env, external(dest), threaded(dest), FALSE, TRUE,
  1933. X    &save_style(dest), &constraints[itop], nil, ¬hing, &recs, &inners);
  1934. X  if( recs != nil )  ExpandRecursives(recs);
  1935. X
  1936. X  /* promote the components, remembering where old spot was */
  1937. X  start_search = PrevDown(Up(dest_index));
  1938. X  debug0(DSA, D, "calling AdjustSize from TransferEnd (a)");
  1939. X  AdjustSize(dest, back(hd, COL), fwd(hd, COL), COL);
  1940. X  if( !external(dest) )
  1941. X  { Child(z, LastDown(hd));
  1942. X    debug0(DSA, D, "calling AdjustSize from TransferEnd (b)");
  1943. X    AdjustSize(dest, back(z, ROW), fwd(z, ROW), ROW);
  1944. X    Interpose(dest, VCAT, hd, z);
  1945. X  }
  1946. X  Promote(hd, hd, dest_index);  DeleteNode(hd);
  1947. X
  1948. X  /* flush any widowed galleys attached to \Input */
  1949. X  if( Down(dest_index) != dest_index )
  1950. X  { OBJECT tinners, index;
  1951. X    tinners = New(ACAT);
  1952. X    while( Down(dest_index) != dest_index )
  1953. X    { Child(y, Down(dest_index));
  1954. X      assert( type(y) == HEAD, "TransferComponent: input child!" );
  1955. X      DetachGalley(y);
  1956. X      Parent(index, Up(y));
  1957. X      MoveLink(Up(index), NextDown(start_search), PARENT);
  1958. X      Link(tinners, index);
  1959. X    }
  1960. X    FlushInners(tinners, nil);
  1961. X  }
  1962. X
  1963. X  /* flush any galleys inside hd */
  1964. X  if( inners != nil )  FlushInners(inners, nil);
  1965. X
  1966. X  /* close dest_index, and flush parent galley if needed */
  1967. X  if( blocked(dest_index) )
  1968. X  { Parent(y, Up(dest_index));
  1969. X    DeleteNode(dest_index);
  1970. X    debug0(DGF, D, "  calling FlushGalley from TransferEnd");
  1971. X    FlushGalley(y);
  1972. X  }
  1973. X  else DeleteNode(dest_index);
  1974. X  
  1975. X  /* pop target stack and exit */
  1976. X  DisposeObject(targets[itop--]);
  1977. X  debug0(DGT, D, "TransferEnd returning.");
  1978. X  ifdebug(DGT, DD, debug_targets());
  1979. X} /* end TransferEnd */
  1980. X
  1981. X/*@::TransferClose()@*********************************************************/
  1982. X/*                                                                           */
  1983. X/*  TransferClose()                                                          */
  1984. X/*                                                                           */
  1985. X/*  Close this module.                                                       */
  1986. X/*                                                                           */
  1987. X/*****************************************************************************/
  1988. X
  1989. XTransferClose()
  1990. X{ OBJECT inners;
  1991. X  debug0(DGT, D, "TransferClose()");
  1992. X  debug0(DGA, D, "  calling FreeGalley from TransferClose");
  1993. X  if( LastDown(root_galley) != root_galley )
  1994. X  { inners = nil;
  1995. X    FreeGalley(root_galley, root_galley, &inners, nil, nil);
  1996. X    if( inners != nil )  FlushInners(inners, nil);
  1997. X    debug0(DGF, D, "  calling FlushGalley from TransferClose");
  1998. X    FlushGalley(root_galley);
  1999. X  }
  2000. X  debug0(DGT, D, "TransferClose returning.");
  2001. X}
  2002. END_OF_FILE
  2003.   if test 16805 -ne `wc -c <'z18.c'`; then
  2004.     echo shar: \"'z18.c'\" unpacked with wrong size!
  2005.   fi
  2006.   # end of 'z18.c'
  2007. fi
  2008. echo shar: End of archive 15 \(of 35\).
  2009. cp /dev/null ark15isdone
  2010. MISSING=""
  2011. 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
  2012.     if test ! -f ark${I}isdone ; then
  2013.     MISSING="${MISSING} ${I}"
  2014.     fi
  2015. done
  2016. if test "${MISSING}" = "" ; then
  2017.     echo You have unpacked all 35 archives.
  2018.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2019. else
  2020.     echo You still must unpack the following archives:
  2021.     echo "        " ${MISSING}
  2022. fi
  2023. exit 0
  2024. exit 0 # Just in case...
  2025.