home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume26 / funnlweb / part12 < prev    next >
Encoding:
Text File  |  1993-04-10  |  121.0 KB  |  2,758 lines

  1. Newsgroups: comp.sources.unix
  2. From: ross@spam.adelaide.edu.au (Ross Williams)
  3. Subject: v26i132: funnelweb - a tool for literate programming in C, Part12/20
  4. Sender: unix-sources-moderator@vix.com
  5. Approved: paul@vix.com
  6.  
  7. Submitted-By: ross@spam.adelaide.edu.au (Ross Williams)
  8. Posting-Number: Volume 26, Issue 132
  9. Archive-Name: funnelweb/part12
  10.  
  11. [ several files in this archive will unpack with the wrong size, due to
  12.   length restrictions in NNTP.  --vix ]
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then unpack
  16. # it by saving it into a file and typing "sh file".  To overwrite existing
  17. # files, type "sh file -c".  You can also feed this as standard input via
  18. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  19. # will see the following message at the end:
  20. #        "End of archive 12 (of 20)."
  21. # Contents:  answers/sc11.lis answers/sc14.lis hackman/h_ch3.tex
  22. #   sources/data.h sources/dump.c
  23. # Wrapped by vixie@gw.home.vix.com on Sun Apr 11 11:00:27 1993
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'answers/sc11.lis' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'answers/sc11.lis'\"
  27. else
  28. echo shar: Extracting \"'answers/sc11.lis'\" \(23578 characters\)
  29. sed "s/^X//" >'answers/sc11.lis' <<'END_OF_FILE'
  30. XFUNNELWEB LISTING FILE
  31. X======================
  32. X
  33. Dump of mapped file "<<Suppressed>>".
  34. X
  35. MEMORY DUMP OF MAPPED FILE
  36. X==========================
  37. X
  38. X+-------------------------------------------------+------------------+
  39. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  40. X+-------------------------------------------------+------------------+
  41. X| 53 43 31 31 3A 20 53 79 6E 74 61 78 20 6F 66 20 | SC11: Syntax of  |
  42. X| 74 68 65 20 69 6E 63 6C 75 64 65 20 70 72 61 67 | the include prag |
  43. X| 6D 61 2E 0A 0A 31 2E 20 54 65 73 74 20 69 6E 63 | ma...1. Test inc |
  44. X| 6C 75 64 65 20 70 72 61 67 6D 61 20 6E 6F 74 20 | lude pragma not  |
  45. X| 61 74 20 73 74 61 72 74 20 6F 66 20 6C 69 6E 65 | at start of line |
  46. X| 2E 0A 0A 20 20 20 40 69 0A 0A 32 2E 20 54 65 73 | ...   @i..2. Tes |
  47. X| 74 20 41 54 69 20 6E 6F 74 20 66 6F 6C 6C 6F 77 | t ATi not follow |
  48. X| 65 64 20 62 79 20 61 20 62 6C 61 6E 6B 2E 0A 0A | ed by a blank... |
  49. X| 40 69 78 0A 0A 33 2E 20 54 65 73 74 20 69 6E 63 | @ix..3. Test inc |
  50. X| 6C 75 64 65 20 66 69 6C 65 6E 61 6D 65 20 69 73 | lude filename is |
  51. X| 20 74 6F 6F 20 6C 6F 6E 67 2E 20 54 68 65 20 6D |  too long. The m |
  52. X| 61 78 69 6D 75 6D 20 6F 6E 20 74 68 65 20 4D 61 | aximum on the Ma |
  53. X| 63 69 6E 74 6F 73 68 20 69 73 0A 20 20 20 32 35 | cintosh is.   25 |
  54. X| 35 20 62 75 74 20 77 65 20 77 69 6C 6C 20 75 73 | 5 but we will us |
  55. X| 65 20 61 20 66 69 6C 65 6E 61 6D 65 20 6F 66 20 | e a filename of  |
  56. X| 6F 76 65 72 20 31 30 32 34 20 63 68 61 72 61 63 | over 1024 charac |
  57. X| 74 65 72 73 20 73 6F 20 61 73 20 74 6F 20 6D 61 | ters so as to ma |
  58. X| 6B 65 0A 20 20 20 74 68 65 20 74 65 73 74 20 70 | ke.   the test p |
  59. X| 6F 72 74 61 62 6C 65 2E 20 54 68 65 20 61 63 74 | ortable. The act |
  60. X| 75 61 6C 20 6C 65 6E 67 74 68 20 75 73 65 64 20 | ual length used  |
  61. X| 69 73 20 31 31 30 30 20 63 68 61 72 61 63 74 65 | is 1100 characte |
  62. X| 72 73 20 69 6E 20 74 68 65 0A 20 20 20 66 69 6C | rs in the.   fil |
  63. X| 65 6E 61 6D 65 2E 0A 0A 20 20 20 20 20 20 20 20 | ename...         |
  64. X| 20 20 20 20 31 20 20 20 20 20 20 20 20 20 32 20 |     1         2  |
  65. X| 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 |         3        |
  66. X| 20 20 34 20 20 20 20 20 20 20 20 20 35 20 20 20 |   4         5    |
  67. X| 20 20 20 20 20 20 36 20 20 20 20 20 20 20 20 20 |       6          |
  68. X| 37 20 20 20 20 20 20 20 20 20 38 20 20 20 20 20 | 7         8      |
  69. X| 20 20 20 20 39 20 20 20 20 20 20 20 20 20 30 20 |     9         0  |
  70. X| 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 |         1        |
  71. X| 20 20 32 20 20 20 20 20 20 20 20 20 33 20 20 20 |   2         3    |
  72. X| 20 20 20 20 20 20 34 20 20 20 20 20 20 20 20 20 |       4          |
  73. X| 35 20 20 20 20 20 20 20 20 20 36 20 20 20 20 20 | 5         6      |
  74. X| 20 20 20 20 37 20 20 20 20 20 20 20 20 20 38 20 |     7         8  |
  75. X| 20 20 20 20 20 20 20 20 39 20 20 20 20 20 20 20 |         9        |
  76. X| 20 20 30 20 20 20 20 20 20 20 20 20 31 20 20 20 |   0         1    |
  77. X| 20 20 20 20 20 20 32 20 20 20 20 20 20 20 20 20 |       2          |
  78. X| 33 20 20 20 20 20 20 20 20 20 34 20 20 20 20 20 | 3         4      |
  79. X| 20 20 20 20 35 20 20 20 20 20 20 20 20 20 36 20 |     5         6  |
  80. X| 20 20 20 20 20 20 20 20 37 20 20 20 20 20 20 20 |         7        |
  81. X| 20 20 38 20 20 20 20 20 20 20 20 20 39 20 20 20 |   8         9    |
  82. X| 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 |       0          |
  83. X| 31 20 20 20 20 20 20 20 20 20 32 20 20 20 20 20 | 1         2      |
  84. X| 20 20 20 20 33 20 20 20 20 20 20 20 20 20 34 20 |     3         4  |
  85. X| 20 20 20 20 20 20 20 20 35 20 20 20 20 20 20 20 |         5        |
  86. X| 20 20 36 20 20 20 20 20 20 20 20 20 37 20 20 20 |   6         7    |
  87. X| 20 20 20 20 20 20 38 20 20 20 20 20 20 20 20 20 |       8          |
  88. X| 39 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20 | 9         0      |
  89. X| 20 20 20 20 31 20 20 20 20 20 20 20 20 20 32 20 |     1         2  |
  90. X| 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 |         3        |
  91. X| 20 20 34 20 20 20 20 20 20 20 20 20 35 20 20 20 |   4         5    |
  92. X| 20 20 20 20 20 20 36 20 20 20 20 20 20 20 20 20 |       6          |
  93. X| 37 20 20 20 20 20 20 20 20 20 38 20 20 20 20 20 | 7         8      |
  94. X| 20 20 20 20 39 20 20 20 20 20 20 20 20 20 30 20 |     9         0  |
  95. X| 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 |         1        |
  96. X| 20 20 32 20 20 20 20 20 20 20 20 20 33 20 20 20 |   2         3    |
  97. X| 20 20 20 20 20 20 34 20 20 20 20 20 20 20 20 20 |       4          |
  98. X| 35 20 20 20 20 20 20 20 20 20 36 20 20 20 20 20 | 5         6      |
  99. X| 20 20 20 20 37 20 20 20 20 20 20 20 20 20 38 20 |     7         8  |
  100. X| 20 20 20 20 20 20 20 20 39 20 20 20 20 20 20 20 |         9        |
  101. X| 20 20 30 20 20 20 20 20 20 20 20 20 31 20 20 20 |   0         1    |
  102. X| 20 20 20 20 20 20 32 20 20 20 20 20 20 20 20 20 |       2          |
  103. X| 33 20 20 20 20 20 20 20 20 20 34 20 20 20 20 20 | 3         4      |
  104. X| 20 20 20 20 35 20 20 20 20 20 20 20 20 20 36 20 |     5         6  |
  105. X| 20 20 20 20 20 20 20 20 37 20 20 20 20 20 20 20 |         7        |
  106. X| 20 20 38 20 20 20 20 20 20 20 20 20 39 20 20 20 |   8         9    |
  107. X| 20 20 20 20 20 20 30 20 20 20 20 20 20 20 20 20 |       0          |
  108. X| 31 20 20 20 20 20 20 20 20 20 32 20 20 20 20 20 | 1         2      |
  109. X| 20 20 20 20 33 20 20 20 20 20 20 20 20 20 34 20 |     3         4  |
  110. X| 20 20 20 20 20 20 20 20 35 20 20 20 20 20 20 20 |         5        |
  111. X| 20 20 36 20 20 20 20 20 20 20 20 20 37 20 20 20 |   6         7    |
  112. X| 20 20 20 20 20 20 38 20 20 20 20 20 20 20 20 20 |       8          |
  113. X| 39 20 20 20 20 20 20 20 20 20 30 20 20 20 20 20 | 9         0      |
  114. X| 20 20 20 20 31 20 20 20 20 20 20 20 20 20 32 20 |     1         2  |
  115. X| 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 |         3        |
  116. X| 20 20 34 20 20 20 20 20 20 20 20 20 35 20 20 20 |   4         5    |
  117. X| 20 20 20 20 20 20 36 20 20 20 20 20 20 20 20 20 |       6          |
  118. X| 37 20 20 20 20 20 20 20 20 20 38 20 20 20 20 20 | 7         8      |
  119. X| 20 20 20 20 39 20 20 20 20 20 20 20 20 20 30 20 |     9         0  |
  120. X| 20 20 20 20 20 20 20 20 31 20 20 20 20 20 20 20 |         1        |
  121. X| 20 20 32 20 20 20 20 20 20 20 20 20 33 20 20 20 |   2         3    |
  122. X| 20 20 20 20 20 20 34 20 20 20 20 20 20 20 20 20 |       4          |
  123. X| 35 20 20 20 20 20 20 20 20 20 36 20 20 20 20 20 | 5         6      |
  124. X| 20 20 20 20 37 20 20 20 20 20 20 20 20 20 38 20 |     7         8  |
  125. X| 20 20 20 20 20 20 20 20 39 20 20 20 20 20 20 20 |         9        |
  126. X| 20 20 30 20 20 20 20 20 20 20 20 20 31 20 20 20 |   0         1    |
  127. X| 20 20 20 20 20 20 32 20 20 20 20 20 20 20 20 20 |       2          |
  128. X| 33 20 20 20 20 20 20 20 20 20 34 20 20 20 20 20 | 3         4      |
  129. X| 20 20 20 20 35 20 20 20 20 20 20 20 20 20 36 20 |     5         6  |
  130. X| 20 20 20 20 20 20 20 20 37 20 20 20 20 20 20 20 |         7        |
  131. X| 20 20 38 20 20 20 20 20 20 20 20 20 39 20 20 20 |   8         9    |
  132. X| 20 20 20 20 20 20 30 0A 40 69 20 31 32 33 34 35 |       0.@i 12345 |
  133. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  134. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  135. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  136. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  137. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  138. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  139. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  140. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  141. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  142. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  143. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  144. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  145. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  146. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  147. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  148. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  149. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  150. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  151. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  152. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  153. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  154. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  155. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  156. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  157. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  158. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  159. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  160. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  161. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  162. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  163. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  164. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  165. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  166. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  167. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  168. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  169. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  170. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  171. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  172. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  173. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  174. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  175. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  176. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  177. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  178. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  179. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  180. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  181. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  182. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  183. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  184. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  185. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  186. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  187. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  188. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  189. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  190. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  191. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  192. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  193. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  194. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  195. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  196. X| 34 35 36 37 38 39 30 31 32 33 34 35 36 37 38 39 | 4567890123456789 |
  197. X| 30 31 32 33 34 35 36 37 38 39 30 31 32 33 34 35 | 0123456789012345 |
  198. X| 36 37 38 39 30 31 32 33 34 35 36 37 38 39 30 31 | 6789012345678901 |
  199. X| 32 33 34 35 36 37 38 39 30 31 32 33 34 35 36 37 | 2345678901234567 |
  200. X| 38 39 30 31 32 33 34 35 36 37 38 39 30 31 32 33 | 8901234567890123 |
  201. X| 34 35 36 37 38 39 30 0A 0A 34 2E 20 49 6E 63 6C | 4567890..4. Incl |
  202. X| 75 64 65 20 70 72 61 67 6D 61 20 68 61 73 20 61 | ude pragma has a |
  203. X| 6E 20 65 6D 70 74 79 20 66 69 6C 65 6E 61 6D 65 | n empty filename |
  204. X| 2E 20 4E 6F 74 65 3A 20 42 65 63 61 75 73 65 20 | . Note: Because  |
  205. X| 74 68 65 20 41 54 69 20 68 61 73 20 74 6F 20 62 | the ATi has to b |
  206. X| 65 0A 20 20 20 66 6F 6C 6C 6F 77 65 64 20 62 79 | e.   followed by |
  207. X| 20 61 20 62 6C 61 6E 6B 2C 20 77 65 20 68 61 76 |  a blank, we hav |
  208. X| 65 20 74 6F 20 69 6E 63 75 72 20 61 20 74 72 61 | e to incur a tra |
  209. X| 69 6C 69 6E 67 20 62 6C 61 6E 6B 20 65 72 72 6F | iling blank erro |
  210. X| 72 20 68 65 72 65 20 69 6E 0A 20 20 20 6F 72 64 | r here in.   ord |
  211. X| 65 72 20 74 6F 20 70 72 6F 76 6F 6B 65 20 74 68 | er to provoke th |
  212. X| 65 20 65 72 72 6F 72 20 77 65 20 72 65 61 6C 6C | e error we reall |
  213. X| 79 20 77 61 6E 74 20 74 6F 20 73 65 65 2E 0A 0A | y want to see... |
  214. X| 40 69 20 0A 0A                                  | @i ..            |
  215. X+-------------------------------------------------+------------------+
  216. X
  217. X
  218. X=========================== Start of LINE LIST DUMP ============================
  219. X
  220. Globl Local| Text
  221. X-----------+--------------------------------------------------------------------
  222. X00001 00001| SC11: Syntax of the include pragma.<010>
  223. X00002 00002| <010>
  224. X00003 00003| 1. Test include pragma not at start of line.<010>
  225. X00004 00004| <010>
  226. X00005 00005|    @i<010>
  227. X00006 00006| <010>
  228. X00007 00007| 2. Test ATi not followed by a blank.<010>
  229. X00008 00008| <010>
  230. X00009 00009| @ix<010>
  231. X00010 00010| <010>
  232. X00011 00011| 3. Test include filename is too long. The maximum on the Macintosh is<010>
  233. X00012 00012|    255 but we will use a filename of over 1024 characters so as to make<010>
  234. X00013 00013|    the test portable. The actual length used is 1100 characters in the<010>
  235. X00014 00014|    filename.<010>
  236. X00015 00015| <010>
  237. X00016 00016|             1         2         (elided by comp.sources.unix moderator)7         8         9         0<010>
  238. X00017 00017| @i 1234567890(elided by comp.sources.unix moderator)1234567890<010>
  239. X00018 00018| <010>
  240. X00019 00019| 4. Include pragma has an empty filename. Note: Because the ATi has to be<010>
  241. X00020 00020|    followed by a blank, we have to incur a trailing blank error here in<010>
  242. X00021 00021|    order to provoke the error we really want to see.<010>
  243. X00022 00022| <010>
  244. X00023 00023| @i <010>
  245. X00024 00024| <010>
  246. X00025 00025| <End-Of-File><010>
  247. X-----------+--------------------------------------------------------------------
  248. Globl Local| Text
  249. X
  250. X============================ End of LINE LIST DUMP =============================
  251. X
  252. X
  253. X=========================== Start of TOKEN LIST DUMP ===========================
  254. X
  255. Summary: There are 6 tokens in the token list.
  256. X
  257. Line[Column]: Token Description
  258. X-------------------------------
  259. X
  260. X0001[01]: Text. Text scrap[Grey]="SC11: Syntax of the include pragma.<010>
  261. X<010>
  262. X1. Test include pragma not at start of line.<010>
  263. X<010>
  264. X   "
  265. X0006[01]: Text. Text scrap[Grey]="<010>
  266. X2. Test ATi not followed by a blank.<010>
  267. X<010>
  268. X"
  269. X0010[01]: Text. Text scrap[Grey]="<010>
  270. X3. Test include filename is too long. The maximum on the Macintosh is<010>
  271. X   255 but we will use a filename of over 1024 characters so as to make<010>
  272. X   the test portable. The actual length used is 1100 characters in the<010>
  273. X   filename.<010>
  274. X<010>
  275. X            1         2         (elided by comp.sources.unix moderator)7         8         9         0<010>
  276. X"
  277. X0018[01]: Text. Text scrap[Grey]="<010>
  278. X4. Include pragma has an empty filename. Note: Because the ATi has to be<010>
  279. X   followed by a blank, we have to incur a trailing blank error here in<010>
  280. X   order to provoke the error we really want to see.<010>
  281. X<010>
  282. X"
  283. X0024[01]: Text. Text scrap[White]="<010>
  284. X"
  285. X0025[01]: End Of File. 
  286. X============================ End of TOKEN LIST DUMP ============================
  287. X
  288. Macro table dump skipped (Parser was not invoked).
  289. Document list dump skipped (Parser was not invoked).
  290. X
  291. Global Local| Input File
  292. X------------+-------------------------------------------------------------------
  293. X     1     1| SC11: Syntax of the include pragma.
  294. X     2     2| 
  295. X     3     3| 1. Test include pragma not at start of line.
  296. X     4     4| 
  297. X     5     5|    @i
  298. X       Error|....^Include sequence must be at the beginning of a line.
  299. X            |....^Include ignored.
  300. X     6     6| 
  301. X     7     7| 2. Test ATi not followed by a blank.
  302. X     8     8| 
  303. X     9     9| @ix
  304. X       Error|...^Include sequence (@i) must be followed by a blank.
  305. X            |...^Example include: @i macros.fwi
  306. X            |...^Include ignored.
  307. X    10    10| 
  308. X    11    11| 3. Test include filename is too long. The maximum on the Macintosh is
  309. X    12    12|    255 but we will use a filename of over 1024 characters so as to make
  310. X    13    13|    the test portable. The actual length used is 1100 characters in the
  311. X    14    14|    filename.
  312. X    15    15| 
  313. X    16    16|             1         2        (elided by comp.sources.unix moderator) 7         8         9         0
  314. X       Error|.................................................................................^Input line is too long (this character is the first offender).
  315. X            |.................................................................................^Currently, the maximum allowable input line length is 80.
  316. X            |.................................................................................^Note: You can change this using a pragma directive (@p).
  317. X    17    17| @i 1234567890(elided by comp.sources.unix moderator)1234567890
  318. X       Error|.^This include command's file specification is too long.
  319. X            |.^The maximum file name length is <<Suppressed>> characters.
  320. X            |.^Include ignored.
  321. X       Error|.................................................................................^Input line is too long (this character is the first offender).
  322. X            |.................................................................................^Currently, the maximum allowable input line length is 80.
  323. X            |.................................................................................^Note: You can change this using a pragma directive (@p).
  324. X    18    18| 
  325. X    19    19| 4. Include pragma has an empty filename. Note: Because the ATi has to be
  326. X    20    20|    followed by a blank, we have to incur a trailing blank error here in
  327. X    21    21|    order to provoke the error we really want to see.
  328. X    22    22| 
  329. X    23    23| @i 
  330. X     Warning|...^Line has trailing spaces up to and including this space.
  331. X       Error|....^Expecting the name of a file to include.
  332. X    24    24| 
  333. X            | <End-Of-File>
  334. X------------+-------------------------------------------------------------------
  335. X
  336. There were 6 Errors and 1 Warning.
  337. END_OF_FILE
  338. if test 23578 -ne `wc -c <'answers/sc11.lis'`; then
  339.     echo shar: \"'answers/sc11.lis'\" unpacked with wrong size!
  340. fi
  341. # end of 'answers/sc11.lis'
  342. fi
  343. if test -f 'answers/sc14.lis' -a "${1}" != "-c" ; then 
  344.   echo shar: Will not clobber existing file \"'answers/sc14.lis'\"
  345. else
  346. echo shar: Extracting \"'answers/sc14.lis'\" \(22685 characters\)
  347. sed "s/^X//" >'answers/sc14.lis' <<'END_OF_FILE'
  348. XFUNNELWEB LISTING FILE
  349. X======================
  350. X
  351. Dump of mapped file "<<Suppressed>>".
  352. X
  353. MEMORY DUMP OF MAPPED FILE
  354. X==========================
  355. X
  356. X+-------------------------------------------------+------------------+
  357. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  358. X+-------------------------------------------------+------------------+
  359. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  360. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  361. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  362. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  363. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  364. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  365. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  366. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  367. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  368. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  369. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  370. X+-------------------------------------------------+------------------+
  371. X
  372. Dump of mapped file "<<Suppressed>>".
  373. X
  374. MEMORY DUMP OF MAPPED FILE
  375. X==========================
  376. X
  377. X+-------------------------------------------------+------------------+
  378. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  379. X+-------------------------------------------------+------------------+
  380. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  381. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  382. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  383. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  384. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  385. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  386. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  387. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  388. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  389. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  390. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  391. X+-------------------------------------------------+------------------+
  392. X
  393. Dump of mapped file "<<Suppressed>>".
  394. X
  395. MEMORY DUMP OF MAPPED FILE
  396. X==========================
  397. X
  398. X+-------------------------------------------------+------------------+
  399. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  400. X+-------------------------------------------------+------------------+
  401. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  402. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  403. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  404. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  405. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  406. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  407. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  408. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  409. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  410. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  411. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  412. X+-------------------------------------------------+------------------+
  413. X
  414. Dump of mapped file "<<Suppressed>>".
  415. X
  416. MEMORY DUMP OF MAPPED FILE
  417. X==========================
  418. X
  419. X+-------------------------------------------------+------------------+
  420. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  421. X+-------------------------------------------------+------------------+
  422. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  423. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  424. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  425. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  426. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  427. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  428. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  429. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  430. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  431. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  432. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  433. X+-------------------------------------------------+------------------+
  434. X
  435. Dump of mapped file "<<Suppressed>>".
  436. X
  437. MEMORY DUMP OF MAPPED FILE
  438. X==========================
  439. X
  440. X+-------------------------------------------------+------------------+
  441. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  442. X+-------------------------------------------------+------------------+
  443. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  444. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  445. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  446. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  447. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  448. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  449. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  450. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  451. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  452. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  453. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  454. X+-------------------------------------------------+------------------+
  455. X
  456. Dump of mapped file "<<Suppressed>>".
  457. X
  458. MEMORY DUMP OF MAPPED FILE
  459. X==========================
  460. X
  461. X+-------------------------------------------------+------------------+
  462. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  463. X+-------------------------------------------------+------------------+
  464. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  465. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  466. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  467. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  468. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  469. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  470. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  471. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  472. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  473. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  474. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  475. X+-------------------------------------------------+------------------+
  476. X
  477. Dump of mapped file "<<Suppressed>>".
  478. X
  479. MEMORY DUMP OF MAPPED FILE
  480. X==========================
  481. X
  482. X+-------------------------------------------------+------------------+
  483. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  484. X+-------------------------------------------------+------------------+
  485. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  486. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  487. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  488. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  489. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  490. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  491. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  492. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  493. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  494. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  495. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  496. X+-------------------------------------------------+------------------+
  497. X
  498. Dump of mapped file "<<Suppressed>>".
  499. X
  500. MEMORY DUMP OF MAPPED FILE
  501. X==========================
  502. X
  503. X+-------------------------------------------------+------------------+
  504. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  505. X+-------------------------------------------------+------------------+
  506. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  507. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  508. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  509. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  510. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  511. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  512. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  513. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  514. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  515. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  516. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  517. X+-------------------------------------------------+------------------+
  518. X
  519. Dump of mapped file "<<Suppressed>>".
  520. X
  521. MEMORY DUMP OF MAPPED FILE
  522. X==========================
  523. X
  524. X+-------------------------------------------------+------------------+
  525. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  526. X+-------------------------------------------------+------------------+
  527. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  528. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  529. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  530. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  531. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  532. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  533. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  534. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  535. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  536. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  537. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  538. X+-------------------------------------------------+------------------+
  539. X
  540. Dump of mapped file "<<Suppressed>>".
  541. X
  542. MEMORY DUMP OF MAPPED FILE
  543. X==========================
  544. X
  545. X+-------------------------------------------------+------------------+
  546. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  547. X+-------------------------------------------------+------------------+
  548. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  549. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  550. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  551. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  552. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  553. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  554. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  555. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  556. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  557. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  558. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  559. X+-------------------------------------------------+------------------+
  560. X
  561. Dump of mapped file "<<Suppressed>>".
  562. X
  563. MEMORY DUMP OF MAPPED FILE
  564. X==========================
  565. X
  566. X+-------------------------------------------------+------------------+
  567. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  568. X+-------------------------------------------------+------------------+
  569. X| 53 43 31 34 3A 20 54 65 73 74 20 74 68 61 74 20 | SC14: Test that  |
  570. X| 74 68 65 20 6D 61 78 69 6D 75 6D 20 6E 75 6D 62 | the maximum numb |
  571. X| 65 72 20 6F 66 20 6C 65 76 65 6C 73 20 6F 66 20 | er of levels of  |
  572. X| 69 6E 63 6C 75 64 65 20 66 69 6C 65 20 69 73 20 | include file is  |
  573. X| 31 30 2E 0A 54 68 69 73 20 69 73 20 6D 6F 73 74 | 10..This is most |
  574. X| 20 65 61 73 69 6C 79 20 64 6F 6E 65 20 77 69 74 |  easily done wit |
  575. X| 68 20 61 20 72 65 63 75 72 73 69 76 65 20 69 6E | h a recursive in |
  576. X| 63 6C 75 73 69 6F 6E 2E 0A 0A 42 65 66 6F 72 65 | clusion...Before |
  577. X| 20 74 68 65 20 69 6E 63 6C 75 64 65 0A 40 69 20 |  the include.@i  |
  578. X| 73 63 31 34 2E 66 77 0A 41 66 74 65 72 20 74 68 | sc14.fw.After th |
  579. X| 65 20 69 6E 63 6C 75 64 65 0A                   | e include.       |
  580. X+-------------------------------------------------+------------------+
  581. X
  582. X
  583. X=========================== Start of LINE LIST DUMP ============================
  584. X
  585. Globl Local| Text
  586. X-----------+--------------------------------------------------------------------
  587. X00001 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  588. X00002 00002| This is most easily done with a recursive inclusion.<010>
  589. X00003 00003| <010>
  590. X00004 00004| Before the include<010>
  591. X00005 00005| @i sc14.fw<010>
  592. X00006 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  593. X00007 00002| This is most easily done with a recursive inclusion.<010>
  594. X00008 00003| <010>
  595. X00009 00004| Before the include<010>
  596. X00010 00005| @i sc14.fw<010>
  597. X00011 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  598. X00012 00002| This is most easily done with a recursive inclusion.<010>
  599. X00013 00003| <010>
  600. X00014 00004| Before the include<010>
  601. X00015 00005| @i sc14.fw<010>
  602. X00016 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  603. X00017 00002| This is most easily done with a recursive inclusion.<010>
  604. X00018 00003| <010>
  605. X00019 00004| Before the include<010>
  606. X00020 00005| @i sc14.fw<010>
  607. X00021 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  608. X00022 00002| This is most easily done with a recursive inclusion.<010>
  609. X00023 00003| <010>
  610. X00024 00004| Before the include<010>
  611. X00025 00005| @i sc14.fw<010>
  612. X00026 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  613. X00027 00002| This is most easily done with a recursive inclusion.<010>
  614. X00028 00003| <010>
  615. X00029 00004| Before the include<010>
  616. X00030 00005| @i sc14.fw<010>
  617. X00031 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  618. X00032 00002| This is most easily done with a recursive inclusion.<010>
  619. X00033 00003| <010>
  620. X00034 00004| Before the include<010>
  621. X00035 00005| @i sc14.fw<010>
  622. X00036 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  623. X00037 00002| This is most easily done with a recursive inclusion.<010>
  624. X00038 00003| <010>
  625. X00039 00004| Before the include<010>
  626. X00040 00005| @i sc14.fw<010>
  627. X00041 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  628. X00042 00002| This is most easily done with a recursive inclusion.<010>
  629. X00043 00003| <010>
  630. X00044 00004| Before the include<010>
  631. X00045 00005| @i sc14.fw<010>
  632. X00046 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  633. X00047 00002| This is most easily done with a recursive inclusion.<010>
  634. X00048 00003| <010>
  635. X00049 00004| Before the include<010>
  636. X00050 00005| @i sc14.fw<010>
  637. X00051 00001| SC14: Test that the maximum number of levels of include file is 10.<010>
  638. X00052 00002| This is most easily done with a recursive inclusion.<010>
  639. X00053 00003| <010>
  640. X00054 00004| Before the include<010>
  641. X00055 00005| @i sc14.fw<010>
  642. X00056 00006| After the include<010>
  643. X00057 00006| After the include<010>
  644. X00058 00006| After the include<010>
  645. X00059 00006| After the include<010>
  646. X00060 00006| After the include<010>
  647. X00061 00006| After the include<010>
  648. X00062 00006| After the include<010>
  649. X00063 00006| After the include<010>
  650. X00064 00006| After the include<010>
  651. X00065 00006| After the include<010>
  652. X00066 00006| After the include<010>
  653. X00067 00007| <End-Of-File><010>
  654. X-----------+--------------------------------------------------------------------
  655. Globl Local| Text
  656. X
  657. X============================ End of LINE LIST DUMP =============================
  658. X
  659. X
  660. X=========================== Start of TOKEN LIST DUMP ===========================
  661. X
  662. Summary: There are 23 tokens in the token list.
  663. X
  664. Line[Column]: Token Description
  665. X-------------------------------
  666. X
  667. X0001[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  668. This is most easily done with a recursive inclusion.<010>
  669. X<010>
  670. Before the include<010>
  671. X"
  672. X0006[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  673. This is most easily done with a recursive inclusion.<010>
  674. X<010>
  675. Before the include<010>
  676. X"
  677. X0011[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  678. This is most easily done with a recursive inclusion.<010>
  679. X<010>
  680. Before the include<010>
  681. X"
  682. X0016[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  683. This is most easily done with a recursive inclusion.<010>
  684. X<010>
  685. Before the include<010>
  686. X"
  687. X0021[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  688. This is most easily done with a recursive inclusion.<010>
  689. X<010>
  690. Before the include<010>
  691. X"
  692. X0026[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  693. This is most easily done with a recursive inclusion.<010>
  694. X<010>
  695. Before the include<010>
  696. X"
  697. X0031[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  698. This is most easily done with a recursive inclusion.<010>
  699. X<010>
  700. Before the include<010>
  701. X"
  702. X0036[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  703. This is most easily done with a recursive inclusion.<010>
  704. X<010>
  705. Before the include<010>
  706. X"
  707. X0041[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  708. This is most easily done with a recursive inclusion.<010>
  709. X<010>
  710. Before the include<010>
  711. X"
  712. X0046[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  713. This is most easily done with a recursive inclusion.<010>
  714. X<010>
  715. Before the include<010>
  716. X"
  717. X0051[01]: Text. Text scrap[Grey]="SC14: Test that the maximum number of levels of include file is 10.<010>
  718. This is most easily done with a recursive inclusion.<010>
  719. X<010>
  720. Before the include<010>
  721. X"
  722. X0056[01]: Text. Text scrap[Grey]="After the include<010>
  723. X"
  724. X0057[01]: Text. Text scrap[Grey]="After the include<010>
  725. X"
  726. X0058[01]: Text. Text scrap[Grey]="After the include<010>
  727. X"
  728. X0059[01]: Text. Text scrap[Grey]="After the include<010>
  729. X"
  730. X0060[01]: Text. Text scrap[Grey]="After the include<010>
  731. X"
  732. X0061[01]: Text. Text scrap[Grey]="After the include<010>
  733. X"
  734. X0062[01]: Text. Text scrap[Grey]="After the include<010>
  735. X"
  736. X0063[01]: Text. Text scrap[Grey]="After the include<010>
  737. X"
  738. X0064[01]: Text. Text scrap[Grey]="After the include<010>
  739. X"
  740. X0065[01]: Text. Text scrap[Grey]="After the include<010>
  741. X"
  742. X0066[01]: Text. Text scrap[Grey]="After the include<010>
  743. X"
  744. X0067[01]: End Of File. 
  745. X============================ End of TOKEN LIST DUMP ============================
  746. X
  747. Macro table dump skipped (Parser was not invoked).
  748. Document list dump skipped (Parser was not invoked).
  749. X
  750. Global Local| Input File
  751. X------------+-------------------------------------------------------------------
  752. X     1     1| SC14: Test that the maximum number of levels of include file is 10.
  753. X     2     2| This is most easily done with a recursive inclusion.
  754. X     3     3| 
  755. X     4     4| Before the include
  756. X     5     5| @i sc14.fw
  757. X     6     1| SC14: Test that the maximum number of levels of include file is 10.
  758. X     7     2| This is most easily done with a recursive inclusion.
  759. X     8     3| 
  760. X     9     4| Before the include
  761. X    10     5| @i sc14.fw
  762. X    11     1| SC14: Test that the maximum number of levels of include file is 10.
  763. X    12     2| This is most easily done with a recursive inclusion.
  764. X    13     3| 
  765. X    14     4| Before the include
  766. X    15     5| @i sc14.fw
  767. X    16     1| SC14: Test that the maximum number of levels of include file is 10.
  768. X    17     2| This is most easily done with a recursive inclusion.
  769. X    18     3| 
  770. X    19     4| Before the include
  771. X    20     5| @i sc14.fw
  772. X    21     1| SC14: Test that the maximum number of levels of include file is 10.
  773. X    22     2| This is most easily done with a recursive inclusion.
  774. X    23     3| 
  775. X    24     4| Before the include
  776. X    25     5| @i sc14.fw
  777. X    26     1| SC14: Test that the maximum number of levels of include file is 10.
  778. X    27     2| This is most easily done with a recursive inclusion.
  779. X    28     3| 
  780. X    29     4| Before the include
  781. X    30     5| @i sc14.fw
  782. X    31     1| SC14: Test that the maximum number of levels of include file is 10.
  783. X    32     2| This is most easily done with a recursive inclusion.
  784. X    33     3| 
  785. X    34     4| Before the include
  786. X    35     5| @i sc14.fw
  787. X    36     1| SC14: Test that the maximum number of levels of include file is 10.
  788. X    37     2| This is most easily done with a recursive inclusion.
  789. X    38     3| 
  790. X    39     4| Before the include
  791. X    40     5| @i sc14.fw
  792. X    41     1| SC14: Test that the maximum number of levels of include file is 10.
  793. X    42     2| This is most easily done with a recursive inclusion.
  794. X    43     3| 
  795. X    44     4| Before the include
  796. X    45     5| @i sc14.fw
  797. X    46     1| SC14: Test that the maximum number of levels of include file is 10.
  798. X    47     2| This is most easily done with a recursive inclusion.
  799. X    48     3| 
  800. X    49     4| Before the include
  801. X    50     5| @i sc14.fw
  802. X    51     1| SC14: Test that the maximum number of levels of include file is 10.
  803. X    52     2| This is most easily done with a recursive inclusion.
  804. X    53     3| 
  805. X    54     4| Before the include
  806. X    55     5| @i sc14.fw
  807. X       Error|.^This include file is nested too deeply. It's probably recursive.
  808. X            |.^The maximum level of nested includes is 10.
  809. X            |.^Include ignored.
  810. X    56     6| After the include
  811. X    57     6| After the include
  812. X    58     6| After the include
  813. X    59     6| After the include
  814. X    60     6| After the include
  815. X    61     6| After the include
  816. X    62     6| After the include
  817. X    63     6| After the include
  818. X    64     6| After the include
  819. X    65     6| After the include
  820. X    66     6| After the include
  821. X            | <End-Of-File>
  822. X------------+-------------------------------------------------------------------
  823. X
  824. There was 1 Error.
  825. END_OF_FILE
  826. if test 22685 -ne `wc -c <'answers/sc14.lis'`; then
  827.     echo shar: \"'answers/sc14.lis'\" unpacked with wrong size!
  828. fi
  829. # end of 'answers/sc14.lis'
  830. fi
  831. if test -f 'hackman/h_ch3.tex' -a "${1}" != "-c" ; then 
  832.   echo shar: Will not clobber existing file \"'hackman/h_ch3.tex'\"
  833. else
  834. echo shar: Extracting \"'hackman/h_ch3.tex'\" \(25736 characters\)
  835. sed "s/^X//" >'hackman/h_ch3.tex' <<'END_OF_FILE'
  836. X%==============================================================================%
  837. X%                              Start of Ch3.tex                                %
  838. X%==============================================================================%
  839. X%
  840. X% Copyright
  841. X% ---------
  842. X% Copyright (C) 1992 Ross N. Williams.
  843. X% This file contains a chapter of the FunnelWeb Hacker's Manual.
  844. X% See the main TeX file for this manual for further information.
  845. X%
  846. X%==============================================================================%
  847. X
  848. X\chapter{FunnelWeb Modification}
  849. X\label{chapmod}\xx{FunnelWeb}{modification}
  850. X
  851. X\section{Introduction}
  852. X
  853. This chapter deals with modifications to FunnelWeb. Although the
  854. GNU license\xx{GNU}{license}
  855. under which FunnelWeb is distributed allows anyone to
  856. modify FunnelWeb and distribute the modified versions, there are a number of
  857. dangers in doing this. This chapter explains the dangers and presents
  858. some issues that you should think about if you intend to
  859. distribute modified versions of FunnelWeb.
  860. X
  861. X\section{The Danger of Modifying Languages}
  862. X\xx{changes}{dangers}\xx{languages}{dangers}
  863. X
  864. Whenever someone modifies a computer program they should always ask
  865. themselves \dq{what is the impact of these changes going to be on
  866. users}. For mature products, the degree of impact is largely determined
  867. by the investment that users have made in particular file formats
  868. supported by the product.
  869. X
  870. At the two extremes, there are the video game\x{video game} and the
  871. compiler.\x{compiler}
  872. If one changes a video game, the change affects only the future games
  873. played. However, if one changes a compiler in particular ways,
  874. it is likely that thousands of users will be forced to change millions
  875. of source files to accommodate the new version. Thus the impact of changes
  876. to a program depends largely on the investment made by users, in
  877. source files, training, and even muscle memory!
  878. X
  879. XFunnelWeb lies very much at the compiler end of this spectrum. In fact
  880. it lies even further. Not only does it implement a language, but it is
  881. currently the \i{only} implementation of that language! This means that,
  882. although they shouldn't, people will be tempted to treat the FunnelWeb
  883. program as the definition of its input language instead of
  884. the definition chapter in the \i{FunnelWeb User's Manual},
  885. which takes precedence.
  886. X
  887. Because FunnelWeb defines an input language, and people will write programs
  888. using that language, particular kinds of changes in the language will
  889. impact severely on users. Three different kinds of change are discussed
  890. below.
  891. X
  892. X\narrowthing{Removing features:}{Removal\xx{removing}{features}
  893. of features (featurectomy) is extremely
  894. difficult once the user base has started using them. If a feature is
  895. removed, users of the program will have to go through all their
  896. programs and find a way to simulate the effect of the removed feature
  897. with other features. Often this is so unthinkable, that bad language
  898. constructs are tolerated far beyond their useful lifetime.}
  899. X
  900. X\narrowthing{Modifying features:}{Modification\xx{features}{modification}
  901. of features has less
  902. direct impact than the removal of features, but can cause more subtle errors.
  903. XFor example, consider the sorts of subtle errors that might arise if the
  904. semantics of the FunnelWeb comment \p{@!} were changed so that it no
  905. longer includes the end of line marker. Anyone modifying features should
  906. be sure that they are not inadvertently laying traps.}
  907. X
  908. X\narrowthing{Adding features:}{Although\xx{features}{adding}
  909. the addition of features is
  910. generally the most painless for the user community, as Hoare points
  911. out, it is also the most dangerous in the long run.}
  912. X
  913. X\begin{quotation}
  914. X\dq{When any new language design project is nearing completion, there is
  915. always a mad rush to get new features added before standardization.
  916. The rush is mad indeed, because it leads into a trap from which there is
  917. no escape. A feature which is omitted can always be added later, when its
  918. design and its implications are well understood. A feature which is
  919. included before it is fully understood can never be removed
  920. later.}\paper{Hoare80}
  921. X\end{quotation}
  922. X
  923. These problems exist even when there is a central authority.
  924. If we consider the case where there is no central authority, and
  925. users modify a language and its implementations and distribute the
  926. modified versions, the result is even worse. For a start, the
  927. structure of the genealogy of the program\xx{genealogy}{program}
  928. changes from a list to a tree.
  929. This makes it impossible to impose an ordering on the different versions
  930. and makes it difficult to merge them once they diverge. Second, it
  931. reduces the portability of files created under different versions.
  932. Third, it makes adding features hazardous. If a feature is added in
  933. one version, files will be created that use it. These files will
  934. immediately become non-portable. Furthermore, two programmers may
  935. introduce different features that use the same syntactical constructs,
  936. thus preventing the two versions from ever being merged. Worse, two
  937. programmers could introduce \i{similar} features that use the
  938. same syntactical constructs, producing even more subtle problems.
  939. X
  940. The only way to avoid all these problems is to create some sort of
  941. central design authority,\xx{design}{authority}
  942. X(or, at the very least, some sort of design
  943. synchronization) that controls the language and its implementation.
  944. X
  945. The benefits of tight control over the language are enormous.
  946. X
  947. X\narrowthing{Universal portability:}{Source files can be treated as portable.
  948. If all the language
  949. implementations in the world are singing the same tune, then someone
  950. in Sydney could send a file to someone in New York and be
  951. sure that it will be successfully processed.}
  952. X
  953. X\narrowthing{Clear semantics:}{Doubt about the semantics of the
  954. language will be greatly minimized.
  955. So long as more than one slightly differing version of a language exists,
  956. there will be confusion over the semantics of its constructs. A good
  957. example is the confusion between the AT\&T Unix\x{Unix}
  958. and Berkeley Unix shell languages.}
  959. X
  960. While changes to the language supported by a piece of software is the
  961. most serious problem associated with multiple versions of software,
  962. the lesser problem of keeping track of changes that don't affect the
  963. language that the software implements can also cause trouble. Merging
  964. different versions of software is extremely tedious as anyone who
  965. has tried it will verify. However, changes not affecting the
  966. language are far less serious because they impact only on the program
  967. itself, not on the far more numerous source files that depend on it.
  968. X
  969. X\section{Authority vs User Security}
  970. X\xx{security}{authority}
  971. X
  972. There are a number of ways of providing the
  973. strong central design authority required to produce
  974. the portability and semantic security desired by users,
  975. X
  976. X\begin{itemize}
  977. X
  978. X\item Trade mark\x{trademark}
  979. the name of the language. Publish a specification of the
  980. language under the trade name. Warn all users not to trust any
  981. implementation that does not guarantee that it implements the language.
  982. Then control implementations by only licensing the trade mark to conforming
  983. implementations.
  984. X
  985. X\item Create a single implementation of the language. Do not release
  986. the source code to the implementation. Release only binary executables.
  987. X
  988. X\item Release the source code to the implementation, but under a license
  989. that prohibits the distribution of modified versions.
  990. X
  991. X\end{itemize}
  992. X
  993. Many other variations on these themes are possible, but they are all
  994. based on the idea of regulating either the \dq{official}
  995. definition of the language
  996. or all of its existing implementations.
  997. X
  998. At about this stage, a conflict arises. While users want the language
  999. they are using to be tightly controlled, they also want to feel secure
  1000. about the availability of its implementations. If hundreds of source
  1001. files are to be created in the language, there had better be one or
  1002. more translators available when the time comes to use them.
  1003. X
  1004. In the case of widely-used programming languages such as~C, the problem of
  1005. securing implementations does not arise. If you don't get your
  1006. compiler from Borland, you can get it from Microsoft. However, in the
  1007. case of a newly introduced language such as FunnelWeb, there may be
  1008. very few implementations, or even just one implementation,
  1009. and this poses a danger to the
  1010. user who is committing to that format. Despite the best intentions of the
  1011. copyright owner, there are a variety of ways in which a computer
  1012. program can suddenly become
  1013. unavailable.\xx{program}{availability} Here are some examples:
  1014. X
  1015. X\begin{itemize}
  1016. X
  1017. X\item If the program is owned by a company and the company goes broke,
  1018. the liquidators may not bother to place the software in the public domain.
  1019. X
  1020. X\item If the program is owned by a kindly individual who issues licenses
  1021. for free, and that individual suddenly dies, users might suddenly find
  1022. themselves negotiating with hard-nosed estate executors for the rights
  1023. to continue using the program.
  1024. X
  1025. X\item If whoever owns the program does not upgrade the program every so
  1026. often, it is actually possible for the released
  1027. executables to \dq{expire} when new operating system upgrades appear.
  1028. X
  1029. X\end{itemize}
  1030. X
  1031. These possibilities mean that users about to invest in a newly
  1032. introduced programming
  1033. tool such as FunnelWeb have legitimate concerns when they worry
  1034. about the tool's availability. For non-commercially
  1035. distributed  tools such as FunnelWeb, the simplest solution to this
  1036. problem is to make the source code available, either by placing it
  1037. into the public domain, or by releasing it under some kind of
  1038. public license, such as a GNU license.
  1039. The trouble with releasing the source code
  1040. is that it removes control from the design
  1041. authority. Once the code is \dq{out} there is no stopping anyone
  1042. from modifying the program and distributing modified versions.
  1043. All chaos can ensue.
  1044. X
  1045. One solution to this conflict is to take the trade mark approach. This
  1046. separates the right of the design authority to control the language and
  1047. its implementations, and the right of the users to use the source
  1048. code in any way they like (but they may have to change its name!).
  1049. However, the trade mark approach is expensive.
  1050. X
  1051. The solution that I (Ross Williams (\p{ross@spam.adelaide.edu.au}))
  1052. have adopted is to release the FunnelWeb source code under a GNU license
  1053. and then to write this chapter in the \i{FunnelWeb
  1054. Hacker's Manual} to dissuade possible hackers from
  1055. releasing modified versions under the FunnelWeb name.
  1056. This is about as close to the GNU/trademark approach
  1057. I can get without forking out about \$1200 for a US trademark
  1058. or paying even more to get a lawyer to attempt to draft a contract
  1059. stating \dq{thou shalt not modify the FunnelWeb language}.
  1060. X
  1061. X\section{What I Want to Protect}
  1062. X\xx{protection}{FunnelWeb}\xx{protection}{file extension}
  1063. X
  1064. The concerns expressed in the previous section about modifications to the
  1065. XFunnelWeb program do not preclude modifications. They merely imply that
  1066. some conditions be observed when modifications are made.
  1067. In fact,
  1068. having formally released the sources under GNU, there is nothing that
  1069. I can do to stop people distributing modified versions and the conditions
  1070. to be described must be imposed voluntarily.
  1071. X
  1072. In the end there are two things that I want to protect/maintain:
  1073. X
  1074. X\begin{enumerate}
  1075. X
  1076. X\item Restriction of the name \dq{FunnelWeb} only to computer programs
  1077. that exactly implement my \dq{official} definition of the language.
  1078. X
  1079. X\item Restriction of the FunnelWeb source file extensions \dqp{.fw}
  1080. X(input files) and \dqp{.fwi} (include files) only
  1081. to source files that conform to my \dq{official} definition of the
  1082. language.
  1083. X
  1084. X\end{enumerate}
  1085. X
  1086. So long as these conditions hold, source files created under \dq{FunnelWeb}
  1087. will be portable, and the language will have the potential to
  1088. be stable and well-defined. Here are my suggestions for how to
  1089. obey these rules. These suggestions are in addition to the GNU license
  1090. rules about documenting any changes that you make in the source files.
  1091. X
  1092. X\narrowthing{Modifications that do not affect functionality:}{If you
  1093. change the FunnelWeb program in a manner that does not
  1094. affect the functionality of the program in any way (\eg{}port
  1095. it to a new machine, or just speed it up),
  1096. then you should modify the program to write out a message when it
  1097. starts up saying that
  1098. it is a modified version of FunnelWeb. No other actions need be taken.}
  1099. X
  1100. X\narrowthing{Modifications that affect functionality:}{If you make changes
  1101. to FunnelWeb that affect its functionality (\eg{}changes to command line
  1102. options, the command language, or the input language)
  1103. you should change the name of the program so that the name
  1104. no longer contains the word
  1105. X\dq{FunnelWeb}, and should choose alternative input and include-file
  1106. file extensions (the current ones are \dqp{.fw} and \dqp{.fwi}). For example,
  1107. you might call your program \dq{BananaWeb} and use the file extensions
  1108. X\dqp{.bw} and \dqp{.bwi}.}
  1109. X
  1110. These rules are not very restrictive. Basically you can do what you like
  1111. so long as you change the name of the resulting program. I do not wish to
  1112. restrict anyone who might want to use FunnelWeb as a foundation for a more
  1113. sophisticated literate programming system. My sole aim here is to
  1114. protect the integrity of what already exists.
  1115. X
  1116. X\section{Modifying the Manuals}
  1117. X\xx{modifying}{manuals}
  1118. X
  1119. While it is permitted to modify the FunnelWeb program, no license has been
  1120. granted
  1121. to modify its documentation (\i{The FunnelWeb User's Manual} and
  1122. X\i{The FunnelWeb Hacker's Manual}). The only operation that can be
  1123. performed on the FunnelWeb documentation is a verbatim copy in any medium.
  1124. X
  1125. If you have created a modified version of FunnelWeb and wish to document it,
  1126. either write your own manual from scratch, or write a manual that can be
  1127. used in conjunction with the existing manuals.
  1128. X
  1129. X\section{How Copyright Law Works}
  1130. X\xx{copyright}{law}
  1131. X
  1132. In order to understand the next section, some understanding of copyright
  1133. law is required. The assertions made in this section are not legal opinions;
  1134. they are merely approximations of the law, based on my understanding of it.
  1135. X
  1136. By default, whoever creates a \newterm{work} owns \newterm{copyright}
  1137. over it. This means that by default, that person is the only person in the
  1138. world who has the legal right to make copies of the work.
  1139. X
  1140. Copyright over a work usually covers all direct derivations of this work.
  1141. XFor example, if someone owns the source code to a computer program
  1142. then they also own any direct derivations such as the binary executable.
  1143. X
  1144. More than one person may own copyright over a work. If this is the case,
  1145. then the work cannot be copied without the permission of all of the people
  1146. owning the copyright.
  1147. X
  1148. A person (or group) owning copyright over a work
  1149. can \newterm{license} the right to make copies
  1150. of the work to anyone he likes under any conditions he likes.
  1151. X
  1152. If a work is modified, the result is called a \newterm{derived work}.
  1153. X
  1154. If copyright on a work is owned by $A$ is the work is modified by $B$,
  1155. copyright on the derived work is owned by both $A$ and $B$.
  1156. X
  1157. Copyright is not ownership over particular configurations of information,
  1158. but rather is the right to restrict the copying of information derived
  1159. from particular sources. For example, if two people point their cameras
  1160. out a window and take identical photographs, each person has the right
  1161. to restrict the copying of \i{their} photograph regardless of the
  1162. fact that the other person has copyright over an identical photograph.
  1163. In the unlikely event that two people wrote
  1164. novels that were letter for letter identical and it could be proven that
  1165. there was no contact between the two people when they wrote the novels,
  1166. then copyright law would each protect the right of each person to
  1167. restrict the copying of the novel originating from \i{them}. In practice,
  1168. the probability of such an event occurring is so low that the law
  1169. assumes that if two works are close or identical, that there has been
  1170. some information interchange at some point.
  1171. X
  1172. Thus, if I own copyright on computer program $X$, and I create
  1173. an identical copy of $X$
  1174. called $Y$ and distribute it under the terms of a license agreement,
  1175. then that license agreement does not cover the copy $X$. Once the
  1176. license agreement is signed, there is nothing I can do to undo the
  1177. license; $Y$ has gone. However, I still have total control over $X$.
  1178. X
  1179. Version~2 of the GNU General Public License\xx{GNU}{license}
  1180. X(under which FunnelWeb is
  1181. released) specifies (in a nutshell) that software can be copied freely
  1182. so long as it is not sold, and that it can be modified and copied
  1183. freely so long as the modifications are logged and it is not sold.
  1184. In both cases, it requires that the
  1185. result of the copy or modification operation
  1186. be copied only under the conditions of the license.
  1187. X
  1188. Once a declaration is issued licensing a copy of a program under GNU
  1189. license, that license cannot be retracted.
  1190. X
  1191. X\section{Management of the Official FunnelWeb}
  1192. X\xx{FunnelWeb}{management}\xx{FunnelWeb}{official}
  1193. X
  1194. I intend to maintain an official copy of FunnelWeb and release it under
  1195. GNU license from time to time so that everyone can use it. Unfortunately
  1196. its going to be a little messy.
  1197. X
  1198. XFor a variety of reasons, I want to maintain
  1199. total control over \i{my} copy of the official version of FunnelWeb.
  1200. Some of the reasons are:
  1201. X
  1202. X\begin{itemize}
  1203. X
  1204. X\item If it turns out that there is an enormous demand for
  1205. XFunnelWeb (unlikely) then
  1206. I want to be able to create a business based on it, or at least
  1207. be able to bundle it with other products.
  1208. This would be difficult if the only up-to-date copy available was a GNU copy.
  1209. Note: If this happens, all the GNU releases of FunnelWeb will remain
  1210. valid.
  1211. X
  1212. X\item I want to be able to copy code from my version of FunnelWeb
  1213. into commercial products without having to worry about the GNU license.
  1214. X
  1215. X\end{itemize}
  1216. X
  1217. The trouble is that (in my understanding of copyright law),
  1218. once a copy of FunnelWeb has been released under GNU license, then it
  1219. and any works derived from it fall under GNU license too. This means that
  1220. if you modify a GNU release of 
  1221. XFunnelWeb and send me your modifications, and I incorporate
  1222. them into my version, then I no longer own copyright on the version I
  1223. modified. Basically, if GNU touches a work, then that copy is gone forever.
  1224. X
  1225. My solution to the problem is to keep a copy of FunnelWeb that is
  1226. GNU-clean and only make modifications to it that are GNU-clean. So
  1227. long as my official copy is GNU clean, any modifications that I make
  1228. myself will be GNU clean. The problem comes when someone else modifies
  1229. the GNU version and then wants me to incorporate the modifications into
  1230. my official version. As I understand the law, by default, the programmer
  1231. owns the modifications (because he made them), but the result of making
  1232. the modifications falls under GNU license. What I propose is that those
  1233. who want their modifications included in the official copy of FunnelWeb
  1234. sign an agreement transferring copyright of the modifications over to
  1235. me on condition that the result be released under GNU license within
  1236. a certain time period. \figlicense{} demonstrates the process.
  1237. X
  1238. X\begin{figure}[htbp]
  1239. X\begin{verbatim}
  1240. X
  1241. X  +---------->----------+--------------<-------------+
  1242. X  |(modifications by    |                            |
  1243. X  | me)                 V                            |
  1244. X  |     +----------------------------------+         |
  1245. X  +--<--|  My Official Copy of FunnelWeb   |         |
  1246. X        |   Copyright (C) Ross Williams    |         |
  1247. X        +----------------------------------+         |
  1248. X                        | (Periodic releases)       / \
  1249. X                        V                          /   \  Programmers
  1250. X              +------------------+                /Legal\ sign away
  1251. X              | GNU Release Copy |                \Filte/ copyright on
  1252. X              +------------------+                 \ r /  modifications
  1253. X                        |                           \ /
  1254. X                        | (Modifications made by     |
  1255. X                        V  random programmers) --->--+
  1256. X             +-----------------------+
  1257. X             | Modified GNU Version  |
  1258. X             +-----------------------+
  1259. X
  1260. X\end{verbatim}
  1261. X\mylabel{\figlicense{}: How I am going to maintain copyright over FunnelWeb.}{%
  1262. X%
  1263. Once a work is released under GNU license, all derived works fall under
  1264. GNU license. However, this diagram shows how copyright can be maintained
  1265. over a work, while still making it available under GNU license.
  1266. Unfortunately, this scheme requires that copyright on
  1267. modifications to FunnelWeb be signed off by the people who make the
  1268. modifications.
  1269. X%
  1270. X}
  1271. X\end{figure}
  1272. X
  1273. There are two main disadvantages to this scheme:
  1274. X
  1275. X\begin{enumerate}
  1276. X
  1277. X\item Getting each person who contributes modifications to FunnelWeb
  1278. to sign and send a piece of paper signing away copyright will be tedious.
  1279. X
  1280. X\item Programmers may be reluctant to sign away copyright on modifications
  1281. because the result could be used by me for commercial purposes
  1282. by me at a later date (Note: But it must be released under GNU as well).
  1283. X
  1284. X\end{enumerate}
  1285. X
  1286. These disadvantages are regrettable consequences of my decision to retain
  1287. total control over the \dq{official} version of FunnelWeb.
  1288. X
  1289. The upshot of all this is that:
  1290. X
  1291. X\begin{itemize}
  1292. X
  1293. X\item I will never allow any code from a GNU release of FunnelWeb to
  1294. touch my official copy. Only modifications will be acceptable.
  1295. X
  1296. X\item If you make a modification to FunnelWeb and send it to me for
  1297. inclusion in the official version, I will not incorporate your
  1298. modification until I have received a signed declaration transferring copyright.
  1299. I will prepare such a contract when the first person sends me a worthy
  1300. modification!
  1301. X
  1302. X\item If you intend to make changes to FunnelWeb that are so massive that they
  1303. will involve wide-scale modification of the source files, and you want
  1304. the modification to be part of the official version,
  1305. it might be a good idea to contact me before doing so. There are two
  1306. reasons for doing this. First, it allows me a chance to comment on your
  1307. proposed modifications and give my opinion on whether they are likely to be
  1308. incorporated into the official version. Second, I can send you a copy
  1309. X(under special license) of the GNU-clean official version to work on. This will
  1310. allow you to ship back your changes as files rather than as change sections.
  1311. X
  1312. X\end{itemize}
  1313. X
  1314. As a separate point from the legal issues, I am likely to turn out to be
  1315. pretty picky about what modifications I will incorporate into the
  1316. official copy. Whether a modification will be accepted will depend,
  1317. amongst other things, on the following criteria.
  1318. X
  1319. X\begin{itemize}
  1320. X
  1321. X\item Does the modification fit in with the design goals of FunnelWeb, or
  1322. is it just a case of creeping featurism?
  1323. X
  1324. X\item How well coded is the modification? Would it reduce the quality of the
  1325. code?
  1326. X
  1327. X\item If the modification changes FunnelWeb's functionality, is this a
  1328. desirable change? How will it impact on existing users?
  1329. X
  1330. X\item Would it be quicker for me to make the modification myself than
  1331. to work out how to incorporate the submitted modification?
  1332. X
  1333. X\end{itemize}
  1334. X
  1335. It is my goal to guard the integrity of the design and code of the
  1336. official version of FunnelWeb and so I will probably be rather
  1337. fussy about what I regard as a worthwhile modification. I do not wish to
  1338. lose control of the code, either technically or legally.
  1339. X
  1340. X\section{A GNU Version?}
  1341. X\xx{GNU}{version}
  1342. X
  1343. The controls on the official version of FunnelWeb described in the previous
  1344. section will have at most a minor impact on FunnelWeb development if
  1345. XFunnelWeb already serves the needs of most of its users. However, if it
  1346. turns out that FunnelWeb is both popular, \i{and} needs
  1347. widespread modifications and enhancements, then the official feedback loop
  1348. described in the previous section will become unworkable, and there will be
  1349. a GNU breakout.
  1350. X
  1351. A \newterm{GNU breakout}\xs{breakout}{GNU}
  1352. will occur if FunnelWeb users become
  1353. organized enough and annoyed enough (at the official development cycle)
  1354. to start maintaining a coherent version of FunnelWeb that
  1355. diverges from the official version.
  1356. If a GNU breakout occurs, I would appreciate, as requested earlier, that
  1357. a different name and file extensions be chosen for the diverging version.
  1358. X
  1359. X\section{Summary}
  1360. X
  1361. Decentralized modifications to a programming language and its implementations
  1362. can seriously damage the language's portability and semantic clarity.
  1363. Unfortunately, there is a tension between centralizing control of a
  1364. programming language and providing source code security to nervous users.
  1365. In FunnelWeb, this trade-off has been resolved to some extent by
  1366. releasing the source code along with a request
  1367. that if the functionality of the program is modified,
  1368. that the program's name be changed and a different file
  1369. extension be chosen for input files created under the modified program.
  1370. The author of FunnelWeb has decided to maintain an official version of
  1371. XFunnelWeb over which he will own copyright, but which he will release
  1372. under GNU license from time to time. This means that copyright
  1373. on all changes to FunnelWeb must be signed over to the author before they
  1374. have a chance of being incorporated in the official version. Finally, it is
  1375. possible that this reluctance of the author to remove his copyrighted
  1376. version from the development cycle of the official version
  1377. will result in a GNU breakout in which a diverging GNU
  1378. version of FunnelWeb will be maintained by the GNU community. The author
  1379. hopes this won't be necessary and requests,
  1380. if this happens, that the diverging GNU version be renamed.
  1381. X
  1382. X%==============================================================================%
  1383. X%                              Start of Ch3.tex                                %
  1384. X%==============================================================================%
  1385. END_OF_FILE
  1386. if test 25736 -ne `wc -c <'hackman/h_ch3.tex'`; then
  1387.     echo shar: \"'hackman/h_ch3.tex'\" unpacked with wrong size!
  1388. fi
  1389. # end of 'hackman/h_ch3.tex'
  1390. fi
  1391. if test -f 'sources/data.h' -a "${1}" != "-c" ; then 
  1392.   echo shar: Will not clobber existing file \"'sources/data.h'\"
  1393. else
  1394. echo shar: Extracting \"'sources/data.h'\" \(26371 characters\)
  1395. sed "s/^X//" >'sources/data.h' <<'END_OF_FILE'
  1396. X/*##############################################################################
  1397. X
  1398. XFUNNNELWEB COPYRIGHT
  1399. X====================
  1400. XFunnelWeb is a literate-programming macro preprocessor.
  1401. X
  1402. Copyright (C) 1992 Ross N. Williams.
  1403. X
  1404. X   Ross N. Williams
  1405. X   ross@spam.adelaide.edu.au
  1406. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1407. X
  1408. This program is free software; you can redistribute it and/or modify
  1409. it under the terms of Version 2 of the GNU General Public License as
  1410. published by the Free Software Foundation.
  1411. X
  1412. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1413. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1414. See Version 2 of the GNU General Public License for more details.
  1415. X
  1416. You should have received a copy of Version 2 of the GNU General Public
  1417. License along with this program. If not, you can FTP the license from
  1418. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1419. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1420. X
  1421. Section 2a of the license requires that all changes to this file be
  1422. recorded prominently in this file. Please record all changes here.
  1423. X
  1424. Programmers:
  1425. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1426. X
  1427. Changes:
  1428. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1429. X
  1430. X##############################################################################*/
  1431. X
  1432. X
  1433. X/******************************************************************************/
  1434. X/*                                    DATA.H                                  */
  1435. X/******************************************************************************/
  1436. X/*                                                                            */
  1437. X/* This package (data.h, data.c) contains ALL of the global variables in      */
  1438. X/* FunnelWeb. Some of the FunnelWeb packages (e.g. the lister) harbour hidden */
  1439. X/* static state variables which could be considered to be a global variable,  */
  1440. X/* but, these aside, this package contains all the variables that are used    */
  1441. X/* directly by more than one package. In many programs, it would likely be    */
  1442. X/* appropriate to have a separate package for each distinct group of shared   */
  1443. X/* data so that only those packages needing a particular group of data need   */
  1444. X/* see it. However, in FunnelWeb's case, the variables are so few, and their  */
  1445. X/* use so widespread that they are clustered here in one package for all to   */
  1446. X/* see.                                                                       */
  1447. X/*                                                                            */
  1448. X/* This package also contains type definitions for the central FunnelWeb data */
  1449. X/* structures.                                                                */
  1450. X/*                                                                            */
  1451. X/******************************************************************************/
  1452. X
  1453. X/* Ensure that the body of this header file is included at most once.         */
  1454. X#ifndef DONE_DATA
  1455. X#define DONE_DATA
  1456. X
  1457. X/******************************************************************************/
  1458. X
  1459. X#include <stdio.h>
  1460. X#include <stdlib.h>
  1461. X#include <limits.h>
  1462. X#include "style.h"
  1463. X#include "clock.h"
  1464. X#include "list.h"
  1465. X#include "table.h"
  1466. X#include "option.h"
  1467. X#include "section.h"
  1468. X#include "writfile.h"
  1469. X
  1470. X/******************************************************************************/
  1471. X/*                                                                            */
  1472. X/* DATA TYPES                                                                 */
  1473. X/* ==========                                                                 */
  1474. X/* The following section contains all the data types of the global variables. */
  1475. X/*                                                                            */
  1476. X/******************************************************************************/
  1477. X
  1478. X/* The following structure defines a position in the global listing of the    */
  1479. X/* input data by storing a line number and a column number. The line number   */
  1480. X/* is a global line number meaning that it increases continuously through     */
  1481. X/* the lines of included files. The first line is line number 1. The first    */
  1482. X/* (leftmost) column is column number 1.                                      */
  1483. typedef
  1484. X   struct
  1485. X     {
  1486. X      ulong ps_line;
  1487. X      ulong ps_column;
  1488. X     } ps_t ;
  1489. X
  1490. typedef ps_t *p_ps_t;  /* A pointer to a position is handy too! */
  1491. X
  1492. X/******************************************************************************/
  1493. X
  1494. X/* A macro name is represented simply as a character array. */
  1495. X#define NAME_MAX 80
  1496. typedef char name_t[NAME_MAX+1];
  1497. typedef name_t *p_name_t;
  1498. X
  1499. X/******************************************************************************/
  1500. X
  1501. X/* SC stands for SCrap of text. A scrap of text is a contiguous group of      */
  1502. X/* printable bytes in memory. The following structure defines such a group by */
  1503. X/* storing a pointer to the first and last character of the scrap.            */
  1504. X/* The scrap must contain at least one character (i.e. sc_last>=sc_first).    */
  1505. typedef
  1506. X   struct
  1507. X     {
  1508. X      char *sc_first; /* Pointer to the first byte of the scrap.              */
  1509. X      char *sc_last;  /* Pointer to the last  byte of the scrap.              */
  1510. X      bool  sc_white; /* TRUE iff the scrap consists entirely of whitespace.  */
  1511. X     } sc_t;
  1512. X
  1513. typedef sc_t *p_sc_t;
  1514. X
  1515. X/******************************************************************************/
  1516. X
  1517. X/* LN stands for LiNe. This record holds global and local line numbers as     */
  1518. X/* well as a scrap that points to the line in question. The scanner (which    */
  1519. X/* generates this list) guarantees that the last character of the line scrap  */
  1520. X/* is an EOL.                                                                 */
  1521. typedef
  1522. X   struct
  1523. X     {
  1524. X      sc_t  ln_body;    /* Scrap pointing to the line. Line ends in EOL.      */
  1525. X      ulong ln_global;  /* Global line number of this line.                   */
  1526. X      ulong ln_local;   /* Local  line number of this line.                   */
  1527. X     } ln_t;
  1528. X
  1529. X/* The global line list is simply a list of lines of the following type.      */
  1530. typedef p_ls_t p_lnls_t;
  1531. X
  1532. X/******************************************************************************/
  1533. X
  1534. X/* The following enumerated type identifies a font. */
  1535. X#define FT_NORM 1
  1536. X#define FT_TITL 2
  1537. X#define FT_STIT 3
  1538. X
  1539. X/* The following enumerated type identifies a horizontal alignment. */
  1540. X#define LR_LEFT 1
  1541. X#define LR_RIGH 2
  1542. X#define LR_CENT 3
  1543. X
  1544. X/* We want to pack a font and an alignment into the tk_gen byte of the token  */
  1545. X/* record (we could create a new field, but as none of the other token kinds  */
  1546. X/* require an extra field, we choose to pack instead. The formula is this:    */
  1547. X/* Packed byte=LRFT_PACK*FONT+ALIGNMENT.                                      */
  1548. X#define LRFT_PACK 10
  1549. X
  1550. X/******************************************************************************/
  1551. X
  1552. X/* The following enumerated type identifies the kind of a token. */
  1553. X#define TK_TEXT  1   /*      Text segment.          */
  1554. X#define TK_NSEC  2   /*  @A..New section.           */
  1555. X#define TK_MDEF  3   /*  @$  Macro definition.      */
  1556. X#define TK_FDEF  4   /*  @F  File definition.       */
  1557. X#define TK_ONAM  5   /*  @<  Open name.             */
  1558. X#define TK_CNAM  6   /*  @>  Close name.            */
  1559. X#define TK_ODEF  7   /*  @{  Open definition.       */
  1560. X#define TK_CDEF  8   /*  @}  Close definition.      */
  1561. X#define TK_OPAR  9   /*  @(  Open parameter list.   */
  1562. X#define TK_CPAR 10   /*  @)  Close parameter list.  */
  1563. X#define TK_COMA 11   /*  @,  Comma.                 */
  1564. X#define TK_QUOT 12   /*  @"  Quote.                 */
  1565. X#define TK_PARM 13   /*  @1  Parameter.             */
  1566. X#define TK_ZERO 14   /*  @Z  Zero calls allowed.    */
  1567. X#define TK_MANY 15   /*  @M  Many calls allowed.    */
  1568. X#define TK_NAME 16   /*  @#  Self contained name.   */
  1569. X#define TK_EMPH 17   /*  @/  Emphasize text.        */
  1570. X#define TK_NPAG 18   /*  @t..Newpage.               */
  1571. X#define TK_TOCS 19   /*  @t..Table of contents.     */
  1572. X#define TK_SKIP 20   /*  @t..Vertical skip.         */
  1573. X#define TK_TITL 21   /*  @t..Title text.            */
  1574. X#define TK_EOF  22   /*      End of file.           */
  1575. typedef ubyte tk_k_t;
  1576. X
  1577. X/* The following structure conveys all the information about a single token.  */
  1578. X/* As well as the kind of token, the parser needs to know where the token is  */
  1579. X/* in the input file and what the text of the token is if it is a text token. */
  1580. X/* Some other tokens have a numeric attribute associated with them and the    */
  1581. X/* tk_gen field provides a place for this. The attributes are:                */
  1582. X/*    TK_PARM - The number of the parameter [1,9].                            */
  1583. X/*    TK_NAME - The number of the character forming the name [0,255].         */
  1584. X/*    TK_NSEC - The level of the section [0,5]. 0=@*, 1=@A, 2=@B,..,5=@E.     */
  1585. X/*    TK_SKIP - Number of millimetres to skip vertically [0,255].             */
  1586. X/*    TK_TITL - Font and alignment packed into byte as specified earlier.     */
  1587. X/*              tk_sc is the text to be set as a title.                       */
  1588. typedef
  1589. X   struct
  1590. X     {
  1591. X      tk_k_t tk_kind;  /* Kind of this token.                                 */
  1592. X      ps_t   tk_ps;    /* Position of the first character of this token.      */
  1593. X      sc_t   tk_sc;    /* Scrap constituting token.                           */
  1594. X      ubyte  tk_gen;   /* General token attribute.                            */
  1595. X     } tk_t;
  1596. X
  1597. typedef p_ls_t p_tkls_t;  /* A list of tokens. */
  1598. X
  1599. X/******************************************************************************/
  1600. X
  1601. typedef p_ls_t p_scls_t;  /* List of scraps.                                  */
  1602. typedef p_ls_t p_scll_t;  /* List of list of scraps =TEXT.                    */
  1603. X
  1604. typedef p_ls_t p_ells_t;  /* List of pointers to elements = EXPRESSION.       */
  1605. typedef p_ls_t p_elll_t;  /* List of list of pointers to elements.            */
  1606. typedef p_ls_t p_ell3_t;  /* List of list of list of pointers to elements.    */
  1607. X
  1608. X/******************************************************************************/
  1609. X
  1610. X/* This structure's signature is BP for Body Part. FunnelWeb macros can       */
  1611. X/* be defined in a series of "+=" definitions scattered through the input     */
  1612. X/* file. The definition of the macro is the concatenation of all the parts.   */
  1613. X/* The contributory part of a part consists of a single expression.           */
  1614. X/* Throughout the document, body parts (definition parts) are numbered        */
  1615. X/* sequentially by a sequence number.                                         */
  1616. typedef
  1617. X   struct
  1618. X    {
  1619. X     p_ells_t bp_ex;  /* Expression that is logically appended to definition. */
  1620. X     ulong    bp_seq; /* Sequence number of body part.                        */
  1621. X     ps_t     bp_ps;  /* Position at which the definition appears.            */
  1622. X    } bp_t;
  1623. X
  1624. typedef bp_t *p_bp_t;
  1625. X
  1626. X/* A list of body parts constitutes the full body of a macro. */
  1627. typedef p_ls_t p_bpls_t;
  1628. X
  1629. X/******************************************************************************/
  1630. X
  1631. X/* The following structure summarizes a macro CALL. Each macro table entry    */
  1632. X/* contains a field ma_calls which contains a list of these structures. The   */
  1633. X/* list is used to generate diagnostics (e.g. if a call has the wrong number  */
  1634. X/* of parameters) and also to give cross reference information in the typeset */
  1635. X/* documentation.                                                             */
  1636. typedef
  1637. X   struct
  1638. X     {
  1639. X      ulong mc_seq;   /* Sequence number of body part containing call.        */
  1640. X      ps_t  mc_ps;    /* Position at which the call occurred.                 */
  1641. X      ulong mc_npar;  /* Number of parameters in call.                        */
  1642. X     } mc_t;
  1643. X
  1644. typedef mc_t *p_mc_t;
  1645. X
  1646. X/* A list of calls summarizes the entire usage of a macro in a document.      */
  1647. typedef p_ls_t p_mcls_t;
  1648. X
  1649. X/******************************************************************************/
  1650. X
  1651. X/* This structure stores the definition of a single macro. The first field    */
  1652. X/* md_isdef indicates whether a definition for this macro has so far been     */
  1653. X/* seen. If it has, md_isdef=TRUE and the remaining fields are well defined.  */
  1654. typedef
  1655. X   struct
  1656. X     {
  1657. X      bool     md_isdef;  /* TRUE iff the macro is defined.                   */
  1658. X      ps_t     md_ps;     /* isdef=> Position of first definition part.       */
  1659. X      ubyte    md_npar;   /* isdef=> Number of params specified in defn.      */
  1660. X      bool     md_isadd;  /* isdef=> TRUE iff additively defined.             */
  1661. X      bool     md_iszer;  /* isdef=> TRUE iff zero calls allowed.             */
  1662. X      bool     md_isman;  /* isdef=> TRUE iff many calls allowed.             */
  1663. X      bool     md_isfil;  /* isdef=> TRUE iff macro is bound to an outp file. */
  1664. X      p_bpls_t md_body;   /* isdef=> Body of the macro (list of parts).       */
  1665. X     } md_t;
  1666. X
  1667. X/******************************************************************************/
  1668. X
  1669. X/* The following structure contains the full information about a macro.       */
  1670. typedef
  1671. X   struct
  1672. X     {
  1673. X      name_t   ma_name;   /* Name of the macro.                               */
  1674. X      p_mcls_t ma_calls;  /* List of calls of this macro in the document.     */
  1675. X      md_t     ma_defn;   /* Definition of this macro.                        */
  1676. X      p_ell3_t ma_actn;   /* Used by tangle. List of actual parameter lists.  */
  1677. X      uword    ma_level;  /* Used by analyser. Depth of deepest call.         */
  1678. X     } ma_t;
  1679. X
  1680. X/* A pointer to the comprehensive macro structure defined above is the way    */
  1681. X/* that FunnelWeb refers to macros internally.                                */
  1682. typedef ma_t *p_ma_t;
  1683. X
  1684. X/******************************************************************************/
  1685. X
  1686. X/* An expression consists of a sequence of ELEMENTS each of which can         */
  1687. X/* be one of three kinds:                                                     */
  1688. X/*                                                                            */
  1689. X/*    1. A block of text.                                                     */
  1690. X/*    2. An invocation of another macro.                                      */
  1691. X/*    3. A parameter of the current macro.                                    */
  1692. X/*                                                                            */
  1693. X/* The following enumerated type identifies one of these three alternatives.  */
  1694. X#define EL_TEXT 1
  1695. X#define EL_INVC 2
  1696. X#define EL_PARM 3
  1697. typedef ubyte el_k_t;
  1698. X
  1699. X/* The following rather messy structure contains information about a single   */
  1700. X/* element. As mentioned above, an element can be one of three kinds and the  */
  1701. X/* following structure should, strictly speaking, be defined as a C union so  */
  1702. X/* as to emphasize the mutually exclusive nature of most of its fields.       */
  1703. X/* At one stage this structure did contain a union, however, it introduced    */
  1704. X/* more mess than it brought clarity (because of the extra two subnames) and  */
  1705. X/* was eventually dropped.                                                    */
  1706. X/* A few fields deserve some explanation:                                     */
  1707. X/*    el_pretx and el_postx hold the exact whitespace appearing between       */
  1708. X/*       actual parameters in a macro call. This enables the call to be       */
  1709. X/*       formatted properly in the typeset output.                            */
  1710. X/*    el_which is part of the macro parameter element (e.g. @1) and points to */
  1711. X/*       the macro within which the @1 appears. Strictly speaking this should */
  1712. X/*       not be necessary, but it is convenient for the tangler to have this  */
  1713. X/*       information when it is half way through expanding an expression.     */
  1714. typedef
  1715. X   struct
  1716. X     {
  1717. X      el_k_t   el_kind;  /* Indicates what kind of element structure holds.   */
  1718. X
  1719. X      p_scls_t el_text;  /* EL_TEXT => List of scraps forming a text chunk.   */
  1720. X
  1721. X      p_ma_t   el_p_mac; /* EL_INVC => Pointer to macro being invoked.        */
  1722. X      p_elll_t el_parls; /* EL_INVC => List of actual parameters.             */
  1723. X      p_scll_t el_pretx; /* EL_INVC => Text before each parameter.            */
  1724. X      p_scll_t el_postx; /* EL_INVC => Text after  each parameter.            */
  1725. X
  1726. X      p_ma_t   el_which; /* EL_PARM => Macro in which this element appears.   */
  1727. X      ubyte    el_parno; /* EL_PARM => Parameter number of this actual param. */
  1728. X     } el_t;
  1729. X
  1730. typedef el_t *p_el_t;
  1731. X
  1732. X/******************************************************************************/
  1733. X
  1734. X/* A document component (represented by the DC_ data structures (see below)   */
  1735. X/* can be one of three things: a lump of text, a typesetter-generic           */
  1736. X/* typesetting directive, or a macro definition. The second of these consists */
  1737. X/* of a whole collection of typesetting commands and so rather than           */
  1738. X/* cluttering up the dc_ record, they have been separated out here.           */
  1739. X#define TY_NSEC 1   /* New section.                                           */
  1740. X#define TY_OLIT 2   /* Open  literal.                                         */
  1741. X#define TY_CLIT 3   /* Close literal.                                         */
  1742. X#define TY_OEMP 4   /* Open  emphasise.                                       */
  1743. X#define TY_CEMP 5   /* Close emphasise.                                       */
  1744. X#define TY_NPAG 6   /* New page.                                              */
  1745. X#define TY_TOCS 7   /* Table of contents.                                     */
  1746. X#define TY_SKIP 8   /* Skip vertical.                                         */
  1747. X#define TY_TITL 9   /* Title.                                                 */
  1748. typedef ubyte ty_k_t;
  1749. X
  1750. typedef
  1751. X   struct
  1752. X     {
  1753. X      ty_k_t   ty_kind;  /* Kind of this typesetting directive.               */
  1754. X      sn_t     ty_sn;    /* TY_NSEC=> Hierarchical section number.            */
  1755. X      bool     ty_isnam; /* TY_NSEC=> TRUE iff the section is named.          */
  1756. X      name_t   ty_name;  /* TY_NSEC=> ty_isnam=> Name of section.             */
  1757. X
  1758. X      uword    ty_mm;    /* TY_SKIP=> Millimetres to skip.                    */
  1759. X
  1760. X      ubyte    ty_font;  /* TY_TITL=> Font in which to write title.           */
  1761. X      ubyte    ty_align; /* TY_TITL=> Alignment with which to write title.    */
  1762. X      sc_t     ty_sc;    /* TY_TITL=> Scrap that is title text.               */
  1763. X     } ty_t;
  1764. X
  1765. typedef ty_t *p_ty_t;
  1766. X
  1767. X/******************************************************************************/
  1768. X
  1769. X/* The document list contains a representation of the input document in the   */
  1770. X/* form in which it was fed to FunnelWeb. This structured representation of   */
  1771. X/* the input is used by the weaver to generate the typeset output.            */
  1772. X/* Here, a document is represented by a list of DOCUMENT COMPONENTs (DC) each */
  1773. X/* of which contains information about a major chunk of the document. The     */
  1774. X/* following enumerated type dc_k_t (document component kind type) is used to */
  1775. X/* indicate which kind of component each list element contains.               */
  1776. X#define DC_TEXT 1   /* Text component consists of a block of text.            */
  1777. X#define DC_TYPE 2   /* Typesettting component affecting document typesetting. */
  1778. X#define DC_MACR 3   /* A MACRo definition.                                    */
  1779. typedef ubyte dc_k_t;
  1780. X
  1781. X/* The following structure stores a single document component. Like the el_t  */
  1782. X/* type, the dc_t type should really be a union type, but a union construct   */
  1783. X/* has been avoided to make the naming simpler.                               */
  1784. typedef
  1785. X   struct
  1786. X     {
  1787. X      ps_t     dc_ps;    /* Position of this component.                       */
  1788. X      dc_k_t   dc_kind;  /* Kind of this component.                           */
  1789. X
  1790. X      p_scls_t dc_text;  /* DC_TEXT=> Text segment constituting this compnt.  */
  1791. X
  1792. X      ty_t     dc_ty;    /* DC_TYPE=> Typesetting object record.              */
  1793. X
  1794. X      p_ma_t   dc_p_ma;  /* DC_MACR=> Pointer to the macro defined.           */
  1795. X      ulong    dc_part;  /* DC_MACR=> Part number of this part of macro defn. */
  1796. X     } dc_t;
  1797. X
  1798. typedef dc_t *p_dc_t;
  1799. X
  1800. X/* A list of document components constitutes the global document list         */
  1801. X/* declared later.                                                            */
  1802. typedef p_ls_t p_dcls_t;
  1803. X
  1804. X/******************************************************************************/
  1805. X
  1806. X/* This enumerated type identifies a typesetter.                              */
  1807. X/*    TR_NONE - No specific typesetter specified.                             */
  1808. X/*    TR_TEX  - The TeX typesetter.                                           */
  1809. X#define TR_NONE 1
  1810. X#define TR_TEX  2
  1811. X/* Add more typesetters here later. */
  1812. typedef ubyte tr_k_t;
  1813. X
  1814. X
  1815. X/******************************************************************************/
  1816. X/*                                                                            */
  1817. X/* VARIABLES                                                                  */
  1818. X/* =========                                                                  */
  1819. X/* This section contains external declarations of the global variables.       */
  1820. X/* The global variables themselves appear in DATA.C.                          */
  1821. X/*                                                                            */
  1822. X/******************************************************************************/
  1823. X
  1824. X/* This #ifndef is part of a mechanism that makes the following definitions   */
  1825. X/* visible to other modules declared as "extern", and visible to data.c       */
  1826. X/* declared as ordinary declarations. This prevents inconsistencies.          */
  1827. X#ifndef EXTERN
  1828. X#define EXTERN extern
  1829. X#endif
  1830. X
  1831. X/* This global options variable holds the options that were transmitted to    */
  1832. X/* FunnelWeb proper through the command line.                                 */
  1833. XEXTERN GLOVAR op_t option;
  1834. X
  1835. X/* The following option variable is set by the scanner and is used by the     */
  1836. X/* tangler. It determines whether the tangler will use natural indenting.     */
  1837. X/* TRUE => Tangler should use space indenting. FALSE=>No indenting.           */
  1838. XEXTERN GLOVAR bool tgindent;
  1839. X
  1840. X/* The following option variable is set by the scanner and is used by the     */
  1841. X/* tangler. It sets a limit on the length of the lines of the product files   */
  1842. X/* generated by tangle. A value of TGMAXINF indicates that no checking need   */
  1843. X/* be performed.                                                              */
  1844. X#define TGMAXINF (ULONG_MAX)
  1845. XEXTERN GLOVAR ulong tglinmax;
  1846. X
  1847. X/* The following variable is written by the scanner and read by weave. It     */
  1848. X/* stores the typesetter format possibly specified by the user in the input.  */
  1849. XEXTERN GLOVAR tr_k_t tr_codes;
  1850. X
  1851. X/* The following five lists and tables constitute the major data structures   */
  1852. X/* that are communicated between the major components of FunnelWeb.           */
  1853. X/* The TOKEN_LIST contains a tokenized representation of the input file.      */
  1854. X/* The LINE_LIST contains a list of the lines of the input file.              */
  1855. X/* The DOCUMENT_LIST contains a structured representation of the input file.  */
  1856. X/* The MACRO_TABLE describes the macros defined in the input file.            */
  1857. X/* The FILE_TABLE identifies macros that are connected to product files.      */
  1858. X/*                                        Created By  Used By                 */
  1859. X/*                                        ----------  -------                 */
  1860. XEXTERN GLOVAR p_tkls_t token_list;     /*    Scanner  Parser                  */
  1861. XEXTERN GLOVAR p_lnls_t line_list;      /*    Scanner  Lister                  */
  1862. XEXTERN GLOVAR p_dcls_t document_list;  /*     Parser  Weaver                  */
  1863. XEXTERN GLOVAR p_tb_t   macro_table;    /*     Parser  Tangler, Weaver         */
  1864. XEXTERN GLOVAR p_tb_t   file_table;     /*     Parser  Tangler, Weaver         */
  1865. X
  1866. X/* Three output streams are accessible globally.                              */
  1867. X/* The SCREEN FILE is connected to standard output (the user screen).         */
  1868. X/* The JOURNAL FILE logs FunnelWeb command language transactions.             */
  1869. X/* The LISTING FILE is created by an single invocation of FunnelWeb proper.   */
  1870. XEXTERN GLOVAR wf_t f_s;  /* Screen  file. */
  1871. XEXTERN GLOVAR wf_t f_j;  /* Journal file. */
  1872. XEXTERN GLOVAR wf_t f_l;  /* Listing file. */
  1873. X
  1874. X/* Many of the FunnelWeb IO functions accept a single string as a parameter.  */
  1875. X/* This means that sprintf and a temporary string must be used in order to    */
  1876. X/* produce parameterized formatted output. Rather than declare temporary      */
  1877. X/* strings in each local function, we declare them globally.                  */
  1878. XEXTERN GLOVAR char linet1[2000];
  1879. X
  1880. X/* Definitions of Diagnostic Levels                                           */
  1881. X/* --------------------------------                                           */
  1882. X/* A WARNING has no effect except to cause a message to be issued.            */
  1883. X/* An ERROR causes FunnelWeb to abort to the shell at the end of the phase.   */
  1884. X/*    Example: An error during scanning means that the FunnelWeb run will     */
  1885. X/*    terminate to the shell at the end of the scanning phase.                */
  1886. X/* A SEVERE ERROR causes FunnelWeb to abort to the shell immediately.         */
  1887. X/* A FATAL ERROR causes FunnelWeb to abort to the OS immediately.             */
  1888. X
  1889. X/* The following variables count diagnostics over a single FunnelWeb run.     */
  1890. XEXTERN GLOVAR ulong num_war;  /* Number of      warnings.                     */
  1891. XEXTERN GLOVAR ulong num_err;  /* Number of        errors.                     */
  1892. XEXTERN GLOVAR ulong num_sev;  /* Number of severe errors.                     */
  1893. X
  1894. X/* The following variables count diagnostics over multiple FunnelWeb runs.    */
  1895. XEXTERN GLOVAR ulong sum_war;  /* Number of      warnings.                     */
  1896. XEXTERN GLOVAR ulong sum_err;  /* Number of        errors.                     */
  1897. XEXTERN GLOVAR ulong sum_sev;  /* Number of severe errors.                     */
  1898. XEXTERN GLOVAR ulong sum_fat;  /* Number of fatal  errors.                     */
  1899. X
  1900. X/******************************************************************************/
  1901. X
  1902. X/* For #ifndef preventing multiple inclusion of the body of this header file. */
  1903. X#endif
  1904. X
  1905. X/******************************************************************************/
  1906. X/*                                 End of DATA.H                              */
  1907. X/******************************************************************************/
  1908. END_OF_FILE
  1909. if test 26371 -ne `wc -c <'sources/data.h'`; then
  1910.     echo shar: \"'sources/data.h'\" unpacked with wrong size!
  1911. fi
  1912. # end of 'sources/data.h'
  1913. fi
  1914. if test -f 'sources/dump.c' -a "${1}" != "-c" ; then 
  1915.   echo shar: Will not clobber existing file \"'sources/dump.c'\"
  1916. else
  1917. echo shar: Extracting \"'sources/dump.c'\" \(24980 characters\)
  1918. sed "s/^X//" >'sources/dump.c' <<'END_OF_FILE'
  1919. X/*##############################################################################
  1920. X
  1921. XFUNNNELWEB COPYRIGHT
  1922. X====================
  1923. XFunnelWeb is a literate-programming macro preprocessor.
  1924. X
  1925. Copyright (C) 1992 Ross N. Williams.
  1926. X
  1927. X   Ross N. Williams
  1928. X   ross@spam.adelaide.edu.au
  1929. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1930. X
  1931. This program is free software; you can redistribute it and/or modify
  1932. it under the terms of Version 2 of the GNU General Public License as
  1933. published by the Free Software Foundation.
  1934. X
  1935. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1936. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1937. See Version 2 of the GNU General Public License for more details.
  1938. X
  1939. You should have received a copy of Version 2 of the GNU General Public
  1940. License along with this program. If not, you can FTP the license from
  1941. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1942. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1943. X
  1944. Section 2a of the license requires that all changes to this file be
  1945. recorded prominently in this file. Please record all changes here.
  1946. X
  1947. Programmers:
  1948. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1949. X
  1950. Changes:
  1951. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1952. X
  1953. X##############################################################################*/
  1954. X
  1955. X
  1956. X/******************************************************************************/
  1957. X/*                                    DUMP.C                                  */
  1958. X/******************************************************************************/
  1959. X
  1960. X#include <ctype.h>
  1961. X#include "style.h"
  1962. X
  1963. X#include "as.h"
  1964. X#include "clock.h"
  1965. X#include "data.h"
  1966. X#include "dump.h"
  1967. X#include "misc.h"
  1968. X
  1969. X/******************************************************************************/
  1970. X
  1971. X#define DUMP_WIDTH (80)
  1972. X
  1973. X/******************************************************************************/
  1974. X
  1975. X/* The following advance declarations are required because of recursion. */
  1976. LOCAL void dm_ex P_((p_wf_t,p_ells_t));
  1977. X
  1978. X/******************************************************************************/
  1979. X
  1980. LOCAL void centerln P_((p_wf_t,uword,int,char *));
  1981. LOCAL void centerln(p_wf,width,ch,s)
  1982. X/* Writes string s in a line surrounded by character ch to specified width.   */
  1983. X/* Example: centerln(*,20,'-',"sloth") would write: "------ sloth -------"    */
  1984. p_wf_t p_wf;
  1985. uword  width;
  1986. int ch;
  1987. char   *s;
  1988. X{
  1989. X uword sidebar,i;
  1990. X char  linet2[100];
  1991. X /* Warning: linet2 can't be too big, or it will blow the Mac's limited       */
  1992. X /* stack space. Perhaps it should be put in the heap with a static pointer.  */
  1993. X
  1994. X as_cold(width>=5,"centerln: Width is too small.");
  1995. X as_cold(width<=80,"centerln: Width is too large.");
  1996. X as_cold(strlen(s) <= width-4,"centerln: Width is too narrow for string.");
  1997. X
  1998. X /* Construct a sidebar string. */
  1999. X sidebar=(width-strlen(s)-2)/2;
  2000. X for (i=0;i<sidebar;i++) linet2[i]=ch;
  2001. X linet2[sidebar]=EOS;
  2002. X
  2003. X /* Now construct the result string. */
  2004. X strcpy(linet1,linet2);
  2005. X strcat(linet1," ");
  2006. X strcat(linet1,s);
  2007. X strcat(linet1," ");
  2008. X strcat(linet1,linet2);
  2009. X
  2010. X /* If the sidebar division removed a character, and the line is long enough  */
  2011. X /* for the user not to notice the imbalance, tack a character on the end.    */
  2012. X if (width>40 && strlen(linet1)==width-1)
  2013. X   {
  2014. X    uword len=strlen(linet1);
  2015. X    linet1[len]=ch;
  2016. X    linet1[len+1]=EOS;
  2017. X   }
  2018. X
  2019. X /* Write the result string to the specified stream. */
  2020. X wf_wl(p_wf,linet1);
  2021. X}
  2022. X
  2023. X/******************************************************************************/
  2024. X
  2025. LOCAL char * fontname P_((ubyte));
  2026. LOCAL char * fontname(font)
  2027. X/* Given a font number, returns a pointer to a static string containing the   */
  2028. X/* name of the font.                                                          */
  2029. ubyte font;
  2030. X{
  2031. X switch (font)
  2032. X   {
  2033. X    case FT_NORM: return "Normal";
  2034. X    case FT_TITL: return "Title";
  2035. X    case FT_STIT: return "Small Title";
  2036. X    default     : as_bomb("fontname: Font switch defaulted.");
  2037. X   }
  2038. X /* Keep GCC warnings happy. */
  2039. X as_bomb("fontname: Dropped out of switch.");
  2040. X return "Failure";
  2041. X}
  2042. X
  2043. X/******************************************************************************/
  2044. X
  2045. LOCAL char * alignname P_((ubyte));
  2046. LOCAL char * alignname(align)
  2047. X/* Given an alignment number, returns a pointer to a static string containing */
  2048. X/* the name of the alignment.                                                 */
  2049. ubyte align;
  2050. X{
  2051. X switch (align)
  2052. X   {
  2053. X    case LR_LEFT: return "Left";
  2054. X    case LR_RIGH: return "Right";
  2055. X    case LR_CENT: return "Centre";
  2056. X    default     : as_bomb("alignname: Alignment switch defaulted.");
  2057. X   }
  2058. X /* Keep GCC warnings happy. */
  2059. X as_bomb("alignnamename: Dropped out of switch.");
  2060. X return "Failure";
  2061. X}
  2062. X
  2063. X/******************************************************************************/
  2064. X
  2065. XEXPORT void dm_mem(p_wf,p_mem,length)
  2066. p_wf_t  p_wf;
  2067. char   *p_mem;
  2068. ulong   length;
  2069. X{
  2070. X ubyte_ *p_base = (ubyte_ *) p_mem;
  2071. X long   len     = length;
  2072. X
  2073. X wf_wl(p_wf,"");
  2074. X wf_wl(p_wf,"MEMORY DUMP OF MAPPED FILE");
  2075. X wf_wl(p_wf,"==========================");
  2076. X wf_wl(p_wf,"");
  2077. X wf_wr(p_wf,"+-------------------------------------------------+------------------+\n");
  2078. X wf_wr(p_wf,"| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |\n");
  2079. X wf_wr(p_wf,"+-------------------------------------------------+------------------+\n");
  2080. X
  2081. X while (len>0)
  2082. X   {/* Write a single line of 16 bytes per iteration. */
  2083. X    uword j;
  2084. X    wf_wr(p_wf,"| ");
  2085. X    for (j=0;j<16;j++)
  2086. X       if (j>=len)
  2087. X          wf_wr(p_wf,"   ");
  2088. X       else
  2089. X         {
  2090. X          char s[10];
  2091. X          sprintf(s,"%02X ",(unsigned int) p_base[j]);
  2092. X          wf_wr(p_wf,s);
  2093. X         }
  2094. X    wf_wr(p_wf,"| ");
  2095. X    for (j=0;j<16;j++)
  2096. X       if (j>=len)
  2097. X          wf_chr(p_wf,' ');
  2098. X       else
  2099. X        {
  2100. X         char ch=p_base[j];
  2101. X         /* DON'T use library function "isprint" - it is too loose. */
  2102. X         /* e.g. The vax "isprint" accepts top bit characters. */
  2103. X         if (!isascprn(ch)) ch='.';
  2104. X         wf_chr(p_wf,ch);
  2105. X        }
  2106. X    wf_wr(p_wf," |\n");
  2107. X    p_base+=16;
  2108. X    len-=16;
  2109. X   } /* End while */
  2110. X
  2111. X wf_wr(p_wf,"+-------------------------------------------------+------------------+\n");
  2112. X wf_wl(p_wf,"");
  2113. X}
  2114. X
  2115. X/******************************************************************************/
  2116. X
  2117. LOCAL void dm_byte P_((p_wf_t,ubyte));
  2118. LOCAL void dm_byte(p_wf,b)
  2119. X/* Dumps a text representation of the given byte to the specified stream.     */
  2120. p_wf_t p_wf;
  2121. ubyte  b;
  2122. X{
  2123. X char t[10];
  2124. X /* DON'T use library function "isprint" - it is too loose. */
  2125. X /* e.g. The vax "isprint" accepts top bit characters. */
  2126. X if (isascprn(b))
  2127. X    sprintf(t,"%c",(char) b);
  2128. X else
  2129. X    sprintf(t,"<%03u>",(unsigned) b);
  2130. X wf_wr(p_wf,t);
  2131. X}
  2132. X
  2133. X/******************************************************************************/
  2134. X
  2135. XEXPORT void dm_lnls(p_wf)
  2136. p_wf_t p_wf;
  2137. X{
  2138. X wf_wl(p_wf,"");
  2139. X centerln(p_wf,DUMP_WIDTH,'=',"Start of LINE LIST DUMP");
  2140. X wf_wl(p_wf,"");
  2141. X           /*12345678901234567890123456789012345678901234567890123456789012345678901234567890*/
  2142. X wf_wl(p_wf,"Globl Local| Text");
  2143. X wf_wl(p_wf,"-----------+--------------------------------------------------------------------");
  2144. X ls_fir(line_list);
  2145. X while (TRUE)
  2146. X   {
  2147. X    ln_t *p_line;
  2148. X    char *p;
  2149. X    ls_nxt(line_list,PPV &p_line);
  2150. X    if (p_line==NULL) break;
  2151. X    sprintf(linet1,"%05lu %05lu| ",
  2152. X            (ulong) p_line->ln_global,
  2153. X            (ulong) p_line->ln_local);
  2154. X    wf_wr(p_wf,linet1);
  2155. X    for (p=p_line->ln_body.sc_first; p<=p_line->ln_body.sc_last; p++)
  2156. X       dm_byte(p_wf,*((ubyte_ *)p));
  2157. X    wf_wl(p_wf,"");
  2158. X   }
  2159. X wf_wl(p_wf,"-----------+--------------------------------------------------------------------");
  2160. X wf_wl(p_wf,"Globl Local| Text");
  2161. X wf_wl(p_wf,"");
  2162. X centerln(p_wf,DUMP_WIDTH,'=',"End of LINE LIST DUMP");
  2163. X wf_wl(p_wf,"");
  2164. X}
  2165. X
  2166. X/******************************************************************************/
  2167. X
  2168. LOCAL void dm_sc P_((p_wf_t,p_sc_t));
  2169. LOCAL void dm_sc(p_wf,p_sc)
  2170. X/* Dumps the specified scrap to the specified stream. */
  2171. p_wf_t p_wf;
  2172. p_sc_t p_sc;
  2173. X{
  2174. X char *p;
  2175. X
  2176. X as_cold(p_sc->sc_first !=NULL,"dm_sc: NULL ptr1.");
  2177. X as_cold(p_sc->sc_last  !=NULL,"dm_sc: NULL ptr2.");
  2178. X
  2179. X if (p_sc->sc_white)
  2180. X    wf_wr(p_wf,"Text scrap[White]=");
  2181. X else
  2182. X    wf_wr(p_wf,"Text scrap[Grey]=");
  2183. X wf_wr(p_wf,"\"");
  2184. X for (p=p_sc->sc_first; p<=p_sc->sc_last; p++)
  2185. X   {
  2186. X    dm_byte(p_wf,*((ubyte_ *) p));
  2187. X    if (*p=='\n')
  2188. X       wf_wl(p_wf,"");
  2189. X   }
  2190. X wf_wl(p_wf,"\"");
  2191. X}
  2192. X
  2193. X/******************************************************************************/
  2194. X
  2195. LOCAL void dm_scls P_((p_wf_t,p_scls_t));
  2196. LOCAL void dm_scls(p_wf,p_scls)
  2197. X/* Dumps the specified scrap list to the specified stream. */
  2198. p_wf_t   p_wf;
  2199. p_scls_t p_scls;
  2200. X{
  2201. X wf_wl(p_wf,"");
  2202. X centerln(p_wf,30,'-',"Start of Text Scrap List");
  2203. X ls_fir(p_scls);
  2204. X while (TRUE)
  2205. X   {
  2206. X    p_sc_t p_sc;
  2207. X    ls_nxt(p_scls,PPV &p_sc);
  2208. X    if (p_sc==NULL) break;
  2209. X    dm_sc(p_wf,p_sc);
  2210. X   }
  2211. X centerln(p_wf,30,'-',"End of Text Scrap List");
  2212. X wf_wl(p_wf,"");
  2213. X}
  2214. X
  2215. X/******************************************************************************/
  2216. X
  2217. XEXPORT void dm_tkls(p_wf)
  2218. p_wf_t p_wf;
  2219. X{
  2220. X tk_t *token;
  2221. X char *m;
  2222. X ubyte font;
  2223. X ubyte align;
  2224. X
  2225. X wf_wl(p_wf,"");
  2226. X centerln(p_wf,DUMP_WIDTH,'=',"Start of TOKEN LIST DUMP");
  2227. X wf_wl(p_wf,"");
  2228. X sprintf(linet1,"Summary: There are %lu tokens in the token list.",
  2229. X                (ulong) ls_len(token_list));
  2230. X wf_wl(p_wf,linet1);
  2231. X wf_wl(p_wf,"");
  2232. X wf_wl(p_wf,"Line[Column]: Token Description");
  2233. X wf_wl(p_wf,"-------------------------------");
  2234. X wf_wl(p_wf,"");
  2235. X
  2236. X ls_fir(token_list);
  2237. X ls_nxt(token_list,PPV &token);
  2238. X while (token != NULL)
  2239. X   {
  2240. X    sprintf(linet1,"%04lu[%02lu]: ",
  2241. X                   (ulong) token->tk_ps.ps_line,
  2242. X                   (ulong) token->tk_ps.ps_column);
  2243. X    wf_wr(p_wf,linet1);
  2244. X    switch (token->tk_kind)
  2245. X      {
  2246. X       case TK_TEXT: m="Text."              ; break;
  2247. X       case TK_MDEF: m="@$ Macro defn."     ; break;
  2248. X       case TK_FDEF: m="@F File defn."      ; break;
  2249. X       case TK_ONAM: m="@< Open name."      ; break;
  2250. X       case TK_CNAM: m="@> Close name."     ; break;
  2251. X       case TK_ODEF: m="@{ Open defn."      ; break;
  2252. X       case TK_CDEF: m="@} Close defn."     ; break;
  2253. X       case TK_OPAR: m="@( Open param."     ; break;
  2254. X       case TK_CPAR: m="@} Close param."    ; break;
  2255. X       case TK_COMA: m="@, Comma."          ; break;
  2256. X       case TK_QUOT: m="@\" Quote."         ; break;
  2257. X       case TK_PARM: m="@n Parameter."      ; break;
  2258. X       case TK_ZERO: m="@Z Zero calls."     ; break;
  2259. X       case TK_MANY: m="@M Many calls."     ; break;
  2260. X       case TK_NAME: m="@# Name."           ; break;
  2261. X       case TK_EMPH: m="@/ Emphasise."      ; break;
  2262. X       case TK_NPAG: m="@t.. Newpage."      ; break;
  2263. X       case TK_TOCS: m="@t.. TOC."          ; break;
  2264. X       case TK_SKIP: m="@t.. Vertical skip."; break;
  2265. X       case TK_TITL: m="@t.. Title."        ; break;
  2266. X       case TK_EOF : m="End Of File."       ; break;
  2267. X       case TK_NSEC:
  2268. X          switch (token->tk_gen)
  2269. X            {
  2270. X             case 0: m="@* New section (Level 0)."; break;
  2271. X             case 1: m="@A New section (Level 1)."; break;
  2272. X             case 2: m="@B New section (Level 2)."; break;
  2273. X             case 3: m="@C New section (Level 3)."; break;
  2274. X             case 4: m="@D New section (Level 4)."; break;
  2275. X             case 5: m="@E New section (Level 5)."; break;
  2276. X             default: as_bomb("dmtkls: Level case defaulted.");
  2277. X            }
  2278. X          break;
  2279. X       default: as_bomb("dmtkls: Token case defaulted.");
  2280. X      }
  2281. X    wf_wr(p_wf,m);
  2282. X    wf_wr(p_wf," ");
  2283. X    switch (token->tk_kind)
  2284. X      {
  2285. X       case TK_PARM:
  2286. X          sprintf(linet1,"Parameterno=%u.",(unsigned) token->tk_gen);
  2287. X          wf_wl(p_wf,linet1);
  2288. X          break;
  2289. X       case TK_NAME:
  2290. X          wf_wr(p_wf,"Character='");
  2291. X          dm_byte(p_wf,token->tk_gen);
  2292. X          wf_wl(p_wf,"'.");
  2293. X          break;
  2294. X       case TK_TEXT:
  2295. X          dm_sc(p_wf,&token->tk_sc);
  2296. X          break;
  2297. X       case TK_SKIP:
  2298. X          sprintf(linet1,"Vertical space skipped=%lumm.",
  2299. X                  (ulong) token->tk_gen);
  2300. X          wf_wl(p_wf,linet1);
  2301. X          break;
  2302. X       case TK_TITL:
  2303. X          font  = token->tk_gen / LRFT_PACK;
  2304. X          align = token->tk_gen % LRFT_PACK;
  2305. X          wf_wr(p_wf,"Font=");        wf_wr(p_wf,fontname(font));
  2306. X          wf_wr(p_wf,", Alignment="); wf_wr(p_wf,alignname(align));
  2307. X          wf_wl(p_wf,". Title text follows:");
  2308. X          dm_sc(p_wf,&token->tk_sc);
  2309. X          break;
  2310. X       default: wf_wl(p_wf,""); break;
  2311. X      }
  2312. X    ls_nxt(token_list,PPV &token);
  2313. X   } /* End of while loop. */
  2314. X
  2315. X centerln(p_wf,DUMP_WIDTH,'=',"End of TOKEN LIST DUMP");
  2316. X wf_wl(p_wf,"");
  2317. X}
  2318. X
  2319. X/******************************************************************************/
  2320. X
  2321. LOCAL void dm_eltx P_((p_wf_t,p_el_t));
  2322. LOCAL void dm_eltx (p_wf,p_el)
  2323. X/* Dumps the specified text element to the specified stream. */
  2324. p_wf_t p_wf;
  2325. p_el_t p_el;
  2326. X{
  2327. X p_sc_t p_sc;
  2328. X
  2329. X wf_wl(p_wf,"");
  2330. X centerln(p_wf,30,'-',"Start Text Element");
  2331. X
  2332. X ls_fir(p_el->el_text);
  2333. X ls_nxt(p_el->el_text,PPV &p_sc);
  2334. X while (p_sc != NULL)
  2335. X   {
  2336. X    dm_sc(p_wf,p_sc);
  2337. X    ls_nxt(p_el->el_text,PPV &p_sc);
  2338. X   }
  2339. X centerln(p_wf,30,'-',"End Text Element");
  2340. X wf_wl(p_wf,"");
  2341. X}
  2342. X
  2343. X/******************************************************************************/
  2344. X
  2345. LOCAL void dm_elin P_((p_wf_t,p_el_t));
  2346. LOCAL void dm_elin(p_wf,p_el)
  2347. X/* Dumps the specified invocation element to the specified stream. */
  2348. p_wf_t p_wf;
  2349. p_el_t p_el;
  2350. X{
  2351. X ulong    parno;
  2352. X p_ells_t *pp_ex;
  2353. X p_ells_t p_ex;
  2354. X p_elll_t p_elll = p_el->el_parls;
  2355. X
  2356. X wf_wl(p_wf,"");
  2357. X centerln(p_wf,30,'-',"Begin Invocation Element");
  2358. X
  2359. X sprintf(linet1,"Invocation of macro @<%s@>",&p_el->el_p_mac->ma_name[0]);
  2360. X wf_wl(p_wf,linet1);
  2361. X
  2362. X if (ls_len(p_elll)==0)
  2363. X    wf_wl(p_wf,"No actual parameters.");
  2364. X else
  2365. X   {
  2366. X    sprintf(linet1,"This invocation has %lu actual parameters.",
  2367. X            (ulong) ls_len(p_elll));
  2368. X    wf_wl(p_wf,linet1);
  2369. X    wf_wl(p_wf,
  2370. X    "Actual parameter list follows as a sequence of expressions:");
  2371. X    wf_wl(p_wf,"(Text crud before and after parameter has been omitted).");
  2372. X    parno=1;
  2373. X    ls_fir(p_elll);
  2374. X    while (TRUE)
  2375. X      {
  2376. X       ls_nxt(p_elll,PPV &pp_ex);
  2377. X       if (pp_ex==NULL) break;
  2378. X       p_ex = *pp_ex;
  2379. X       sprintf(linet1,"Expression for parameter number %lu:",(ulong) parno);
  2380. X       wf_wl(p_wf,linet1);
  2381. X       dm_ex(p_wf,p_ex);
  2382. X       parno++;
  2383. X      }
  2384. X   }
  2385. X
  2386. X centerln(p_wf,30,'-',"End Invocation Element");
  2387. X wf_wl(p_wf,"");
  2388. X}
  2389. X
  2390. X/******************************************************************************/
  2391. X
  2392. LOCAL void dm_elpr P_((p_wf_t,p_el_t));
  2393. LOCAL void dm_elpr(p_wf,p_el)
  2394. X/* Dumps the specified parameter element to the specified stream. */
  2395. p_wf_t p_wf;
  2396. p_el_t p_el;
  2397. X{
  2398. X wf_wl(p_wf,"");
  2399. X centerln(p_wf,30,'-',"Start Parameter Element");
  2400. X sprintf(linet1,"Parameter number=%lu.",(ulong) p_el->el_parno);
  2401. X wf_wl(p_wf,linet1);
  2402. X sprintf(linet1,"Parameter is of macro \"%s\".",
  2403. X         &p_el->el_which->ma_name[0]);
  2404. X wf_wl(p_wf,linet1);
  2405. X centerln(p_wf,30,'-',"End Parameter Element");
  2406. X wf_wl(p_wf,"");
  2407. X}
  2408. X
  2409. X/******************************************************************************/
  2410. X
  2411. LOCAL void dm_ex(p_wf,p_ex)
  2412. X/* Dumps the specified expression to the specified stream. */
  2413. p_wf_t   p_wf;
  2414. p_ells_t p_ex;
  2415. X{
  2416. X p_el_t p_el;
  2417. X
  2418. X wf_wl(p_wf,"");
  2419. X centerln(p_wf,30,'-',"Start of Expression");
  2420. X ls_fir(p_ex);
  2421. X ls_nxt(p_ex,PPV &p_el);
  2422. X while (p_el != NULL)
  2423. X   {
  2424. X    switch (p_el->el_kind)
  2425. X      {
  2426. X       case EL_TEXT: dm_eltx(p_wf,p_el); break;
  2427. X       case EL_INVC: dm_elin(p_wf,p_el); break;
  2428. X       case EL_PARM: dm_elpr(p_wf,p_el); break;
  2429. X       default     : as_bomb("dm_ex: Case defaulted.");
  2430. X      }
  2431. X    ls_nxt(p_ex,PPV &p_el);
  2432. X   }
  2433. X centerln(p_wf,30,'-',"End of Expression");
  2434. X wf_wl(p_wf,"");
  2435. X}
  2436. X
  2437. X/******************************************************************************/
  2438. X
  2439. LOCAL void dm_macro P_((p_wf_t,p_ma_t));
  2440. LOCAL void dm_macro(p_wf,p_ma)
  2441. X/* Dump all the information on the specified macro. */
  2442. p_wf_t p_wf;
  2443. p_ma_t p_ma;
  2444. X{
  2445. X wf_wl(p_wf,"");
  2446. X centerln(p_wf,DUMP_WIDTH-20,'-',"Start of Macro Dump");
  2447. X
  2448. X /* A macro can't exist in the macro table without a name. */
  2449. X sprintf(linet1,"Macro Name  : \"%s\"",p_ma->ma_name); wf_wl(p_wf,linet1);
  2450. X
  2451. X /* Is the macro defined? */
  2452. X if (!p_ma->ma_defn.md_isdef) wf_wl(p_wf,"Defined?    : No.");
  2453. X                         else wf_wl(p_wf,"Defined?    : Yes.");
  2454. X
  2455. X /* Defined macros carry lots more information. */
  2456. X if (p_ma->ma_defn.md_isdef)
  2457. X   {
  2458. X    /* Number of parameters the macro has. */
  2459. X    sprintf(linet1,"Parameters  : %lu",(ulong) p_ma->ma_defn.md_npar);
  2460. X    wf_wl(p_wf,linet1);
  2461. X
  2462. X    /* Is the macro additive? */
  2463. X    if (p_ma->ma_defn.md_isadd) wf_wl(p_wf,"Additive?   : Yes.");
  2464. X                           else wf_wl(p_wf,"Additive?   : No.");
  2465. X
  2466. X    /* Is the macro allowed to be called zero times? */
  2467. X    if (p_ma->ma_defn.md_iszer) wf_wl(p_wf,"Zero Calls? : Yes.");
  2468. X                           else wf_wl(p_wf,"Zero Calls? : No.");
  2469. X
  2470. X    /* Is the macro allowed to be called many times? */
  2471. X    if (p_ma->ma_defn.md_isman) wf_wl(p_wf,"Many Calls? : Yes.");
  2472. X                           else wf_wl(p_wf,"Many Calls? : No.");
  2473. X
  2474. X    /* Is the macro connected to an product file? */
  2475. X    if (p_ma->ma_defn.md_isfil) wf_wl(p_wf,"Output File?: Yes.");
  2476. X                           else wf_wl(p_wf,"Output File?: No.");
  2477. X
  2478. X    /* Dump a list of all the calls to the macro. */
  2479. X    {
  2480. X     p_mc_t p_mc;
  2481. X     ulong  mcnum;
  2482. X     wf_wl(p_wf,"Call list   :");
  2483. X     ls_fir(p_ma->ma_calls);
  2484. X     ls_nxt(p_ma->ma_calls,PPV &p_mc);
  2485. X     mcnum=1;
  2486. X     while (p_mc != NULL)
  2487. X       {
  2488. X        sprintf(linet1,
  2489. X "   Call %lu: Parameters=%lu, Sequence num=%lu, Position(L,C)=(%lu,%lu).",
  2490. X                (ulong) mcnum,
  2491. X                (ulong) p_mc->mc_npar,
  2492. X                (ulong) p_mc->mc_seq,
  2493. X                (ulong) p_mc->mc_ps.ps_line,
  2494. X                (ulong) p_mc->mc_ps.ps_column);
  2495. X        wf_wl(p_wf,linet1);
  2496. X        ls_nxt(p_ma->ma_calls,PPV &p_mc);
  2497. X        mcnum++;
  2498. X       }
  2499. X    }
  2500. X
  2501. X    /* Dump a list of the body parts of the macro. */
  2502. X    {
  2503. X     p_bp_t p_bp;
  2504. X     ulong  bpnum;
  2505. X     ulong  bptot = ls_len(p_ma->ma_defn.md_body);
  2506. X     wf_wl(p_wf,"Macro body  :");
  2507. X     wf_wl(p_wf,"");
  2508. X     wf_wl(p_wf,"--Start of List of Body Parts--");
  2509. X     sprintf(linet1,"This macro has %lu body part",(ulong) bptot);
  2510. X     if (bptot!=1) strcat(linet1,"s");
  2511. X     strcat(linet1,".");
  2512. X     wf_wl(p_wf,linet1);
  2513. X     bpnum=1;
  2514. X     ls_fir(p_ma->ma_defn.md_body);
  2515. X     ls_nxt(p_ma->ma_defn.md_body,PPV &p_bp);
  2516. X     while (p_bp != NULL)
  2517. X       {
  2518. X        sprintf(linet1,
  2519. X        "Body part %lu: Seqnum=%lu, Pos(L,C)=(%lu,%lu), Expression follows:",
  2520. X                (ulong) bpnum,
  2521. X                (ulong) p_bp->bp_seq,
  2522. X                (ulong) p_bp->bp_ps.ps_line,
  2523. X                (ulong) p_bp->bp_ps.ps_column);
  2524. X        wf_wl(p_wf,linet1);
  2525. X        dm_ex(p_wf,p_bp->bp_ex);
  2526. X        ls_nxt(p_ma->ma_defn.md_body,PPV &p_bp);
  2527. X        bpnum++;
  2528. X       }
  2529. X     wf_wl(p_wf,"---End of List of Body Parts---");
  2530. X     wf_wl(p_wf,"");
  2531. X    }
  2532. X
  2533. X   } /* End of IF defined. */
  2534. X
  2535. X centerln(p_wf,DUMP_WIDTH-20,'-',"End of Macro Dump");
  2536. X wf_wl(p_wf,"");
  2537. X}
  2538. X
  2539. X/******************************************************************************/
  2540. X
  2541. XEXPORT void dm_matb P_((p_wf_t));
  2542. XEXPORT void dm_matb(p_wf)
  2543. p_wf_t p_wf;
  2544. X{
  2545. X wf_wl(p_wf,"");
  2546. X centerln(p_wf,DUMP_WIDTH,'=',"Start of MACRO TABLE DUMP");
  2547. X wf_wl(p_wf,"");
  2548. X tb_fir(macro_table);
  2549. X while (TRUE)
  2550. X   {
  2551. X    name_t name;
  2552. X    p_ma_t p_ma;
  2553. X    if (!tb_rea(macro_table,PV &name[0],PV &p_ma)) break;
  2554. X    dm_macro(p_wf,p_ma);
  2555. X    wf_wl(p_wf,"");
  2556. X   }
  2557. X wf_wl(p_wf,"");
  2558. X centerln(p_wf,DUMP_WIDTH,'=',"End of MACRO TABLE DUMP");
  2559. X wf_wl(p_wf,"");
  2560. X}
  2561. X
  2562. X/******************************************************************************/
  2563. X
  2564. LOCAL void dm_ty P_((p_wf_t,p_ty_t));
  2565. LOCAL void dm_ty(p_wf,p_ty)
  2566. p_wf_t p_wf;
  2567. p_ty_t p_ty;
  2568. X{
  2569. X char linet2[200];
  2570. X char linet3[200];
  2571. X
  2572. X switch (p_ty->ty_kind)
  2573. X   {
  2574. X    case TY_NSEC:
  2575. X       sn_str(&p_ty->ty_sn,linet2);
  2576. X       strcpy(linet3,"<No name>");
  2577. X       if (p_ty->ty_isnam) strcpy(linet3,&p_ty->ty_name[0]);
  2578. X       sprintf(linet1,"   Section \"%s\", Section name=\"%s\".",linet2,linet3);
  2579. X       wf_wl(p_wf,"");
  2580. X       wf_wl(p_wf,linet1);
  2581. X       break;
  2582. X    case TY_OLIT: wf_wl(p_wf,"   Open  literal."    ); break;
  2583. X    case TY_CLIT: wf_wl(p_wf,"   Close literal."    ); break;
  2584. X    case TY_OEMP: wf_wl(p_wf,"   Open emphasise."   ); break;
  2585. X    case TY_CEMP: wf_wl(p_wf,"   Close emphasise."  ); break;
  2586. X    case TY_NPAG: wf_wl(p_wf,"   New page."         ); break;
  2587. X    case TY_TOCS: wf_wl(p_wf,"   Table of contents."); break;
  2588. X    case TY_SKIP:
  2589. X       sprintf(linet1,"   Vertical skip by %lu mm.",(ulong) p_ty->ty_mm);
  2590. X       wf_wl(p_wf,linet1);
  2591. X       break;
  2592. X    case TY_TITL:
  2593. X       wf_wr(p_wf,"Font=");        wf_wr(p_wf,fontname(p_ty->ty_font));
  2594. X       wf_wr(p_wf,", Alignment="); wf_wr(p_wf,alignname(p_ty->ty_align));
  2595. X       wf_wl(p_wf,". Title text follows:");
  2596. X       dm_sc(p_wf,&p_ty->ty_sc);
  2597. X       break;
  2598. X    default: as_bomb("dm_ty: Typesetter directive switch defaulted.");
  2599. X   }
  2600. X}
  2601. X
  2602. X/******************************************************************************/
  2603. X
  2604. XEXPORT void dm_dcls(p_wf)
  2605. X/* Dumps a text representation of the document list to the given stream.      */
  2606. p_wf_t p_wf;
  2607. X{
  2608. X wf_wl(p_wf,"");
  2609. X centerln(p_wf,DUMP_WIDTH,'=',"Start of DOCUMENT LIST DUMP");
  2610. X wf_wl(p_wf,"");
  2611. X
  2612. X ls_fir(document_list);
  2613. X while (TRUE)
  2614. X   {
  2615. X    p_dc_t p_dc;
  2616. X    ls_nxt(document_list,PPV &p_dc);
  2617. X    if (p_dc == NULL) break;
  2618. X    wf_wl(p_wf,"");
  2619. X    sprintf(linet1,"Pos(L,C)=(%lu,%lu). ",
  2620. X            p_dc->dc_ps.ps_line,
  2621. X            p_dc->dc_ps.ps_column);
  2622. X    switch (p_dc->dc_kind)
  2623. X      {
  2624. X       case DC_TEXT:
  2625. X          wf_wr(p_wf,"TEXT COMPONENT: "); wf_wl(p_wf,linet1);
  2626. X          dm_scls(p_wf,p_dc->dc_text);
  2627. X          break;
  2628. X
  2629. X       case DC_TYPE:
  2630. X          wf_wr(p_wf,"TYPESETTER DIRECTIVE COMPONENT: ");
  2631. X          dm_ty(p_wf,&p_dc->dc_ty);
  2632. X          break;
  2633. X
  2634. X       case DC_MACR:
  2635. X          wf_wr(p_wf,"MACRO DEFINITION COMPONENT: "); wf_wl(p_wf,linet1);
  2636. X          sprintf(linet1,"Part %lu of macro @<%s@>.",
  2637. X                  p_dc->dc_part,
  2638. X                  &p_dc->dc_p_ma->ma_name[0]);
  2639. X          wf_wl(p_wf,linet1);
  2640. X          break;
  2641. X
  2642. X       default: as_bomb("dm_scls: Case defaulted.");
  2643. X      }
  2644. X   }
  2645. X
  2646. X wf_wl(p_wf,"");
  2647. X centerln(p_wf,DUMP_WIDTH,'=',"End of DOCUMENT LIST DUMP");
  2648. X wf_wl(p_wf,"");
  2649. X}
  2650. X
  2651. X/******************************************************************************/
  2652. X
  2653. LOCAL void tm_for P_((p_wf_t,char *,p_ck_t,p_ck_t));
  2654. LOCAL void tm_for(p_wf,s,p_val,p_tot)
  2655. X/* This rather ragged function simplifies the formatting in dm_times.         */
  2656. p_wf_t p_wf;
  2657. char   *s;
  2658. p_ck_t p_val;
  2659. p_ck_t p_tot;
  2660. X{
  2661. X sprintf(linet1,"|%s| %3d%% | %8.2f | %8.2f | %3d%% |",
  2662. X         s,
  2663. X         (int)   ((100.0*ck_cpu(p_val))/ck_cpu(p_tot)),
  2664. X         (float) ck_cpu(p_val),
  2665. X         (float) ck_real(p_val),
  2666. X         (int)   ((100.0*ck_real(p_val))/ck_real(p_tot))
  2667. X        );
  2668. X wf_wl(p_wf,linet1);
  2669. X}
  2670. X
  2671. X/******************************************************************************/
  2672. X
  2673. XEXPORT void dm_times(p_wf,
  2674. X                     p_mapp,p_scan,p_pars,p_anal,
  2675. X                     p_dump,p_lstr,p_tang,p_weav,p_totl)
  2676. p_wf_t p_wf;
  2677. p_ck_t p_mapp;
  2678. p_ck_t p_scan;
  2679. p_ck_t p_pars;
  2680. p_ck_t p_anal;
  2681. p_ck_t p_dump;
  2682. p_ck_t p_lstr;
  2683. p_ck_t p_tang;
  2684. p_ck_t p_weav;
  2685. p_ck_t p_totl;
  2686. X{
  2687. X float cputot;
  2688. X float realtot;
  2689. X float cpuerr;
  2690. X float realerr;
  2691. X
  2692. X cputot = ck_cpu(p_mapp) + ck_cpu(p_scan) + ck_cpu(p_pars) +
  2693. X          ck_cpu(p_anal) + ck_cpu(p_dump) + ck_cpu(p_lstr) +
  2694. X          ck_cpu(p_tang) + ck_cpu(p_weav);
  2695. X
  2696. X realtot = ck_real(p_mapp) + ck_real(p_scan) + ck_real(p_pars) +
  2697. X           ck_real(p_anal) + ck_real(p_dump) + ck_real(p_lstr) +
  2698. X           ck_real(p_tang) + ck_real(p_weav);
  2699. X
  2700. X cpuerr  = ck_cpu (p_totl)-cputot;
  2701. X realerr = ck_real(p_totl)-realtot;
  2702. X
  2703. X wf_wl(p_wf,"");
  2704. X wf_wl(p_wf,"Summary of time used by each subsystem of Funnelweb (seconds).");
  2705. X wf_wl(p_wf,"");
  2706. X wf_wl(p_wf,    "+------------+------+----------+----------+------+");
  2707. X wf_wl(p_wf,    "| Subsystem  | CPU% | CPU Time | RealTime |  RT% |");
  2708. X wf_wl(p_wf,    "+------------+------+----------+----------+------+");
  2709. X tm_for(p_wf," Mapper     ",p_mapp,p_totl);
  2710. X tm_for(p_wf," Scanner    ",p_scan,p_totl);
  2711. X tm_for(p_wf," Parser     ",p_pars,p_totl);
  2712. X tm_for(p_wf," Analyser   ",p_anal,p_totl);
  2713. X tm_for(p_wf," Dumper     ",p_dump,p_totl);
  2714. X tm_for(p_wf," Lister     ",p_lstr,p_totl);
  2715. X tm_for(p_wf," Tangler    ",p_tang,p_totl);
  2716. X tm_for(p_wf," Weaver     ",p_weav,p_totl);
  2717. X sprintf(linet1,"|%s| %3d%% | %8.2f | %8.2f | %3d%% |",
  2718. X         " Clock Err  ",
  2719. X         (int)   ((100.0*cpuerr )/ck_cpu (p_totl)),
  2720. X         (float)                            cpuerr,
  2721. X         (float)                           realerr,
  2722. X         (int)   ((100.0*realerr)/ck_real(p_totl))
  2723. X        );
  2724. X wf_wl(p_wf,linet1);
  2725. X
  2726. X wf_wl(p_wf,    "+------------+------+----------+----------+------+");
  2727. X tm_for(p_wf," Total      ",p_totl,p_totl);
  2728. X wf_wl(p_wf,    "+------------+------+----------+----------+------+");
  2729. X wf_wl(p_wf,"");
  2730. X}
  2731. X
  2732. X/******************************************************************************/
  2733. X/*                                 End of DUMP.C                              */
  2734. X/******************************************************************************/
  2735. END_OF_FILE
  2736. if test 24980 -ne `wc -c <'sources/dump.c'`; then
  2737.     echo shar: \"'sources/dump.c'\" unpacked with wrong size!
  2738. fi
  2739. # end of 'sources/dump.c'
  2740. fi
  2741. echo shar: End of archive 12 \(of 20\).
  2742. cp /dev/null ark12isdone
  2743. MISSING=""
  2744. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  2745.     if test ! -f ark${I}isdone ; then
  2746.     MISSING="${MISSING} ${I}"
  2747.     fi
  2748. done
  2749. if test "${MISSING}" = "" ; then
  2750.     echo You have unpacked all 20 archives.
  2751.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2752. else
  2753.     echo You still need to unpack the following archives:
  2754.     echo "        " ${MISSING}
  2755. fi
  2756. ##  End of shell archive.
  2757. exit 0
  2758.