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

  1. Newsgroups: comp.sources.unix
  2. From: ross@spam.adelaide.edu.au (Ross Williams)
  3. Subject: v26i125: funnelweb - a tool for literate programming in C, Part05/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 125
  9. Archive-Name: funnelweb/part05
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 5 (of 20)."
  18. # Contents:  answers/pr10.lis answers/sc18.lis sources/analyse.c
  19. #   sources/environ.h sources/list.h sources/lister.c sources/machin.c
  20. #   sources/texhead.tex sources/writfile.h userman/u_manual.toc
  21. # Wrapped by vixie@gw.home.vix.com on Sun Apr 11 11:00:16 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'answers/pr10.lis' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'answers/pr10.lis'\"
  25. else
  26. echo shar: Extracting \"'answers/pr10.lis'\" \(12685 characters\)
  27. sed "s/^X//" >'answers/pr10.lis' <<'END_OF_FILE'
  28. XFUNNELWEB LISTING FILE
  29. X======================
  30. X
  31. Dump of mapped file "<<Suppressed>>".
  32. X
  33. MEMORY DUMP OF MAPPED FILE
  34. X==========================
  35. X
  36. X+-------------------------------------------------+------------------+
  37. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  38. X+-------------------------------------------------+------------------+
  39. X| 50 52 31 30 3A 20 54 65 73 74 20 73 79 6E 74 61 | PR10: Test synta |
  40. X| 63 74 69 63 20 65 72 72 6F 72 20 72 65 63 6F 76 | ctic error recov |
  41. X| 65 72 79 2E 0A 0A 31 2E 20 54 65 73 74 20 72 65 | ery...1. Test re |
  42. X| 63 6F 76 65 72 79 20 61 74 20 74 6F 70 20 70 61 | covery at top pa |
  43. X| 72 73 69 6E 67 20 6C 65 76 65 6C 2E 0A 40 3C 0A | rsing level..@<. |
  44. X| 0A 40 41 40 3C 45 72 72 6F 72 20 72 65 63 6F 76 | .@A@<Error recov |
  45. X| 65 72 79 20 70 6F 69 6E 74 40 3E 0A 0A 32 2E 20 | ery point@>..2.  |
  46. X| 54 65 73 74 20 72 65 63 6F 76 65 72 79 20 69 6E | Test recovery in |
  47. X| 73 69 64 65 20 6D 61 63 72 6F 20 64 65 66 69 6E | side macro defin |
  48. X| 69 74 69 6F 6E 2E 0A 0A 40 24 40 3C 53 6C 6F 74 | ition...@$@<Slot |
  49. X| 68 31 40 3E 40 3E 3D 3D 40 7B 0A 57 61 6C 72 75 | h1@>@>==@{.Walru |
  50. X| 73 40 7D 0A 0A 40 24 40 3C 53 6C 6F 74 68 32 40 | s@}..@$@<Sloth2@ |
  51. X| 3E 3D 3D 40 7B 0A 40 3C 57 61 6C 72 75 73 40 3C | >==@{.@<Walrus@< |
  52. X| 0A 40 7D 0A 40 41 40 3C 45 72 72 6F 72 20 72 65 | .@}.@A@<Error re |
  53. X| 63 6F 76 65 72 79 20 70 6F 69 6E 74 40 3E 0A 0A | covery point@>.. |
  54. X| 33 2E 20 54 65 73 74 20 72 65 63 6F 76 65 72 79 | 3. Test recovery |
  55. X| 20 69 6E 73 69 64 65 20 61 63 74 75 61 6C 20 70 |  inside actual p |
  56. X| 61 72 61 6D 65 74 65 72 20 6C 69 73 74 20 69 6E | arameter list in |
  57. X| 20 6D 61 63 72 6F 20 64 65 66 69 6E 69 74 69 6F |  macro definitio |
  58. X| 6E 2E 0A 40 24 40 3C 53 6C 6F 74 68 33 40 3E 3D | n..@$@<Sloth3@>= |
  59. X| 3D 40 7B 0A 40 3C 57 61 6C 72 75 73 40 3E 40 28 | =@{.@<Walrus@>@( |
  60. X| 40 22 61 61 72 64 76 61 72 6B 40 3E 0A 40 7D 0A | @"aardvark@>.@}. |
  61. X| 40 41 40 3C 45 72 72 6F 72 20 72 65 63 6F 76 65 | @A@<Error recove |
  62. X| 72 79 20 70 6F 69 6E 74 40 3E 0A 0A 34 2E 20 54 | ry point@>..4. T |
  63. X| 65 73 74 20 45 4F 46 20 69 6E 20 74 68 65 20 6D | est EOF in the m |
  64. X| 69 64 64 6C 65 20 6F 66 20 61 20 63 6F 6D 70 6C | iddle of a compl |
  65. X| 69 63 61 74 65 64 20 63 6F 6E 73 74 72 75 63 74 | icated construct |
  66. X| 2E 0A 54 68 65 20 66 6F 6C 6C 6F 77 69 6E 67 20 | ..The following  |
  67. X| 6D 61 6B 65 73 20 74 68 65 20 65 6E 64 20 6F 66 | makes the end of |
  68. X| 20 74 68 65 20 66 69 6C 65 20 6C 6F 6F 6B 65 64 |  the file looked |
  69. X| 20 63 68 6F 70 70 65 64 20 6F 66 66 2C 20 62 75 |  chopped off, bu |
  70. X| 74 20 69 74 20 69 73 0A 61 63 74 75 61 6C 6C 79 | t it is.actually |
  71. X| 20 69 6E 74 65 6E 74 69 6F 6E 61 6C 2E 0A 40 24 |  intentional..@$ |
  72. X| 40 3C 53 6C 6F 74 68 34 40 3E 3D 3D 40 7B 0A 40 | @<Sloth4@>==@{.@ |
  73. X| 3C 57 61 6C 72 75 73 40 3E 40 28 40 22 61 61 72 | <Walrus@>@(@"aar |
  74. X| 64 76 61 0A                                     | dva.             |
  75. X+-------------------------------------------------+------------------+
  76. X
  77. X
  78. X=========================== Start of LINE LIST DUMP ============================
  79. X
  80. Globl Local| Text
  81. X-----------+--------------------------------------------------------------------
  82. X00001 00001| PR10: Test syntactic error recovery.<010>
  83. X00002 00002| <010>
  84. X00003 00003| 1. Test recovery at top parsing level.<010>
  85. X00004 00004| @<<010>
  86. X00005 00005| <010>
  87. X00006 00006| @A@<Error recovery point@><010>
  88. X00007 00007| <010>
  89. X00008 00008| 2. Test recovery inside macro definition.<010>
  90. X00009 00009| <010>
  91. X00010 00010| @$@<Sloth1@>@>==@{<010>
  92. X00011 00011| Walrus@}<010>
  93. X00012 00012| <010>
  94. X00013 00013| @$@<Sloth2@>==@{<010>
  95. X00014 00014| @<Walrus@<<010>
  96. X00015 00015| @}<010>
  97. X00016 00016| @A@<Error recovery point@><010>
  98. X00017 00017| <010>
  99. X00018 00018| 3. Test recovery inside actual parameter list in macro definition.<010>
  100. X00019 00019| @$@<Sloth3@>==@{<010>
  101. X00020 00020| @<Walrus@>@(@"aardvark@><010>
  102. X00021 00021| @}<010>
  103. X00022 00022| @A@<Error recovery point@><010>
  104. X00023 00023| <010>
  105. X00024 00024| 4. Test EOF in the middle of a complicated construct.<010>
  106. X00025 00025| The following makes the end of the file looked chopped off, but it is<010>
  107. X00026 00026| actually intentional.<010>
  108. X00027 00027| @$@<Sloth4@>==@{<010>
  109. X00028 00028| @<Walrus@>@(@"aardva<010>
  110. X00029 00029| <End-Of-File><010>
  111. X-----------+--------------------------------------------------------------------
  112. Globl Local| Text
  113. X
  114. X============================ End of LINE LIST DUMP =============================
  115. X
  116. X
  117. X=========================== Start of TOKEN LIST DUMP ===========================
  118. X
  119. Summary: There are 72 tokens in the token list.
  120. X
  121. Line[Column]: Token Description
  122. X-------------------------------
  123. X
  124. X0001[01]: Text. Text scrap[Grey]="PR10: Test syntactic error recovery.<010>
  125. X<010>
  126. X1. Test recovery at top parsing level.<010>
  127. X"
  128. X0004[01]: @< Open name. 
  129. X0004[03]: Text. Text scrap[White]="<010>
  130. X<010>
  131. X"
  132. X0006[01]: @A New section (Level 1). 
  133. X0006[03]: @< Open name. 
  134. X0006[05]: Text. Text scrap[Grey]="Error recovery point"
  135. X0006[25]: @> Close name. 
  136. X0006[27]: Text. Text scrap[Grey]="<010>
  137. X<010>
  138. X2. Test recovery inside macro definition.<010>
  139. X<010>
  140. X"
  141. X0010[01]: @$ Macro defn. 
  142. X0010[03]: @< Open name. 
  143. X0010[05]: Text. Text scrap[Grey]="Sloth1"
  144. X0010[11]: @> Close name. 
  145. X0010[13]: @> Close name. 
  146. X0010[15]: Text. Text scrap[Grey]="=="
  147. X0010[17]: @{ Open defn. 
  148. X0010[19]: Text. Text scrap[Grey]="<010>
  149. Walrus"
  150. X0011[07]: @} Close defn. 
  151. X0011[09]: Text. Text scrap[White]="<010>
  152. X<010>
  153. X"
  154. X0013[01]: @$ Macro defn. 
  155. X0013[03]: @< Open name. 
  156. X0013[05]: Text. Text scrap[Grey]="Sloth2"
  157. X0013[11]: @> Close name. 
  158. X0013[13]: Text. Text scrap[Grey]="=="
  159. X0013[15]: @{ Open defn. 
  160. X0013[17]: Text. Text scrap[White]="<010>
  161. X"
  162. X0014[01]: @< Open name. 
  163. X0014[03]: Text. Text scrap[Grey]="Walrus"
  164. X0014[09]: @< Open name. 
  165. X0014[11]: Text. Text scrap[White]="<010>
  166. X"
  167. X0015[01]: @} Close defn. 
  168. X0015[03]: Text. Text scrap[White]="<010>
  169. X"
  170. X0016[01]: @A New section (Level 1). 
  171. X0016[03]: @< Open name. 
  172. X0016[05]: Text. Text scrap[Grey]="Error recovery point"
  173. X0016[25]: @> Close name. 
  174. X0016[27]: Text. Text scrap[Grey]="<010>
  175. X<010>
  176. X3. Test recovery inside actual parameter list in macro definition.<010>
  177. X"
  178. X0019[01]: @$ Macro defn. 
  179. X0019[03]: @< Open name. 
  180. X0019[05]: Text. Text scrap[Grey]="Sloth3"
  181. X0019[11]: @> Close name. 
  182. X0019[13]: Text. Text scrap[Grey]="=="
  183. X0019[15]: @{ Open defn. 
  184. X0019[17]: Text. Text scrap[White]="<010>
  185. X"
  186. X0020[01]: @< Open name. 
  187. X0020[03]: Text. Text scrap[Grey]="Walrus"
  188. X0020[09]: @> Close name. 
  189. X0020[11]: @( Open param. 
  190. X0020[13]: @" Quote. 
  191. X0020[15]: Text. Text scrap[Grey]="aardvark"
  192. X0020[23]: @> Close name. 
  193. X0020[25]: Text. Text scrap[White]="<010>
  194. X"
  195. X0021[01]: @} Close defn. 
  196. X0021[03]: Text. Text scrap[White]="<010>
  197. X"
  198. X0022[01]: @A New section (Level 1). 
  199. X0022[03]: @< Open name. 
  200. X0022[05]: Text. Text scrap[Grey]="Error recovery point"
  201. X0022[25]: @> Close name. 
  202. X0022[27]: Text. Text scrap[Grey]="<010>
  203. X<010>
  204. X4. Test EOF in the middle of a complicated construct.<010>
  205. The following makes the end of the file looked chopped off, but it is<010>
  206. actually intentional.<010>
  207. X"
  208. X0027[01]: @$ Macro defn. 
  209. X0027[03]: @< Open name. 
  210. X0027[05]: Text. Text scrap[Grey]="Sloth4"
  211. X0027[11]: @> Close name. 
  212. X0027[13]: Text. Text scrap[Grey]="=="
  213. X0027[15]: @{ Open defn. 
  214. X0027[17]: Text. Text scrap[White]="<010>
  215. X"
  216. X0028[01]: @< Open name. 
  217. X0028[03]: Text. Text scrap[Grey]="Walrus"
  218. X0028[09]: @> Close name. 
  219. X0028[11]: @( Open param. 
  220. X0028[13]: @" Quote. 
  221. X0028[15]: Text. Text scrap[Grey]="aardva<010>
  222. X"
  223. X0029[01]: End Of File. 
  224. X============================ End of TOKEN LIST DUMP ============================
  225. X
  226. X
  227. X========================== Start of MACRO TABLE DUMP ===========================
  228. X
  229. X
  230. X------------------- Start of Macro Dump --------------------
  231. Macro Name  : "Sloth1"
  232. Defined?    : Yes.
  233. Parameters  : 0
  234. Additive?   : No.
  235. Zero Calls? : No.
  236. Many Calls? : No.
  237. Output File?: No.
  238. Call list   :
  239. Macro body  :
  240. X
  241. X--Start of List of Body Parts--
  242. This macro has 0 body parts.
  243. X---End of List of Body Parts---
  244. X
  245. X-------------------- End of Macro Dump ---------------------
  246. X
  247. X
  248. X
  249. X------------------- Start of Macro Dump --------------------
  250. Macro Name  : "Sloth2"
  251. Defined?    : Yes.
  252. Parameters  : 0
  253. Additive?   : No.
  254. Zero Calls? : No.
  255. Many Calls? : No.
  256. Output File?: No.
  257. Call list   :
  258. Macro body  :
  259. X
  260. X--Start of List of Body Parts--
  261. This macro has 0 body parts.
  262. X---End of List of Body Parts---
  263. X
  264. X-------------------- End of Macro Dump ---------------------
  265. X
  266. X
  267. X
  268. X------------------- Start of Macro Dump --------------------
  269. Macro Name  : "Sloth3"
  270. Defined?    : Yes.
  271. Parameters  : 0
  272. Additive?   : No.
  273. Zero Calls? : No.
  274. Many Calls? : No.
  275. Output File?: No.
  276. Call list   :
  277. Macro body  :
  278. X
  279. X--Start of List of Body Parts--
  280. This macro has 0 body parts.
  281. X---End of List of Body Parts---
  282. X
  283. X-------------------- End of Macro Dump ---------------------
  284. X
  285. X
  286. X
  287. X------------------- Start of Macro Dump --------------------
  288. Macro Name  : "Sloth4"
  289. Defined?    : Yes.
  290. Parameters  : 0
  291. Additive?   : No.
  292. Zero Calls? : No.
  293. Many Calls? : No.
  294. Output File?: No.
  295. Call list   :
  296. Macro body  :
  297. X
  298. X--Start of List of Body Parts--
  299. This macro has 0 body parts.
  300. X---End of List of Body Parts---
  301. X
  302. X-------------------- End of Macro Dump ---------------------
  303. X
  304. X
  305. X
  306. X=========================== End of MACRO TABLE DUMP ============================
  307. X
  308. X
  309. X========================= Start of DOCUMENT LIST DUMP ==========================
  310. X
  311. X
  312. TEXT COMPONENT: Pos(L,C)=(1,1). 
  313. X
  314. X-- Start of Text Scrap List --
  315. Text scrap[Grey]="PR10: Test syntactic error recovery.<010>
  316. X<010>
  317. X1. Test recovery at top parsing level.<010>
  318. X"
  319. X--- End of Text Scrap List ---
  320. X
  321. X
  322. TEXT COMPONENT: Pos(L,C)=(4,3). 
  323. X
  324. X-- Start of Text Scrap List --
  325. Text scrap[White]="<010>
  326. X<010>
  327. X"
  328. X--- End of Text Scrap List ---
  329. X
  330. X
  331. TYPESETTER DIRECTIVE COMPONENT: 
  332. X   Section "1", Section name="Error recovery point".
  333. X
  334. TEXT COMPONENT: Pos(L,C)=(6,27). 
  335. X
  336. X-- Start of Text Scrap List --
  337. Text scrap[Grey]="<010>
  338. X<010>
  339. X2. Test recovery inside macro definition.<010>
  340. X<010>
  341. X"
  342. X--- End of Text Scrap List ---
  343. X
  344. X
  345. TYPESETTER DIRECTIVE COMPONENT: 
  346. X   Section "2", Section name="Error recovery point".
  347. X
  348. TEXT COMPONENT: Pos(L,C)=(16,27). 
  349. X
  350. X-- Start of Text Scrap List --
  351. Text scrap[Grey]="<010>
  352. X<010>
  353. X3. Test recovery inside actual parameter list in macro definition.<010>
  354. X"
  355. X--- End of Text Scrap List ---
  356. X
  357. X
  358. TYPESETTER DIRECTIVE COMPONENT: 
  359. X   Section "3", Section name="Error recovery point".
  360. X
  361. TEXT COMPONENT: Pos(L,C)=(22,27). 
  362. X
  363. X-- Start of Text Scrap List --
  364. Text scrap[Grey]="<010>
  365. X<010>
  366. X4. Test EOF in the middle of a complicated construct.<010>
  367. The following makes the end of the file looked chopped off, but it is<010>
  368. actually intentional.<010>
  369. X"
  370. X--- End of Text Scrap List ---
  371. X
  372. X
  373. X========================== End of DOCUMENT LIST DUMP ===========================
  374. X
  375. X
  376. Global Local| Input File
  377. X------------+-------------------------------------------------------------------
  378. X     1     1| PR10: Test syntactic error recovery.
  379. X     2     2| 
  380. X     3     3| 1. Test recovery at top parsing level.
  381. X     4     4| @<
  382. X       Error|.^The parser was at the top level and was expecting
  383. X            |.^one of: {Directive, Text, Macro definition, EOF}.
  384. X     5     5| 
  385. X     6     6| @A@<Error recovery point@>
  386. X     7     7| 
  387. X     8     8| 2. Test recovery inside macro definition.
  388. X     9     9| 
  389. X    10    10| @$@<Sloth1@>@>==@{
  390. X       Error|.............^Expecting '@{'.
  391. X            |.............^Skipping after error to the next major construct...
  392. X    11    11| Walrus@}
  393. X    12    12| 
  394. X    13    13| @$@<Sloth2@>==@{
  395. X            |.^...skipped to here after the error.
  396. X    14    14| @<Walrus@<
  397. X       Error|.........^Illegal character or symbol in name.
  398. X            |.........^Skipping after error to the next major construct...
  399. X    15    15| @}
  400. X    16    16| @A@<Error recovery point@>
  401. X            |.^...skipped to here after the error.
  402. X    17    17| 
  403. X    18    18| 3. Test recovery inside actual parameter list in macro definition.
  404. X    19    19| @$@<Sloth3@>==@{
  405. X    20    20| @<Walrus@>@(@"aardvark@>
  406. X       Error|.......................^Expecting '@"'.
  407. X            |.......................^Skipping after error to the next major construct...
  408. X    21    21| @}
  409. X    22    22| @A@<Error recovery point@>
  410. X            |.^...skipped to here after the error.
  411. X    23    23| 
  412. X    24    24| 4. Test EOF in the middle of a complicated construct.
  413. X    25    25| The following makes the end of the file looked chopped off, but it is
  414. X    26    26| actually intentional.
  415. X    27    27| @$@<Sloth4@>==@{
  416. X    28    28| @<Walrus@>@(@"aardva
  417. X            | <End-Of-File>
  418. X       Error|.^Expecting '@"'.
  419. X            |.^Skipping after error to the next major construct...
  420. X            |.^...skipped to here after the error.
  421. X------------+-------------------------------------------------------------------
  422. X
  423. There were 5 Errors.
  424. END_OF_FILE
  425. if test 12685 -ne `wc -c <'answers/pr10.lis'`; then
  426.     echo shar: \"'answers/pr10.lis'\" unpacked with wrong size!
  427. fi
  428. # end of 'answers/pr10.lis'
  429. fi
  430. if test -f 'answers/sc18.lis' -a "${1}" != "-c" ; then 
  431.   echo shar: Will not clobber existing file \"'answers/sc18.lis'\"
  432. else
  433. echo shar: Extracting \"'answers/sc18.lis'\" \(11098 characters\)
  434. sed "s/^X//" >'answers/sc18.lis' <<'END_OF_FILE'
  435. XFUNNELWEB LISTING FILE
  436. X======================
  437. X
  438. Dump of mapped file "<<Suppressed>>".
  439. X
  440. MEMORY DUMP OF MAPPED FILE
  441. X==========================
  442. X
  443. X+-------------------------------------------------+------------------+
  444. X| 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F | 0123456789ABCDEF |
  445. X+-------------------------------------------------+------------------+
  446. X| 53 43 31 38 3A 20 54 65 73 74 20 3C 73 70 65 63 | SC18: Test <spec |
  447. X| 69 61 6C 3E 23 3D 0A 0A 46 69 72 73 74 20 77 65 | ial>#=..First we |
  448. X| 20 74 72 69 70 20 75 70 20 74 68 65 20 73 63 61 |  trip up the sca |
  449. X| 6E 6E 65 72 20 73 6F 20 6E 6F 20 66 75 72 74 68 | nner so no furth |
  450. X| 65 72 20 70 61 73 73 65 73 20 74 61 6B 65 20 70 | er passes take p |
  451. X| 6C 61 63 65 2E 0A 0A 40 0A 0A 31 2E 20 54 65 73 | lace...@..1. Tes |
  452. X| 74 20 77 69 74 68 20 61 6C 6C 20 70 6F 73 73 69 | t with all possi |
  453. X| 62 6C 65 20 70 72 69 6E 74 61 62 6C 65 20 63 68 | ble printable ch |
  454. X| 61 72 61 63 74 65 72 73 2E 0A 0A 40 3D 21 20 21 | aracters...@=! ! |
  455. X| 3D 22 20 22 3D 23 20 23 3D 24 20 24 3D 25 20 25 | =" "=# #=$ $=% % |
  456. X| 3D 26 20 26 3D 27 20 27 3D 28 20 28 3D 29 20 29 | =& &=' '=( (=) ) |
  457. X| 3D 2A 20 2A 3D 2B 20 2B 3D 2C 20 2C 3D 2D 20 2D | =* *=+ +=, ,=- - |
  458. X| 3D 2E 20 2E 3D 2F 0A 2F 3D 30 20 30 3D 31 20 31 | =. .=/./=0 0=1 1 |
  459. X| 3D 32 20 32 3D 33 20 33 3D 34 20 34 3D 35 20 35 | =2 2=3 3=4 4=5 5 |
  460. X| 3D 36 20 36 3D 37 20 37 3D 38 20 38 3D 39 20 39 | =6 6=7 7=8 8=9 9 |
  461. X| 3D 3A 20 3A 3D 3B 20 3B 3D 3C 20 3C 3D 3D 20 3D | =: :=; ;=< <== = |
  462. X| 3D 3E 0A 3E 3D 3F 20 3F 3D 40 20 40 3D 41 20 41 | =>.>=? ?=@ @=A A |
  463. X| 3D 42 20 42 3D 43 20 43 3D 44 20 44 3D 45 20 45 | =B B=C C=D D=E E |
  464. X| 3D 46 20 46 3D 47 20 47 3D 48 20 48 3D 49 20 49 | =F F=G G=H H=I I |
  465. X| 3D 4A 20 4A 3D 4B 20 4B 3D 4C 20 4C 3D 4D 0A 4D | =J J=K K=L L=M.M |
  466. X| 3D 4E 20 4E 3D 4F 20 4F 3D 50 20 50 3D 51 20 51 | =N N=O O=P P=Q Q |
  467. X| 3D 52 20 52 3D 53 20 53 3D 54 20 54 3D 55 20 55 | =R R=S S=T T=U U |
  468. X| 3D 56 20 56 3D 57 20 57 3D 58 20 58 3D 59 20 59 | =V V=W W=X X=Y Y |
  469. X| 3D 5A 20 5A 3D 5B 20 5B 3D 5C 0A 5C 3D 5D 20 5D | =Z Z=[ [=\.\=] ] |
  470. X| 3D 5E 20 5E 3D 5F 20 5F 3D 60 20 60 3D 61 20 61 | =^ ^=_ _=` `=a a |
  471. X| 3D 62 20 62 3D 63 20 63 3D 64 20 64 3D 65 20 65 | =b b=c c=d d=e e |
  472. X| 3D 66 20 66 3D 67 20 67 3D 68 20 68 3D 69 20 69 | =f f=g g=h h=i i |
  473. X| 3D 6A 20 6A 3D 6B 0A 6B 3D 6C 20 6C 3D 6D 20 6D | =j j=k.k=l l=m m |
  474. X| 3D 6E 20 6E 3D 6F 20 6F 3D 70 20 70 3D 71 20 71 | =n n=o o=p p=q q |
  475. X| 3D 72 20 72 3D 73 20 73 3D 74 20 74 3D 75 20 75 | =r r=s s=t t=u u |
  476. X| 3D 76 20 76 3D 77 20 77 3D 78 20 78 3D 79 20 79 | =v v=w w=x x=y y |
  477. X| 3D 7A 0A 7A 3D 7B 20 7B 3D 7C 20 7C 3D 7D 20 7D | =z.z={ {=| |=} } |
  478. X| 3D 7E 20 7E 3D 40 0A 0A 32 2E 20 54 65 73 74 20 | =~ ~=@..2. Test  |
  479. X| 74 68 61 74 20 3C 73 70 65 63 69 61 6C 3E 3D 3C | that <special>=< |
  480. X| 73 70 61 63 65 3E 20 69 73 20 66 6C 61 67 67 65 | space> is flagge |
  481. X| 64 20 61 73 20 61 6E 20 65 72 72 6F 72 2E 0A 0A | d as an error... |
  482. X| 20 20 20 40 3D 20 20 20 20 20 40 21 20 53 68 6F |    @=     @! Sho |
  483. X| 75 6C 64 20 62 65 20 66 6C 61 67 67 65 64 20 61 | uld be flagged a |
  484. X| 73 20 61 6E 20 65 72 72 6F 72 2E 0A 0A 33 2E 20 | s an error...3.  |
  485. X| 54 65 73 74 20 74 68 61 74 20 3C 73 70 65 63 69 | Test that <speci |
  486. X| 61 6C 3E 3D 45 4F 4C 20 69 73 20 66 6C 61 67 67 | al>=EOL is flagg |
  487. X| 65 64 20 61 73 20 61 6E 20 65 72 72 6F 72 2E 0A | ed as an error.. |
  488. X| 0A 20 20 20 40 3D 0A 0A                         | .   @=..         |
  489. X+-------------------------------------------------+------------------+
  490. X
  491. X
  492. X=========================== Start of LINE LIST DUMP ============================
  493. X
  494. Globl Local| Text
  495. X-----------+--------------------------------------------------------------------
  496. X00001 00001| SC18: Test <special>#=<010>
  497. X00002 00002| <010>
  498. X00003 00003| First we trip up the scanner so no further passes take place.<010>
  499. X00004 00004| <010>
  500. X00005 00005| @<010>
  501. X00006 00006| <010>
  502. X00007 00007| 1. Test with all possible printable characters.<010>
  503. X00008 00008| <010>
  504. X00009 00009| @=! !=" "=# #=$ $=% %=& &=' '=( (=) )=* *=+ +=, ,=- -=. .=/<010>
  505. X00010 00010| /=0 0=1 1=2 2=3 3=4 4=5 5=6 6=7 7=8 8=9 9=: :=; ;=< <== ==><010>
  506. X00011 00011| >=? ?=@ @=A A=B B=C C=D D=E E=F F=G G=H H=I I=J J=K K=L L=M<010>
  507. X00012 00012| M=N N=O O=P P=Q Q=R R=S S=T T=U U=V V=W W=X X=Y Y=Z Z=[ [=\<010>
  508. X00013 00013| \=] ]=^ ^=_ _=` `=a a=b b=c c=d d=e e=f f=g g=h h=i i=j j=k<010>
  509. X00014 00014| k=l l=m m=n n=o o=p p=q q=r r=s s=t t=u u=v v=w w=x x=y y=z<010>
  510. X00015 00015| z={ {=| |=} }=~ ~=@<010>
  511. X00016 00016| <010>
  512. X00017 00017| 2. Test that <special>=<space> is flagged as an error.<010>
  513. X00018 00018| <010>
  514. X00019 00019|    @=     @! Should be flagged as an error.<010>
  515. X00020 00020| <010>
  516. X00021 00021| 3. Test that <special>=EOL is flagged as an error.<010>
  517. X00022 00022| <010>
  518. X00023 00023|    @=<010>
  519. X00024 00024| <010>
  520. X00025 00025| <End-Of-File><010>
  521. X-----------+--------------------------------------------------------------------
  522. Globl Local| Text
  523. X
  524. X============================ End of LINE LIST DUMP =============================
  525. X
  526. X
  527. X=========================== Start of TOKEN LIST DUMP ===========================
  528. X
  529. Summary: There are 101 tokens in the token list.
  530. X
  531. Line[Column]: Token Description
  532. X-------------------------------
  533. X
  534. X0001[01]: Text. Text scrap[Grey]="SC18: Test <special>#=<010>
  535. X<010>
  536. XFirst we trip up the scanner so no further passes take place.<010>
  537. X<010>
  538. X"
  539. X0006[01]: Text. Text scrap[Grey]="<010>
  540. X1. Test with all possible printable characters.<010>
  541. X<010>
  542. X"
  543. X0009[04]: Text. Text scrap[White]=" "
  544. X0009[08]: Text. Text scrap[White]=" "
  545. X0009[12]: Text. Text scrap[White]=" "
  546. X0009[16]: Text. Text scrap[White]=" "
  547. X0009[20]: Text. Text scrap[White]=" "
  548. X0009[24]: Text. Text scrap[White]=" "
  549. X0009[28]: Text. Text scrap[White]=" "
  550. X0009[32]: Text. Text scrap[White]=" "
  551. X0009[36]: Text. Text scrap[White]=" "
  552. X0009[40]: Text. Text scrap[White]=" "
  553. X0009[44]: Text. Text scrap[White]=" "
  554. X0009[48]: Text. Text scrap[White]=" "
  555. X0009[52]: Text. Text scrap[White]=" "
  556. X0009[56]: Text. Text scrap[White]=" "
  557. X0009[60]: Text. Text scrap[White]="<010>
  558. X"
  559. X0010[04]: Text. Text scrap[White]=" "
  560. X0010[08]: Text. Text scrap[White]=" "
  561. X0010[12]: Text. Text scrap[White]=" "
  562. X0010[16]: Text. Text scrap[White]=" "
  563. X0010[20]: Text. Text scrap[White]=" "
  564. X0010[24]: Text. Text scrap[White]=" "
  565. X0010[28]: Text. Text scrap[White]=" "
  566. X0010[32]: Text. Text scrap[White]=" "
  567. X0010[36]: Text. Text scrap[White]=" "
  568. X0010[40]: Text. Text scrap[White]=" "
  569. X0010[44]: Text. Text scrap[White]=" "
  570. X0010[48]: Text. Text scrap[White]=" "
  571. X0010[52]: Text. Text scrap[White]=" "
  572. X0010[56]: Text. Text scrap[White]=" "
  573. X0010[60]: Text. Text scrap[White]="<010>
  574. X"
  575. X0011[04]: Text. Text scrap[White]=" "
  576. X0011[08]: Text. Text scrap[White]=" "
  577. X0011[12]: Text. Text scrap[White]=" "
  578. X0011[16]: Text. Text scrap[White]=" "
  579. X0011[20]: Text. Text scrap[White]=" "
  580. X0011[24]: Text. Text scrap[White]=" "
  581. X0011[28]: Text. Text scrap[White]=" "
  582. X0011[32]: Text. Text scrap[White]=" "
  583. X0011[36]: Text. Text scrap[White]=" "
  584. X0011[40]: Text. Text scrap[White]=" "
  585. X0011[44]: Text. Text scrap[White]=" "
  586. X0011[48]: Text. Text scrap[White]=" "
  587. X0011[52]: Text. Text scrap[White]=" "
  588. X0011[56]: Text. Text scrap[White]=" "
  589. X0011[60]: Text. Text scrap[White]="<010>
  590. X"
  591. X0012[04]: Text. Text scrap[White]=" "
  592. X0012[08]: Text. Text scrap[White]=" "
  593. X0012[12]: Text. Text scrap[White]=" "
  594. X0012[16]: Text. Text scrap[White]=" "
  595. X0012[20]: Text. Text scrap[White]=" "
  596. X0012[24]: Text. Text scrap[White]=" "
  597. X0012[28]: Text. Text scrap[White]=" "
  598. X0012[32]: Text. Text scrap[White]=" "
  599. X0012[36]: Text. Text scrap[White]=" "
  600. X0012[40]: Text. Text scrap[White]=" "
  601. X0012[44]: Text. Text scrap[White]=" "
  602. X0012[48]: Text. Text scrap[White]=" "
  603. X0012[52]: Text. Text scrap[White]=" "
  604. X0012[56]: Text. Text scrap[White]=" "
  605. X0012[60]: Text. Text scrap[White]="<010>
  606. X"
  607. X0013[04]: Text. Text scrap[White]=" "
  608. X0013[08]: Text. Text scrap[White]=" "
  609. X0013[12]: Text. Text scrap[White]=" "
  610. X0013[16]: Text. Text scrap[White]=" "
  611. X0013[20]: Text. Text scrap[White]=" "
  612. X0013[24]: Text. Text scrap[White]=" "
  613. X0013[28]: Text. Text scrap[White]=" "
  614. X0013[32]: Text. Text scrap[White]=" "
  615. X0013[36]: Text. Text scrap[White]=" "
  616. X0013[40]: Text. Text scrap[White]=" "
  617. X0013[44]: Text. Text scrap[White]=" "
  618. X0013[48]: Text. Text scrap[White]=" "
  619. X0013[52]: Text. Text scrap[White]=" "
  620. X0013[56]: Text. Text scrap[White]=" "
  621. X0013[60]: Text. Text scrap[White]="<010>
  622. X"
  623. X0014[04]: Text. Text scrap[White]=" "
  624. X0014[08]: Text. Text scrap[White]=" "
  625. X0014[12]: Text. Text scrap[White]=" "
  626. X0014[16]: Text. Text scrap[White]=" "
  627. X0014[20]: Text. Text scrap[White]=" "
  628. X0014[24]: Text. Text scrap[White]=" "
  629. X0014[28]: Text. Text scrap[White]=" "
  630. X0014[32]: Text. Text scrap[White]=" "
  631. X0014[36]: Text. Text scrap[White]=" "
  632. X0014[40]: Text. Text scrap[White]=" "
  633. X0014[44]: Text. Text scrap[White]=" "
  634. X0014[48]: Text. Text scrap[White]=" "
  635. X0014[52]: Text. Text scrap[White]=" "
  636. X0014[56]: Text. Text scrap[White]=" "
  637. X0014[60]: Text. Text scrap[White]="<010>
  638. X"
  639. X0015[04]: Text. Text scrap[White]=" "
  640. X0015[08]: Text. Text scrap[White]=" "
  641. X0015[12]: Text. Text scrap[White]=" "
  642. X0015[16]: Text. Text scrap[White]=" "
  643. X0015[20]: Text. Text scrap[Grey]="<010>
  644. X<010>
  645. X2. Test that <special>=<space> is flagged as an error.<010>
  646. X<010>
  647. X   "
  648. X0019[07]: Text. Text scrap[White]="    "
  649. X0020[01]: Text. Text scrap[Grey]="<010>
  650. X3. Test that <special>=EOL is flagged as an error.<010>
  651. X<010>
  652. X   "
  653. X0024[01]: Text. Text scrap[White]="<010>
  654. X"
  655. X0025[01]: End Of File. 
  656. X============================ End of TOKEN LIST DUMP ============================
  657. X
  658. Macro table dump skipped (Parser was not invoked).
  659. Document list dump skipped (Parser was not invoked).
  660. X
  661. Global Local| Input File
  662. X------------+-------------------------------------------------------------------
  663. X     1     1| SC18: Test <special>#=
  664. X     2     2| 
  665. X     3     3| First we trip up the scanner so no further passes take place.
  666. X     4     4| 
  667. X     5     5| @
  668. X       Error|.^<special><endofline> is not a legal special sequence.
  669. X     6     6| 
  670. X     7     7| 1. Test with all possible printable characters.
  671. X     8     8| 
  672. X     9     9| @=! !=" "=# #=$ $=% %=& &=' '=( (=) )=* *=+ +=, ,=- -=. .=/
  673. X    10    10| /=0 0=1 1=2 2=3 3=4 4=5 5=6 6=7 7=8 8=9 9=: :=; ;=< <== ==>
  674. X    11    11| >=? ?=@ @=A A=B B=C C=D D=E E=F F=G G=H H=I I=J J=K K=L L=M
  675. X    12    12| M=N N=O O=P P=Q Q=R R=S S=T T=U U=V V=W W=X X=Y Y=Z Z=[ [=\
  676. X    13    13| \=] ]=^ ^=_ _=` `=a a=b b=c c=d d=e e=f f=g g=h h=i i=j j=k
  677. X    14    14| k=l l=m m=n n=o o=p p=q q=r r=s s=t t=u u=v v=w w=x x=y y=z
  678. X    15    15| z={ {=| |=} }=~ ~=@
  679. X    16    16| 
  680. X    17    17| 2. Test that <special>=<space> is flagged as an error.
  681. X    18    18| 
  682. X    19    19|    @=     @! Should be flagged as an error.
  683. X       Error|....^You cannot set the special character to <space>!
  684. X            |....^Special sequence ignored.
  685. X    20    20| 
  686. X    21    21| 3. Test that <special>=EOL is flagged as an error.
  687. X    22    22| 
  688. X    23    23|    @=
  689. X       Error|....^You cannot set the special character to <endofline>!
  690. X            |....^Special sequence ignored.
  691. X    24    24| 
  692. X            | <End-Of-File>
  693. X------------+-------------------------------------------------------------------
  694. X
  695. There were 3 Errors.
  696. END_OF_FILE
  697. if test 11098 -ne `wc -c <'answers/sc18.lis'`; then
  698.     echo shar: \"'answers/sc18.lis'\" unpacked with wrong size!
  699. fi
  700. # end of 'answers/sc18.lis'
  701. fi
  702. if test -f 'sources/analyse.c' -a "${1}" != "-c" ; then 
  703.   echo shar: Will not clobber existing file \"'sources/analyse.c'\"
  704. else
  705. echo shar: Extracting \"'sources/analyse.c'\" \(11750 characters\)
  706. sed "s/^X//" >'sources/analyse.c' <<'END_OF_FILE'
  707. X/*##############################################################################
  708. X
  709. XFUNNNELWEB COPYRIGHT
  710. X====================
  711. XFunnelWeb is a literate-programming macro preprocessor.
  712. X
  713. Copyright (C) 1992 Ross N. Williams.
  714. X
  715. X   Ross N. Williams
  716. X   ross@spam.adelaide.edu.au
  717. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  718. X
  719. This program is free software; you can redistribute it and/or modify
  720. it under the terms of Version 2 of the GNU General Public License as
  721. published by the Free Software Foundation.
  722. X
  723. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  724. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  725. See Version 2 of the GNU General Public License for more details.
  726. X
  727. You should have received a copy of Version 2 of the GNU General Public
  728. License along with this program. If not, you can FTP the license from
  729. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  730. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  731. X
  732. Section 2a of the license requires that all changes to this file be
  733. recorded prominently in this file. Please record all changes here.
  734. X
  735. Programmers:
  736. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  737. X
  738. Changes:
  739. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  740. X
  741. X##############################################################################*/
  742. X
  743. X
  744. X/******************************************************************************/
  745. X/*                                   ANALYSE.C                                */
  746. X/******************************************************************************/
  747. X
  748. X#include "style.h"
  749. X
  750. X#include "analyse.h"
  751. X#include "as.h"
  752. X#include "data.h"
  753. X#include "lister.h"
  754. X#include "misc.h"
  755. X#include "table.h"
  756. X
  757. X/******************************************************************************/
  758. X
  759. LOCAL void chk_mac P_((p_ma_t));
  760. LOCAL void chk_mac (p_ma)
  761. p_ma_t p_ma;
  762. X{
  763. X mc_t *call;
  764. X
  765. X /* Deal with undefined macros by flagging the first invocation. */
  766. X if (!p_ma->ma_defn.md_isdef)
  767. X   {
  768. X    ls_loo(p_ma->ma_calls,(ulong) 1,PPV &call);
  769. X    as_cold(call!=NULL,"check_macro: No instances of \"undefined\" macro!");
  770. X    lr_err(&call->mc_ps,"Call to undefined macro.");
  771. X    return;
  772. X   }
  773. X
  774. X /* Assert: The macro has a definition. */
  775. X
  776. X /* Check that all the calls to the macro have the correct number of params. */
  777. X ls_fir(p_ma->ma_calls);
  778. X ls_nxt(p_ma->ma_calls,PPV &call);
  779. X while (call!=NULL)
  780. X    {
  781. X     if (call->mc_npar != p_ma->ma_defn.md_npar)
  782. X       {
  783. X        sprintf(linet1,"Call has %lu parameter%s, but the macro",
  784. X                (ulong) call->mc_npar,
  785. X                call->mc_npar==1 ? "" : "s");
  786. X        lr_err(&(call->mc_ps),linet1);
  787. X        sprintf(linet1,"definition at line %lu specifies %lu parameter%s.",
  788. X                (ulong) p_ma->ma_defn.md_ps.ps_line,
  789. X                (ulong) p_ma->ma_defn.md_npar,
  790. X                p_ma->ma_defn.md_npar==1 ? "" : "s");
  791. X        lr_mes(&(call->mc_ps),linet1);
  792. X        if (p_ma->ma_defn.md_npar==0 && call->mc_npar==1)
  793. X          {
  794. X           lr_mes(&(call->mc_ps),"Note: If your call looks like this: @<Macro@>@(@) then you");
  795. X           lr_mes(&(call->mc_ps),"should be aware that FunnelWeb treats this as a call with");
  796. X           lr_mes(&(call->mc_ps),"a single parameter consisting of the empty string. This");
  797. X           lr_mes(&(call->mc_ps),"is a consequence of parameter delimiters @\"@\" being optional.");
  798. X          }
  799. X       }
  800. X     ls_nxt(p_ma->ma_calls,PPV &call);
  801. X    }
  802. X
  803. X /* Check that the number of calls of the macro is legal. */
  804. X if (p_ma->ma_defn.md_isfil)
  805. X   {
  806. X    /* Flag all calls to a file macro as errors. */
  807. X    if (ls_len(p_ma->ma_calls)>0)
  808. X      {
  809. X       lr_mes(&p_ma->ma_defn.md_ps,
  810. X              "This file macro is called one or more times.");
  811. X       lr_mes(&p_ma->ma_defn.md_ps,
  812. X              "Each call has been flagged with an error message.");
  813. X      }
  814. X    ls_fir(p_ma->ma_calls);
  815. X    ls_nxt(p_ma->ma_calls,PPV &call);
  816. X    while (call!=NULL)
  817. X      {
  818. X       lr_err(&(call->mc_ps),"Calls to file macros are not allowed.");
  819. X       lr_mes(&(call->mc_ps),"Reason: It should be possible to comment out a");
  820. X       lr_mes(&(call->mc_ps),"file macro without a big fuss. Calling a file macro");
  821. X       lr_mes(&(call->mc_ps),"just tangles it up in the macro structure,");
  822. X       lr_mes(&(call->mc_ps),"making it more difficult to comment out later.");
  823. X       ls_nxt(p_ma->ma_calls,PPV &call);
  824. X      }
  825. X   }
  826. X else
  827. X   {
  828. X    /* Non-file macros. */
  829. X    if (ls_len(p_ma->ma_calls)==0 && !p_ma->ma_defn.md_iszer)
  830. X       lr_err(&p_ma->ma_defn.md_ps,
  831. X              "This macro is never used (and has no @Z).");
  832. X
  833. X    if (ls_len(p_ma->ma_calls)>1 && !p_ma->ma_defn.md_isman)
  834. X       lr_err(&p_ma->ma_defn.md_ps,
  835. X              "This macro is used more than once (and has no @M).");
  836. X   }
  837. X}
  838. X
  839. X/******************************************************************************/
  840. X
  841. LOCAL void chk_rec P_((void));
  842. LOCAL void chk_rec()
  843. X/* This macro analyses the calls between the macros in the macro              */
  844. X/* table and flags all recursive macros with an error message.                */
  845. X/*                                                                            */
  846. X/* Def: A macro is a "level 0 macro" if it does not call any macros.          */
  847. X/* Def: A macro is a "level n macro" if it calls at least one macro of level  */
  848. X/*      n-1, but does not call any macros of level n or higher.               */
  849. X/* Def: A macro is a "level infinity macro" if it directly or indirectly      */
  850. X/*      calls itself.                                                         */
  851. X/*                                                                            */
  852. X/* This function totally ignores undefined macros. This means that it can be  */
  853. X/* invoked even if problems are detected by the other checks.                 */
  854. X/*                                                                            */
  855. X/* Although the actions of this may seem rather time expensive, they may not  */
  856. X/* be. The function repeatedly runs through the macro table and each macro's  */
  857. X/* bodypart list and expression lists. However, there are not likely to be    */
  858. X/* many macros and each definition expression list is likely to be quite      */
  859. X/* short, as each macro will be mainly text.                                  */
  860. X/* Even if this stuff does take a while, it is better to detect recursion now */
  861. X/* than at tangle time!                                                       */
  862. X{
  863. X p_ma_t p_ma;        /* General purpose pointer to macro.                     */
  864. X name_t dummy_name;  /* Dummy name variable acts as a placeholder in calls.   */
  865. X uword  level;       /* Level of macro currently being tagged.                */
  866. X bool   gotone;      /* TRUE iff current loop iteration tagged >0 macros.     */
  867. X
  868. X/* We need a concrete number to stand for level infinity. */
  869. X/* 30000 is a nice, large 15 bit number.                  */
  870. X#define LEVINF 30000
  871. X
  872. X /* Make sure that our idea of infinity is big enough. */
  873. X as_cold(tb_len(macro_table)<LEVINF,"ana_rec: too many macros.");
  874. X
  875. X /* Tag all the macros as being at level infinity.                            */
  876. X /* This could be done in the parser, but it's neater to do it here.          */
  877. X tb_fir(macro_table);
  878. X while (tb_rea(macro_table,PV dummy_name,PV &p_ma))
  879. X    if (p_ma->ma_defn.md_isdef)
  880. X       p_ma->ma_level=LEVINF;
  881. X
  882. X gotone=TRUE;
  883. X /* Work from level 0 upwards identifying macros of successive levels.        */
  884. X for (level=0; level<LEVINF && gotone; level++)
  885. X   {
  886. X    /* Identify all macros of level 'level'. */
  887. X    /* Gotone tells us if we managed to tag a macro during this iteration. */
  888. X    gotone=FALSE;
  889. X
  890. X    /* Run through table tagging all macros at level 'level'. */
  891. X    tb_fir(macro_table);
  892. X    while (tb_rea(macro_table,PV dummy_name,PV &p_ma))
  893. X      {
  894. X       if (p_ma->ma_defn.md_isdef && p_ma->ma_level == LEVINF)
  895. X         {
  896. X          p_bpls_t p_bpls = p_ma->ma_defn.md_body;
  897. X          /* Run through each body part of the macro. */
  898. X          ls_fir(p_bpls);
  899. X          while (TRUE)
  900. X            {
  901. X             p_bp_t p_bp;
  902. X             ls_nxt(p_bpls,PPV &p_bp);
  903. X             if (p_bp==NULL) break;
  904. X             /* Run through the list of expression elements. */
  905. X             ls_fir(p_bp->bp_ex);
  906. X             while (TRUE)
  907. X               {
  908. X                p_el_t p_el;
  909. X                ls_nxt(p_bp->bp_ex,PPV &p_el);
  910. X                if (p_el==NULL) break;
  911. X                /* Don't tag anything that calls anything that isn't tagged. */
  912. X                if ((p_el->el_kind==EL_INVC          ) &&
  913. X                    (p_el->el_p_mac->ma_defn.md_isdef) &&
  914. X
  915. X    (p_el->el_p_mac->ma_level==LEVINF))
  916. X                   goto nextmacro;
  917. X               }
  918. X            }
  919. X          /* If we got this far, then our macro must have called nothing but  */
  920. X          /* macros of levels [0,level-1]. Thus, we can tag it level 'level'. */
  921. X          p_ma->ma_level=level;
  922. X          gotone=TRUE;
  923. X         } /* End if */
  924. X       nextmacro:;
  925. X      } /* End while */
  926. X   } /* End for loop. */
  927. X
  928. X /* At this point, we have tagged all macros with their level number. Note    */
  929. X /* that level infinity macros are discovered simply because they do not get  */
  930. X /* tagged. The following loop flags all such recursive macros with errors.   */
  931. X tb_fir(macro_table);
  932. X while (tb_rea(macro_table,PV dummy_name,PV &p_ma))
  933. X    if (p_ma->ma_defn.md_isdef && p_ma->ma_level==LEVINF)
  934. X       lr_err(&p_ma->ma_defn.md_ps,"This macro has an infinite expansion.");
  935. X
  936. X /* Note: The above message is not "This macro is defined recursively",       */
  937. X /* because this function catches not only recursive macros, but also all the */
  938. X /* non-recursive macros that call the recursive macros!! To detect only      */
  939. X /* the recursive macros, we really ought to use Tarjan's algorithm for the   */
  940. X /* detection of strongly connected components. However, I don't have the     */
  941. X /* reference handy right now and I want to finish this version of FunnelWeb  */
  942. X /* soon, so I'll leave the installation of Tarjan's algorithm as a possible  */
  943. X /* future enhancement. Then the error message can be changed.                */
  944. X}
  945. X
  946. X/******************************************************************************/
  947. X
  948. XEXPORT void analyse()
  949. X{
  950. X name_t dummy_name;
  951. X p_ma_t p_ma;
  952. X
  953. X /* Issue an error if there are no macros. */
  954. X if (tb_len(macro_table)==0)
  955. X   {
  956. X    char *m="E: No macros defined.";
  957. X    wl_l(m);
  958. X    if (option.op_s_b)
  959. X       wl_sj(m);
  960. X    num_err++;
  961. X   }
  962. X
  963. X /* Issue an error if there are no product (output) files. */
  964. X if (tb_len(file_table)==0)
  965. X   {
  966. X    char *m="E: No output files specified.";
  967. X    wl_l(m);
  968. X    if (option.op_s_b)
  969. X       wl_sj(m);
  970. X    num_err++;
  971. X   }
  972. X
  973. X /* Take a look at each macro and issue appropriate diagnostics. */
  974. X tb_fir(macro_table);
  975. X while (tb_rea(macro_table,PV dummy_name,PV &p_ma))
  976. X    chk_mac(p_ma);
  977. X
  978. X /* Check for recursive macros. */
  979. X chk_rec();
  980. X
  981. X /* Run through the document list and flag any sections that still have not   */
  982. X /* been given names.                                                         */
  983. X ls_fir(document_list);
  984. X while (TRUE)
  985. X   {
  986. X    p_dc_t p_dc;
  987. X    ls_nxt(document_list,PPV &p_dc);
  988. X    if (p_dc==NULL) break;
  989. X    if (p_dc->dc_kind==DC_TYPE &&
  990. X        p_dc->dc_ty.ty_kind==TY_NSEC &&
  991. X        !p_dc->dc_ty.ty_isnam)
  992. X      {
  993. X       lr_err(&p_dc->dc_ps,"This section has no name.");
  994. X       lr_mes(&p_dc->dc_ps,"You can give it one explicitly (As in @A@<Sloth@>) or implicitly by");
  995. X       lr_mes(&p_dc->dc_ps,"defining a macro (whose name will be inherited) within the section.");
  996. X      }
  997. X   }
  998. X}
  999. X
  1000. X/******************************************************************************/
  1001. X/*                               End of ANALYSE.C                             */
  1002. X/******************************************************************************/
  1003. END_OF_FILE
  1004. if test 11750 -ne `wc -c <'sources/analyse.c'`; then
  1005.     echo shar: \"'sources/analyse.c'\" unpacked with wrong size!
  1006. fi
  1007. # end of 'sources/analyse.c'
  1008. fi
  1009. if test -f 'sources/environ.h' -a "${1}" != "-c" ; then 
  1010.   echo shar: Will not clobber existing file \"'sources/environ.h'\"
  1011. else
  1012. echo shar: Extracting \"'sources/environ.h'\" \(11366 characters\)
  1013. sed "s/^X//" >'sources/environ.h' <<'END_OF_FILE'
  1014. X/*##############################################################################
  1015. X
  1016. XFUNNNELWEB COPYRIGHT
  1017. X====================
  1018. XFunnelWeb is a literate-programming macro preprocessor.
  1019. X
  1020. Copyright (C) 1992 Ross N. Williams.
  1021. X
  1022. X   Ross N. Williams
  1023. X   ross@spam.adelaide.edu.au
  1024. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1025. X
  1026. This program is free software; you can redistribute it and/or modify
  1027. it under the terms of Version 2 of the GNU General Public License as
  1028. published by the Free Software Foundation.
  1029. X
  1030. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1031. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1032. See Version 2 of the GNU General Public License for more details.
  1033. X
  1034. You should have received a copy of Version 2 of the GNU General Public
  1035. License along with this program. If not, you can FTP the license from
  1036. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1037. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1038. X
  1039. Section 2a of the license requires that all changes to this file be
  1040. recorded prominently in this file. Please record all changes here.
  1041. X
  1042. Programmers:
  1043. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1044. X
  1045. Changes:
  1046. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1047. X
  1048. X##############################################################################*/
  1049. X
  1050. X
  1051. X/******************************************************************************/
  1052. X/*                                   ENVIRON.H                                */
  1053. X/******************************************************************************/
  1054. X/*                                                                            */
  1055. X/* WARNING: DO NOT ADD ANY PROGRAM-DEPENDENT DEFINITIONS.                     */
  1056. X/*                                                                            */
  1057. X/* This header file environ.h contains definitions and objects whose values   */
  1058. X/* depends directly on the compilation and execution environment, but are     */
  1059. X/* otherwise independent of any particular computer program.                  */
  1060. X/*                                                                            */
  1061. X/* This is one of two machine-dependent, program-independent modules. The     */
  1062. X/* other module is machin (machin.h,machin.c). This "environ" module contains */
  1063. X/* definitions and objects that are considered essential. The "machin" module */
  1064. X/* contains less essential definitions. Motivation for the division came from */
  1065. X/* the fact that style.h (used by almost every module) includes environ.h     */
  1066. X/* (this file), and from the need for the stuff in style.h by some            */
  1067. X/* environment-dependent definitions.                                         */
  1068. X/*                                                                            */
  1069. X/* There seems to be two ways to organize a module such as this one. The      */
  1070. X/* first is to have a different version of this module for each target        */
  1071. X/* environment. The second is to have a single file that uses #defines and    */
  1072. X/* #ifs to select between code for each target environment. I have chosen the */
  1073. X/* latter method as this allows many different environments to share the same */
  1074. X/* definitions.                                                               */
  1075. X/*                                                                            */
  1076. X/******************************************************************************/
  1077. X
  1078. X/* Ensure that the body of this header file is included at most once.         */
  1079. X#ifndef DONE_ENVIRON
  1080. X#define DONE_ENVIRON
  1081. X
  1082. X/******************************************************************************/
  1083. X
  1084. X/* Select An Environment                                                      */
  1085. X/* ---------------------                                                      */
  1086. X/* Choose the environment in which the program will be compiled and executed. */
  1087. X/* This may be the only change you need to make to get FunnelWeb to compile.  */
  1088. X/*                                                                            */
  1089. X/* If your exact environment is not listed, try one that is close.            */
  1090. X/* If problems arise, an attempt should be made to solve them                 */
  1091. X/* without creating a new environment definition.  However, if this is not    */
  1092. X/* possible, define a new environment below and "implement" it by going       */
  1093. X/* through environ.h and machin.h and machin.c and adding appropriate         */
  1094. X/* definitions.                                                               */
  1095. X/*                                                                            */
  1096. X/* The following table lists real/defined environment pairs under which       */
  1097. X/* FunnelWeb is known to compile cleanly.                                     */
  1098. X/*                                                                            */
  1099. X/* Symbol = Processor  Machine       OS            Compiler                   */
  1100. X/* ------   ---------  -------       --            --------                   */
  1101. X/*    MAC = 68000      Macintosh-SE  Mac           THINK-C V4.0.5             */
  1102. X/*    SUN = SPARC      SUN ELC       Unix(SunOS)   GNUC                       */
  1103. X/*    VMS = VAX        VAXStation    VMS           VAXC                       */
  1104. X/*     PC = 386        IBM PC Clone  MSDOS5.0      Borland C++                */
  1105. X/*                                                                            */
  1106. X/* Set exactly one of the following environments to 1, the others to 0.       */
  1107. X
  1108. X#define MAC 0
  1109. X#define SUN 1
  1110. X#define VMS 0
  1111. X#define PC  0
  1112. X
  1113. X/* Ensure that exactly one environment has been selected.                     */
  1114. X#if MAC+SUN+VMS+PC != 1
  1115. X   #error Error: You must choose exactly one machine in ENVIRON.H.
  1116. X#endif
  1117. X
  1118. X/******************************************************************************/
  1119. X
  1120. X/* Establish Presence or Absence of __STDC__                                  */
  1121. X/* -----------------------------------------                                  */
  1122. X/* The __STDC__ symbol is very useful for determining if the compiler is      */
  1123. X/* ANSI. However, some "nearly ANSI" compilers don't set this symbol, and     */
  1124. X/* experience shows that things turn out better if it is set.                 */
  1125. X/* This section decides if __STDC__ should be defined.                        */
  1126. X
  1127. X/* The Macintosh THINK C compiler seems to be ANSI standard but, strangely    */
  1128. X/* does not define the standard preprocessor symbol __STDC__ that indicates   */
  1129. X/* this. Instead it defines THINK_C. Here, we execute the link manually.      */
  1130. X/* For more information see the THINK C User's Manual, Chapter 57: "Language  */
  1131. X/* Reference", Section 12.10, p.442.                                          */
  1132. X#ifdef THINK_C
  1133. X#define __STDC__ 1
  1134. X#endif
  1135. X
  1136. X/* The problem seems to exist with VAX C too. */
  1137. X#if VMS
  1138. X#define __STDC__ 1
  1139. X#endif
  1140. X
  1141. X/******************************************************************************/
  1142. X
  1143. X/* Switch From Definedness to Boolean Symbols                                 */
  1144. X/* ------------------------------------------                                 */
  1145. X/* Use of the definedness of a preprocessor symbol to detect a condition is   */
  1146. X/* convenient if it is desired that only one condition be tested at a time.   */
  1147. X/* However, if we want to OR conditions, it is more convenient to use defined */
  1148. X/* symbols that are either 0 or 1. This section contains ifdefs that do this. */
  1149. X
  1150. X#ifdef __STDC__
  1151. X#define STDC 1
  1152. X#else
  1153. X#define STDC 0
  1154. X#endif
  1155. X
  1156. X/* Note: If THINK_C is predefined, it is predefined to be 1. */
  1157. X#ifndef THINK_C
  1158. X#define THINK_C 0
  1159. X#endif
  1160. X
  1161. X/******************************************************************************/
  1162. X
  1163. X/* Void                                                                       */
  1164. X/* ----                                                                       */
  1165. X/* Define void if necessary and define pointer to void.                       */
  1166. X/* This idea from the book "Portable C", p.41.                                */
  1167. X/* If necessary, add a boolean condition to cover your environment.           */
  1168. X/* Note: The "| SUN" is a last minute desperate hack.                         */
  1169. X#if STDC | SUN
  1170. typedef void   *p_void;
  1171. X#else
  1172. typedef int       void;
  1173. typedef char   *p_void;
  1174. X#endif
  1175. X
  1176. X/* The following function is here solely to act as a first tripping point for */
  1177. X/* environments with no "void" so that the users trying to port this code     */
  1178. X/* will look here first instead of starting to delete voids in the program.   */
  1179. extern void test_void();
  1180. X
  1181. X/******************************************************************************/
  1182. X
  1183. X/* Const                                                                      */
  1184. X/* -----                                                                      */
  1185. X/* It's useful to be able to specify that certain objects are constants.      */
  1186. X/* Unfortunately, the "const" construct is only available in ANSI C and so we */
  1187. X/* have to have a macro so as to cope with non-ANSI compilers.                */
  1188. X/* Note: THINK-C is nearly ANSI, but does not support "const".                */
  1189. X#if STDC & !THINK_C
  1190. X#define CONST const
  1191. X#else
  1192. X#define CONST
  1193. X#endif
  1194. X
  1195. X/******************************************************************************/
  1196. X
  1197. X/* Prototypes                                                                 */
  1198. X/* ----------                                                                 */
  1199. X/* Define a macro to wrap around prototype parameter lists so as to support   */
  1200. X/* compilers with and without prototypes.                                     */
  1201. X/* This idea came from the book "Portable C", S3.1, p.32.                     */
  1202. X#if STDC
  1203. X#define P_(A) A
  1204. X#else
  1205. X#define P_(A) ()
  1206. X#endif
  1207. X
  1208. X/******************************************************************************/
  1209. X
  1210. X/* Structure Assignments                                                      */
  1211. X/* ---------------------                                                      */
  1212. X/* Structure assignments are not supported on some of the older compilers and */
  1213. X/* so we use a macro to perform such operations.                              */
  1214. X/* This idea came from the book "Portable C", S8.2.2, p.184.                  */
  1215. X#if STDC
  1216. X#define ASSIGN(a,b) ((a)=(b))
  1217. X#else
  1218. X#define ASSIGN(a,b) (memcpy((char *)&(a),(char *)&(b),sizeof(a)))
  1219. X#endif
  1220. X
  1221. X/******************************************************************************/
  1222. X
  1223. X/* VMS EXIT STATUS */
  1224. X/* --------------- */
  1225. X/* The VAX C compiler I used doesn't seem to be ANSI. This means that the    */
  1226. X/* exit symbols aren't set up properly. Furthermore, the sensible defaults   */
  1227. X/* in the style.h file don't work for VMS. The upshot is that we have to do  */
  1228. X/* a special case. Note: The top bit set in a VMS exit status means suppress */
  1229. X/* diagnostic message. Even status means failure. Odd means success.         */
  1230. X#if VMS
  1231. X#undef  EXIT_SUCCESS
  1232. X#undef  EXIT_FAILURE
  1233. X#define EXIT_SUCCESS 1
  1234. X#define EXIT_FAILURE (0x10000002)
  1235. X#endif
  1236. X
  1237. X/******************************************************************************/
  1238. X
  1239. X/* For #ifndef preventing multiple inclusion of the body of this header file. */
  1240. X#endif
  1241. X
  1242. X/******************************************************************************/
  1243. X/*                                End of ENVIRON.H                            */
  1244. X/******************************************************************************/
  1245. END_OF_FILE
  1246. if test 11366 -ne `wc -c <'sources/environ.h'`; then
  1247.     echo shar: \"'sources/environ.h'\" unpacked with wrong size!
  1248. fi
  1249. # end of 'sources/environ.h'
  1250. fi
  1251. if test -f 'sources/list.h' -a "${1}" != "-c" ; then 
  1252.   echo shar: Will not clobber existing file \"'sources/list.h'\"
  1253. else
  1254. echo shar: Extracting \"'sources/list.h'\" \(12123 characters\)
  1255. sed "s/^X//" >'sources/list.h' <<'END_OF_FILE'
  1256. X/*##############################################################################
  1257. X
  1258. XFUNNNELWEB COPYRIGHT
  1259. X====================
  1260. XFunnelWeb is a literate-programming macro preprocessor.
  1261. X
  1262. Copyright (C) 1992 Ross N. Williams.
  1263. X
  1264. X   Ross N. Williams
  1265. X   ross@spam.adelaide.edu.au
  1266. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1267. X
  1268. This program is free software; you can redistribute it and/or modify
  1269. it under the terms of Version 2 of the GNU General Public License as
  1270. published by the Free Software Foundation.
  1271. X
  1272. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1273. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1274. See Version 2 of the GNU General Public License for more details.
  1275. X
  1276. You should have received a copy of Version 2 of the GNU General Public
  1277. License along with this program. If not, you can FTP the license from
  1278. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1279. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1280. X
  1281. Section 2a of the license requires that all changes to this file be
  1282. recorded prominently in this file. Please record all changes here.
  1283. X
  1284. Programmers:
  1285. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1286. X
  1287. Changes:
  1288. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1289. X
  1290. X##############################################################################*/
  1291. X
  1292. X
  1293. X/******************************************************************************/
  1294. X/*                                  LIST.H                                    */
  1295. X/******************************************************************************/
  1296. X/*                                                                            */
  1297. X/* Introduction                                                               */
  1298. X/* ------------                                                               */
  1299. X/* This list package (list.h and list.c) implements a list abstraction.       */
  1300. X/*                                                                            */
  1301. X/* Facts about Lists                                                          */
  1302. X/* -----------------                                                          */
  1303. X/* - A LIST stores zero or more LIST ELEMENTS.                                */
  1304. X/* - The user decides the type of element to be stored in each list.          */
  1305. X/* - Each list stores only one type of list element; lists are homogeneous.   */
  1306. X/* - Lists store copies of elements rather than pointers to elements.         */
  1307. X/* - Each list can hold from zero to about 2^31 elements.                     */
  1308. X/* - Each list has a HEAD end and a TAIL end.                                 */
  1309. X/* - Elements can be appended and deleted only at the tail of the list.       */
  1310. X/* - The elements of a list can be read sequentially from head to tail.       */
  1311. X/* - A MARKER stores the current position in the list for sequential reading. */
  1312. X/* - Upon list creation, the marker is positioned at the tail of the list.    */
  1313. X/* - In a list of n elements, elements are numbered from 1 to n.              */
  1314. X/* - Element 1 is at the head of the list. Element n is at the tail.          */
  1315. X/* - The identifier "ls" is used as an abbreviation for "list".               */
  1316. X/* - The identifier "el" is used as an abbreviation for "element".            */
  1317. X/* - Longer names are desirable, but shorter ones have been used so as to     */
  1318. X/*   enhance the portability of the package.                                  */
  1319. X/* - IMPORTANT: Lists get all their memory using mm_temp calls.               */
  1320. X/*                                                                            */
  1321. X/* How To Use This List Package                                               */
  1322. X/* ----------------------------                                               */
  1323. X/* 1. Include this .H file in your program file.                              */
  1324. X/* 2. Identify the type of elements to be placed in the list.                 */
  1325. X/* 3. Define a variable of type p_ls as a view to a list.                     */
  1326. X/* 4. Use the ls_* functions to perform the desired operations.               */
  1327. X/*    Start with a call to ls_cre and (optionally) end with a call to ls_des. */
  1328. X/*                                                                            */
  1329. X/******************************************************************************/
  1330. X
  1331. X/* Ensure that the body of this header file is included at most once.         */
  1332. X#ifndef DONE_LIST
  1333. X#define DONE_LIST
  1334. X
  1335. X/******************************************************************************/
  1336. X
  1337. X#include "style.h"
  1338. X
  1339. X/******************************************************************************/
  1340. X
  1341. X/* Users manipulate lists through pointers to lists (p_ls_t). The following   */
  1342. X/* declaration serves the list user of the package while hiding the           */
  1343. X/* implementation details (which appear in a similar declaration in list.c).  */
  1344. X/* The #ifndef stops list.c from seeing these public declarations.            */
  1345. X#ifndef INLISTC
  1346. typedef struct {word NEVER_USE_THIS_FIELD_UQJTKC;} ls_yqwx; /* Don't use! */
  1347. typedef ls_yqwx *p_ls_t;
  1348. typedef p_void p_lsel_t;
  1349. typedef p_lsel_t *pp_lsel_t;
  1350. X#endif
  1351. X
  1352. X/******************************************************************************/
  1353. X/*                                                                            */
  1354. X/* General Notes About These Functions                                        */
  1355. X/* -----------------------------------                                        */
  1356. X/* - All lists and elements are passed by pointer. Whether a parameter is     */
  1357. X/*   read or written is determined by it's function's description.            */
  1358. X/* - Each function (except ls_cre) accepts a single pointer to a list and     */
  1359. X/*   each function's description is assumed to be referring to the list.      */
  1360. X/* - "Raising an error" means calling the external function "error" to        */
  1361. X/*   write out a message and bomb the program.                                */
  1362. X/* - You must create a list using ls_cre before performing any operations     */
  1363. X/*   upon it. A list function will usually raise an error if it is            */
  1364. X/*   handed a pointer that does not point to a properly CREated list.         */
  1365. X/*                                                                            */
  1366. X/* WARNING: This package copies values into its internal data structures      */
  1367. X/* (through ls_add), but returns only POINTERS to elements when asked to      */
  1368. X/* retrieve them. These pointers are valid only so long as the element        */
  1369. X/* that they point to remains in the list. If the element is deleted somehow, */
  1370. X/* the pointer points to garbage and becomes dangerous.                       */
  1371. X/* So, if you have been handed a pointer to an element in a list (ls_nxt,     */
  1372. X/* ls_loo), do not subsequently delete the element (ls_lop, ls_emp, ls_des)   */
  1373. X/* and then attempt to access the element through the pointer.                */
  1374. X/* One sure way to avoid the problem is always to use the pointer handed back */
  1375. X/* by ls_nxt or ls_loo to copy the element immediately.                       */
  1376. X
  1377. X/* The Functions                                                              */
  1378. X/* -------------                                                              */
  1379. XEXPORT p_ls_t ls_cre P_((size_t));
  1380. X/* CREate. Creates a new list and returns a pointer to the new list. The user */
  1381. X/* must specify in the parameter the size of elements that are to be stored   */
  1382. X/* in the list. Specify the size of elements in bytes (usually using sizeof). */
  1383. X/* The sequential reading marker is set to position n+1=1=tail of the list.   */
  1384. X
  1385. XEXPORT void ls_add P_((p_ls_t,p_lsel_t));
  1386. X/* ADD. Adds a new element onto the tail of the list (at position n+1).       */
  1387. X/* The user must supply in the second parameter a pointer to the element to   */
  1388. X/* be added. ls_add takes a copy of the element (it knows from the earlier    */
  1389. X/* call to ls_cre how many bytes to copy) and stores the copy in its own      */
  1390. X/* internal data structures.                                                  */
  1391. X
  1392. XEXPORT void ls_lop P_((p_ls_t));
  1393. X/* LOP. Removes (lops) element n from the tail of the list.                   */
  1394. X/* Raises an error if the list is empty.                                      */
  1395. X
  1396. XEXPORT ulong ls_len P_((p_ls_t));
  1397. X/* LENgth. Returns the number of elements in the list (n).                    */
  1398. X
  1399. XEXPORT void ls_fir P_((p_ls_t));
  1400. X/* FIRst. Sets the sequential reading marker to element 1.                    */
  1401. X/* If the list is empty (n=0) the marker is placed at the tail of the list    */
  1402. X/* and subsequent calls to ls_add will leave it there until the next call to  */
  1403. X/* ls_fir.                                                                    */
  1404. X
  1405. XEXPORT void ls_nxt P_((p_ls_t,pp_lsel_t));
  1406. X/* NeXT. Returns the list element under the marker and advances the marker    */
  1407. X/* one position towards the tail of the list.                                 */
  1408. X/* The method of returning the list element is a little messy. The user       */
  1409. X/* supplies a pointer to a pointer in the second parameter, and the function  */
  1410. X/* writes the address of the element in the list into the pointer.            */
  1411. X/* If the marker is at position n+1 upon entry to ls_nxt, the marker position */
  1412. X/* doesn't change and NULL is written to the argument pointer.                */
  1413. X
  1414. XEXPORT void ls_loo P_((p_ls_t,ulong,pp_lsel_t));
  1415. X/* LOOkup. Returns (using the same mechanism as ls_nxt) the k'th element of   */
  1416. X/* the specified list where k is the second (ulong) parameter and the first   */
  1417. X/* element (at the head of the list) is numbered number one (1).              */
  1418. X/* Raises an error if the index k is out of the range [1,n].                  */
  1419. X
  1420. XEXPORT void ls_tai P_((p_ls_t,pp_lsel_t));
  1421. X/* Lookup TAIl. Returns (using the same mechanism as ls_nxt) the tail element */
  1422. X/* of the specified list.                                                     */
  1423. X/* Raises an error if the list is empty.                                      */
  1424. X
  1425. XEXPORT void ls_emp P_((p_ls_t));
  1426. X/* EMPty. Empties the specified list, deallocating all the space used by the  */
  1427. X/* list elements. Upon completion, the list will be empty and the list marker */
  1428. X/* will be positioned at the tail of the list.                                */
  1429. X
  1430. XEXPORT void ls_des P_((p_ls_t));
  1431. X/* DEStroy. Destroys a list, destroying all its elements and deallocating all */
  1432. X/* the memory used by the list.                                               */
  1433. X
  1434. X/* Marker Functions */
  1435. X/* ---------------- */
  1436. X/* The following two functions ls_mar and ls_set were hacked in to this list  */
  1437. X/* package when it was discovered that the tangler sometimes needs to run     */
  1438. X/* more than one context down a list at the same time. The two new functions  */
  1439. X/* allow the list package user to save and restore the current mark.          */
  1440. X/* These functions are not tightly controlled and so care must be taken in    */
  1441. X/* their use.                                                                 */
  1442. X
  1443. XEXPORT p_void ls_mar P_((p_ls_t));
  1444. X/* Returns a representation of the current list marker. */
  1445. X
  1446. XEXPORT void ls_set P_((p_ls_t,p_void));
  1447. X/* Sets the position of the marker to an earlier saved position.              */
  1448. X/* Calls to this function should satisfy the following conditions:            */
  1449. X/*    1. The marker argument (p_void) must be the result of an earlier call   */
  1450. X/*       to ls_mar with the same list as an argument.                         */
  1451. X/*    2. No part of the list should have been modified in the interim. In     */
  1452. X/*       particular, this means that no calls to ls_add, ls_lop, ls_emp or    */
  1453. X/*       ls_des can be made between linked calls to ls_mar and ls_set.        */
  1454. X
  1455. X/******************************************************************************/
  1456. X
  1457. X/* For #ifndef preventing multiple inclusion of the body of this header file. */
  1458. X#endif
  1459. X
  1460. X/******************************************************************************/
  1461. X/*                               End of LIST.H                                */
  1462. X/******************************************************************************/
  1463. END_OF_FILE
  1464. if test 12123 -ne `wc -c <'sources/list.h'`; then
  1465.     echo shar: \"'sources/list.h'\" unpacked with wrong size!
  1466. fi
  1467. # end of 'sources/list.h'
  1468. fi
  1469. if test -f 'sources/lister.c' -a "${1}" != "-c" ; then 
  1470.   echo shar: Will not clobber existing file \"'sources/lister.c'\"
  1471. else
  1472. echo shar: Extracting \"'sources/lister.c'\" \(11799 characters\)
  1473. sed "s/^X//" >'sources/lister.c' <<'END_OF_FILE'
  1474. X/*##############################################################################
  1475. X
  1476. XFUNNNELWEB COPYRIGHT
  1477. X====================
  1478. XFunnelWeb is a literate-programming macro preprocessor.
  1479. X
  1480. Copyright (C) 1992 Ross N. Williams.
  1481. X
  1482. X   Ross N. Williams
  1483. X   ross@spam.adelaide.edu.au
  1484. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1485. X
  1486. This program is free software; you can redistribute it and/or modify
  1487. it under the terms of Version 2 of the GNU General Public License as
  1488. published by the Free Software Foundation.
  1489. X
  1490. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1491. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1492. See Version 2 of the GNU General Public License for more details.
  1493. X
  1494. You should have received a copy of Version 2 of the GNU General Public
  1495. License along with this program. If not, you can FTP the license from
  1496. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1497. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1498. X
  1499. Section 2a of the license requires that all changes to this file be
  1500. recorded prominently in this file. Please record all changes here.
  1501. X
  1502. Programmers:
  1503. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1504. X
  1505. Changes:
  1506. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1507. X
  1508. X##############################################################################*/
  1509. X
  1510. X
  1511. X/******************************************************************************/
  1512. X/*                                    LISTER.C                                */
  1513. X/******************************************************************************/
  1514. X
  1515. X#include "style.h"
  1516. X
  1517. X#include "as.h"
  1518. X#include "data.h"
  1519. X#include "list.h"
  1520. X#include "lister.h"
  1521. X#include "machin.h"
  1522. X#include "misc.h"
  1523. X#include "table.h"
  1524. X#include "writfile.h"
  1525. X
  1526. X/******************************************************************************/
  1527. X
  1528. X#define LISTWIDTH     80  /* Nominal width of listing file. Can be wider.     */
  1529. X#define INDENTQ        3  /* Indentation quantum for include files.           */
  1530. X#define MESSMAXCH    200  /* Maximum number of characters in a message.       */
  1531. X#define CTXINF       100  /* Special value that signals infinite context.     */
  1532. X#define MAXLINES   10000  /* Maximum number of lines in input file.           */
  1533. X
  1534. X/******************************************************************************/
  1535. X
  1536. X/* The following #defines and typedef define an enumerated type for message   */
  1537. X/* kinds. There are four kinds of message, and we need a type for storing     */
  1538. X/* this information. mess_k_t stands for message_kind_type.                   */
  1539. X/* We use #defines instead of enums as enums are not portable enough.         */
  1540. X#define MESS_MES 1
  1541. X#define MESS_WAR 2
  1542. X#define MESS_ERR 3
  1543. X#define MESS_SEV 4
  1544. typedef ubyte mess_k_t;
  1545. X
  1546. X/* We wish to store messages in a table with message positions as keys.       */
  1547. X/* However, the table package will not tolerate duplicate keys. To solve this */
  1548. X/* problem, we create a new type 'unqpos_t' (unique position type) which has  */
  1549. X/* not only a position but a serial number as well.                           */
  1550. typedef struct
  1551. X  {
  1552. X   ps_t  up_pos;
  1553. X   ulong up_serial;
  1554. X  } unqpos_t;
  1555. X
  1556. X/* The following structure stores a single message. As we are storing COPIES  */
  1557. X/* of the messages, we impose a maximum limit (MESSMAXCH) to their length.    */
  1558. typedef struct
  1559. X  {
  1560. X   mess_k_t ms_kind;
  1561. X   char     ms_text[MESSMAXCH+1];
  1562. X  } mess_t;
  1563. X
  1564. X/******************************************************************************/
  1565. X
  1566. LOCVAR p_tb_t p_msgtab;           /* The message table storing diagnostics.   */
  1567. LOCVAR ulong  serial_next;        /* Serial number for numbering messages.    */
  1568. X
  1569. X/******************************************************************************/
  1570. X
  1571. LOCAL int cmpuqpos P_((unqpos_t *,unqpos_t *));
  1572. LOCAL int cmpuqpos(p1,p2)
  1573. X/* Compare two unique positions for the table package and returns [-1,0,1].   */
  1574. unqpos_t *p1;
  1575. unqpos_t *p2;
  1576. X{
  1577. X long  diff;
  1578. X ubyte i;
  1579. X
  1580. X for (i=1; i<=3; i++)
  1581. X   {
  1582. X    switch (i)
  1583. X      {
  1584. X       case 1: diff= p1->up_pos.ps_line   - p2->up_pos.ps_line;   break;
  1585. X       case 2: diff= p1->up_pos.ps_column - p2->up_pos.ps_column; break;
  1586. X       case 3: diff= p1->up_serial        - p2->up_serial;  break;
  1587. X       default: as_bomb("cmpuqpos: Case defaulted.");
  1588. X      }
  1589. X    if (diff<0)
  1590. X       return -1;
  1591. X    else
  1592. X       if (diff>0)
  1593. X          return 1;
  1594. X   }
  1595. X return 0;
  1596. X}
  1597. X
  1598. X/******************************************************************************/
  1599. X
  1600. X/* Converts a value of message kind type into a representative string. */
  1601. X/* This routine unused at present.
  1602. LOCAL char *mess_let P_((mess_k_t));
  1603. LOCAL char *mess_let (mess_k)
  1604. mess_k_t mess_k;
  1605. X{
  1606. X switch (mess_k)
  1607. X   {
  1608. X    case MESS_MES : return "M";
  1609. X    case MESS_WAR : return "W";
  1610. X    case MESS_ERR : return "E";
  1611. X    case MESS_SEV : return "S";
  1612. X    default: as_bomb("mess_let: Case defaulted.");
  1613. X   }
  1614. X as_bomb("mess_let: Switch dropped out.");
  1615. X return "Failure";
  1616. X}
  1617. X*/
  1618. X
  1619. X/******************************************************************************/
  1620. X
  1621. X#define DUPMAX 200
  1622. X
  1623. LOCAL char *dup P_((int,uword));
  1624. LOCAL char *dup(ch,count)
  1625. X/* Returns a pointer to a STAVAR string containing 'count' copies of 'ch'.    */
  1626. X/* Count must be in the range [0,DUPMAX]. The pointer returned always points  */
  1627. X/* to the same address which is a 'STAVAR' inside this function.              */
  1628. int   ch;
  1629. uword count;
  1630. X{
  1631. X STAVAR char buffer[DUPMAX+1];
  1632. X
  1633. X as_cold(count<DUPMAX,"lister.dup: count>=DUPMAX");
  1634. X /* The IF in the following is just in case 'memset' is brain damaged. */
  1635. X if (count>0) memset(&buffer[0],ch,(size_t) count);
  1636. X buffer[count]=EOS;
  1637. X return &buffer[0];
  1638. X}
  1639. X
  1640. X/******************************************************************************/
  1641. X
  1642. LOCAL void mess_wri P_((p_wf_t,mess_t *,uword,uword));
  1643. LOCAL void mess_wri(p_wf,p_mess,indent,column)
  1644. X/* Writes message p_mess to file p_wf indented by INDENTQ*indent+column.      */
  1645. p_wf_t p_wf;
  1646. mess_t *p_mess;
  1647. uword  indent;
  1648. uword  column;
  1649. X{
  1650. X switch (p_mess->ms_kind)
  1651. X   {
  1652. X    case MESS_MES : wf_wr(p_wf,"            "); break;
  1653. X    case MESS_WAR : wf_wr(p_wf,"     Warning"); break;
  1654. X    case MESS_ERR : wf_wr(p_wf,"       Error"); break;
  1655. X    case MESS_SEV : wf_wr(p_wf,"      Severe"); break;
  1656. X    default: as_bomb("mess_let: Case defaulted.");
  1657. X   }
  1658. X wf_wr(p_wf,"|.");
  1659. X wf_wr(p_wf,dup('.',indent*INDENTQ));
  1660. X wf_wr(p_wf,dup('.',column-1));
  1661. X wf_wr(p_wf,"^");
  1662. X wf_wr(p_wf,&p_mess->ms_text[0]);
  1663. X wf_wr(p_wf,"\n");
  1664. X}
  1665. X
  1666. X/******************************************************************************/
  1667. X
  1668. LOCAL void line_wri P_((p_wf_t,ln_t *));
  1669. LOCAL void line_wri(p_wf,p_line)
  1670. X/* Writes the given line to the given output stream. */
  1671. p_wf_t  p_wf;
  1672. ln_t   *p_line;
  1673. X{
  1674. X char buffer[100];
  1675. X
  1676. X /* The last line of the line list is the EOF marker line and to indicate     */
  1677. X /* that it is not really part of the input file, we omit it's line number.   */
  1678. X if (p_line->ln_global==ls_len(line_list))
  1679. X                 /*" 12345 12345| "*/
  1680. X    sprintf(buffer,"            | ");
  1681. X else
  1682. X    sprintf(buffer," %5lu %5lu| ",
  1683. X                   (unsigned long) p_line->ln_global,
  1684. X                   (unsigned long) p_line->ln_local);
  1685. X wf_wr(p_wf,buffer);
  1686. X wf_blk(p_wf,p_line->ln_body.sc_first,(size_t)
  1687. X     (p_line->ln_body.sc_last-p_line->ln_body.sc_first+1));
  1688. X}
  1689. X
  1690. X/******************************************************************************/
  1691. X
  1692. LOCAL void add_mess P_((ps_t *,mess_k_t,char *));
  1693. LOCAL void add_mess(p_pos,messkind,p_string)
  1694. X/* Creates a message record and places the message information in the         */
  1695. X/* argument into the record. Inserts the record into the message table.       */
  1696. ps_t      *p_pos;
  1697. mess_k_t   messkind;
  1698. char      *p_string;
  1699. X{
  1700. X mess_t   tempmess;
  1701. X unqpos_t unqpos;
  1702. X
  1703. X tempmess.ms_kind=messkind;
  1704. X as_cold(strlen(p_string)<=MESSMAXCH,
  1705. X         "lister.add_mess: Parameter message is too long.");
  1706. X strcpy(tempmess.ms_text,p_string);
  1707. X ASSIGN(unqpos.up_pos,*p_pos);
  1708. X unqpos.up_serial=serial_next++;
  1709. X tb_ins(p_msgtab,PV &unqpos,PV &tempmess);
  1710. X}
  1711. X
  1712. X/******************************************************************************/
  1713. X
  1714. XEXPORT void lr_ini P_((void))
  1715. X{
  1716. X /* Create a brand new empty message table. */
  1717. X p_msgtab=tb_cre(sizeof(unqpos_t),sizeof(mess_t),(p_kycm_t) cmpuqpos);
  1718. X
  1719. X /* Start the serial numbers at zero again. */
  1720. X serial_next=0;
  1721. X}
  1722. X
  1723. X/******************************************************************************/
  1724. X
  1725. XEXPORT void lr_mes(p_pos,s)
  1726. ps_t *p_pos;
  1727. char *s;
  1728. X{
  1729. X add_mess(p_pos,MESS_MES,s);
  1730. X}
  1731. X
  1732. X/******************************************************************************/
  1733. X
  1734. XEXPORT void lr_war(p_pos,s)
  1735. ps_t *p_pos;
  1736. char *s;
  1737. X{
  1738. X add_mess(p_pos,MESS_WAR,s);
  1739. X num_war++;
  1740. X}
  1741. X
  1742. X/******************************************************************************/
  1743. X
  1744. XEXPORT void lr_err(p_pos,s)
  1745. ps_t *p_pos;
  1746. char *s;
  1747. X{
  1748. X add_mess(p_pos,MESS_ERR,s);
  1749. X num_err++;
  1750. X}
  1751. X
  1752. X/******************************************************************************/
  1753. X
  1754. XEXPORT void lr_sev(p_pos,s)
  1755. ps_t *p_pos;
  1756. char *s;
  1757. X{
  1758. X add_mess(p_pos,MESS_SEV,s);
  1759. X num_sev++;
  1760. X}
  1761. X
  1762. X/******************************************************************************/
  1763. X
  1764. XEXPORT void lr_gen(p_wf,ctx)
  1765. p_wf_t p_wf;
  1766. uword  ctx;
  1767. X{
  1768. X unqpos_t next_pos; /* Position of next message.                              */
  1769. X mess_t   next_mes; /* Content  of next message.                              */
  1770. X long     prev_no;  /* Global line number of previous message.                */
  1771. X long     next_no;  /* Global line number of next     message.                */
  1772. X bool     ingap;    /* Controls issuance of gap markers in the listing.       */
  1773. X long     context=ctx; /* Signed version of the parameter.                    */
  1774. X
  1775. X /* A context of CTXINF signals an infinite context. */
  1776. X if (context==CTXINF) context=MAXLINES;
  1777. X
  1778. X /* Write listing header. */
  1779. X wf_wr(p_wf,"\nGlobal Local| Input File\n");
  1780. X wf_wr(p_wf,dup('-',12));wf_wr(p_wf,"+");
  1781. X wf_wr(p_wf,dup('-',LISTWIDTH-13));wf_wr(p_wf,"\n");
  1782. X
  1783. X /* Reset the line list and message table for reading. */
  1784. X ls_fir(line_list);
  1785. X tb_fir(p_msgtab);
  1786. X
  1787. X /* Prime the variables ingap, prev_no, next_no, next_pos, and next_mes. */
  1788. X ingap=FALSE; prev_no = -(context+1);
  1789. X if (tb_rea(p_msgtab,PV &next_pos,PV &next_mes))
  1790. X    next_no=next_pos.up_pos.ps_line;
  1791. X else
  1792. X    next_no=MAXLINES+context+1;
  1793. X
  1794. X while (TRUE)
  1795. X   {/* Process a single line per iteration. */
  1796. X    ln_t *p_line;
  1797. X
  1798. X    /* Grab the next line from the line list. */
  1799. X    ls_nxt(line_list,PPV &p_line);
  1800. X    if (p_line==NULL) break;
  1801. X
  1802. X    /* List the line if it is within context range of prev or next message. */
  1803. X    if ((((long) p_line->ln_global) <= prev_no+context) ||
  1804. X        (((long) p_line->ln_global) >= next_no-context))
  1805. X       {line_wri(p_wf,p_line);ingap=FALSE;}
  1806. X    else
  1807. X       if (!ingap)
  1808. X          {wf_wr(p_wf,".................\n");ingap=TRUE;}
  1809. X
  1810. X    /* Issue any messages that are about this line. */
  1811. X    while (next_no == p_line->ln_global)
  1812. X      {
  1813. X       /* Write the current message. */
  1814. X       mess_wri(p_wf,&next_mes,(uword) 0,
  1815. X                (uword) next_pos.up_pos.ps_column);
  1816. X                
  1817. X       /* Read the next message from the table. */
  1818. X       prev_no=next_no;
  1819. X       if (tb_rea(p_msgtab,PV &next_pos,PV &next_mes))
  1820. X          next_no=next_pos.up_pos.ps_line;
  1821. X       else
  1822. X          next_no=MAXLINES+context+1;
  1823. X      }
  1824. X   } /* End while */
  1825. X
  1826. X /* Make sure that we have read to the end of the message table. */
  1827. X {bool result;
  1828. X  result=tb_rea(p_msgtab,PV &next_pos,PV &next_mes);
  1829. X  as_cold(!result,
  1830. X          "lr_gen: Messages remaining in message table after listing.");
  1831. X }
  1832. X
  1833. X /* Write listing trailer. */
  1834. X wf_wr(p_wf,dup('-',12));wf_wr(p_wf,"+");
  1835. X wf_wr(p_wf,dup('-',LISTWIDTH-13));wf_wr(p_wf,"\n");
  1836. X wf_wl(p_wf,"");
  1837. X}
  1838. X
  1839. X/******************************************************************************/
  1840. X/*                               End of LISTER.C                              */
  1841. X/******************************************************************************/
  1842. END_OF_FILE
  1843. if test 11799 -ne `wc -c <'sources/lister.c'`; then
  1844.     echo shar: \"'sources/lister.c'\" unpacked with wrong size!
  1845. fi
  1846. # end of 'sources/lister.c'
  1847. fi
  1848. if test -f 'sources/machin.c' -a "${1}" != "-c" ; then 
  1849.   echo shar: Will not clobber existing file \"'sources/machin.c'\"
  1850. else
  1851. echo shar: Extracting \"'sources/machin.c'\" \(11580 characters\)
  1852. sed "s/^X//" >'sources/machin.c' <<'END_OF_FILE'
  1853. X/*##############################################################################
  1854. X
  1855. XFUNNNELWEB COPYRIGHT
  1856. X====================
  1857. XFunnelWeb is a literate-programming macro preprocessor.
  1858. X
  1859. Copyright (C) 1992 Ross N. Williams.
  1860. X
  1861. X   Ross N. Williams
  1862. X   ross@spam.adelaide.edu.au
  1863. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  1864. X
  1865. This program is free software; you can redistribute it and/or modify
  1866. it under the terms of Version 2 of the GNU General Public License as
  1867. published by the Free Software Foundation.
  1868. X
  1869. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  1870. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1871. See Version 2 of the GNU General Public License for more details.
  1872. X
  1873. You should have received a copy of Version 2 of the GNU General Public
  1874. License along with this program. If not, you can FTP the license from
  1875. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  1876. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1877. X
  1878. Section 2a of the license requires that all changes to this file be
  1879. recorded prominently in this file. Please record all changes here.
  1880. X
  1881. Programmers:
  1882. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  1883. X
  1884. Changes:
  1885. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  1886. X
  1887. X##############################################################################*/
  1888. X
  1889. X
  1890. X/******************************************************************************/
  1891. X/*                                    MACHIN.C                                */
  1892. X/******************************************************************************/
  1893. X/*                                                                            */
  1894. X/* WARNING: DO NOT ADD ANY PROGRAM DEPENDENT DEFINITIONS.                     */
  1895. X/*                                                                            */
  1896. X/* This file contains machine-dependent, program-independent stuff that       */
  1897. X/* implements the functionality promised in MACHIN.H.                         */
  1898. X/*                                                                            */
  1899. X/* Note: As usual, the full definitions of functions in the .H file are not   */
  1900. X/*       repeated here.                                                       */
  1901. X/*                                                                            */
  1902. X/******************************************************************************/
  1903. X
  1904. X#include <time.h>
  1905. X#include "style.h"
  1906. X
  1907. X#include "as.h"
  1908. X#include "machin.h"
  1909. X
  1910. X/* The Macintosh's doesn't have a command language, and so we have to prompt  */
  1911. X/* for a command line. This requires a special package.                       */
  1912. X#if MAC
  1913. X#include <console.h>
  1914. X#endif
  1915. X
  1916. X/* Under VMS, we need RMS to get at stuff to do with filenames.               */
  1917. X#if VMS
  1918. X#include RMS
  1919. X#endif
  1920. X
  1921. X/******************************************************************************/
  1922. X/*                           LOCAL FUNCTIONS                                  */
  1923. X/******************************************************************************/
  1924. X
  1925. LOCAL void mconcat P_((int,char **,char *));
  1926. LOCAL void mconcat(argc,argv,result)
  1927. X/* Given argc and argv, as passed to main(), this function appends all the    */
  1928. X/* arguments together (separated by spaces) into the string "result".         */
  1929. X/* This function assists in reconstructing the command line.                  */
  1930. X/* This function is actually portable, so you shouldn't have to change it.    */
  1931. X/* Note: "mconcat" stands for Multiple CONCATenation.                         */
  1932. int    argc;
  1933. char **argv;
  1934. char *result;
  1935. X{
  1936. X uword i;
  1937. X strcpy(&result[0],argv[0]);
  1938. X for (i=1;i<argc;i++)
  1939. X   {
  1940. X    strcat(&result[0]," "    );
  1941. X    strcat(&result[0],argv[i]);
  1942. X   }
  1943. X}
  1944. X
  1945. X/******************************************************************************/
  1946. X
  1947. X#if MAC | SUN | PC
  1948. LOCAL void fn_split P_((p_fn_t,p_fn_t,p_fn_t,p_fn_t));
  1949. LOCAL void fn_split(p_fn,p_path,p_name,p_ext)
  1950. X/* Accepts a filename in p_fn and writes the path, name, and extension        */
  1951. X/* components of the filename to the strings p_path, p_name, and p_ext.       */
  1952. p_fn_t p_fn;
  1953. p_fn_t p_path;
  1954. p_fn_t p_name;
  1955. p_fn_t p_ext;
  1956. X{
  1957. X char *p,*q;
  1958. X
  1959. X /* Make sure that the input filename is a sensible length. */
  1960. X as_cold(strlen(p_fn)<=FILENAME_MAX,"fn_split: Filename is too long.");
  1961. X
  1962. X /* Extract the path from the input string by searching for the last */
  1963. X /* occurrance of the special character used for directories.        */
  1964. X
  1965. X /* Find the last directory/filename separator. */
  1966. X p=strrchr(p_fn,FN_DELIM);
  1967. X if (p==NULL)
  1968. X   {strcpy(p_path,""); p=p_fn;}
  1969. X else
  1970. X   {
  1971. X    memcpy(p_path,p_fn,(size_t) (p-p_fn+1));
  1972. X    p_path[(size_t) (p-p_fn+1)]=EOS;
  1973. X    p++;
  1974. X   }
  1975. X
  1976. X /* Assert: p now points to the first character of the name field. */
  1977. X
  1978. X /* Now locate the file extension. */
  1979. X q=strrchr(p_fn,'.');
  1980. X if (q==NULL)
  1981. X   {strcpy(p_ext,""); q = &p_fn[strlen(p_fn)];}
  1982. X else
  1983. X   {strcpy(p_ext,q);}
  1984. X
  1985. X /* Assert: q now points to the '.' preceding the extension field. */
  1986. X
  1987. X /* Now anything between p and q must be the filename proper. */
  1988. X for (;p<q;p++)
  1989. X    *p_name++ = *p;
  1990. X *p_name=EOS;
  1991. X}
  1992. X#endif
  1993. X
  1994. X/******************************************************************************/
  1995. X
  1996. X#if MAC | SUN | PC
  1997. LOCAL void fn_join P_((p_fn_t,p_fn_t,p_fn_t,p_fn_t));
  1998. LOCAL void fn_join(p_fn,p_path,p_name,p_ext)
  1999. X/* This function sets p_fn to the empty string and then successively appends  */
  2000. X/* p_path, p_name, and p_ext. Before doing this, it checks to make sure that  */
  2001. X/* there will be enough room and bombs the program if there isn't.            */
  2002. p_fn_t p_fn;
  2003. p_fn_t p_path;
  2004. p_fn_t p_name;
  2005. p_fn_t p_ext;
  2006. X{
  2007. X as_cold(strlen(p_path)+strlen(p_name)+strlen(p_ext) <= FILENAME_MAX,
  2008. X         "fn_join: Constructed filename is too long.");
  2009. X strcpy(p_fn,p_path);
  2010. X strcat(p_fn,p_name);
  2011. X strcat(p_fn,p_ext);
  2012. X}
  2013. X#endif
  2014. X
  2015. X/******************************************************************************/
  2016. X/*                              EXPORTED FUNCTIONS                            */
  2017. X/******************************************************************************/
  2018. X
  2019. X#if MAC | SUN | PC
  2020. XEXPORT void fn_ins(p_cur,p_add)
  2021. p_fn_t p_cur;
  2022. p_fn_t p_add;
  2023. X{
  2024. X fn_t cur_path, add_path;
  2025. X fn_t cur_name, add_name;
  2026. X fn_t cur_extn, add_extn;
  2027. X
  2028. X /* Split the argument file names into their component parts. */
  2029. X fn_split(p_cur,cur_path,cur_name,cur_extn);
  2030. X fn_split(p_add,add_path,add_name,add_extn);
  2031. X
  2032. X /* Perform the inheriting on a field by field basis. */
  2033. X if (strlen(add_path) > 0) strcpy(cur_path,add_path);
  2034. X if (strlen(add_name) > 0) strcpy(cur_name,add_name);
  2035. X if (strlen(add_extn) > 0) strcpy(cur_extn,add_extn);
  2036. X
  2037. X /* Put the fields back together again to yield the final result. */
  2038. X fn_join(p_cur,cur_path,cur_name,cur_extn);
  2039. X}
  2040. X#endif
  2041. X
  2042. X#if VMS
  2043. XEXPORT void fn_ins(p_cur,p_add)
  2044. X/* This VMS version of fn_ins was written with the assistance of:             */
  2045. X/*    Jeremy Begg (jeremy@vsm.com.au) of VSM Software Services. Thanks!       */
  2046. X/* The VMS version is messy because VMS has highly structured filenames and   */
  2047. X/* highly ingrained rituals for manipulating them.                            */
  2048. p_fn_t p_cur;
  2049. p_fn_t p_add;
  2050. X{
  2051. X struct FAB cur_fab;   /* FAB    for SYS$PARSE */
  2052. X struct NAM cur_nam;   /* NAM    for SYS$PARSE */
  2053. X fn_t expanded;        /* Result of  SYS$PARSE */
  2054. X long rms_status;      /* Status of  SYS$PARSE */
  2055. X
  2056. X /*
  2057. X printf("\nTRACE: Call of fn_ins(...).\n");
  2058. X printf("   Current spec = \"%s\".\n",p_cur);
  2059. X printf("   Add     spec = \"%s\".\n",p_add);
  2060. X */
  2061. X
  2062. X /* Initialize the FAB and NAM block to something sensible. */
  2063. X cur_fab = cc$rms_fab;
  2064. X cur_nam = cc$rms_nam;
  2065. X
  2066. X /* (fna,fns) is address and size of input file spec in FAB block. */
  2067. X cur_fab.fab$l_fna = p_add;
  2068. X cur_fab.fab$b_fns = strlen(p_add);
  2069. X
  2070. X /* (dna,dns) is address and size of default file spec in FAB block. */
  2071. X cur_fab.fab$l_dna = p_cur;
  2072. X cur_fab.fab$b_dns = strlen(p_cur);
  2073. X
  2074. X /* Connect the NAM block to the FAB block. */
  2075. X cur_fab.fab$l_nam = &cur_nam;
  2076. X
  2077. X /* Point the NAM block's target name fields to the target namechar array. */
  2078. X cur_nam.nam$l_esa = &expanded;
  2079. X cur_nam.nam$b_ess = FILENAME_MAX;  /* Reserve last char for NULL terminator */
  2080. X
  2081. X /* PWD => put the password from a DECnet Access Control String in the filespec
  2082. X  * SYNCHK => check syntax only, don't search for the file on disk
  2083. X  */
  2084. X cur_nam.nam$b_nop = NAM$M_PWD + NAM$M_SYNCHK;
  2085. X
  2086. X /* Perform the parse. */
  2087. X rms_status = sys$parse(&cur_fab);
  2088. X if (rms_status & 1)
  2089. X   {
  2090. X    expanded[cur_nam.nam$b_esl]=EOS; /* Terminate VMS string. */
  2091. X    strcpy(p_cur,expanded);
  2092. X   }
  2093. X else
  2094. X   {
  2095. X    printf("Note: RMS parse failed. Could be a syntax error, could be a bug!\n");
  2096. X   }
  2097. X
  2098. X /* TRACE printf("   Result  spec = \"%s\".",p_cur); */
  2099. X}
  2100. X#endif
  2101. X
  2102. X/******************************************************************************/
  2103. X
  2104. XEXPORT void getcline(argc,argv,p_comline)
  2105. X/* Given, argc and argv, writes a command line string in p_comline.           */
  2106. X/* See machin.h for a thorough definition of this function.                   */
  2107. int   argc;
  2108. char **argv;
  2109. char *p_comline;
  2110. X{
  2111. X int    argc2;
  2112. X char **argv2;
  2113. X
  2114. X#if MAC
  2115. X /* On the Macintosh there is no command language and therefore no command    */
  2116. X /* line. Therefore we cannot trust the argc and argv handed to us by main()  */
  2117. X /* and have to obtain a command line from other sources.                     */
  2118. X /* The "ccommand" function comes from <console.h> of the THINK C libraries.  */
  2119. X argc2=ccommand(&argv2);
  2120. X#endif
  2121. X
  2122. X/* The other systems work like Unix. */
  2123. X#if SUN | VMS | PC
  2124. argc2=argc;
  2125. argv2=argv;
  2126. X#endif
  2127. X
  2128. X /* The command line is currently in pieces. Reassemble it. That's all!       */
  2129. X mconcat(argc2,argv2,p_comline);
  2130. X}
  2131. X
  2132. X/******************************************************************************/
  2133. X
  2134. XEXPORT float tim_real()
  2135. X{
  2136. X STAVAR bool   init=FALSE;
  2137. X STAVAR time_t base;
  2138. X
  2139. X /* The first time this routine is called, we establish a base real time      */
  2140. X /* from which real time differences are calculated. There are two reasons    */
  2141. X /* for doing this. The first is that difftime seems to be the only way to    */
  2142. X /* get ANSI C to hand over a calibrated arithmetic type holding the real     */
  2143. X /* time. The second is that we don't want to have to deal with large         */
  2144. X /* absolute times anyway.                                                    */
  2145. X if (!init)
  2146. X   {
  2147. X    /* Returns -1 if the time is not available (ANSI 7.12.2.4). */
  2148. X    base=time(NULL);
  2149. X    init=TRUE;
  2150. X   }
  2151. X
  2152. X /* Return the elapsed time since the base time. */
  2153. X
  2154. X/* Macintosh, VMS, and PC have difftime. */
  2155. X#if MAC | VMS | PC
  2156. X if (base == -1)
  2157. X    return 0.0;
  2158. X else
  2159. X    return (float) difftime(time(NULL),base);
  2160. X#endif
  2161. X
  2162. X/* Sun does not have difftime. */
  2163. X#if SUN
  2164. X return 0.0;
  2165. X#endif
  2166. X
  2167. X/* The timing functions are only used to generate performance statistics and  */
  2168. X/* are not critical to FunnelWeb. There is not much harm in returning 0.0.    */
  2169. X}
  2170. X
  2171. X/******************************************************************************/
  2172. X
  2173. XEXPORT float tim_cpu()
  2174. X{
  2175. X clock_t t=clock();
  2176. X
  2177. X/* Make sure that we have a definition for CLOCKS_PER_SEC. */
  2178. X#ifndef CLOCKS_PER_SEC
  2179. X#ifdef CLK_TCK
  2180. X#define CLOCKS_PER_SEC CLK_TCK
  2181. X#else
  2182. X/* Assume one million ticks per second. */
  2183. X#define CLOCKS_PER_SEC (1000000L)
  2184. X#endif
  2185. X#endif
  2186. X
  2187. X /* The clock() function returns -1 if the CPU time is not available. */
  2188. X /* Otherwise it returns the number of "clocks" since power-up.       */
  2189. X if (t == -1)
  2190. X    return 0.0;
  2191. X else
  2192. X    return ((float) t) / ((float) CLOCKS_PER_SEC);
  2193. X}
  2194. X
  2195. X/******************************************************************************/
  2196. X/*                              End of MACHIN.C                               */
  2197. X/******************************************************************************/
  2198. END_OF_FILE
  2199. if test 11580 -ne `wc -c <'sources/machin.c'`; then
  2200.     echo shar: \"'sources/machin.c'\" unpacked with wrong size!
  2201. fi
  2202. # end of 'sources/machin.c'
  2203. fi
  2204. if test -f 'sources/texhead.tex' -a "${1}" != "-c" ; then 
  2205.   echo shar: Will not clobber existing file \"'sources/texhead.tex'\"
  2206. else
  2207. echo shar: Extracting \"'sources/texhead.tex'\" \(13048 characters\)
  2208. sed "s/^X//" >'sources/texhead.tex' <<'END_OF_FILE'
  2209. X%===================== Start of FunnelWeb TeX Definitions ======================
  2210. X
  2211. X
  2212. X% Version
  2213. X% -------
  2214. X% This is FunnelWeb TeX Macro Library Version 1.0.
  2215. X
  2216. X
  2217. X% Copyright
  2218. X% ---------
  2219. X% This set of FunnelWeb TeX definitions was written by Ross Williams and was
  2220. X% originally Copyright (C) 1992 Ross N. Williams.  However, I, Ross Williams,
  2221. X% hereby forego any claim to Copyright in this set of FunnelWeb TeX definitions
  2222. X% and hereby authorize that the set of TeX definitions pass into the public
  2223. X% domain. -- Ross N. Williams, 3:41pm 07-May-1992, Adelaide, Australia.
  2224. X
  2225. X
  2226. X% Modification
  2227. X% ------------
  2228. X% Please record all modifications to these TeX definitions here. Unless
  2229. X% otherwise specified, all modified definitions fall in the public domain too.
  2230. X%
  2231. X% Programmers:
  2232. X%    RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  2233. X%
  2234. X% Changes:
  2235. X%    07-May-1992  RNW  Prepared this work for public domain release.
  2236. X%
  2237. X
  2238. X
  2239. X% General Comments
  2240. X% ----------------
  2241. X% This set of TeX definitions exists for two reasons:
  2242. X%
  2243. X%    1. To shorten and neaten the FunnelWeb TeX output.
  2244. X%    2. To allow users to fiddle with the output format in their input files
  2245. X%       (by inserting redefining "\def"s) without having to resort to
  2246. X%       modifying the FunnelWeb code.
  2247. X%
  2248. X% The user is warned that these definitions may be changed from time to time
  2249. X% (but probably not much). The user should not be too sneaky. In particular,
  2250. X% users wishing to redefine some of these macros should do so in an explicitly
  2251. X% defined section at the top of their input file. This will mean that in the
  2252. X% event of problems, that section can simply be deleted or commented out to
  2253. X% allow the document to at least be typeset in the default format. Users should
  2254. X% limit themselves to redefining these macros in such a section and should
  2255. X% refrain from using the macros throughout their documents.
  2256. X
  2257. X
  2258. X% Environment Parameters
  2259. X% ----------------------
  2260. X% \tolerance tells TeX how tolerant it should be about making bad line and
  2261. X% page breaks. Here we set it to it's maximum, as
  2262. X%   1) Computer programs are likely to cause lots of bad breaks.
  2263. X%   2) In most cases the user would probably rather get the TeX file through
  2264. X%      TeX without any errors than fiddle with spacings for perfection.
  2265. X\tolerance=10000
  2266. X
  2267. X% I don't like indentation as it makes the page look more busy. Instead,
  2268. X% paragraphs are separated by a little space (see next).
  2269. X\parindent=0pt
  2270. X
  2271. X% In many cases, users will produce documents with long runs of paragraphs.
  2272. X% In order to space out these paragraphs, it is convenient to maintain a
  2273. X% prevailing non-zero \parskip (end-of-paragaph skip). The only trouble is
  2274. X% that the skip becomes a problem in macro definitions which require no skip
  2275. X% and so we have to turn the skip on and off. The following two macros
  2276. X% simplify this process.
  2277. X\def\fwparskipon{\parskip=\medskipamount}
  2278. X\def\fwparskipoff{\parskip=0pt}
  2279. X\fwparskipon
  2280. X
  2281. X% Setting raggedbottom allows TeX to leave a bit of space at the bottom of the
  2282. X% page in order to better vertically align the rest of the page (e.g. skips
  2283. X% won't stretch as much). It also means that headings are less likely to be
  2284. X% isolated at the bottom of the page without any following text.
  2285. X\raggedbottom
  2286. X
  2287. X
  2288. X% Fonts
  2289. X% -----
  2290. X% Most of the typeset output is set in 10pt roman and 10pt tt font.
  2291. X% The major extra font needs spring from titles and headings.
  2292. X% For portability's sake we use only the following fonts:
  2293. X%    cmr10
  2294. X%    cmbx10
  2295. X%    cmtt10
  2296. X% and some enlargements of them. These fonts are all "standard" fonts
  2297. X% in Plain TeX. See The TeXbook p.350.
  2298. X\font\fwfontnote=cmr7
  2299. X
  2300. X\font\fwfontnorm=cmr10
  2301. X\font\fwfontnorma=cmr10 scaled \magstep1
  2302. X\font\fwfontnormb=cmr10 scaled \magstep2
  2303. X
  2304. X\font\fwfontbold=cmbx10
  2305. X\font\fwfontbolda=cmbx10 scaled \magstep1
  2306. X\font\fwfontboldb=cmbx10 scaled \magstep2
  2307. X\font\fwfontboldc=cmbx10 scaled \magstep3
  2308. X\font\fwfontboldd=cmbx10 scaled \magstep4
  2309. X
  2310. X
  2311. X% Macros for Stylistic Details
  2312. X% ----------------------------
  2313. X% This section contains all the fiddly little macros for setting the details
  2314. X% of each macro definition.
  2315. X
  2316. X% Macro definitions are sandwiched by calls to these macros which can be used
  2317. X% to sort out the spacing before and after the macro definition.
  2318. X\def\fwbeginmacro{\fwparskipoff\bigskip}
  2319. X\def\fwendmacro{\fwparskipon\par}
  2320. X
  2321. X% These macros deal with the macro name and definition line.
  2322. X\def\fwmacroname#1#2{{\sl #1\/}$\lbrack$#2$\rbrack$}
  2323. X\def\fwfilename#1#2{{\bf #1}$\lbrack$#2$\rbrack$}
  2324. X\def\fwzero#1{{\bf Z}}
  2325. X\def\fwmany#1{{\bf M}}
  2326. X\def\fwequals{ $\equiv$}
  2327. X\def\fwplusequals{ $+\equiv$}
  2328. X
  2329. X% Now for the actual body of the definition. It looks nice to have the tt
  2330. X% code indented a little. Again, we use macros instead of writing direct TeX,
  2331. X% so as to allow the user to fiddle this stuff to taste without having to
  2332. X% modify the FunnelWeb C code.
  2333. X\def\fwodef{\parindent=15pt\vskip0pt$\lbrace$\parindent=20pt}
  2334. X\def\fwcdef{$\rbrace$\vskip0pt\parindent=0pt}
  2335. X\def\fwoquote{`}
  2336. X\def\fwcquote{'}
  2337. X\def\fwoparen{$($}
  2338. X\def\fwcomma{$,$}
  2339. X\def\fwcparen{$)$}
  2340. X\def\fwparam#1{$\diamond #1$}
  2341. X\def\fwparams#1{$(\diamond #1)$}
  2342. X
  2343. X% These macros deal with the notes that are appended at the end of each
  2344. X% macro definition. Note that even though \fwisafile,\fwusedin, and \fwseealso
  2345. X% have the same definition, they are given different names so as to allow the
  2346. X% user to redefine these macros to typeset each kind of information differently
  2347. X% if desired.
  2348. X\def\fwbeginmacronotes{\begingroup\baselineskip=9pt\smallskip}
  2349. X\def\fwnote#1{{\fwfontnote #1}\par}
  2350. X\def\fwisafile#1{\fwnote{#1}}
  2351. X\def\fwusedin#1{\fwnote{#1}}
  2352. X\def\fwseealso#1{\fwnote{#1}}
  2353. X\def\fwendmacronotes{\endgroup}
  2354. X
  2355. X
  2356. X% Macros to Typeset Program Code Verbatim
  2357. X% ---------------------------------------
  2358. X% This is by far the hairiest and most difficult part of the typesetting task
  2359. X% because we have to turn off most of TeX's natural instincts in order to
  2360. X% typeset the program text exactly as it appears in the input file.
  2361. X% Two macros are defined to pull this off: \fwbtx and \fwverbatimgobble.
  2362. X% Their code was inspired by the following sections of "The TeXbook":
  2363. X%    Appendix D: Dirty Tricks, 3.Verbatim listing, p.380-382.
  2364. X%    Appendix E: Example Formats, p.421.
  2365. X% The \fwbtx[ (for "FunnelWeb Begin TeXt") macro does most of the hard work.
  2366. X% The liberal use of "%" is because I don't understand TeX well enough to
  2367. X% understand when an end of line will cause trouble, and I am playing it safe.
  2368. X
  2369. X% Before defining the main \fwbtx macro, we have to stash away some definitions
  2370. X% in the hidden part of TeX's environment. Let's hope that these "hidden"
  2371. X% definitions don't affect anything except what is desired to be affected.
  2372. X
  2373. X% The tt font in which we wish to set the text has two Latin lurking ligatures!
  2374. X% These are ?` and !`. To disable them, we define the left quote when ACTIVE
  2375. X% to be defined in such a way as to prevent ligatures. The main TeX text will
  2376. X% normally not be exposed to this definition because normally the leftquote
  2377. X% character is not active. The \fwbtx macro temporarily makes the left quote
  2378. X% character active thus activating the deactivation of left quote ligatures.
  2379. X% See The TeXbook p.381.
  2380. X{\catcode`\`=\active \gdef`{\relax\lq}}
  2381. X
  2382. X% TeX is fairly carefree about spaces and so we have to make it more serious.
  2383. X% To do so we pull the same trick as above, setting up a definition for active
  2384. X% space, but only making space active during the span of the verbatim text.
  2385. X% In Plain TeX the active space is defined to be simply a space, but here we
  2386. X% define it to be a control space. This ensures that the space cannot
  2387. X% be gobbled up by one of TeX's mysterious mechanisms when activated.
  2388. X% See The TeXbook, p.381 and p.352.
  2389. X{\obeyspaces\global\let =\ }
  2390. X
  2391. X% Here is the main \fwbtx verbatim text macro.
  2392. X% Note: The order in which all these pieces of business have to be done is
  2393. X% still a partial mystery to me. Don't fiddle with this stuff unless you
  2394. X% think you know what you are doing.
  2395. X\def\fwbtx[{%
  2396. X%
  2397. X% The funnies involved in getting verbatim output are safely housed inside
  2398. X% this \begingroup, and the \endgroup in \fwverbatimgobble. Groups are used
  2399. X% instead of curly braces because we have to be able to signal the end of
  2400. X% this macro with a curly brace.
  2401. X\begingroup%
  2402. X%
  2403. X% \pars at the end of empty lines in the verbatim text won't come out normally
  2404. X% because TeX is in vertical mode and they get gobbled up. To prevent this,
  2405. X% we force \par to exit vertical mode first. See The TeXbook p.381.
  2406. X\def\par{\leavevmode\endgraf}%
  2407. X%
  2408. X% Activate the leftquote character so as to avoid ligatures (see above).
  2409. X\catcode`\`=\active%
  2410. X%
  2411. X% The \obeylines macro simply defines end of line (^M) to be \par. This ensures
  2412. X% that TeX will treat each verbatim line as a new paragraph.
  2413. X\obeylines%
  2414. X%
  2415. X% To get verbatim output, we have to desex all the special characters. This
  2416. X% is explained in detail in The TeXbook p.380.
  2417. X\def\do##1{\catcode`##1=12 }\dospecials%
  2418. X%
  2419. X% Activate the space character so as to make TeX treat blanks seriously.
  2420. X% This activation invokes an eralier definition (see above).
  2421. X\obeyspaces
  2422. X%
  2423. X% Interparagraph skips do not help the cause.
  2424. X% Note: We have to preserve the indentation though, as the code is actually
  2425. X% indented in the final output. See \fwodef in an earlier section.
  2426. X\parskip=0pt%
  2427. X%
  2428. X% We typeset the verbatim text in tt font (courier on the Macintosh) for a
  2429. X% number of reasons:
  2430. X%    - tt font has the same horizontal spacing for each character.
  2431. X%    - tt font covers the ASCII character set.
  2432. X%    - tt font doesn't have many surprises (e.g. ligatures).
  2433. X%    - tt font looks much what you might see on a computer terminal screen.
  2434. X\tt%
  2435. X%
  2436. X% Having set up an environment for verbatim, we are ready to use it.
  2437. X% By invoking \fwverbatimgobble, this \fwbtx macro gobbles up text verbatim (as
  2438. X% part of the parameter of \fwverbatimgobble) until it sees the termination
  2439. X% string "]fwetx=" (the "=" was thrown in to add obscurity as this sequence
  2440. X% must never occur in the verbatim text).
  2441. X\fwverbatimgobble}
  2442. X
  2443. X% The \fwverbatimgobble macro exists to allow \fwbtx to bracket verbatim text.
  2444. X\def\fwverbatimgobble#1]fwetx={#1\endgroup}
  2445. X
  2446. X
  2447. X% Table of Contents
  2448. X% -----------------
  2449. X% The five levels of table of contents that FunnelWeb supports are identified
  2450. X% by the five letters [A..E]. These are used throughout the following macros.
  2451. X
  2452. X% The following macros are utilities to the TOC macros to follow.
  2453. X\def\fwrule{\medskip\hrule\medskip}
  2454. X\def\fwqh{\hskip1.5em\relax}
  2455. X\def\fwbeforesec{\penalty-200\bigskip\medskip\par}
  2456. X
  2457. X% The following macros are used to typeset the table of contents.
  2458. X\def\fwtocstart#1{\fwrule\leftline{\fwfontbolda Table of Contents}\fwrule}
  2459. X\def\fwtoca#1#2{\leftline{{\bf #1 #2}}}
  2460. X\def\fwtocb#1#2{\leftline{\fwqh #1 #2}}
  2461. X\def\fwtocc#1#2{\leftline{\fwqh\fwqh #1 #2}}
  2462. X\def\fwtocd#1#2{\leftline{\fwqh\fwqh\fwqh #1 #2}}
  2463. X\def\fwtoce#1#2{\leftline{\fwqh\fwqh\fwqh\fwqh #1 #2}}
  2464. X\def\fwtocfinish#1{\fwrule}
  2465. X
  2466. X% The following "library" macros define five different strengths of headings
  2467. X% which can be used later in the section macros.
  2468. X\def\fwliba#1#2{\vfill\eject{\fwfontboldc #1 #2}\penalty200\smallskip}
  2469. X\def\fwlibb#1#2{\fwbeforesec{\fwfontboldb #1 #2}\penalty200\smallskip}
  2470. X\def\fwlibc#1#2{\fwbeforesec{\fwfontnormb #1 #2}\penalty200\smallskip}
  2471. X\def\fwlibd#1#2{\fwbeforesec{\bf          #1 #2}\penalty200}
  2472. X\def\fwlibe#1#2{\fwbeforesec{\bf          #1 #2}}
  2473. X
  2474. X% Here are the macros that actually typeset the section headings throughout
  2475. X% the document. The fwlib system has been employed so as to easily allow the
  2476. X% user to redefine the strengths of headings to taste. For example, the
  2477. X% user could insert in the input document a similar set of definitions to these
  2478. X% but with the b..e headings set to \fwlibc. This would tone down the output.
  2479. X\def\fwseca#1#2{\fwliba{#1}{#2}}
  2480. X\def\fwsecb#1#2{\fwlibb{#1}{#2}}
  2481. X\def\fwsecc#1#2{\fwlibc{#1}{#2}}
  2482. X\def\fwsecd#1#2{\fwlibd{#1}{#2}}
  2483. X\def\fwsece#1#2{\fwlibe{#1}{#2}}
  2484. X
  2485. X
  2486. X% Support for Explicit Typesetting
  2487. X% --------------------------------
  2488. X% FunnelWeb supports pragmas and other constructs that allow
  2489. X% typesetter-independent typesetting commands to be given. The
  2490. X% following macros support these features.
  2491. X
  2492. X% The in-text literal @{sloth@} and emphasise @[walrus@] features.
  2493. X\def\fwlit#1{{\tt #1}}
  2494. X\def\fwemp#1{{\it #1}}
  2495. X
  2496. X% The "@p new_page" pragma.
  2497. X\def\fwnewpage{\vfill\eject}
  2498. X
  2499. X% The "@p vskip Nmm" pragma.
  2500. X\def\fwvskip#1{\null\vskip #1mm}
  2501. X
  2502. X% The "@p title <font> <align> <text>" pragma.
  2503. X\def\fwfontnormal#1{{\fwfontnorm {#1}}}
  2504. X\def\fwfonttitle#1{{\fwfontboldd {#1}}}
  2505. X\def\fwfontsmalltitle#1{{\fwfontboldb {#1}}}
  2506. X\def\fwleftline#1{\leftline{#1}}
  2507. X\def\fwcenterline#1{\centerline{#1}}
  2508. X\def\fwrightline#1{\rightline{#1}}
  2509. X
  2510. X
  2511. X% Support for Old FunnelWeb
  2512. X% -------------------------
  2513. X% The following macros were used extensively in the first version of
  2514. X% FunnelWeb and are retained so that these older input files will still
  2515. X% typeset cleanly.
  2516. X\def\p#1{{\tt #1}}  % P for Program text.
  2517. X\def\flagpage#1#2{
  2518. X   \null
  2519. X   \vfill
  2520. X   \centerline{\fwfontboldd #1}
  2521. X   \vskip 1cm
  2522. X   \centerline{\fwfontboldd #2}
  2523. X   \vfill
  2524. X   \null
  2525. X   \vfill
  2526. X}
  2527. X
  2528. X%====================== End of FunnelWeb TeX Definitions =======================
  2529. END_OF_FILE
  2530. if test 13048 -ne `wc -c <'sources/texhead.tex'`; then
  2531.     echo shar: \"'sources/texhead.tex'\" unpacked with wrong size!
  2532. fi
  2533. # end of 'sources/texhead.tex'
  2534. fi
  2535. if test -f 'sources/writfile.h' -a "${1}" != "-c" ; then 
  2536.   echo shar: Will not clobber existing file \"'sources/writfile.h'\"
  2537. else
  2538. echo shar: Extracting \"'sources/writfile.h'\" \(11225 characters\)
  2539. sed "s/^X//" >'sources/writfile.h' <<'END_OF_FILE'
  2540. X/*##############################################################################
  2541. X
  2542. XFUNNNELWEB COPYRIGHT
  2543. X====================
  2544. XFunnelWeb is a literate-programming macro preprocessor.
  2545. X
  2546. Copyright (C) 1992 Ross N. Williams.
  2547. X
  2548. X   Ross N. Williams
  2549. X   ross@spam.adelaide.edu.au
  2550. X   16 Lerwick Avenue, Hazelwood Park 5066, Australia.
  2551. X
  2552. This program is free software; you can redistribute it and/or modify
  2553. it under the terms of Version 2 of the GNU General Public License as
  2554. published by the Free Software Foundation.
  2555. X
  2556. This program is distributed WITHOUT ANY WARRANTY; without even the implied
  2557. warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  2558. See Version 2 of the GNU General Public License for more details.
  2559. X
  2560. You should have received a copy of Version 2 of the GNU General Public
  2561. License along with this program. If not, you can FTP the license from
  2562. prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
  2563. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  2564. X
  2565. Section 2a of the license requires that all changes to this file be
  2566. recorded prominently in this file. Please record all changes here.
  2567. X
  2568. Programmers:
  2569. X   RNW  Ross N. Williams  ross@spam.adelaide.edu.au
  2570. X
  2571. Changes:
  2572. X   07-May-1992  RNW  Program prepared for release under GNU GPL V2.
  2573. X
  2574. X##############################################################################*/
  2575. X
  2576. X
  2577. X/******************************************************************************/
  2578. X/*                                   WRITFILE.H                               */
  2579. X/******************************************************************************/
  2580. X/*                                                                            */
  2581. X/* Introduction                                                               */
  2582. X/* ------------                                                               */
  2583. X/* This package performs all of FunnelWeb's file output.                      */
  2584. X/* FunnelWeb performs lots of output to lots of different files:              */
  2585. X/*                                                                            */
  2586. X/*    - Standard output (to write to the screen).                             */
  2587. X/*    - The journal file.                                                     */
  2588. X/*    - The listing file.                                                     */
  2589. X/*    - The tangle output files.                                              */
  2590. X/*    - The weave output file.                                                */
  2591. X/*                                                                            */
  2592. X/* Error Detection                                                            */
  2593. X/* ---------------                                                            */
  2594. X/* As we are serious about detecting errors, every call to every IO function  */
  2595. X/* must have its status checked. Unfortunately this makes everything very     */
  2596. X/* messy. Having to check result statuses and react to them can be very       */
  2597. X/* awkward in deeply nested pieces of code, particularly as C does not have   */
  2598. X/* exceptions. As a result, the policy adopted in FunnelWeb is to RECORD when */
  2599. X/* an error occurs on an output stream and silently shut down that stream.    */
  2600. X/* Then later, at a convenient time, the error status of the stream can be    */
  2601. X/* checked, and an error message issued.                                      */
  2602. X/*                                                                            */
  2603. X/* The C libraries make an effort to be helpful here by providing the ferror  */
  2604. X/* function. However, it is not useful here for two reasons:                  */
  2605. X/*                                                                            */
  2606. X/*    1. Some calls (e.g. fwrite) are not listed as setting the error status. */
  2607. X/*    2. It is not guaranteed that IO calls to a stream with error status     */
  2608. X/*       will not cause a crash.                                              */
  2609. X/*    3. Even if ferror were used, it may not be supported by older compilers.*/
  2610. X/*                                                                            */
  2611. X/* This package was created to take care of the vexing problems of IO errors  */
  2612. X/* in output streams. It is a layer above the ANSI file library that provides */
  2613. X/* the elementary calls for writing. It differs in that if an error occurs,   */
  2614. X/* the package records that fact and simply ignores all further operations    */
  2615. X/* on the file. At any time, it is possible to find out whether a file is in  */
  2616. X/* normal mode or error mode. All this means that a piece of code can use     */
  2617. X/* this package to create and write to a file without worrying about errors.  */
  2618. X/* Then later, when the dust settles, the package can check the status  of    */
  2619. X/* the file, and take appropriate action if an error has been detected.       */
  2620. X/*                                                                            */
  2621. X/* Text vs Binary                                                             */
  2622. X/* --------------                                                             */
  2623. X/* This package translates all '\n' (contained in the data it has been given  */
  2624. X/* to write) into the appropriate environment specific representation.        */
  2625. X/*                                                                            */
  2626. X/* Facts About WF Objects                                                     */
  2627. X/* ----------------------                                                     */
  2628. X/* - A WF object is either in NORMAL or ERROR mode.                           */
  2629. X/* - A WF object in NORMAL mode is also either in OPEN or CLOSED mode.        */
  2630. X/* - The term "raise an error" means bomb the program with a message.         */
  2631. X/* - The comments attached to the functions given below are meant to be read  */
  2632. X/*   sequentially with each action or check being performed before the next.  */
  2633. X/* - This package can not guarantee to detect uninitialized WF objects. The   */
  2634. X/*   reason is that policing is performed using magic number mechanism and it */
  2635. X/*   is possible that a piece of random memory may contain just the right     */
  2636. X/*   numbers to fool the package.                                             */
  2637. X/*                                                                            */
  2638. X/******************************************************************************/
  2639. X
  2640. X/* Ensure that the body of this header file is included at most once.         */
  2641. X#ifndef DONE_WRITFILE
  2642. X#define DONE_WRITFILE
  2643. X
  2644. X/******************************************************************************/
  2645. X
  2646. X#include "style.h"
  2647. X
  2648. X/******************************************************************************/
  2649. X
  2650. X/* We really don't want to show all the guts of this record here, but as      */
  2651. X/* users of the package have to be able to declare objects of this type and   */
  2652. X/* make them the right size, it seems as if we have no choice.                */
  2653. typedef struct
  2654. X  {
  2655. X   ulong  wf_mhead;   /* Helps detect uninitialized and corrupted records.    */
  2656. X   bool   wf_iserr;   /* TRUE=>ERROR,   FALSE=>NORMAL.                        */
  2657. X   bool   wf_isope;   /* TRUE=>OPEN,    FALSE=>CLOSED.                        */
  2658. X   bool   wf_istxt;   /* TRUE=>TEXT,    FALSE=>BINARY.                        */
  2659. X   FILE  *wf_pfile;   /* Pointer to the file object.                          */
  2660. X   ulong  wf_mtail;   /* Helps detect uninitialized and  corrupted records.   */
  2661. X  } wf_t;
  2662. X
  2663. typedef wf_t *p_wf_t;
  2664. X
  2665. X/******************************************************************************/
  2666. X
  2667. XEXPORT void wf_ini P_((p_wf_t,bool));
  2668. X/* Initializes a WF to a well defined state in accordance with the boolean.   */
  2669. X/*    FALSE => State=(ERROR).                                                 */
  2670. X/*    TRUE  => State=(NORMAL,CLOSED).                                         */
  2671. X/* wf_ini must be applied to a WF before any other operation.                 */
  2672. X/* It can be re-applied repeatedly.                                           */
  2673. X
  2674. XEXPORT void wf_att P_((p_wf_t,FILE *));
  2675. X/* If WF is uninitialized, raises an error (probably).                        */
  2676. X/* If WF is in ERROR mode, returns with no effect.                            */
  2677. X/* If WF is OPEN, raises an error.                                            */
  2678. X/* Attaches an already opened output file to the specified FW object.         */
  2679. X/* Changes the WF to the OPEN state.                                          */
  2680. X/* The memory that the second parameter points to must be stable.             */
  2681. X
  2682. XEXPORT void wf_ope P_((p_wf_t,char *));
  2683. X/* If WF is uninitialized, raises an error (probably).                        */
  2684. X/* If WF is in ERROR mode, returns with no effect.                            */
  2685. X/* If WF is OPEN, raises an error.                                            */
  2686. X/* Creates an output file of the specified name and prepares it for writing.  */
  2687. X/* Changes the WF to the OPEN state.                                          */
  2688. X/* Sets the WF to the ERROR state if the file cannot be opened for writing.   */
  2689. X
  2690. XEXPORT void wf_chr P_((p_wf_t,intchar));
  2691. X/* If WF is uninitialized, raises an error (probably).                        */
  2692. X/* If WF is in ERROR mode, returns with no effect.                            */
  2693. X/* If WF is CLOSED, raises an error.                                          */
  2694. X/* Writes the specified character to the output file associated with WF.      */
  2695. X/* Sets WF to the ERROR state if an error occurs during the write.            */
  2696. X
  2697. XEXPORT void wf_wr P_((p_wf_t,char *));
  2698. X/* Same as wf_chr except that it writes an entire string.                     */
  2699. X
  2700. XEXPORT void wf_wl P_((p_wf_t,char *));
  2701. X/* Same as wf_wr except that appends a '\n'.                                  */
  2702. X
  2703. XEXPORT void wf_blk P_((p_wf_t,char *,size_t));
  2704. X/* Same as wf_wr but writes a block of bytes whose address is given by the    */
  2705. X/* second parameter and whose length (in bytes) is given by the third         */
  2706. X/* parameter.                                                                 */
  2707. X
  2708. XEXPORT void wf_clo P_((p_wf_t));
  2709. X/* If WF is uninitialized, raises an error (probably).                        */
  2710. X/* If WF is in ERROR mode, returns with no effect.                            */
  2711. X/* If WF is CLOSED, raises an error.                                          */
  2712. X/* Flushes and closes the output file attached to WF.                         */
  2713. X/* Sets WF to the CLOSED state.                                               */
  2714. X/* Sets WF to the ERROR state if an error occurs during the close.            */
  2715. X
  2716. XEXPORT bool wf_err P_((p_wf_t));
  2717. X/* If WF is uninitialized, raises an error (probably).                        */
  2718. X/* Returns TRUE iff WF is in the ERROR state, otherwise FALSE.                */
  2719. X/* This function can be called at any time so long as the WF is initialized.  */
  2720. X
  2721. X/******************************************************************************/
  2722. X
  2723. X/* For #ifndef preventing multiple inclusion of the body of this header file. */
  2724. X#endif
  2725. X
  2726. X/******************************************************************************/
  2727. X/*                              End of WRITFILE.H                             */
  2728. X/******************************************************************************/
  2729. END_OF_FILE
  2730. if test 11225 -ne `wc -c <'sources/writfile.h'`; then
  2731.     echo shar: \"'sources/writfile.h'\" unpacked with wrong size!
  2732. fi
  2733. # end of 'sources/writfile.h'
  2734. fi
  2735. if test -f 'userman/u_manual.toc' -a "${1}" != "-c" ; then 
  2736.   echo shar: Will not clobber existing file \"'userman/u_manual.toc'\"
  2737. else
  2738. echo shar: Extracting \"'userman/u_manual.toc'\" \(11191 characters\)
  2739. sed "s/^X//" >'userman/u_manual.toc' <<'END_OF_FILE'
  2740. X\contentsline {chapter}{Preface}{9}
  2741. X\contentsline {chapter}{Acknowledgements}{11}
  2742. X\contentsline {chapter}{Presentation Notes}{13}
  2743. X\contentsline {chapter}{\numberline {1}A Tutorial Introduction}{15}
  2744. X\contentsline {section}{\numberline {1.1}What is Literate Programming?}{15}
  2745. X\contentsline {section}{\numberline {1.2}What is FunnelWeb?}{18}
  2746. X\contentsline {section}{\numberline {1.3}The Name FunnelWeb}{19}
  2747. X\contentsline {section}{\numberline {1.4}A FunnelWeb Tutorial}{19}
  2748. X\contentsline {section}{\numberline {1.5}A Hello World Document}{20}
  2749. X\contentsline {section}{\numberline {1.6}Macro Facilities}{22}
  2750. X\contentsline {subsection}{\numberline {1.6.1}Simple Macros}{22}
  2751. X\contentsline {subsection}{\numberline {1.6.2}Number of Times Called}{23}
  2752. X\contentsline {subsection}{\numberline {1.6.3}Indentation}{25}
  2753. X\contentsline {subsection}{\numberline {1.6.4}Additive Macros}{26}
  2754. X\contentsline {subsection}{\numberline {1.6.5}Parameterized Macros}{28}
  2755. X\contentsline {subsection}{\numberline {1.6.6}Macro Expansion}{30}
  2756. X\contentsline {subsection}{\numberline {1.6.7}Include Files}{30}
  2757. X\contentsline {section}{\numberline {1.7}Typesetting Facilities}{32}
  2758. X\contentsline {subsection}{\numberline {1.7.1}Overview}{32}
  2759. X\contentsline {subsection}{\numberline {1.7.2}Typesetter Independence}{34}
  2760. X\contentsline {subsection}{\numberline {1.7.3}Hierarchical Structure}{34}
  2761. X\contentsline {subsection}{\numberline {1.7.4}Understanding the Printed Documentation}{35}
  2762. X\contentsline {subsection}{\numberline {1.7.5}Literals and Emphasis}{37}
  2763. X\contentsline {subsection}{\numberline {1.7.6}Adding a Header Page}{37}
  2764. X\contentsline {subsection}{\numberline {1.7.7}Comments}{37}
  2765. X\contentsline {section}{\numberline {1.8}A Complete Example}{38}
  2766. X\contentsline {section}{\numberline {1.9}Summary}{39}
  2767. X\contentsline {chapter}{\numberline {2}FunnelWeb Hints}{41}
  2768. X\contentsline {section}{\numberline {2.1}Macro Names}{41}
  2769. X\contentsline {section}{\numberline {2.2}Quick Names}{42}
  2770. X\contentsline {section}{\numberline {2.3}FunnelWeb the Martinet}{42}
  2771. X\contentsline {section}{\numberline {2.4}Fiddling With End of Lines}{43}
  2772. X\contentsline {section}{\numberline {2.5}Fudging Conditionals}{44}
  2773. X\contentsline {section}{\numberline {2.6}Changing the Strength of Headings}{46}
  2774. X\contentsline {section}{\numberline {2.7}Efficiency Notes}{47}
  2775. X\contentsline {section}{\numberline {2.8}Interactive Mode}{47}
  2776. X\contentsline {section}{\numberline {2.9}Setting Up Default Options}{49}
  2777. X\contentsline {section}{\numberline {2.10}FunnelWeb and Make}{49}
  2778. X\contentsline {section}{\numberline {2.11}The Dangers of FunnelWeb}{50}
  2779. X\contentsline {section}{\numberline {2.12}Wholistic Debugging}{53}
  2780. X\contentsline {section}{\numberline {2.13}Examples of FunnelWeb Applications}{53}
  2781. X\contentsline {subsection}{\numberline {2.13.1}Analyzing the Monster Postscript Header File}{54}
  2782. X\contentsline {subsection}{\numberline {2.13.2}Making Ada ADTs more A}{55}
  2783. X\contentsline {subsection}{\numberline {2.13.3}Multiple Language Systems}{55}
  2784. X\contentsline {subsection}{\numberline {2.13.4}The Case of the Small Function}{56}
  2785. X\contentsline {subsection}{\numberline {2.13.5}When Comments are Bad}{57}
  2786. X\contentsline {subsection}{\numberline {2.13.6}Documents That Share Text}{58}
  2787. X\contentsline {subsection}{\numberline {2.13.7}Generics}{59}
  2788. X\contentsline {section}{\numberline {2.14}Summary}{62}
  2789. X\contentsline {chapter}{\numberline {3}FunnelWeb Definition}{63}
  2790. X\contentsline {section}{\numberline {3.1}Introduction}{63}
  2791. X\contentsline {section}{\numberline {3.2}Notation}{63}
  2792. X\contentsline {section}{\numberline {3.3}Terminology}{63}
  2793. X\contentsline {section}{\numberline {3.4}An Architectural Overview}{64}
  2794. X\contentsline {section}{\numberline {3.5}Diagnostics}{65}
  2795. X\contentsline {section}{\numberline {3.6}Typesetter Independence}{65}
  2796. X\contentsline {section}{\numberline {3.7}Command Line Interface}{66}
  2797. X\contentsline {subsection}{\numberline {3.7.1}Invoking FunnelWeb}{66}
  2798. X\contentsline {subsection}{\numberline {3.7.2}Command Line Arguments}{67}
  2799. X\contentsline {subsection}{\numberline {3.7.3}Options}{68}
  2800. X\contentsline {section}{\numberline {3.8}File Name Inheritance}{70}
  2801. X\contentsline {section}{\numberline {3.9}FunnelWeb Startup}{70}
  2802. X\contentsline {section}{\numberline {3.10}Scanner}{71}
  2803. X\contentsline {subsection}{\numberline {3.10.1}Basic Input File Processing}{71}
  2804. X\contentsline {subsection}{\numberline {3.10.2}Special Sequences}{72}
  2805. X\contentsline {subsection}{\numberline {3.10.3}Setting the Special Character}{74}
  2806. X\contentsline {subsection}{\numberline {3.10.4}Inserting the Special Character into the Text}{74}
  2807. X\contentsline {subsection}{\numberline {3.10.5}Inserting Arbitrary Characters into the Text}{74}
  2808. X\contentsline {subsection}{\numberline {3.10.6}Comments}{75}
  2809. X\contentsline {subsection}{\numberline {3.10.7}Quick Names}{76}
  2810. X\contentsline {subsection}{\numberline {3.10.8}Inserting End of Line Markers}{76}
  2811. X\contentsline {subsection}{\numberline {3.10.9}Suppressing End of Line Markers}{77}
  2812. X\contentsline {subsection}{\numberline {3.10.10}Include Files}{77}
  2813. X\contentsline {subsection}{\numberline {3.10.11}Pragmas}{78}
  2814. X\contentsline {subsubsection}{\numberline {3.10.11.1}Indentation}{78}
  2815. X\contentsline {subsubsection}{\numberline {3.10.11.2}Maximum Input Line Length}{79}
  2816. X\contentsline {subsubsection}{\numberline {3.10.11.3}Maximum Output File Line Length}{79}
  2817. X\contentsline {subsubsection}{\numberline {3.10.11.4}Typesetter}{80}
  2818. X\contentsline {subsection}{\numberline {3.10.12}Freestanding Typesetter Directives}{81}
  2819. X\contentsline {subsubsection}{\numberline {3.10.12.1}New Page}{81}
  2820. X\contentsline {subsubsection}{\numberline {3.10.12.2}Table of Contents}{81}
  2821. X\contentsline {subsubsection}{\numberline {3.10.12.3}Vertical Skip}{81}
  2822. X\contentsline {subsubsection}{\numberline {3.10.12.4}Title}{82}
  2823. X\contentsline {subsection}{\numberline {3.10.13}Scanner/Parser Interface}{82}
  2824. X\contentsline {section}{\numberline {3.11}Parser}{82}
  2825. X\contentsline {subsection}{\numberline {3.11.1}High Level Structure}{82}
  2826. X\contentsline {subsection}{\numberline {3.11.2}Free Text}{83}
  2827. X\contentsline {subsection}{\numberline {3.11.3}Typesetter Directives}{83}
  2828. X\contentsline {subsubsection}{\numberline {3.11.3.1}Section}{83}
  2829. X\contentsline {subsubsection}{\numberline {3.11.3.2}Literal Directive}{84}
  2830. X\contentsline {subsubsection}{\numberline {3.11.3.3}Emphasis Directive}{85}
  2831. X\contentsline {subsection}{\numberline {3.11.4}Macros}{85}
  2832. X\contentsline {subsubsection}{\numberline {3.11.4.1}Names}{86}
  2833. X\contentsline {subsubsection}{\numberline {3.11.4.2}Formal Parameter Lists}{86}
  2834. X\contentsline {subsection}{\numberline {3.11.5}Expressions}{86}
  2835. X\contentsline {subsection}{\numberline {3.11.6}Macro Calls}{86}
  2836. X\contentsline {subsection}{\numberline {3.11.7}Formal Parameters}{87}
  2837. X\contentsline {subsection}{\numberline {3.11.8}Macros are Static}{87}
  2838. X\contentsline {section}{\numberline {3.12}Analyser}{88}
  2839. X\contentsline {section}{\numberline {3.13}Tangle}{88}
  2840. X\contentsline {section}{\numberline {3.14}Weave}{89}
  2841. X\contentsline {subsection}{\numberline {3.14.1}Target Typesetter}{89}
  2842. X\contentsline {subsection}{\numberline {3.14.2}Cross Reference Numbering}{89}
  2843. X\contentsline {section}{\numberline {3.15}FunnelWeb Shell}{90}
  2844. X\contentsline {subsection}{\numberline {3.15.1}Introduction}{90}
  2845. X\contentsline {subsection}{\numberline {3.15.2}Return Statuses}{90}
  2846. X\contentsline {subsection}{\numberline {3.15.3}Command Line Length}{91}
  2847. X\contentsline {subsection}{\numberline {3.15.4}String Substitution}{91}
  2848. X\contentsline {subsection}{\numberline {3.15.5}How a Command Line is Processed}{92}
  2849. X\contentsline {subsection}{\numberline {3.15.6}Options}{92}
  2850. X\contentsline {subsection}{\numberline {3.15.7}Shell Commands}{93}
  2851. X\contentsline {subsubsection}{\numberline {3.15.7.1}Absent}{93}
  2852. X\contentsline {subsubsection}{\numberline {3.15.7.2}Codify}{93}
  2853. X\contentsline {subsubsection}{\numberline {3.15.7.3}Compare}{93}
  2854. X\contentsline {subsubsection}{\numberline {3.15.7.4}Define}{94}
  2855. X\contentsline {subsubsection}{\numberline {3.15.7.5}Diff}{94}
  2856. X\contentsline {subsubsection}{\numberline {3.15.7.6}Diffsummary}{95}
  2857. X\contentsline {subsubsection}{\numberline {3.15.7.7}Diffzero}{95}
  2858. X\contentsline {subsubsection}{\numberline {3.15.7.8}Eneo}{95}
  2859. X\contentsline {subsubsection}{\numberline {3.15.7.9}Execute}{96}
  2860. X\contentsline {subsubsection}{\numberline {3.15.7.10}Exists}{96}
  2861. X\contentsline {subsubsection}{\numberline {3.15.7.11}Fixeols}{96}
  2862. X\contentsline {subsubsection}{\numberline {3.15.7.12}Fw}{97}
  2863. X\contentsline {subsubsection}{\numberline {3.15.7.13}Help}{97}
  2864. X\contentsline {subsubsection}{\numberline {3.15.7.14}Here}{98}
  2865. X\contentsline {subsubsection}{\numberline {3.15.7.15}Quit}{98}
  2866. X\contentsline {subsubsection}{\numberline {3.15.7.16}Set}{98}
  2867. X\contentsline {subsubsection}{\numberline {3.15.7.17}Show}{98}
  2868. X\contentsline {subsubsection}{\numberline {3.15.7.18}Skipto}{98}
  2869. X\contentsline {subsubsection}{\numberline {3.15.7.19}Status}{99}
  2870. X\contentsline {subsubsection}{\numberline {3.15.7.20}Tolerate}{100}
  2871. X\contentsline {subsubsection}{\numberline {3.15.7.21}Trace}{100}
  2872. X\contentsline {subsubsection}{\numberline {3.15.7.22}Write}{100}
  2873. X\contentsline {subsubsection}{\numberline {3.15.7.23}Writeu}{100}
  2874. X\contentsline {section}{\numberline {3.16}Concluding Remarks}{100}
  2875. X\contentsline {chapter}{\numberline {4}FunnelWeb Installation}{101}
  2876. X\contentsline {section}{\numberline {4.1}Obtaining a Copy of FunnelWeb}{101}
  2877. X\contentsline {section}{\numberline {4.2}Establishing The Directory Tree}{102}
  2878. X\contentsline {subsection}{\numberline {4.2.1}Admin Directory}{102}
  2879. X\contentsline {subsection}{\numberline {4.2.2}Answers Directory}{102}
  2880. X\contentsline {subsection}{\numberline {4.2.3}Hackman Directory}{103}
  2881. X\contentsline {subsection}{\numberline {4.2.4}Results Directory}{103}
  2882. X\contentsline {subsection}{\numberline {4.2.5}Scripts Directory}{103}
  2883. X\contentsline {subsection}{\numberline {4.2.6}Sources Directory}{103}
  2884. X\contentsline {subsection}{\numberline {4.2.7}Tests Directory}{104}
  2885. X\contentsline {subsection}{\numberline {4.2.8}Userman Directory}{105}
  2886. X\contentsline {section}{\numberline {4.3}Compiling FunnelWeb}{105}
  2887. X\contentsline {section}{\numberline {4.4}Testing FunnelWeb}{105}
  2888. X\contentsline {section}{\numberline {4.5}Installing FunnelWeb}{106}
  2889. X\contentsline {section}{\numberline {4.6}Printing Manuals}{107}
  2890. X\contentsline {section}{\numberline {4.7}Installation Problems?}{107}
  2891. X\contentsline {chapter}{\numberline {5}FunnelWeb Administration}{109}
  2892. X\contentsline {section}{\numberline {5.1}Introduction}{109}
  2893. X\contentsline {section}{\numberline {5.2}The User's Commitment To FunnelWeb}{109}
  2894. X\contentsline {section}{\numberline {5.3}Documentation}{110}
  2895. X\contentsline {section}{\numberline {5.4}Registration}{110}
  2896. X\contentsline {section}{\numberline {5.5}Support}{110}
  2897. X\contentsline {section}{\numberline {5.6}Copyright}{112}
  2898. X\contentsline {section}{\numberline {5.7}Nowarranty}{112}
  2899. X\contentsline {section}{\numberline {5.8}Distribution}{113}
  2900. X\contentsline {section}{\numberline {5.9}Modification}{113}
  2901. X\contentsline {section}{\numberline {5.10}Versions}{114}
  2902. X\contentsline {section}{\numberline {5.11}FTP Archive and Author}{114}
  2903. X\contentsline {chapter}{\numberline {A}Glossary}{115}
  2904. X\contentsline {chapter}{\numberline {B}References}{117}
  2905. X\contentsline {chapter}{Index}{117}
  2906. END_OF_FILE
  2907. if test 11191 -ne `wc -c <'userman/u_manual.toc'`; then
  2908.     echo shar: \"'userman/u_manual.toc'\" unpacked with wrong size!
  2909. fi
  2910. # end of 'userman/u_manual.toc'
  2911. fi
  2912. echo shar: End of archive 5 \(of 20\).
  2913. cp /dev/null ark5isdone
  2914. MISSING=""
  2915. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  2916.     if test ! -f ark${I}isdone ; then
  2917.     MISSING="${MISSING} ${I}"
  2918.     fi
  2919. done
  2920. if test "${MISSING}" = "" ; then
  2921.     echo You have unpacked all 20 archives.
  2922.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2923. else
  2924.     echo You still need to unpack the following archives:
  2925.     echo "        " ${MISSING}
  2926. fi
  2927. ##  End of shell archive.
  2928. exit 0
  2929.