summaryrefslogtreecommitdiff
path: root/web/webfiles/webfiles.dtx
blob: a33898ecfc3421bcc9cd85b329528332380655a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
%    ^^A WEBFILES.DTX  $Revision: 2.1 $
%    ^^A LaTeX package webfiles, documented with DOC,
%    ^^A for use with DOCSTRIP.
%
%
%    \title{The \texttt{webfiles} Package \\ Version~\xwebVersion}
%    \author{Mark Potse%
%       \thanks{Medical Physics Department, University
%          of Amsterdam. \newline
%          Email: {\tt M.Potse@amc.uva.nl}
%          }\\
%       }
%    \date{\xwebDate}
%    \maketitle
%
%    ^^A an environment to extend the doc macros:
%    ^^A (cannot be nested!)
%    \newtoks\Macros
%    \catcode`\@=11
%       \def\macros{\begingroup  ^^A defines \begin{macros}{#1}
%          \catcode`\\=12
%          \catcode`\  =9      ^^A ignore spaces, tabs, and newlines
%          \catcode`\^^I=9
%          \catcode`\^^M=9
%          \MakePrivateLetters
%    	   \scanmacros}
%       \def\scanmacros#1{%
%    	   \global\Macros={#1}
%          \endgroup
%    	   \@for\tmpa:=#1\do{
%               \expandafter\macro \expandafter{\tmpa}}}
%    	\def\endmacros{
%           \@for\tmpa:=\the\Macros\do{\endmacro}}
%    \catcode`\@=12
%
%
%    ^^A don't print macros in the margin; there are too many of them
%    \def\PrintMacroName#1{}
%    \MacroTopsep=-10pt
%
%    
%    \section{Introduction}
%
%    The \texttt{webfiles} package makes it possible to plug the
%    documentation of \cweb\footnote{version~3, this package does not
%    work with older versions} and Spidery \web\ programs into a
%    \LaTeX\ document.  One can include any number of webs by
%    including the \weave\ processor's output with the command
%    \begin{quote}
%           |\webfile[|\meta{options}|]{|\meta{filename}|}|
%    \end{quote}
%    where \meta{filename} is the name of the \texttt{.tex} file (with
%    or without the extension) that
%    is output by the \weave\ processor and \meta{options} is a
%    comma-separated list of options, as explained later.
%    Of course, the \texttt{webfiles} package must be loaded:
%       \begin{quote}
%          |\usepackage[|\meta{options}|]{webfiles}|
%       \end{quote}
%       in the preamble of the document. The package recognizes the same
%       options as the |\webfiles| command.
%   
%    This manual does not describe the usage of \web{} systems
%       themselves; they have their own
%       manuals\cite{cweb:manual,spiderywebman,mweb:manual}.
%    In what follows, it is assumed that you read at least one of them, but
%       note that some of the information here overrides what was said
%       there.
%    
%    This package is based on the {\tt cweb} style
%       by Joachim Schrod (even this manual is based on his).
%    Apart from the fact that, with this package, {\tt web}'s are `plugged in'
%       while in Schrod's style they are the main and only body, there is a
%       number of differences:
%       \begin{enumerate}
%       \item This package can also work with Spidery webs.
%       \item The layout (determined by the document class and maybe
%             other packages) is not changed.
%       \item Existing counters are not affected.
%       \item The section numbers in \weave's output are used.
%       \item The contents of all webs are listed in a ``List of
%             Programs'', if the user wishes so.
%       \item The user may choose if pagebreaks may occur inside
%             sections. If not, the result is a `ragged bottom'.
%       \item A section is only printed if it is `on'. (Refer to the
%             documentation of 
%             a \web\ to see what `on' means in this context.)
%       \item The \texttt{multicol} package is used, if present, to
%             typeset the identifier index in two columns. Therefore a
%             pagebreak between the identifier index and the list of
%             refinements is no longer necessary. If \texttt{multicol}
%             cannot be found, \LaTeX's \verb"\twocolumn" is used.
%       \item The index and list of refinements can be suppressed in
%             the \LaTeX{} document.
%       \item Format (|@f|) statements can be suppressed in the \LaTeX{}
%             document.
%       \item Support for hyperlinks is included, as well as direct
%             support for PDF\TeX.
%       \end{enumerate}
%
%
%    
%
%
%    \subsection{The overall structure}
%    
%    The philosophy behind this package is that you, like it's
%    author, may wish to import more than one \web\ program, maybe in
%    more than one programming language, in a single \LaTeX\ document. 
%    With this package, you can regard to the {\tt .web} file as just
%    a part of your document, like the parts that you |\include|
%    when writing a large document in more than one file, and in the
%    documentation parts of the \web{} program you can use all features of
%    \LaTeX\ the way you would in that case.
%
%     \cweb{} Version~3.0 introduced the notion of a starred section's
%    ``depth.'' As 
%    in the layout produced by {\tt cwebmac.tex} the depth value does only
%    influence  the web's table of contents (and ``List of
%    Programs''), not the rendering of the 
%    title within the text. (\texttt{cwebmac.tex} is the original,
%    plain-based macro package used to typeset \cweb{} sources; I
%    refer henceforth to it as the ``plain version.'')
%
%    The \emph{document} structure is tagged in the mother document, with
%    \verb"\section" and such. Although it is not forbidden to use
%    sectioning commands in the documentation part of the \web{}
%    program, it doesn't seem useful to do so. The only place where a
%    sectioning command could be useful is in the limbo section.
%
%    The `mother document' must load the ``{\tt webfiles}'' package:
%    \begin{quote}
%    \verb"\usepackage{webfiles}"
%    \end{quote}
%    Then you can include a \web{} program with the following command:
%    \begin{quote}
%        \verb"\webfile{"\meta{filename}\verb"}"
%    \end{quote}
%    where \meta{filename} is the {\tt .tex} file that is
%    output by  a \weave\ processor.
%
%    The resulting structure of the mother document is exemplified in
%    figure~\ref{fig:structure}. Text may be inserted anywhere
%    inbetween the tags shown there.
%    
%    \begin{figure}[t]
%    
%      \setbox0=\vbox{\parindent=0pt \hsize=.9\textwidth
%      \begin{minipage}{\hsize}
%      \begin{verbatim}
%        \documentclass{report}
%        \usepackage{webfiles}
%        
%        \begin{document}
%    
%        \title{Three solutions for the Travelling Salesman problem}
%        \author{Joe L. User}
%    
%        \maketitle
%    
%        \tableofcontents    % optional
%        \listoffigures      % etc., optional
%        \listofprograms     % optional
%    
%        \chapter{A PSPACE solution for the Travelling Salesman}
%        \webfile{pspace}
%        
%        \chapter{The Travelling Salesman problem, solved by Simulated
%          Annealing} 
%        \webfile{anneal}
%        
%        \chapter{A Neural Network solution for the Travelling Salesman}
%        \webfile{neu_net}
%        
%        \appendix
%        \chapter{The Travelling Salesman Problem, solved by telepresence}
%        \input{internet-user}
%         
%        \end{document}
%    
%      \end{verbatim}
%      \end{minipage}
%    }
%    
%    \begin{center}
%    \fboxsep=1em
%    \fbox{\box0}
%    \end{center}
%    
%    \caption{Exemplified document structure}
%    \label{fig:structure}
%    \end{figure}
%
% 
% \subsection{Notes on running weave processors}
% 
% \begin{itemize}
% \item Recent versions of Levy \&\ Knuth's \texttt{cweave} should be
%   run with the \texttt{+e} flag to work correctly with the
%   \texttt{webfiles} package (if this flag is omitted, program code
%   fragments between vertical bars in the documentation part will not
%   be printed correctly).
% \item If \texttt{cweave} or a Spidery weave is run with the |-x|
%   option, a (harmless) error message occurs about a file that ``ended
%   while scanning use of |\end|''.
% \end{itemize}
% 
%    
%    \section{Customization}
%
%    Both the |\webfile| command and the |\usepackage{webfiles}|
%    command accept an optional argument that may contain a
%    comma-separated list of options. Options specified to
%    |\usepackage| act as global defaults that can be overridden in
%    the optional argument to |\webfile|. Therefore each option has an
%    opposite. The recognized options are summarized in
%    table~\ref{opttab}, and discussed in the following sections.
%    \begin{table}
%      \def\*{*}
%      \begin{center}
%      \begin{tabular}{llp{8cm}}
%        \textit{option} & \textit{opposite} & \textit{effect} \\[4pt]
%        |index|\*     & |noindex| & print identifier index \\
%        |noindex|     & |index|   & don't print identifier index \\
%        |reflist|\*   & |noreflist| & print List of Refinements \\
%        |noreflist|   & |reflist|   & don't print List of Refinements \\
%        |contents|\*  & |nocon| & print table of contents\\
%        |nocon|       & |contents| &  don't print table of contents\\
%        |allsections|\* & |onlychanges| & print all sections\\ 
%        |onlychanges| & |allsections| & print only changed sections\\ 
%        |showformats|\* & |hideformats| & show |@f| declarations \\
%        |hideformats|   & |showformats| & don't show |@f| declarations \\
%        |raggedbottom|\* & |flushbottom| & try not to break modules
%                                           across pages \\
%        |flushbottom| & |raggedbottom| & try to create a flush
%                                      bottom, break modules if necessary \\
%        |hyperref| & |nohype| & make hyperlinks using |hyperref| package\\
%        |pdftex| & |nohype| & make hyperlinks and PDF outlines with
%                                PDF\TeX\\
%        |nohype|\* & \ldots & no hyperlinks\\
%        |nofiles|    & |writefiles| & dont't write a contents file
%        (equivalent to setting |\setcounter{xwebLopDepth}{-9}|).\\
%        |writefiles|\* &  |nofiles| & do write a contents file.
%        (equivalent to setting |\setcounter{xwebLopDepth}{9}|).\\
%      \end{tabular}
%      \end{center}
%      \caption{Webfiles options. Defaults are tagged with a \*.}
%      \label{opttab}
%    \end{table}
%    Other customizations are possible through the redefinition of
%    macros and the setting of counters; the most important of these
%    will be explained in this section.
%
%    
%    \subsection{The index and the list of refinements}
%    
%    An identifier index and a list of refinements are created  at the
%    end of each  \web{} document, if you didn't call \weave{} with
%    the {\tt -x}  
%    option\footnote{%
%       The `{\tt-x}' option suppresses output of the index and
%    reflist---see the documentation.}.
%    You can specify an introductionary text for the index with
%    the tag \verb"\xwebIndexIntro", the introduction is the argument of this
%    tag.
%    To suppress generation of an identifier index, even when \weave{}
%    was not called with the {\tt -x} option you can use an optional
%    argument to the |\webfile| command; for example:
%    \begin{verbatim}
%       \webfile[noindex]{foo}
%    \end{verbatim}
%    To suppress identifier indexes in all web's, use this option in
%    the |\usepackage| command:
%    \begin{verbatim}
%       \usepackage[noindex]{webfiles}
%    \end{verbatim}
%    You can use the |index| option in the |\webfile| command to
%    override this global default.
%
%    The same applies to the list of refinements, using the options
%    |reflist| and |noreflist|.
%    
%
%    \subsection{The table of contents}
%
%    Each web document gets its own table of contents. It can be suppressed
%    with the |nocon| option; the opposite option is |contents|.
%    You can produce the table of contents of any web document in any
%    position with the |\xwebContents| command. This command takes one
%    argument: the basename of the web document, and does not work
%    with Spidery webs (yet\footnote{I consider releasing a revised
%    version of Spider that is more compatible with CWEB, and has less
%    bugs}).
%
%    The tables of contents are produced like all \LaTeX's tables of contents
%    etc., in the second \LaTeX\ run. They are stored in a file with name
%    \meta{basename}\texttt{.con}, where \meta{basename} is the basename
%    of the web document.
%    
%    
%    \subsection{The List of Programs}
%
%    In addition to 
%    the table of contents there is a
%    ``List of Programs'', analogous to the ``List of Figures''
%    etc.~that standard \LaTeX{} provides. 
%    The list can be produced with a 
%    \begin{verbatim}
%      \listofprograms
%    \end{verbatim}
%    command, which can be placed at any position. 
%    It is customary to put it at the beginning of the mother
%    document, after it's table of contents.  
%    As with the List of Figures, the List of Programs is generated at
%    the second \LaTeX{} run. It can list programs, main sections and
%    normal sections; the default is to list only programs and main
%    sections. You can control what goes into the list by setting the
%    counter {\tt xwebLopDepth\/}: 
%    \begin{itemize}
%    \item Normal sections get into it if {\tt xwebLopDepth\/} is
%          greater than or equal to 10.
%    \item All starred sections that have a depth smaller than  {\tt
%          xwebLopDepth\/} will be mentioned.
%    \item Programs will be mentioned unless {\tt xwebLopDepth\/} is
%          smaller than or equal to $-10$.
%    \end{itemize}
%    By setting {\tt xwebLopDepth\/} inbetween \verb"\webfile"
%    commands you can handle each \web{} file differently, if you
%    wish. 
%    The default value is 9.
%    It is a \LaTeX{} counter, so its value can be changed using the
%    \verb"\setcounter" and 
%    \verb"\addtocounter" commands.
%
%    The PDF outline (if you use PDF\TeX) can be controlled in the
%    same way, using the counter \texttt{xwebOutlineDepth}, except
%    that normal sections never get into the outline.
%    
%    The entries for the List of Programs are put into the file 
%    ``{\meta{jobname}\tt.lop}'', where \meta{jobname}
%    is the jobname that \TeX\ chose for the mother document (usually
%    the name of the {\tt.tex} file, without the extension). 
%    Edit this file only if you're desparate, as with the {\tt.toc} and
%    {\tt.lof} files etc. 
%    
%    
%    
%    \subsection{Newpages}
%    
%    The default behaviour of the |webfiles| package is never to break
%    sections across pages if they fit on a single page.
%    If sections may be broken across pages, the |webfiles| package
%    is able create `flush bottom' pages.
%    To enable this, specify the |flushbottom| option to the
%    |\webfile| or the |\usepackage| command.
%    To re-enable the default behaviour locally, specify the
%    |raggedbottom| option.
%    
%    A main section can start a new page regardless if it will fit on
%    the current one. To change this behaviour,
%    set the counter 
%    {\tt xwebSecNoEject}, which keeps the lowest group level where
%    no new page is started at a main section. The default is~3.
%    It is a \LaTeX{} counter, so its value can be changed using the
%    |\setcounter| and |\addtocounter| commands.
%
%
%    \subsection{Hyperlinks}
%
%    If the |hyperref| option is specified, all module references are
%    turned into hyperlinks using the \texttt{hyperref}
%    package\cite{hyperref}. To use this feature, you have to import the
%    \texttt{hyperref} package yourself, before importing the
%    \texttt{webfiles} package, e.g.:
%    \begin{verbatim}
%      \usepackage[hypertex]{hyperref}
%      \usepackage[hyperref]{webfiles}
%    \end{verbatim}
%    Alternatively, with the |pdftex| option, direct support for PDF\TeX\
%    can be enabled. This provides the same look and feel as the
%    \texttt{pdfcwebmac} macros, including the `PDF Outline', but of
%    course works only with PDF\TeX.
%
%    Both types of hyperlinked references can be switched off with the
%    |nohype| option. 
%    
%
%    \subsection{Output in other languages}
%    
%    \web\ documentation can contain a few---predefined---informal texts.
%    As in the plain version, you can change these texts, for example
%    to obtain output in an other language than English, by redefining
%    some macros. The macro names concerned are listed below, together
%    with their default definitions. 
%    \begin{verbatim}
%    
%    \def\xwebIndexName{Index of \xwebJobname}
%    \def\xwebReflistName{List of Refinements in \xwebJobname}
%    \def\xwebCRAlso{\xwebCrossRef{See also section}}
%    \def\xwebCRsAlso{\xwebCrossRef{See also sections}}
%    \def\xwebCRCite{\xwebCrossRef{This code is cited in section}}
%    \def\xwebCRsCite{\xwebCrossRef{This code is cited in sections}}
%    \def\xwebRLCite{\xwebCrossRef{Cited in section}}
%    \def\xwebRLsCite{\xwebCrossRef{Cited in sections}}
%    \def\xwebCRUse{\xwebCrossRef{This code is used in section}}
%    \def\xwebCRsUse{\xwebCrossRef{This code is used in sections}}
%    \def\xwebRLUse{\xwebCrossRef{Used in section}}
%    \def\xwebRLsUse{\xwebCrossRef{Used in sections}}
%    \def\xwebCRChanged{%
%       \xwebCrossRef{The following sections were changed by the change file:}%
%       \let\*\relax}
%    \def\xwebCREt{ and~}
%    \def\xwebCRsEt{, and~}
%    \def\xwebLopName{List of Programs}
%    \def\xwebTocName{Contents of \xwebJobname}
%    \def\xwebRefMacrosHere{Preprocessor Definitions}
%    \def\xwebSectionName{Section}
%    \def\xwebPageName{Page}
%    
%    \end{verbatim}
%
%
%    \subsection{Documenting changefiles}
%
%    If a web file is included that has some sections changed by a
%    changefile you can have the |\webfile| command print only the
%    changed sections by giving the |onlychanges| option.
%    As with all options, this option can also be given to the
%    |\usepackage| command. Its opposite option is |allsections|.
%    Specifying |onlychanges| is equivalent to saying
%    |\let\maybe=\iffalse| in the plain version.
%
%    
%    
%    \subsection{Miscellaneous}
%
%    You can control the appearance of web section numbers by redefining
%    the appearance of |\thexwebModule|. Its default definition is
%    |\arabic{xwebModule}|.
%
%    With the |noformats| option, you can suppress the printing of
%    |@f| specifiers. (In cweb, you can also use |@s| instead of |@f|,
%    that way you can control which format specifiers get printed and
%    which don't).
%    
%    
%    \section{Problems and Restrictions}
%    
%    Restrictions:
%    \begin{itemize}
%    
%    \item Please be aware that the vertical bar (`\verb"|"') is used
%          by \web{} to delimit small program code pieces in the
%          documentation parts, and is therefore processed by
%          \weave{}. {\it You cannot use it for \LaTeX{} anymore.}
%    
%          In particular, you cannot specify rules for the {\tt
%          tabular\/} or the 
%          {\tt array\/} environment. Since you probably want to do
%          so: You have two choices left:
%     
%          \begin{enumerate}
%          
%          \item Make sure you have the {\tt array\/} package (by Frank
%            Mittelbach 
%            and David Carlisle) installed. Then you may use the package
%            {\tt cwebarray\/}, it defines `{\tt I\/}' (that's an uppercase~i)
%            as a specifier 
%            for rules. I.e., instead of 
%            \begin{verbatim}
%               \begin{tabular}{l|l}
%            \end{verbatim}
%            you have to write
%            \begin{verbatim}
%               \begin{tabular}{lIl} 
%            \end{verbatim}
%          
%          \item \begin{sloppypar}
%            Use `\verb"^^7c"' instead of `\verb"|"'. I.e., instead of
%            \verb"\begin{tabular}{l|l}" you may write
%            \verb"\begin{tabular}{l^^7cl}". 
%            \end{sloppypar}
%          
%          \end{enumerate}
%          %
%         These two choices are compatible, you may use both in one document.
%         Needless to say, I consider the first alternative the better one.
%    
%    \item One cannot use restricted program mode in moving
%          arguments. Most 
%          notably, this is annoying in the titles of starred sections
%          and in 
%          \verb"\caption" tags. 
%    
%    \begingroup
%    \hfuzz=10pt        ^^A 9.89442pt too wide at a4-9
%    \item Neither a refinement name nor an index entry made
%          by~|@^| may consist of a {\it single\/} dot-accented
%          term. I.e., you must not write `|@<\.O@>|', `|@^\.o@>|', or
%          even `|@^\.{foolish}@>|'. Of course you may write
%          `|@^\.o accent@>|' or `|@< Handle accent \.o @>|'.
%    \endgroup
%
%    \item If weave is run with the |-x| option, a (harmless) error
%          message occurs about a file that
%          ``ended while scanning use of |\end|''.
%    
%    
%    \end{itemize}
%    
%    
%    \subsection{Reserved Control Sequences}
%    
%    The following tags are reserved and must neither be used nor
%    redefined:
%    \begin{verbatim}
%     \ATL
%     \B
%     \M
%     \N
%     \PB
%     \Y
%    \end{verbatim}
%    
%    \verb"\9" is already explained in the \cweb{} user manual: It's a special
%    control sequence used for the index entries tagged with~`\verb"@:"'. Its
%    default definition is setup in such a way that you can cheat
%    \weave{} concerning the sort order of this entry: If you enter
%    `\verb"@:sort}{print@>"' you will get an index entry ``print'' next to the
%    place where the index entry ``sort'' would be. But you're allowed to
%    change this default definition.%
%    
%    The names of all other control sequences defined by this
%    package---besides the common \LaTeX{} control sequences---start with
%    \texttt{xweb}. Please don't define new control
%    sequences starting with this prefix. (The control sequences that
%    don't have a `|@|' or `|_|' in them may be
%    redefined to change the appearence of the \web{}
%    document, check the implementation's documentation for their
%    meaning.)
%    
%    
%    
%    
%    \subsection{Problems} \label{sec:problems}
%     Since this is still a test version of the package, there are some
%    known bugs and problems.
%    
%    \bigskip
%    
%    \noindent {\it Known Bugs\/}:
%     %
%    \begin{itemize}
%    
%    \item The presentation of \verb"@l" redefinitions is not proper. But it
%    wasn't in the plain version, either.
%    
%    \end{itemize}
%    
%    \noindent {\it Problems\/}:
%     %
%    \begin{itemize}
%    \item One cannot use an other basic font size than 10\,pt. A few
%      symbol definitions and layout parameters depend on this.
%    \item \C++ comments in \cweb\ (i.e., from \verb"//" to the end of
%      the line) are 
%      typeset as C comments. This is especially bad if they are used for a
%      whole block of comment lines, as it is quite common. Please put such
%      comment blocks in the documentation part.
%    \end{itemize}
%    
%    
%    
%    \section{\TeX nical Data}
%    
%    \web{} programmers who used the plain version before
%    should note that the macros from {\tt cwebmac.tex} and {\tt
%    webkernel.tex} are not available anymore.  
%    E.g., you cannot use \verb"\." to typeset typewriter material; use
%    either |\texttt| or~|\verb|, as it fits the situation. On
%    the other hand, 
%    now you're able, for example, to use |\.| for the dot accent, 
%    |\\| will be the newline again (as usual in \LaTeX),
%    you can define  |\C++| for the \C++\ logo, etc.
%    
%    Another detail for ex-plainies: The ``List of Programs'' that
%    replaces the table of contents is produced by 
%    the \verb"\listofprograms" tag (during the second \LaTeX{} run), not
%    automatically. But this is the standard \LaTeX{} way of handling
%    such things.
%    
%    There are now two kinds of indexes, both optional: Those that are
%    created by \weave{}, which come at the end of each \web{}
%    program, and the index of the mother document, that is, the one
%    that is created with \verb"\index" commands and the {\tt
%    theindex\/} environment (possibly with the help of
%    \MakeIndex\/\cite{makeindex}). 
%    There are no problems in using these together, but it's for you
%    to decide in which of them the entries must go that you specify
%    yourself.  
%    You may, with a few definitions, get the indexes of the \web{}
%    files into the index of the mother document. 
%    
%    The modules are put in a new environment, called
%    \verb"xwebModule". They are not made into \verb"\section"s and
%    such, and they are numbered in a single layer, in exactly the
%    same way as in the plain version, so that the cross-reference
%    information output by \weave\ will always be right. (It refers
%    literally to the section numbers.) 
%    
%    You can change this, e.g., you can let \verb"xwebModule"s be
%    \verb"\section"s, but you'll have to change the way
%    cross-references are printed too. For more information, consult
%    the documentation\cite{webfiles}.
%
%    The \texttt{webfiles} package is documented with the \texttt{doc}
%    package, and uses \texttt{docstrip} to create its \texttt{.sty}
%    files. See the \emph{\LaTeX\ Companion} or the \texttt{README}
%    file that goes together with the \texttt{webfiles} package for
%    instructions on how to use these to change the sources or produce
%    typeset documentation.
%    
%    This package reserves the namespace |xweb|.
%    
%    
%    \subsection{Files}
%    
%    \def\xweave{{\tt{\it x\/}weave}}
%    \def\xweb{{\tt{\it x\/}web}}
%    
%    \begin{description}
%    \item[{\tt webfiles.sty}] is the main package file.
%    It suffices to handle \cweb\ files. 
%    \item[{\tt cwebmac.tex}] is the macro package that is input on
%    the first line 
%       of the {\tt .tex} file that \cweave\ creates. It contains
%    macros that enable  
%       \TeX\ to handle \cweb, but it can see if it's being input by
%    \LaTeX\ (instead 
%       of \TeX\/), and, if so, it won't define anything.
%    \item[{\tt{\it x\/}web.tex}] is the file that is input on the
%       first line of  
%       output of \xweave, where \xweave\ is a Spidery \weave.
%       It inputs {\tt webkernel.tex}, and defines additional macros that are
%       specific for \xweb. The person that made \xweb\ should make
%       sure that these  
%       macros work with \LaTeX\ too.
%    \item[{\tt webkernel.tex}] is input by {\tt{\it x\/}web.tex}; it
%       is the Spidery 
%       analogon of {\tt cwebmac.tex\/}, but
%       it contains no language-dependent macros: These are concentrated in the
%       {\tt{\it x\/}web.tex} files.
%       If {\tt webkernel.tex} sees that it is being input by \LaTeX, it inputs
%       {\tt swebbind.sty}, and doesn't define anything, else it
%       defines the macros  
%       that enable \TeX\ to handle a Spidery \web{}.
%    \item[{\tt swebbind.sty}] contains redefinitions of some macros in {\tt 
%       webfiles.sty} that 
%       make them able to handle Spidery \web{}s.
%    \end{description}
%    %
%    {\tt webfiles.sty} and {\tt swebbind.sty} are supplied with the
%    {\tt webfiles} package. 
%    So is {\tt webkernel.tex}; this file replaces the file of the
%    same name that goes together with \spider. 
%    The {\tt{\it x\/}web.tex} files are supplied with their
%    respective (Spidery) \web{}s. 
%    {\tt cwebmac.tex} is supplied with \cweb.
%    
%    \filbreak\subsection{Bug reports}
%    
%    If you have any comments on the {\tt webfiles\/} package
%    that may be of interest to others, please report them to the
%    author:   
%    \begin{quote}
%      \parbox{\textwidth}{
%       Mark Potse\\
%       Medical Physics department,\\
%       Academic Medical Center\\
%       Meibergdreef 15,\\
%       1105 AZ Amsterdam,
%       The Netherlands.\\
%       email: \texttt{M.Potse@amc.uva.nl}}
%    \end{quote}
%    You may be able to fix bugs or customize the package after
%    consulting the documentation that goes
%    together with this manual. 
%
% 
% \section{Acknowledgements}
% 
% Most of the code in this package was shamelessly stolen from the
% \texttt{cweb} style by Joachim Schrod (even this manual is based on
% his). Thanks to Andreas Scherer and Amelie Stein for useful
% comments. And if God had not given us \TeX\ it would have been
% necessary to invent it.
% 
% 
%    
% \StopEventually{
%     \bibliographystyle{unsrt}
%     \bibliography{webfiles}
%     \addcontentsline{toc}{section}{Bibliography}}
%
%
%
%
% \chap The documentation driver.
%
%    \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
%    \DoNotIndex{\@ne}
%    \DoNotIndex{\advance,\begingroup}
%    \DoNotIndex{\begin,\bf,\bigskip}
%    \DoNotIndex{\catcode,\closein,\closeout}
%    \DoNotIndex{\copy,\csname,\cdot,\char,\chardef}
%    \DoNotIndex{\day,\def,\edef,\else,\empty,\endcsname,}
%    \DoNotIndex{\endgroup,\errmessage}
%    \DoNotIndex{\expandafter,\fi,\futurelet,\gdef,\global,\hbox,\if,\ifeof}
%    \DoNotIndex{\ifx,\immediate,\let,\loop,\m@ne,\message,\month}
%    \DoNotIndex{\newcount}
%    \DoNotIndex{\newif,\newlinechar,\newread,\newtoks,\newwrite}
%    \DoNotIndex{\noexpand,\par,\read,\relax,\repeat}
%    \DoNotIndex{\space,\the,\undefined,\write,\xdef,\year,\z@}
%
%    The \texttt{webfiles} package is documented with \texttt{docstrip}.
%    This code will generate the documentation. Since it is the first piece
%    of code in the file, the documentation can be obtained by simply
%    processing this file with \LaTeXe.
%
%    \begin{macros}{\MakePrivateLetters}
%    \begin{macrocode}
%<*driver>
\documentclass[twoside]{ltxdoc}
\usepackage{xwebdoc,array,cwebarray}
\pagestyle{headings}
\renewcommand\MakePrivateLetters{\makeatletter\catcode`\_=11\relax}
\IndexPrologue{\section*{Index}%
   \markboth{Index}{Index}%
     The italic numbers denote the code lines where the corresponding
     entry is described, underlined numbers point to the definition,
     all others indicate the places where it is used.}
\EnableCrossrefs
\CodelineIndex % \RecordChanges
% \OnlyDescription
%</driver>
%    \end{macrocode}
%    \end{macros}
%    
%    
%    \sect The RCS version number is extracted from the keyword string
%    and joined with the manually-set major version number.
%    The complete version number is also written in
%    ``\texttt{version.tex}'' for use in the Makefile.
%
%    \begin{macros}{\xwebMajor,\xwebVersion,\xwebDate}
%    \begin{macrocode} 
%<*driver|main>

%%
%% $Id: webfiles.dtx,v 2.1 2002/03/05 10:38:14 potse Exp $
%%

\begingroup
   \catcode`\$=9  % ignore $
   \gdef\xwebMajorNr{1.0.}
   \def\setversion#1:#2.#3:{\xdef\xwebVersion{\xwebMajorNr #3}}
   \setversion $Revision: 2.1 $:
   \def\setdate#1: #2/#3/#4#5#6:#7:#8;{\gdef\xwebDate{#2/#3/#4#5}}
   \setdate $Date: 2002/03/05 10:38:14 $;
   \newwrite\vf \immediate\openout\vf=version.tex
   \immediate\write\vf{\xwebVersion}\immediate\closeout\vf
\endgroup
%</driver|main>
%    \end{macrocode}
%    \end{macros}
%    
%    
%    \sect After that, the document can be input by the driver.
%    
%    \begin{macrocode}
%<*driver>
\begin{document}
   \DocInput{webfiles.dtx}
   \PrintIndex
   % \PrintChanges
\end{document}
%</driver>
%    \end{macrocode}
%
%    
%    \chap Implementation.
%    
%    The implementation is still somewhat messy.
%   
%    A good explanation of the vocabulary used here is given by Schrod
%    in the implementation of the {\tt cweb} style:
%
% \begin{quotation}
% 
% Before we start with an overview of the implementation I want to
% explain the \cweb{} vocabulary I use while I guide you through this
% document. The commonly used terms sometimes denote two entities, but
% for the purpose of this style we need exact terms. I've tried to stick
% to a ``canonical'' computer science terminology.
% 
% I distinguish two different structures in a \cweb{} file: The 
% \emph{document structure} and the \emph{program structure}.
% 
% A \cweb{} document consists of a series of \emph{sections}. Within
% this series some sections are especially emphasized, we call them the
% \emph{main sections}. (They are also called \emph{starred sections},
% since their corresponding \cweb{} tag is~|@*|.) These main sections
% have a title, ordinary sections are untitled. A table of contents may
% therefore list only the main sections. Note that there is no
% hierarchy in the sections, they are all on the same level, i.e., they
% are numbered subsequently.
% 
% Each section consists of three parts: (1)~the \emph{documentation
% part}, (2)~the \emph{definition part}, and (3)~the \emph{program part}.
% Each of these parts can be empty. The documentation part is mostly text
% with \LaTeX{} tags. In this text material from \emph{restricted program
% mode} can appear. The definition part consists of a series of either
% \emph{macro} or \emph{format definitions}. The program part is one
% piece of a refinement, identified by a name (see below).
% 
% A \cweb{} program consists of a tree of \emph{refinements}. A
% refinement is a list of program parts with the same name, ordered in
% appearence. The root of the tree is the refinement with the special
% name~|@c|. The program text is defined by the DFS (i.e., infix-order)
% traversal of the tree.
% 
% \end{quotation}
% 
%  
%    \sect
%    Before we start we declare some names for category codes. By
%    declaring the underscore~`(|_|)' as letter we can use it in our
%    macros.  As this is a \LaTeX{} package the at sign is a letter
%    anyhow; so we can use the ``private'' plain and \LaTeX{} control
%    sequences; and with the underscore we can make our own control
%    sequences (\emph{cseqs} for short) more readable. Since we have to
%    restore this category code at the end of this macro file, we save its
%    former value in the control sequence |\xwebCatUsCode|.
%    This method is better than to use a group, not all cseqs must be
%    defined global this way. 
%
%    \begin{macros}{\xwebCatEscape,\xwebCatOpen,\xwebCatClose,
%       \xwebCatIgnore,\xwebCatLetter,\xwebCatOther,\xwebCatActive,
%       \xwebCatUsCode}
%    \begin{macrocode}
%<*main|spider>
\catcode`\@=11
\chardef\xwebCatUsCode=\catcode`\_       % top level macro file!
\catcode`\_=11 % Catcode letter
\chardef\xwebCatEscape=0
\chardef\xwebCatOpen=1
\chardef\xwebCatClose=2
\chardef\xwebCatIgnore=9
\chardef\xwebCatLetter=11
\chardef\xwebCatOther=12
\chardef\xwebCatActive=13
%</main|spider>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \sect Let's identify this package against the user and in the Log file.
%  
%    \begin{macrocode}
%<*main>
\ProvidesPackage{webfiles}
\begingroup
    \typeout{LaTeX package `webfiles', version \xwebVersion, \xwebDate}
\endgroup
%</main>
%    \end{macrocode}
%
%    \sect The very first (alpha) version of the {\tt cweb} style was a style 
%    option.
%    The version on which the {\tt webfiles} style is based was a full style.
%    {\tt webfiles.sty} itself is an option again, and since the author
%    has \LaTeXe, it has become a \emph{package}.  
%    Therefore we test if a documentclass was chosen (by testing if
%    |\section| is defined).
%  
%    \begin{macrocode}
%<*main>
\ifx \section\undefined 
    \PackageError{webfiles}{`webfiles' is a package, not a class}{%
        webfiles is not a document class, but only a package.
        Please adapt your documentclass tag appropriately. 
        I.e., write \MessageBreak
        \protect\usepackage{webfiles} instead of 
        \protect\documentclass{webfiles}.}
\fi
%</main>
%    \end{macrocode}
%  
%
%    \chap Options.
%
%    The package options may be used in the optional argument of the
%    \verb=\usepackage= command, or in the optional argument of the
%    \verb=\webfile= command. In the second case, they only apply to
%    a single web.
%    We keep track of the choices with logical variables and a count
%    register, each having a global and a local variant.
%
%    \begin{macros}{\ifxwebIndex,\ifxwebRef,\ifxwebRagged,
%        \ifxwebHideFormats,\ifxwebCon,\xweb_hypertype}
%    \begin{macrocode}
%<*main>
\newif\ifxweb_GlobalIndex \newif\ifxwebIndex
\newif\ifxweb_GlobalRef    \newif\ifxwebRef
\newif\ifxweb_GlobalRagged \newif\ifxwebRagged
\newif\ifxweb_GlobalOC
\newif\ifxweb_GlobalHideFormats \newif\ifxwebHideFormats
\newif\ifxweb_GlobalCon    \newif\ifxwebCon
\DeclareOption{index}{\xweb_GlobalIndextrue}
\DeclareOption{noindex}{\xweb_GlobalIndexfalse}
\DeclareOption{reflist}{\xweb_GlobalReftrue}
\DeclareOption{noreflist}{\xweb_GlobalReffalse}
\DeclareOption{raggedbottom}{\xweb_GlobalRaggedtrue}
\DeclareOption{flushbottom}{\xweb_GlobalRaggedfalse}
\DeclareOption{onlychanges}{\xweb_GlobalOCtrue}
\DeclareOption{allsections}{\xweb_GlobalOCfalse}
\DeclareOption{nocon}{\xweb_GlobalConfalse}
\DeclareOption{contents}{\xweb_GlobalContrue}
\DeclareOption{hideformats}{\xweb_GlobalHideFormatstrue}
\DeclareOption{showformats}{\xweb_GlobalHideFormatsfalse}

\newcount\xweb_hypertype
\newcount\xweb_GlobalHypertype
\DeclareOption{hyperref}{\xweb_GlobalHypertype=1}
\DeclareOption{pdftex}{\xweb_GlobalHypertype=2 \input pdfcolor}
\DeclareOption{nohype}{\xweb_GlobalHypertype=0}

\newcounter{xwebLopDepth}  \setcounter{xwebLopDepth}{9}
\newcounter{xwebOutlineDepth}  \setcounter{xwebOutlineDepth}{9}
\DeclareOption{nofiles}{\c@xwebLopDepth=-9}
\DeclareOption{writefiles}{\c@xwebLopDepth=9}
\ExecuteOptions{index,reflist,raggedbottom,allsections,%
                contents,showformats,nohype,writefiles}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%  
%  
%  \iffalse
%   subdocument: The interface between CWEAVE and TeX
%  \fi
%  \input cweave-f-spec
%  
%  
%  
%    \chap Processing states.
%    
%    We have to typeset five different categories of material:
%    Documentation, program pieces---embedded within the documentation and
%    as large chunks, \TeX{} material within program pieces (i.e., comments
%    and refinement names), and cross reference information. Since we need
%    a complete other environment for the program pieces than for the rest
%    we design ``states'' where we switch to appropriately.
%     %
%    \begin{enumerate}
%    
%    \item A section starts in the {\it documentation state}.
%    
%    \item |\B| switches to {\it program state}. This can happen in
%    documentation and program state.
%    
%    \item While we process the argument of |\PB| we're in \emph{restricted
%    program state}; |\PB| may appear in documentation and in \TeX{}
%    state. Since \TeX{} state can be switched on within restricted
%    program state, |\PB| can appear within the argument of itself.
%    
%    \item In the arguments of |\C|, |\SHC|, and |\X| we switch to
%    {\it \TeX{} state}. All these cseqs appear only in (restricted)
%    program state, their official names are actually different. I.e., only
%    in (restricted) program state these cseqs are bound to the meaning
%    described here.
%    
%    \item Cross reference information are attached to most sections with
%    refinements. This information is processed in {\it CR state}.
%    After CR state material
%    comes always the next section or the document end, i.e., material in
%    documentation state.
%    
%    \end{enumerate}
%     %
%    This FSA is illustrated by the diagram in figure~\ref{fig:fsa}.
%  
%    \begin{figure}
%    
%    \begin{center}
%    \chardef\\=`\\
%    \input{cweb-fsa.latex}
%    \end{center}
%    
%    \caption{The processing state's FSA. The automaton starts and ends in
%    the ``documentation'' state.}
%     \label{fig:fsa}
%    
%    \end{figure}
%  
%    \begin{sloppypar}
%     |\xweb_documentation| will switch to documentation state,
%     |\xweb_program| to program state, |\xweb_Rprogram| to restricted
%     program state, |\xweb_tex| to \TeX{} state, and |\xweb_CR| to CR state.
%     If we're already in a state, the switch to this state shall be a
%     permissible null operation.
%    \end{sloppypar}
%    
%    
%    \sect The basic difference between these states can be named with
%    two parameters: (1)~The cseq bindings in effect and (2)~the layout
%    parameters used for paragraph makeup.
%    
%    In (restricted) program state and in CR state the text is output
%    under the control of \cweave{}, and tagged by \cweave{}. The used
%    tags are from a global namespace and should only be in effect during
%    these states. We call this tag set the \emph{CWEAVE bindings}. In the
%    other two states the tags are largely defined by the user, the tag
%    set is called the \emph{user bindings}. The switch to another binding
%    is always done locally, i.e., if we switch from documentation to
%    restricted program state within a group we don't have to bother about
%    the restauration of the user binding; it will be done automatically
%    by \TeX{} at the end of the group. Nevertheless we must be able to
%    switch from the \cweave{} bindings back to the user bindings which
%    were in effect when we activated the \cweave{} bindings. This is
%    needed for the \TeX{} state which is always activated within
%    (restricted) program state.
%    
%    The parameters for \emph{program layout} are really special ones
%    since they need to support the indentation which shows the program
%    structure. These parameters are used in program and in \TeX{} state.
%    The \emph{document layout} parameters established by the user are
%    used in the other three states.
%  
%    The following table shall summarize this. $C$~denotes \cweave{}
%    bindings, $U$~user bindings, $P$~program layout, and $D$~document
%    layout. If an entry is empty, its value is not changed on entry in
%    this state.
%
%    \begin{quote}\rm
%    \begin{tabular}{rIcIc}
%    \multicolumn1{cI}{\sc State} & \sc Binding & \sc Layout \\[1pt]
%    \hline
%    documentation & $U$ & $D$ \\
%    program & $C$ & $P$ \\
%    restricted program & $C$ & \\
%    \TeX{} & $U$ & \\
%    CR & $C$ & $D$ \\
%    \end{tabular}
%    \end{quote}
%  
%  
%    \sect Since the user bindings and the document layout is defined
%    initially, we don't have to do anything if it's requested. Only if we
%    change it, i.e., within |\xweb_CweaveBindings| and
%    |\xweb_ProgramLayout|, we redefine |\xweb_UserBindings| and
%    |\xweb_DocLayout|. If they are eventually executed, they shall
%    rebind themselves back to |\relax|. This way we can switch to
%    documentation state as often as we want.
%
%    \begin{macros}{\xweb_UserBindings,\xweb_DocLayout,
%         \xweb_documentation,
%         \xweb_Rprogram,\xweb_program,\xweb_tex,\xweb_CR}
%    \begin{macrocode}
%<*main>
\let\xweb_UserBindings=\relax
\let\xweb_DocLayout=\relax
\def\xweb_documentation{%
   \xweb_UserBindings
   \xweb_DocLayout}
\def\xweb_Rprogram{%
   \xweb_CweaveBindings}
\def\xweb_program{%
   \xweb_CweaveBindings
   \xweb_ProgramLayout}
\def\xweb_tex{%
   \xweb_UserBindings}
\def\xweb_CR{%
   \xweb_CweaveBindings
   \xweb_DocLayout}
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \chap Saving and restoring control sequences.
%    
%    We have a lot of cseqs which are defined within the namespace of this
%    package and which will be used with other names. This usage is in a
%    controlled environment, namely neither in documentation nor in \TeX{}
%    state. (I.e., the text processed is tagged by \cweave{}, not by humans;
%    therefore we have a precise specification of the cseqs we have to
%    accept.) We cannot work with groups where a cseq is just redefined
%    and \TeX{} takes care for establishing the old binding again; when we
%    switch from program state to \TeX{} state all the bindings which were
%    in effect before the program state got active, i.e., in the
%    documentation state, must be in effect again. We cannot simply
%    consider the \TeX{} state as something parallel to program state, it
%    must be a hierarchical relationship: In the program state values are
%    set up which must be available after switching back from \TeX{} to
%    program state.
%    
%    We save the current binding of a cseq in another cseq, but only if
%    there exists a binding currently. This is done to save valuable
%    \TeX{} main memory. Actually, one
%    can assume that nearly no cseq bindings must be saved at all---the
%    used names are strange enough. The bindings of |\foo|, i.e., of the
%    cseq with the name \fbox{\tt foo}, is saved as the cseq with the name
%    \fbox{\tt xweb\_s\_\char `\\ foo}, i.e., as
%      |\csname xweb\_s\_\string\foo\endcsname|.
%    
%    
%    \sect The save process is not done statically, but by the macro
%    |\xweb_rebind| which interprets a list of tuples $({\it old\_name},
%    {\it new\_name})$, terminated by the tuple $(|\stop|, |\stop|)$.
%    Eventually it constructs two new lists, |\xweb_ToRestore| with the
%    cseqs which had a binding, and |\xweb_undefined| with the names which
%    didn't have one.
%    
%    The saving is actually done by |\xweb_SaveBinding|, |\xweb_rebind|
%    is responsible for the initialization, |\xweb_DoRebind| for the
%    effective rebinding and the tail recursion on the list.
%  
%    \begin{fixme}
%       We could pull the |\next| assignment in the |\else| branch out
%       of the loop to get a better performance. Should measure if
%       this is of interest.  
%    \end{fixme}
%
%    \begin{macros}{\xweb_undefined,\xweb_ToRestore,\xweb_rebind,
%        \xweb_DoRebind}
%    \begin{macrocode}
%<*main>
\newtoks\xweb_undefined
\newtoks\xweb_ToRestore
\def\xweb_rebind{%
    \xweb_undefined{}%
    \xweb_ToRestore{}%
    \xweb_DoRebind
    }
\def\xweb_DoRebind#1#2{%
    \ifx #1\stop
       \let\next\relax
    \else
        \xweb_SaveBinding #2%
        \let #2=#1%
        \let\next\xweb_DoRebind
    \fi
    \next
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \sect If the cseq to be saved is undefined, it may just be added to
%    the ``undefined list.'' Otherwise its binding is saved and it's added
%    to the ``to-be-restored list.''
%    
%    \TeX{}nical note: The cseq-name for the saved binding must be created
%    before the |\let| is executed.
%
%    \begin{macro}{\xweb_SaveBinding}
%    \begin{macrocode}
%<*main>
\def\xweb_SaveBinding#1{%
    \ifx #1\undefined
        \xweb_undefined \expandafter{\the\xweb_undefined #1}%
    \else
        \expandafter\let \csname xweb_s_\string#1\endcsname =#1%
        \xweb_ToRestore \expandafter{\the\xweb_ToRestore #1}%
    \fi
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%  
%    \sect The restoration of rebound cseqs is a two-tied activity: All
%    previously undefined cseqs must be made undefined again, and all saved
%    cseqs must be restored. Actually, we don't need to reset the two token
%    lists, but we do it to save space.
%    
%    Both |\xweb_undefine| and |\xweb_RestoreBinding| iterate over a list
%    of cseqs terminated by |\stop|.
%    
%    \begin{fixme}
%      And here the |\next| assignment could be prepended to the loop as
%      well.
%    \end{fixme}
%
%    \begin{macros}{\xweb_RestoreBindings,\xweb_undefine}
%    \begin{macrocode}
%<*main>
\def\xweb_RestoreBindings{%
    \expandafter\xweb_undefine \the\xweb_undefined \stop
    \xweb_undefined{}%
    \expandafter\xweb_RestoreBinding \the\xweb_ToRestore \stop
    \xweb_ToRestore{}%
    }
\def\xweb_undefine#1{%
    \ifx #1\stop
        \let\next\relax
    \else
        \let#1\undefined
        \let\next\xweb_undefine
    \fi
    \next
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect \TeX{}nical note: As in |\xweb_SaveBinding|, the cseq-name for
%    the saved binding must be created before the |\let|s are executed.
%    
%    \begin{fixme}
%        Another |\next| assignment.
%    \end{fixme}
%
%    \begin{macro}{\xweb_RestoreBinding}
%    \begin{macrocode}
%<*main>
\def\xweb_RestoreBinding#1{%
    \ifx #1\stop
        \let\next\relax
    \else
        \expandafter\let \expandafter#1\csname xweb\string#1\endcsname
        \expandafter\let \csname xweb_s_\string#1\endcsname \undefined
        \let\next\xweb_RestoreBinding
    \fi
    \next
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%
%    \chap Hyperlinks.
%
%    Because at least two implementations of hyperlinks are supported,
%    it is most convenient to define private macros for
%    hyperlinks and hypertargets. Their definition depends on
%    |\xweb_hypertype| and must therefore be performed as part
%    of the |\webfile| command, after the options are processed.
%    (This is more efficient than testing |\xweb_hypertype| again for
%    each link.)
%
%    The anchor name depends on the current value of the |xwebModule|
%    counter; this value must be set before |\xweb_hyperlink| or
%    |\xweb_hypertarget| is used.
%
%    \begin{macros}{\xweb_anchor,\xweb_SetupHrefs,
%        \xweb_hlink,\xweb_htarget}
%    \begin{macrocode}
%<*main>
\def\xweb_anchor{xwebmod:\xwebJobname:\arabic{xwebModule}}
\def\xweb_SetupHrefs{
   \ifnum\xweb_hypertype=0
      \def\xweb_hlink##1{##1}
      \def\xweb_htarget##1{##1}
   \else\ifnum\xweb_hypertype=1
      \def\xweb_hlink##1{\hyperlink{\xweb_anchor}{##1}}
      \def\xweb_htarget##1{\hypertarget{\xweb_anchor}{##1}}
   \else\ifnum\xweb_hypertype=2
      \def\xweb_hlink##1{\xweb_pdflink{\xweb_anchor}{##1}}
      \def\xweb_htarget##1{\xweb_pdftarget{\xweb_anchor}{##1}}
   \else\PackageError{webfiles}{This can't happen.}{%
      this may be a bug in the webfiles package}
   \fi\fi\fi}
\xweb_SetupHrefs
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \chap PDF\TeX\ support.  PDF\TeX\ is an implementation of \TeX\
%    that has the ability to output pdf instead of dvi. It has some
%    extra primitives, that control pdf-specific things, such as
%    hyperlinks, colours, and `outlines'.
%
%    
%    \sect The outline is a kind of table of contents, that is always
%    present at the left side of the pdf reader window (if the user
%    wishes so). Web documents and main sections get outline entries.
%
%    \begin{macro}{\xwebPDFOutline}
%    \begin{macrocode}
%<*main>
\def\xwebPDFOutline#1#2{{%
      \edef\tmpnr{#1}%
      \edef\name{#2}%
      \c@xwebModule=\tmpnr\relax
      \ifnum\xweb_hypertype=2
          \edef\anchor{\xweb_anchor}
          \pdfoutline goto name{\anchor}{#1 \name}
      \fi}}
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect  PDF links are implemented using code copied from
%    \texttt{pdfcwebmac.tex}, with fixes from Andreas Scherer. The
%    raised |\hbox| is to ensure that the top line of the module will
%    be entirely visible. It must be |\smash|ed to avoid spurious
%    vertical material.
%
%    \begin{macros}{\xweb_pdflink,\xweb_pdftarget}
%    \begin{macrocode}
%<*main>
   \def\xweb_pdflink#1#2{%
       \pdfannotlink
          attr{/Border [0 0 0]}
          goto name{#1}
          \Blue #2\Black
       \pdfendlink}
   \def\xweb_pdftarget#1#2{
       \smash{\raise\baselineskip\hbox to 0pt{\pdfdest name{#1} fith}}
       #2}
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%    
%    \chap Sections.
%  
%    We distinguish between main sections with titles which start a group
%    of sections and normal (untitled) sections within a group.
%    All sections are numbered sequentially by \cweave.
%    The section numbers are output in boldface at the very start of a
%    section, followed by a dot and a quad. The changeflag is a star
%    lapping to the right.
%
%    \begin{macro}{\xwebLapStar}
%    \begin{macrocode}
%<*main>
\def\xwebLapStar{\rlap{*}}
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%  
%    \sect Important main sections are (optionally) started on a new
%    page, normal sections 
%    have approximately two picas vertical space in front. The very first
%    main section does not automatically start on a new page since a title
%    may be in front of it.
%    
%    The user may also add a ``level'' to the title of a main section. 
%    A newpage is inserted before a section if its level is smaller than the
%    value of the counter |xwebSecNoEject| which has default value~3.
%    And we will pay attention to this group level when
%    we create a table of contents.
%  
%    The title of a main section is set as a heading after the section
%    number, also in bold face. The first paragraph of the following
%    documentation has no indentation. The documentation part of normal
%    sections is run in after the section number.
%
%    \begin{macros}{\xwebGroupLevel,xwebSecNoEject}
%    \begin{macrocode}
%<*main>
\newcount\xwebGroupLevel
\newcounter{xwebSecNoEject}
        \setcounter{xwebSecNoEject}{3}
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%    
%    \sect The section number that is supplied by \cweave\ is used to
%    set the counter |xwebModule|.
%    This is necessary because the section numbers
%    can be non-sequentially, for example, if only changed sections are
%    printed, or if an excerpt from a web is taken. By using a
%    counter, the appearance of the number is made changeable in the
%    normal \LaTeX\ way through redefinition of |\thexwebModule|.
%    The number can contain a star, to indicate that the section is
%    changed by a changefile.
%    In that case, |\ifon| is made |true|; else it will be |\maybe|, and
%    by redefining |\maybe| the user can decide wether non-changed sections
%    should be printed. The default behaviour is to print them.
%    This weird interface is copied from the plain version, but this 
%    package adds a friendlier interface.
%
%    This is all implemented in the macro |\xweb_PrepareSection|, which
%    is used before each section.
%    This macro also changes to documentation state.
%
%    \begin{macros}{xwebModule,\ifon,\onmaybe,\maybe,
%       \xweb_PrepareSection,\xweb_secno,\*,\xweb_star}
%    \begin{macrocode}
%<*main>
\newcounter{xwebModule}
\newif\ifon % determines if the section is `on'
\def\onmaybe{\let\ifon=\maybe} % analogous to \ontrue
\let\maybe=\iftrue  % initial meaning; the user can say "\let\maybe=\iffalse"
\def\xweb_PrepareSection#1{%
   {\xdef\secstar{#1}%
    \let\*=\empty%  remove \* from the number
    \xdef\xweb_secno{#1}}
   \ifx\xweb_secno\secstar % if they are the same; i.e.: 
      \onmaybe                  % if there was no star in #1
      \xdef\xweb_star{}%
   \else
      \ontrue
      \xdef\xweb_star{*}%
   \fi
    \setcounter{xwebModule}{#1}% global set!
    \xweb_documentation
}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect Every web section is contained in a |xwebModule|
%    environment. This environment takes care of vertical space before
%    the section, optional page breaks, setting the section number,
%    and initializing the |\everypar| token register.
%
%    |\everypar| must make |\@noskipsec| false, to indicate that the
%    first paragraph of the documentation part has been processed.
%    We have to initialize it ourselves, because there is no
%    |\section| to do it.  
%    |\Y| and |\B| use |@noskipsec| to decide if there must be a |\par|
%    before the program part. 
%
%    The current reference, |\@currentlabel|, is set to the web
%    section.
%
%    If |\xwebRaggedtrue|, the user has specified that sections should
%    preferably not be broken across pages, so every section will be
%    finished with optional vertical space and a negative penalty.
%    Else, just the negative penalty is inserted to indicate that this
%    is a good place for a page break.
%
%    The module is typeset in a |\vbox| that is |\unvbox|ed at the end
%    of the environment. This way, the output routine cannot fire
%    while \TeX\ is processing a program text, and no name conflicts
%    can arise even when the weave bindings are in effect. Thanks to
%    Hans Hagen for the idea. ---No, we can't do it this way. The
%    documentation part cannot generate floats if it's in a vbox. Only
%    the program part should be vboxed and unvboxed, but this is more
%    difficult. Must think about it.
%
%    The module is also the target for hyperlinks, using |\xweb_htarget|.
%    (This macro is defined to produce only its second argument if the
%    hyperref package is not in use.)
%
%    If it is the first module, the table of contents is set
%    first. By setting the table of contents when the first module is
%    found, we allow the user to change |\xwebContentsTop| etc.~in the
%    limbo section.
%
%    \begin{macros}{\thexwebModule,\xweb_ModBox,\ifxweb_FirstModule,
%                   \xwebModuleHook}
%    \begin{environment}{xwebModule}
%    \begin{macrocode}
%<*main>
\def\thexwebModule{\arabic{xwebModule}}
\newbox\xweb_ModBox
\newif\ifxweb_FirstModule \xweb_FirstModulefalse
\newenvironment{xwebModule}{%
   \ifxweb_FirstModule
      \ifxwebCon\xwebContents{\xwebJobname}\fi
      \global\xweb_FirstModulefalse
      \openout\xweb_cont=\xwebJobname.con
      \write\xweb_cont{\catcode `\noexpand\@=11\relax}%
   \fi
   \ifxwebRagged\vfil\penalty-200\vfilneg%  (TeXbook p.353)
                                   % (this is a \filbreak without a \par)
   \else\penalty-200\fi
   %\setbox\xweb_ModBox=\vbox\bgroup
   \edef\@currentlabel{\thexwebModule}
   \par\bigskip
   \everypar{%
      \if@noskipsec%
         \global\@noskipsecfalse%
         \everypar{\penalty-100}%
      \fi}
   \@noskipsectrue
   \mbox{}\hspace{-\parindent}%
   \xwebModuleHook
   \xweb_htarget{\textbf{\thexwebModule.}\xweb_star}% typeset module number
   \hskip 1em plus0.1em minus 0.1em%
   }{%\egroup\unvbox\xweb_ModBox
   }
\def\xwebModuleHook{}
%</main>
%    \end{macrocode}
%    \end{environment}
%    \end{macros}
%  
%    
%    \sect The main sections are started with the macro |\N|. 
%    The parameters are:
%    \begin{description}
%    \item{|#1|:} a number denoting the ``group level'' of the main
%      section, titles of main sections with lower numbers should be
%      presented more prominently in the table of contents.
%    \item{|#2|:} the section number.
%    \item{|#3|:} the title of the section
%      group. This last parameter must be terminated by a dot.
%    \end{description}
%    The group level must be passed to the macros that format the table
%    of contents. Since there is no easy place predetermined by \LaTeX{}
%    for such a wish we use a trick: The entry text for the table of
%    contents first sets the count register |\xwebGroupLevel| with the
%    respective level---this register may be tested after a pro-forma
%    evaluation of the entry.
%
%    When writing to the \texttt{.con} file, we have to use
%    |\@unexpandable@protect|; else there will be trouble with
%    insertion of |\xweb_ModTitle| in the contents file.
%  
%    We tell the user that we have reached the next starred section.
%    The message is output after the section header is set, it shall be on
%    the correct page. Since the token list to be output is expanded at
%    shipout time, we must take care for the immediate expansion ourselves.
%
%    A newpage is inserted if the level of the section is smaller than
%    the |xwebSecNoEject| counter and it is not the first section (if
%    the user wants the web document to begin on a new page, he can
%    insert a newpage himself).
%
%    \begin{macros}{\N,\xwebMainSecSkip}
%    \begin{macrocode}
%<*main>
\def\xwebMainSecSkip{\clearpage}
\def\N#1#2#3.{%
    \ifon\end{xwebModule}\fi
    \global\xwebGroupLevel #1                   % <-- space!!
    { \let\*=\empty%
      \xdef\xweb_secno{#2}% get the section number
    }%
    \ifnum\xweb_secno>1
       \ifnum \xwebGroupLevel<\c@xwebSecNoEject
          \xwebMainSecSkip
       \fi
    \fi
    \message \expandafter{*\xweb_secno}%
    \xweb_PrepareSection{#2}
    \ifon
       \def\xweb_ModTitle{#3}%
       \begin{xwebModule}{\textbf{#3.}}% title
       \hskip 1em plus.1em minus.1em%
       \ifnum\c@xwebLopDepth > #1%
          \addcontentsline{lop}{starred}{%
          \protect\global\xwebGroupLevel #1 %  space after #1 !
              {\thexwebModule.}~{#3}}%
          {   \let\protect\@unexpandable@protect
              \edef\next{\write\xweb_cont{%
                \ZZ{#3}{#1}{\xweb_secno}{\thepage}}}%
              \next 
          }%  write "\ZZ{title}{depth}{sec}{page}" to .con file
       \fi
       \ifnum\c@xwebOutlineDepth > #1%
          \xwebPDFOutline{\xweb_secno}{#3}% args: nr, title       
       \fi
}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%  
%    \sect Normal sections are started with |\M|.
%    
%    \begin{macro}{\M}  
%    \begin{macrocode}
%<*main>
\def\M#1{%
    \ifon\end{xwebModule}\fi
    \xweb_PrepareSection{#1}%
    \ifon\begin{xwebModule}%
      \ifnum\c@xwebLopDepth>9%
         \addcontentsline{lop}{xwebsection}{%
             \protect\global\xwebGroupLevel 4 \thexwebModule.}%
         {   \let\protect\@unexpandable@protect
             \edef\next{\write\xweb_cont{%
               \ZZ{}{4}{#1}{\thepage}}}%
             \next 
         }% write "\ZZ{title}{depth}{sec}{page}" to .con file
      \fi
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%  
%  
%  
%  
%    \chap The List of Programs.
%
%    \begin{macro}{\listofprograms}
%    The ``List of Programs'' is like the ``List of Figures'' or the ``List
%    of Tables'', which are defined in the document class.
%    The following definition is copied, with the necessary changes, from 
%    |article.sty|,  16-Mar-88. It defines |\listofprograms| which is
%    used like |\listoffigures|. 
%
%    \begin{macros}{\xwebTocName,\xwebLopName}
%    \begin{macrocode}
%<*main>
\def\xwebTocName{Contents of \xwebJobname}
\def\xwebLopName{List of Programs}
\ifx\listofprograms\undefined
   \ifx \chapter\undefined  
       \def\listofprograms{\section*{\xwebLopName\@mkboth
       {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
   \else
       \newcommand{\listofprograms}{\chapter*{\xwebLopName\@mkboth
       {\uppercase{\xwebLopName}}{\uppercase{\xwebLopName}}}\@starttoc{lop}}
    \fi
\fi
%</main>
%    \end{macrocode}
%    \end{macros}
%    \end{macro}
%
%    
%    \sect Entries for the |.lop| file are generated with
%    |\addcontentsline| by the following commands: 
%  
%    \begin{itemize}
%    \item |\webfile| produces a |program| entry
%    \item |\N| produces a |starred| entry
%    \item |\M| produces a |xwebsection| entry
%    \end{itemize}
%  
%    \noindent
%    Program names are typeset with |\xweb_TTLopLine|, which sets
%    in large typewriter type:
%
%    \begin{macro}{\l@program}
%    \begin{macrocode}
%<*main>
\def\l@program#1{%
     \xwebGroupLevel\z@         % default value of group level
     \begingroup
         \let\numberline\@gobble        % width not known yet
         \setbox\z@ \hbox{#1}%
     \endgroup
     \xweb_TTLopLine{#1}%
}
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect Normal sections are hardly ever mentioned in the list,
%    but it will be possible. The entry consists of the number only,
%    as they have no title.
%
%    \begin{macro}{\l@xwebSection}
%    \begin{macrocode}
%<*main>
\def\l@xwebSection#1{
     \xwebGroupLevel\z@ % default value of group level
     \begingroup
         \let\numberline\@gobble        % width not known yet
         \setbox\z@ \hbox{#1}%
     \endgroup
     \xweb_NormalTocLine{#1}%
 }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%
%    \sect  Titles of main sections might have an associated group level
%    that determines how they are featured in the table. Titles on group
%    level~0 are typeset boldface, other titles in roman. 
%    They are indented proportionally to the group level, with
%    a basic indentation of |\xwebLopIndent|. 
%    An entry on group level~1 is not indented, the different layout
%    suffices as a distinction to level~0.  
%    The counter |\xwebLopIndentMaxLevel| constitutes an upper limit for
%    a recognized group level (concerning indentation, that is).
%
%    \begin{macros}{\xwebLopIndent,\xwebLopIndentMaxLevel}
%    \begin{macrocode}
%<*main>
\newdimen\xwebLopIndent
     \xwebLopIndent=2em
\newcount\xwebLopIndentMaxLevel
     \xwebLopIndentMaxLevel=4   % group level <= max level
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \sect The group level is specified within the entry name, i.e., in the
%    first argument to |\l@starred|. If this argument is evaluated,
%    |\xwebGroupLevel| might be set to the respective value. If it is
%    not set, an explicit invocation of |\addcontentsline|
%    is responsible for this entry. Then we assume that the group level
%    is~0.
%
%    \begin{macro}{\l@starred}
%    \begin{macrocode}
%<*main>
 \def\l@starred#1{%             % page will be processed later
     \xwebGroupLevel\z@         % default value of group level
     \begingroup
         \let\numberline\@gobble        % width not known yet
         \setbox\z@ \hbox{#1}%
     \endgroup
     \ifnum \xwebGroupLevel=\z@
         \let\next\xweb_BoldTocLine
     \else
         \let\next\xweb_NormalTocLine
     \fi
     \next{#1}}
%</main>
%    \end{macrocode}
%    \end{macro}
%    A |\next| assignment is needed here, because the macro is
%    actually called with 2 arguments; the second is used by 
%    |\@dottedtocline| and such, so a |\fi| after the expansion
%    is not allowed.
%
%    
%    \sect A normal line has an indentation of $(l-1) \cdot {\it
%    toc\_indent}$, where $l = \min({\it group\_level},
%    {\it max\_level})$.
%  
%    The first argument of |\@dottedtocline| is used to specify a
%    depth of the issued entry. All entries with a depth larger than
%    |tocdepth| are discarded! So we always specify level 1, as the
%    level doesn't matter to \LaTeX\ and no entry is to be discarded.
%
%    \begin{macro}{\xweb_NormalTocLine}
%    \begin{macrocode}
%<*main>
\def\xweb_NormalTocLine#1{%     % page will be processed later
    \ifnum \xwebGroupLevel>\xwebLopIndentMaxLevel
        \xwebGroupLevel\xwebLopIndentMaxLevel
    \fi
    \advance\xwebGroupLevel\m@ne        % group level -= 1
    \@dottedtocline
            % \xwebGroupLevel                   % level (old)
            1                                   % level
            {\xwebGroupLevel\xwebLopIndent}%    % basic indent
            \xwebLopIndent                      % numwidth
            {#1}%                               % entry
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%  
%  
%    \sect A bold line is typeset like a normal line, only the entry
%    is typeset in bold.
%
%    \begin{macro}{\xweb_BoldTocLine}
%    \begin{macrocode}
%<*main>
\def\xweb_BoldTocLine#1{%
    \@dottedtocline
            1                                   % level
            {\xwebGroupLevel\xwebLopIndent}%    % basic indent
            \xwebLopIndent                      % numwidth
            {{\bf #1}}%                         % entry
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%  
%    \sect A |xweb@tt_lop_line| is like a |cweb@bold_toc_line| in the
%    |cweb| style:  
%    It has no dots, but the entry is typeset in large typewriter type,
%    instead of 
%    bold roman.
%
%    \begin{macro}{\xweb_TTLopLine}
%    \begin{macrocode}
%<*main>
\def\xweb_TTLopLine#1#2{%
    \addpenalty{\@secpenalty}%
    \addvspace{2em plus\p@}%
    \begingroup
        \noindent 
        \hangindent\xwebLopIndent
        \rightskip\@tocrmarg  \parfillskip -\rightskip
        \interlinepenalty\@M
        \@tempdima\xwebLopIndent        % for \numberline
        {\large\bf\tt #1}\nobreak\hfill \hbox to\@pnumwidth{\hss #2}%
        \par
    \endgroup
    \addvspace{.5em plus\p@}%
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%  
%  
%  
%    \chap Typesetting programs.
%    
%    Program pieces come in two flavours: as argument of |\PB|, or as
%    material after |\B|. In the former case we can use a group for the
%    switch to the restricted program state, the group end will restore the
%    previous state again. In the latter case we use |\B| for the switch to
%    program state, the cross reference list or the next section will go to
%    another state. Since we have to do more for the material after |\B|,
%    we define this cseq later.
%
%    \begin{macro}{\PB}
%    \begin{macrocode}
%<*main>
\def\PB#1{%
    \begingroup
        \xweb_Rprogram
        \leavevmode
        #1%
    \endgroup}
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%  
%    \sect Note, that |\Y| cannot just be |\smallskip|, as in the plain
%    version. We must assert that the current paragraph is ended before
%    the vertical glue is inserted, and that's not done by the \LaTeX{}
%    definition of |\smallskip|. In addition we add some negative penalty,
%    here is a good place for a page break. As the penalty value we use
%    half the section break penalty---of course a section start is an even
%    better place for a page break\,\dots
%    
%    It might be that |\Y| is the very first token in a ``normal''
%    section. Then the section number isn't set already since it is to be
%    run-in. In that case we don't set the vertical skip but simply start
%    the section with the program part.
%    
%    \TeX{}nical note: The flag |@noskipsec| may be used to test if we're
%    immediately after a run-in section heading.
%
%    \begin{macros}{\xwebProgPenalty,\Y}
%    \begin{macrocode}
%<*main>
\newcount\xwebProgPenalty
        \xwebProgPenalty=\@secpenalty
        \divide\xwebProgPenalty by 2
\def\Y{%
    \if@noskipsec
    \else
        \par
        \penalty\xwebProgPenalty
        \smallskip
    \fi}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect Yep, let's unfold the ``official'' names of the cseqs used in
%    program state.
%    
%    If we turn on the \cweave{} bindings, they might be in effect already,
%    we don't need to establish them again. We can test
%    |\xweb_UserBindings| for this case, it will be redefined then.
%
%    \errorcontextlines=20
%    \begin{macros}{\xweb_CweaveBindings,\xweb_UserBindings,
%       \1,\2,\3,\4,\5,\6,\7,\8,\?,\AND,\CM,\DC,\E,\G,\GG,\I,\K,
%       \LL,\MOD,\NULL,\R,\OR,\PA,\this,\V,\W,\XOR,\Z,\MG,\MGA,
%       \MM,\PP,\.,\T,\MRL,\C,\SHC,\X,\ATH,\D,\F,\J,
%       \vb,\*,\A,\As,\Q,\Qs,\U,\Us,\ET,\ETs,\)}
%    \begin{macro}{\\}
%    \begingroup\catcode`\&=12 \catcode`\|=12
%      \begin{macro}{\&}
%      \begin{macro}{\|}
%    \endgroup
%    \begin{macrocode}
%<*main>
\def\xweb_CweaveBindings{%
    \ifx \xweb_UserBindings\relax
        \xweb_rebind
            % indentation and paragraph layout
            \xweb_IncrIndent    \1%
            \xweb_DecrIndent    \2%
            \xweb_ExprBreak     \3%
            \xweb_backup        \4%
            \xweb_OptBreak      \5%
            \xweb_break         \6%
            \xweb_BigBreak      \7%
            \xweb_noindent      \8%
            % C/C++ tokens
            \xwebRel               \?%
            \xwebAddress           \AND
            \xwebComplement        \CM
            \xwebScope             \DC
            \xwebEquiv             \E
            \xwebGe                \G
            \xwebRightShift        \GG
            \xwebNe                \I
            \xwebAssign            \K
            \xwebLeftShift         \LL
            \xwebMod               \MOD
            \xwebNull              \NULL
            \xwebNot               \R
            \xwebBinOr             \OR
            \xwebMemberRef         \PA
            \xwebThis              \this
            \xwebOr                \V
            \xwebAnd               \W
            \xwebXor               \XOR
            \xwebLE                \Z
            \xwebPointer           \MG
            \xwebPointerMemberRef  \MGA
            \xwebDecr              \MM
            \xwebIncr              \PP
            % more tokens
            \xwebId             \\%
            \xwebIdLetter       \|%
            \xwebRes            \&%
            \xwebString         \.%             %% ( ...Emacs...
            \xwebStringBreak    \)%
            \xwebNumber         \T
            \xwebCombinedOp     \MRL
            % goes to TeX state
            \xwebComment        \C
            \xwebCxxComment     \SHC
            \xwebRefName        \X
            % CWEB tokens
            \xwebMacrosHere     \ATH
            \xwebDefine         \D
            \xwebFormat         \F
            \xwebIdCat          \J
            \xwebVerbString     \vb
            % cross reference tags
            \xwebChangeFlag     \*%
            \xwebCRAlso         \A
            \xwebCRsAlso        \As
            \xwebCRCite         \Q
            \xwebCRsCite        \Qs
            \xwebCRUse          \U
            \xwebCRsUse         \Us
            \xwebCREt           \ET
            \xwebCRsEt          \ETs
            % finish the list
            \stop\stop
        \def\xweb_UserBindings{%
            \xweb_RestoreBindings
            \let\xweb_UserBindings\relax
            }%
    \fi
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macros}
%  
%    \sect Since most of the \cweave{} bindings are simple and tedious
%    coding, we'll have a look at the program layout next. Between two
%    paragraphs there must not be any skip, the skip used in document
%    layout is saved in |\xweb_SaveParskip|. A few other layout
%    parameters from the document layout must be saved as well.
%
%    \begin{macros}{\xweb_SaveParskip,\xweb_SaveRightskip,      
%		    \xweb_SaveSemSFCode,\xweb_SavePretolerance, 
%		    \xweb_SaveHyphenpenalty,\xweb_SaveExhyphenpenalty,
%                   \xweb_SaveDocLayout,\xweb_RestoreDocLayout}
%    \begin{macrocode}
%<*main>
\newskip\xweb_SaveParskip
\newskip\xweb_SaveRightskip
\newcount\xweb_SaveSemSFCode
\newcount\xweb_SavePretolerance
\newcount\xweb_SaveHyphenpenalty
\newcount\xweb_SaveExhyphenpenalty

\def\xweb_SaveDocLayout{%
    \xweb_SaveParskip\parskip
    \xweb_SaveRightskip\rightskip
    \xweb_SaveSemSFCode\sfcode`; % changed by \xweb_ProgramLayout
    \xweb_SavePretolerance\pretolerance
    \xweb_SaveHyphenpenalty\hyphenpenalty
    \xweb_SaveExhyphenpenalty\exhyphenpenalty
    }
\def\xweb_RestoreDocLayout{%
    \parskip\xweb_SaveParskip
    \rightskip\xweb_SaveRightskip
    \sfcode`;=\xweb_SaveSemSFCode
    \pretolerance\xweb_SavePretolerance
    \hyphenpenalty\xweb_SaveHyphenpenalty
    \exhyphenpenalty\xweb_SaveExhyphenpenalty
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect When |\xweb_ProgramLayout| is called for the very first time
%    we have to set up some variables. This cannot be done in advance
%    since they depend on values that might be changed by the user in the
%    preamble. This setup is done in |\xweb_LayoutInit|.
%    
%    If the program layout is already active, we must not switch it on
%    another time. This can be tested by the current binding of
%    |\xweb_DocLayout|.
%
%    \begin{macros}{\xweb_ProgramLayout,\xweb_DocLayout}
%    \begin{macrocode}
%<*main>
\def\xweb_ProgramLayout{%
    \ifx \xweb_DocLayout\relax
        \xweb_LayoutInit
        \xweb_SaveDocLayout
        \def\xweb_DocLayout{%
            \xweb_RestoreDocLayout
            \let\xweb_DocLayout\relax
            }%
        % set new values
        \parskip\z@skip
        \rightskip\z@ plus 100\p@ minus 10\p@
        \sfcode`;=3000          % same stretch factor as period.
        \pretolerance\@M
        \hyphenpenalty 9999     % strings can be broken this way
        \exhyphenpenalty\@M
    \fi
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The unit of the basic indentation is stored in
%    |\xwebIndentUnit|. Continuation lines are indented two units further,
%    i.e., the initial hanging indentation is 3~units. The current hanging
%    indentation is kept in |\xweb_indent|.
%    
%    We need undiscardable items which can be used as backspaces, of one
%    and two units, respectively. This is done best by boxes. The
%    initialization of the boxes must be postponed until the user had the
%    chance to change |\xwebIndentUnit|, it's done in the program state
%    initialization.
%
%    \begin{macros}{\xwebIndentUnit,\xweb_indent,\xweb_bak,\xweb_bakk,
%                   \xweb_LayoutInit}
%    \begin{macrocode}
%<*main>
\newdimen\xwebIndentUnit   \xwebIndentUnit=1em
\newdimen\xweb_indent
\newbox\xweb_bak        % backspace one unit
\newbox\xweb_bakk       % backspace two units
\def\xweb_LayoutInit{%
    \global\setbox\xweb_bak \hbox to -1\xwebIndentUnit{}%
    \global\setbox\xweb_bakk \hbox to -2\xwebIndentUnit{}%
    \global\let\xweb_LayoutInit\relax
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Now we can formulate how to start typesetting program pieces: We
%    switch to program state, set the initial indentation, and add the basic
%    indentation of the first code line.
%    
%    If the code line is the very first text to be typeset in this
%    section, we don't add the basic indentation---we're already indented
%    from the run-in section number. But we must not start our section
%    with |\noindent|, the section number would be typeset in the left
%    margin then. So we just
%    emulate an empty documentation part, the section number is now
%    correctly set. |\B| can test for this case: |@noskipsec| is still true
%    then.
%  
%    \begin{macro}{\B}
%    \begin{macrocode}
%<*main>
\def\B{%
    \if@noskipsec \hskip 1em \fi
    \xweb_program
    \xweb_indent 3\xwebIndentUnit  \hangindent\xweb_indent
    \ifvmode
         \if@noskipsec
            \indent             % add an empty documentation part
        \else
            \noindent \kern\xwebIndentUnit
        \fi
   \fi
}
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%  
%    \sect If a statement is finished, a new paragraph with the basic
%    indentation has to be started.
%    
%    An optional statement break is implemented by a low penalty which
%    will be selected if the line has to be broken. We assume that the
%    hanging indentation of the new line is already set correctly, and
%    have to backup two units to get the basic indentation. It might be
%    that the line break is not chosen by \TeX{}, we compensate the
%    backspace for this case. This compensation is discarded at the start
%    of a new line.
%
%    \begin{macros}{\xweb_break,\xweb_ExprBreak,\xweb_BigBreak,
%                   \xweb_OptBreak}
%    \begin{macrocode}
%<*main>
\def\xweb_break{%       % forced break, between statements
    \ifmmode\else
        \endgraf        % in LaTeX it isn't sure what \par is really...
        \noindent
        \hangindent\xweb_indent  \kern\xweb_indent
        \copy\xweb_bakk % go back to basic indentation
        \ignorespaces
    \fi
    }
\def\xweb_OptBreak{%    % optional break between statements
    \hfil \penalty\m@ne
    \hfilneg  \kern .5em  \kern 2\xwebIndentUnit   % discarded on line break
    \copy\xweb_bakk
    \ignorespaces
    }
\def\xweb_BigBreak{%    % forced break and a little extra space
    \Y
    \xweb_break
    }
\def\xweb_ExprBreak#1{% % break with penalty #1 * 10
    \hfil \penalty#10
    \hfilneg            % discarded on line break
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect When we increment the indentation, we must not forget to set
%    the hanging indentation immediately since |\xweb_OptBreak| relies on
%    the new value. If a continuation line is needed it will also be
%    indented one unit more, which is ok since it should be distinguishable
%    from the next line.
%     %
%    \begin{fixme}  
%      Shouldn't the hanging indentation be set anew at the end of
%      |\xweb_DecrIndent| as well?
%    \end{fixme}
%
%    \begin{macros}{\xweb_IncrIndent,\xweb_DecrIndent,\xweb_backup,
%                   \xweb_noindent}
%    \begin{macrocode}
%<*main>
\def\xweb_IncrIndent{%
    \global\advance\xweb_indent\xwebIndentUnit
    \hangindent\xweb_indent
    }
\def\xweb_DecrIndent{\global\advance\xweb_indent -\xwebIndentUnit}
\def\xweb_backup{\copy\xweb_bak}
\def\xweb_noindent{%                            % no indentation
    \hskip -\xweb_indent \hskip 2\xwebIndentUnit
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%  
%    \chap Program (C or \C++) tokens.
%  
%    Since the user might want to change the (somewhat unusual) way some
%    of the operators are typeset, we supply names for them.
%
%    \begin{macros}{\xwebAnd,\xwebEquiv,\xwebGe,\xwebLE,
%                   \xwebNe,\xwebNull,\xwebNot,\xwebOr,\xwebXor}
%    \begin{macrocode}
%<*main>
\let\xwebAnd=\land              % logical and, &&
\let\xwebEquiv=\equiv           % equiv sign, for ==
\let\xwebGe=\ge                 % greater or equal
\let\xwebLE=\le                 % less or equal
\let\xwebNe=\ne                 % unequal, !=
\let\xwebNull=\Lambda           % NULL pointer
\let\xwebNot=\lnot              % logical not, !
\let\xwebOr=\lor                % logical or, ||
\let\xwebXor=\oplus             % bitwise exclusive or, ^
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Some symbols have to be shifted around, to save computation time
%    we put them in boxes.
%    %
%    \begin{fixme}
%      The amount of the shifting depends on the used fonts. Particularly,
%      it depends on the usage of 10\,pt fonts. We use the plain \TeX{}
%      names for these fonts since we need {\it them\/} especially, it's not
%      possible to substitute them without changing these macros. If the
%      NFSS is used with \LaTeX{} the font names are not available, we have
%      to assert that they exist and that they are preloaded.
%    \end{fixme}
%    %
%    But there is one exception where we try to define a general look: the
%    increment operator~|++|. We might want to use it for different logos,
%    nowadays it's en vogue to attach |++| to all kinds of product names.
%    We choose to use the plus sign from script size (whatever this is
%    currently), but we must be careful that it is not used as a binary
%    operation. Instead we convert it to an ordinary symbol and set a
%    back-kern in between.
%
%    \begin{macros}{\teni,\sevensy,\xweb_pointer,\xweb_decr,\xweb_incr}
%    \begin{macrocode}
%<*main>
\font\teni=cmmi10
\font\sevensy=cmsy7

\newbox\xweb_pointer            % pointer to struct component, ->
\setbox\xweb_pointer=\hbox{\kern-2pt\lower3pt\hbox{\teni\char'176}\kern1pt}

\newbox\xweb_decr               % decrement, --
\setbox\xweb_decr=\hbox{%
            \kern .5pt
            \raise 1pt \hbox{\sevensy\char0 \kern-1pt\char0}%
            \kern .5pt
            }
\newbox\xweb_incr               % increment, ++
\setbox\xweb_incr=\hbox{%
            \kern .05em
            \raise .1em \hbox{$\scriptstyle {+}\kern -.1em{+}$}%
            \kern .05em
            }
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Although the following symbols are typeset like an ``ordinary
%    \C++ programmer'' would expect them, we provide own module names
%    nevertheless. They can now be changed as well, i.e., orthogonality is
%    enhanced. (And we can use |\xweb_rebind| for assigning them to their
%    names while we switch to program state\,\dots).
%     %
%    \begin{fixme}
%      Must fix the comment on |\xwebMod|: Is C a ``modulo language''
%      or a ``remainder language.'' Well, IMHO $n
%      \mathbin{\hbox{\footnotesize\rm\%}} 
%      i$ with $n < 0$ shouldn't be used anyhow\,\dots
%    \end{fixme}
%
%    \begin{macros}{\xwebAddress,\xwebAssign,\xwebBinOr,\xwebComplement,
%       \xwebDecr,\xwebIncr,\xwebLeftShift,\xwebMod,\xwebMemberRef,
%       \xwebPointer,\xwebPointerMemberRef,\xwebRel,\xwebRightShift,
%       \xwebScope,\xwebThis}
%    \begin{macrocode}
%<*main>
\mathchardef\xwebAddress="2026  % `&', as binary op
\let\xwebAssign==               % assignment
\let\xwebBinOr=\mid             % binary or
\def\xwebComplement{{\sim}}     % `~', as ordinary symbol
\def\xwebDecr{\copy\xweb_decr}  % decrement
\def\xwebIncr{\copy\xweb_incr}  % increment
\let\xwebLeftShift=\ll          % left shift, <<
\def\xwebMod{\mathbin{\hbox{\footnotesize\rm\%}}}       % modulo/remainder, %
\def\xwebMemberRef{\mathbin{.*}}        % ptr to member (on object)
\def\xwebPointer{\copy\xweb_pointer}
\def\xwebPointerMemberRef{\mathbin{\xwebPointer*}} % ptr to member (on ptr)
\def\xwebRel{\mathrel?}         % relation operator
\let\xwebRightShift=\gg         % right shift, >>
\def\xwebScope{\kern.1em{::}\kern.1em}  % scope resolution

\def\xwebThis{\xwebRes{this}}   % reserved identifier `this'
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \sect Some tokens don't have constant names, the name is supplied as
%    the argument.
%    
%    Identifiers are typeset in italics, reserved words and type names in
%    boldface, and strings in typewriter.
%     %
%    \begin{fixme}  
%      The definition of the underscore in |\xwebRes| depends on a 10\,pt
%      type. Particularly, the height is 0.6\,pt and therefore 1.5~times as
%      high as the usual height (to get a bold impression). This height must
%      be adapted if another size is used. Is there a font dimension which
%      can be used as the default value for a rule?
%    \end{fixme}
%
%    \begin{macros}{\xwebCombinedOp,\xwebId,\xwebIdLetter,\xwebRes}
%    \begin{macrocode}
%<*main>
\def\xwebCombinedOp#1{\mathrel{\let\K==#1}}  % eg, += operator
\def\xwebId#1{\hbox{\it#1\/\kern.05em}} % identifier, more than one char
\def\xwebIdLetter#1{\hbox{$#1$}}        % identifier, one letter
\def\xwebRes#1{%                        % reserverd words and type names
    \hbox{\bf
        \def\_{\kern.04em\vbox{\hrule width.3em height .6pt}\kern.08em}%
        #1\/\kern .05em
        }%
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect In the plain version strings are typeset in the font |cmtex10|,
%    which is a typewriter font with extended ASCII characters. This font
%    does not have the usual accents and can therefore not used for
%    typesetting national characters. (Very often they are input in some
%    8-bit encoding, the respective character code is made active and is
%    substituted by a cseq which expands to the correct glyph. Of course,
%    there are better ways, but that's the reality we have to cope with.)
%    Instead of this special font we use the standard typewriter font.
%    This has the further advantage that |cmtex10| may not be introduced
%    to NFSS\@.
%    
%    \begin{sloppypar}
%     Within strings certain cseqs have a special meaning; this is
%     introduced by |\xweb_StringSetup|. The cseqs within strings are
%     mostly accessible by their ASCII code.
%    \end{sloppypar}
%    
%    \begin{sloppypar}
%     Every once in a while we have discretionary breaks in a string,
%     denoted by |\xwebStringBreak|. This break is shown with the C
%     convention of escaped newlines.
%    \end{sloppypar}
%
%    \begin{macros}{\xwebString,\xweb_StringSetup,\xwebStringBreak}
%    \begin{macrocode}
%<*main>
\def\xwebString#1{%
    \hbox{\tt
        \xweb_StringSetup
        #1\kern .05em
        }%
    }
\def\xweb_StringSetup{%
    \chardef\ =`\  %            % <-- two spaces !
    \chardef\&=`\&
    \chardef\\=`\\
    \chardef\^=`\^
    \chardef\_=`\_
    \chardef\{=`\{
    \chardef\}=`\}
    \chardef\~=`\~
    \def\`{`}%
    }
\def\xwebStringBreak{\discretionary{\hbox{\tt\char`\\}}{}{}}
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Numbers are typeset in different ways. We use the definition of
%    the plain macros.
%     %
%    \begin{fixme}  
%      Should add a specification of the possible input and an explanation
%      of the macros below. In particular, that the closing brace after
%      |\aftergroup| is used much later is probably not grokked by most
%      \TeX{} programmers.
%  
%      Zden\v{e}k Wagner notes that with NFSS |\rm| in math mode is a noop.
%      Have to check a clean work-around.    
%    \end{fixme}
%
%    \begin{macros}{\xweb_oct,\xweb_hex,\xwebNumber}
%    \begin{macrocode}
%<*main>
\def\xweb_oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}
\def\xweb_hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}}

\def\xwebNumber#1{%             % octal, hex, or decimal constant
    \hbox{%
        $%
            \def\?{\kern.2em}%
            \def\$##1{\egroup\sb{\,\rm##1}\bgroup}% suffix to constant
            \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
            \let\~\xweb_oct \let\^\xweb_hex
            {#1}%
        $}%
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Comments are typeset in \TeX{} state. We add a hook, the user
%    shall be able to change the layout (eg, he might want another font).
%     %
%    \begin{fixme}
%      Currently \C++ comments are typeset like C comments. This is horrible
%      in usual circumstances, i.e., when complete blocks of text are prefixed
%      with |//|. We should simply catenate all these text and typeset it as
%      one paragraph, each line prefixed by |//|. But then we have to
%      implement an |\everyline| first, and since that's not so easy we
%      postpone it\,\dots
%    \end{fixme}
%     %
%    In front of a C comment there is an optional stmt break, with 2\,quad
%    in front if the line is not broken and 1.5\,quad if the line is broken.
%
%    \begin{macros}{\xwebComment,\xwebCommentHook,\xwebCxxComment}
%    \begin{macrocode}
%<*main>
\def\xwebComment#1{%
    \5%                         % 0.5em will be discarded on line break
    \hskip 1.5em
    $/\ast\,$%
    {\xweb_tex
        \xwebCommentHook
        #1%
    }%
    $\,\ast/$%
    }
\let\xwebCommentHook\relax
\let\xwebCxxComment\xwebComment
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%  
%  
%    \chap \cweb{} tokens.
%    
%    We distinguish three categories of \cweb{} tokens: (1) Those which
%    output constant text, (2) those which have attributes to be displayed
%    in a special way, and (3) those which start a new structure element,
%    namely |@d| and~|@f|. Let's consider them in this order.
%    
%    
%    \sect \cweb{} tokens which expand in a constant string are the
%    identifier catenation operator~(`|@&|') and the macro placement
%    directive~(`|@h|').
%
%    \begin{macros}{\xwebIdCat,\xwebMacrosHere,\xwebRefMacrosHere}
%    \begin{macrocode}
%<*main>
\def\xwebIdCat{\xwebString{@\&}}
\def\xwebMacrosHere{%
    \begingroup
        \def\xwebRefNumber##1{}%
        \xwebRefName :\xwebRefMacrosHere\X
    \endgroup
    }
\def\xwebRefMacrosHere{Preprocessor Definitions}
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Verbatim program strings, i.e., strings passed verbatim by
%    \ctangle{}~(`|@=|') are typeset like normal strings, but within a box.
%    We use 2\,pt as the separating distance, this is set locally.
%
%    \begin{macro}{\xwebVerbString}
%    \begin{macrocode}
%<*main>
\def\xwebVerbString#1{{\fboxsep\tw@\p@ \fbox{\xwebString{#1}}}}
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect The refinement names are typeset in angles, this has a long
%    tradition. We bury the typesetting of the section number (which is
%    the first parameter) in a macro call; the user may change this to
%    achieve special effects.
%     %
%    \begin{fixme}
%     One could think about handling special values of the section numbers
%     differently. Eg, an empty argument is not typeset at all, a~0 triggers
%     a marginal note about a missing definition, etc.
%    \end{fixme}
%    
%    \sect A refinement name may be typeset both in math and horizontal mode.
%    The name itself is typeset in horizontal mode, of course; for the
%    angles we need math mode. Therefore we assert at the start of the
%    macro that we're not in math mode any more. At the end we switch back
%    to math mode if we've started in it. This conditional switch from and
%    back to math mode is done by |\xweb_ToggleText|.
%    
%    \TeX{}nical note: If we're in math mode |\xweb_ToggleText| must be
%    defined globally, as it will turn off math mode and the definition
%    would be un-made then. The second invocation of |\xweb_ToggleText|
%    would be undefined then.
%    
%     \label{sec:refname-dot}
%     A refinement may also consist of the file name the expansion of this
%    refinement shall be written to. This file name is tagged with |\.|,
%    it shall be typeset like a string. But the user shall be able to use
%    the dot accent in the refinement name as well. We check if the text
%    consists solely of the tag and its argument; in this case we
%    substitute |\.| with |\xwebString|. Otherwise we leave it as it is.
%    Then a refinement name may not consist of a single dot-accented
%    expression---well, that's highly unlikely. (Nevertheless it's
%    documented in the user's manual)
%    
%    \begin{fixme}
%     I took the implementation strategy (i.e., the math mode toggle)
%     from the plain version. But
%     I don't understand why it was done this way. Why isn't it just an
%     hbox? Isn't that much simpler? Would it break something?
%    \end{fixme}
%
%    \begin{macros}{\xwebRefName}
%    \begin{macrocode}
%<*main>
\def\xwebRefName#1:#2\X{%
    \ifmmode  \gdef\xweb_ToggleText{\null$\null}%
    \else  \let\xweb_ToggleText\relax
    \fi
    \xweb_ToggleText
    $\langle\,${\xweb_tex \xweb_CheckDot{#2}\xwebRefNumber{#1}}$\,\rangle$%
    \xweb_ToggleText
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect  The |\xwebRefNumber| macro is used in the module names in
%    program text; It switches to footnotesize and calls
%    |\xwebSetModuleNumber| to create the reference text.
%
%    \begin{macro}{\xwebRefNumber}
%    \begin{macrocode}
%<*main>
\def\xwebRefNumber#1{%
    {\reset@font \footnotesize \kern .5em%
      \xwebSetModNrList#1.}}
%</main>
%    \end{macrocode}
%    \end{macro}  
%
%    
%    \sect There are two macros to typeset module numbers:
%    |\xwebSetModuleNumber| takes one number, and |\xwebSetModNrList|
%    takes a comma-separated list that is terminated by a period.
%    These macros must  employ |\thexwebModule| to get consistent 
%    numbers with nonstandard definitions of |\thexwebModule|. The
%    value of the |xwebModule| counter must be set with low-level
%    code; we cannot use |\setcounter| because it does a global set,
%    and we want to keep the change local, just for one-shot use.
%    (Else the number of the current module would be wrong after the
%    use of a module name.)
%
%    In hypertext, every section number becomes
%    a link to the corresponding section.
%    
%    \begin{macro}{\xwebSetModuleNumber}
%    \begin{macrocode}
%<*main>
\def\xwebSetModuleNumber#1{{\edef\tmpnr{#1}%
   \c@xwebModule=\tmpnr\relax
   \xweb_hlink{\thexwebModule}}}
%</main>
%    \end{macrocode}
%    \end{macro}  
%  
%
%    \sect  If we want to handle a comma-separated list of numbers, a
%    control sequence must be inserted before each element. The
%    following macros, essentially copied 
%    from \texttt{pdfcwebmac.tex} (plain cweb macros modified by
%    Andreas Scherer), insert |\xweb_TagSec| before each
%    number, filter things like |\ET|, and then expand the list.
%
%    \begin{macro}{\maketoks}
%    \begin{macrocode}
%<*main>
\newtoks\xweb_toksA
\newtoks\xweb_toksB
\newtoks\xweb_toksC
\newtoks\xweb_toksD
\newcount\xweb_countA
\xweb_countA=0
\def\xweb_AddTokens#1#2{%
    \edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
\def\xweb_adn#1{\xweb_AddTokens{\xweb_toksC}{#1}%
    \global\xweb_countA=1\let\next=\maketoks}
\def\xweb_poptoks#1#2|ENDTOKS|{%
     \let\first=#1\xweb_toksD={#1}\xweb_toksA={#2}}
\def\maketoks{%
    \expandafter\xweb_poptoks\the\xweb_toksA|ENDTOKS|
    \ifx\first0\xweb_adn0
    \else\ifx\first1\xweb_adn1 \else\ifx\first2\xweb_adn2
    \else\ifx\first3\xweb_adn3 \else\ifx\first4\xweb_adn4
    \else\ifx\first5\xweb_adn5 \else\ifx\first6\xweb_adn6
    \else\ifx\first7\xweb_adn7 \else\ifx\first8\xweb_adn8
    \else\ifx\first9\xweb_adn9
    \else
        \ifnum0=\xweb_countA\else\xweb_makenote\fi
        \ifx\first.\let\next=\xweb_tdone\else
            \let\next=\maketoks
            \xweb_AddTokens{\xweb_toksB}{\the\xweb_toksD}
            \ifx\first,\xweb_AddTokens{\xweb_toksB}{\space}\fi
        \fi
    \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \next
}
\def\xweb_makenote{\xweb_AddTokens{\xweb_toksB}%
    {\noexpand\xweb_TagSec{\the\xweb_toksC}}%
     \xweb_toksC={}\global\xweb_countA=0}
\def\xweb_tdone{\edef\st{\global\noexpand\xweb_toksA={\the\xweb_toksB}}\st}
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect  By defining |\xweb_TagSec| to |\xwebSetModuleNumber| we
%    can now employ |\maketoks| in |\xwebSetModNrList| to typeset a
%    list of references.
%
%    \begin{macros}{\xweb_TagSec,\xwebSetModNrList}
%    \begin{macrocode}
%<*main>
\def\xweb_TagSec#1{\xwebSetModuleNumber{#1}}
\def\xwebSetModNrList#1.{%
   \setbox0=\hbox{\xweb_toksA={#1.}\xweb_toksB={}\maketoks}%
   \the\xweb_toksA}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The next macro, |\xweb_CheckDot| is a hassle to implement. We
%    must check if it's argument consists solely of a `|\.|'~tag, together
%    with the argument to this tag. Then the `|\.|'-argument shall be
%    typeset like a string, |\.| itself must be ignored.
%  
%    The check for |\.| must not evaluate the parameter. Especially |\PB|
%    must not be evaluated within, it would lead to havoc with the
%    redefinition of all bindings, etc. (At least that's the empirical
%    result---it happened; although I don't know where the problems are.
%    Anyhow, it wasn't in the specs of the rebinding process.) All other
%    cseqs which shouldn't be used in moving arguments may cause problems
%    here, too. Note that |\protect| is no solution here, the user often is
%    not aware of the presence of \cweave{}-generated tags. As an example,
%    consider the refinement
%    {\tt |@< local variables of |\vbar|foo|\vbar|@>|\/} which will lead
%    to a call with the argument `|local variables of \PB{\\{foo}}|'.
%    |\\| must not be evaluated here. 
%    
%    I use an approach where I hope that it will work---but to be honest,
%    I'm not sure. I want to define a macro |\next| which shall have an
%    empty expansion iff |#1| was a `|\.|'~tag with its argument. Empty
%    refinement names are not allowed so we can assume that |#1| consists
%    of at least one token. I evaluate the first token of |#1| before the
%    |\def| is done. With an appropriate binding a |\.| will disappear,
%    perhaps leaving an empty token list. I also take care that |\PB| is
%    not evaluated then, by temporary rebinding it to |\relax|. Thereby I
%    have taken care for all cseqs \cweave{} might have introduced at the
%    very front of |#1|. Other cseqs are user-tags. If they cause
%    problems, the user might circumvent them by adding |\protect|.
%
%    \begin{macro}{\xweb_CheckDot}
%    \begin{macrocode}
%<*main>
\def\xweb_CheckDot#1{%
    \begingroup
      \let\.\@gobble
      \let\PB\relax
      \expandafter\def \expandafter\next \expandafter{#1}%
      \ifx \next\empty
         \gdef\next##1{\xwebString}%
      \else
         \global\let\next\relax
      \fi
    \endgroup
    \next #1
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect \cweb{} macro definitions (done by~|@d|) and format
%    directives are 
%    basically program text. When they are started we are already in
%    program state, i.e., |\B| has appeared in front of it. But since we have
%    an introductionary identifier (either |#define| or |format|) to set at
%    the very front we increase the indentation by three units.
%
%    \begin{macros}{\xwebDefine,\xwebFormat,\xweb_macro}
%    \begin{macrocode}
%<*main>
\def\xwebDefine{\xweb_macro{\#define}}
\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
  \xweb_macro{format}\\{#1} \\{#2}\par\fi}
\def\xweb_macro#1{%
    \global\advance\xweb_indent \tw@\xwebIndentUnit
    \xweb_IncrIndent
    \xwebRes{#1 }%              % <-- blank!
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%  
%    \chap Section cross references and changes.
%    
%    At the end of sections with refinements, \cweave{} may output cross
%    reference information: In which sections additional definitions for
%    this refinement are found, where this refinement is used, and where it
%    is cited. This cross reference information is always introduced by a
%    tag followed by a non-empty list of section numbers. Different tags
%    are used for lists with only one element and for lists with more than
%    one element, this way the introductionary text may be adapted.
%    
%    Within a list of $n$~section numbers the first $n-1$~numbers are
%    separated by commas with one following blank. The last two numbers
%    are separated by |\ET| if~$n=2$, and by |\ETs| if~$n>2$. If a section
%    is changed by the changefile, a changeflag~(`|\*|') is appended to
%    its number. The list is eventually terminated by a full stop.
%  
%  
%    \sect We separate the cross reference information by a smallskip from
%    the refinement or from a previous cross reference information. The
%    information itself is typeset in a smaller font, as it is auxilliary,
%    inserted stuff. The number list has a hanging indentation of
%    |\xwebNumberListHangindent|. But beware: This isn't a dimension
%    register, it's a macro. This way one can use ems as dimensions.
%    
%    We must assert that we're in CR state while we set a cross reference.
%    
%    The first parameter of a cross reference information unit is the
%    introductionary text, the second is the number list. The parameters
%    must be evaluated in a group---local parameter changes therein must
%    not influence the environment. The list must be passed to
%    |\xwebSetModNrList| to typeset (and hyperreference) them correctly.
%
%    \begin{macros}{\xwebNumberListHangindent,\xwebCrossRef}
%    \begin{macrocode}
%<*main>
\def\xwebNumberListHangindent{2em}
\def\xwebCrossRef#1#2.{%
    \par\smallskip% (= \Y)
    \xweb_CR%
    \begingroup%
        \reset@font \footnotesize%
        \noindent \hangindent\xwebNumberListHangindent%
        #1~\xwebSetModNrList #2..\par%
    \endgroup%
    }%
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect Well, let's define all introducing tags, which in fact start the
%    cross reference information unit. The number list is gathered by
%    |\xwebCrossRef|.
%
%    \begin{macros}{\xwebCRAlso,\xwebCRCite,\xwebCRUse,
%                   \xwebCRsAlso,\xwebCRsCite,\xwebCRsUse}
%    \begin{macrocode}
%<*main>
\def\xwebCRAlso{\xwebCrossRef{See also section}}
\def\xwebCRsAlso{\xwebCrossRef{See also sections}}

\def\xwebCRCite{\xwebCrossRef{This code is cited in section}}
\def\xwebCRsCite{\xwebCrossRef{This code is cited in sections}}

\def\xwebCRUse{\xwebCrossRef{This code is used in section}}
\def\xwebCRsUse{\xwebCrossRef{This code is used in sections}}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The changeflag is set as a star.
%
%    \begin{macros}{\xwebChangeFlag,\xwebCREt,\xwebCRsEt}
%    \begin{macrocode}
%<*main>
\let\xwebChangeFlag=*
\def\xwebCREt{ and~}
\def\xwebCRsEt{, and~}
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%  
%    \chap Including the web file.  Because the web document is
%    included  by the |\webfile| command, we have an easy way to
%    handle the index and list of refinements at the end; this is done
%    by the |\webfile| command itself.
%  
%    \sect As outlined above, we want to check if there are any entries in
%    the identifier index or the refinement list. The former is stored in
%    the file |\xwebJobname.idx|, the latter in the file |\xwebJobname.scn|.
%    For each of these files exists a flag named |xweb_|{\it
%    ext\/}|Entries| (where $\it ext \in \{ |idx|, |scn| \}$ is the
%    extension of the appropriate file) which tells if there are any
%    entries of the respective category.
%
%    \begin{macros}{\ifxweb_idxEntries,\ifxweb_scnEntries}
%    \begin{macrocode}
%<*main>
\newif\ifxweb_idxEntries
\newif\ifxweb_scnEntries
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect We consider a file as ``without entries'' if (1)~the file does
%    not exist, (2)~is empty, or (3)~has an empty line at the very front.
%    (In fact, case~(3) means that there should not be anything behind
%    it---but we can't test this portably.)
%    
%    |\xweb_HasEntries| tests the property, it's parametrized by the
%    extension. As a result, it sets the respective flag.
%    
%    We open the file first. Then we check if it doesn't exist or if it's
%    empty, both conditions deliver true on |\ifeof|; in this case we
%    pretend that there was an empty line. (The \LaTeX{} kernel
%    already provides 
%    a macro for an empty line, |\@defpar|.) Otherwise we read the first
%    line. At this state, the emptiness of the first line is equivalent to
%    the non-availability of entries, we can easily construct an
%    appropriate macro call to set the flag.
%
%    \begin{macros}{\xweb_TmpFile,\xweb_HasEntries}
%    \begin{macrocode}
%<*main>
\newread\xweb_TmpFile
\def\xweb_HasEntries#1{%
    \openin\xweb_TmpFile \xwebJobname.#1\relax
    \ifeof \xweb_TmpFile
        \let\next\@defpar
        \message{No #1 file present for \xwebJobname !}
    \else
        \read\xweb_TmpFile to \next
    \fi
    \csname xweb_#1Entries%
            \ifx \next\@defpar  false%
            \else  true%
            \fi
        \endcsname
    \closein\xweb_TmpFile
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%
%
%    
%    \sect Every web document can have its own table of contents.
%    It is stored in a file that has the web name as basename, and
%    extension \texttt{.con}.
%    The control sequence |\ZZ| is used to tag the entries.
%    |\xwebContents| typesets the table of contents.
%    |\xwebSetModuleNumber| is used here to typeset the section
%    number and possibly create a hyperlink.
%    
%    \begin{macros}{\ZZ,\xweb_contentsline,\xweb_cont,\xweb_consetup}
%    \begin{macrocode}
%<*main>
\newwrite\xweb_cont
\let\ZZ=\let % now you can \write the control sequence \ZZ
\def\xweb_contentsline#1#2#3#4{%
    \ifnum#2=0 \smallbreak\fi
    \hbox to \textwidth{\xweb_consetup{#2}#1
      \rm\leaders\hbox to .5em{.\hfil}\hfil\ %
      \xwebSetModuleNumber{#3}
      \hbox to3em{\hss#4}}}
\def\xweb_consetup#1{\ifcase#1 \bf % depth -1 (@**)
  \or % depth 0 (@*)
  \or \hskip2em % depth 1 (@*1)
  \or \hskip4em % depth 2 (@*2)
  \or \hskip6em % depth 3 (@*3)
  \or \hskip8em % depth 4 (@*4)
  \or \hskip10em % depth 5 (@*5)
  \else \hskip12em \fi} % depth 6 or more
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect  PDF\TeX\ will add an outline entry referring to the table
%    of contents.
%    
%    \begin{macros}{\xwebContents,\xwebSectionName,\xwebPageName}
%    \begin{macrocode}
%<*main>
\def\xwebContents#1{
    \def\readcontents{\IfFileExists{#1.con}{\input #1.con}{}}
    \begingroup
         \xwebContentsTop
         \ifnum\xweb_hypertype=2
            \pdfdest name{#1:contents} fith
            \pdfoutline goto name{#1:contents}{#1}
         \fi
         \hbox to \textwidth{\hfil
             \xwebSectionName\hbox to3em{\hss \xwebPageName}}
         \let\ZZ=\xweb_contentsline
         \readcontents\relax % read the contents info
         \xwebContentsBot    % print the contents page(s) and terminate
    \endgroup
}
\def\xwebSectionName{Section}
\def\xwebPageName{Page}
%</main>
%    \end{macrocode}
%    \end{macros}
%  
%  
%    \sect The |\xweb_InputWebfile| macro disables |\inx| etc., adds a
%    List Of Programs entry, inputs the web document and finishes it
%    with some code that was stolen from |\cweb@end_document| and
%    |\cweb@finish|. We don't need these macros themselves as there
%    should be no |\end{document}| in the web file.
%    
%    Note that there are two `jobnames': the |\jobname| of the main
%    document and the |\xwebJobname| of the included web document.
%
%    To get the jobname, we strip off the optional filename extension
%    with |\setname|, using its special parameter syntax. |##1| will
%    be the basename of the file; |##2| will be the extension, if
%    present. |##3| will only be set if the extension has mutltiple
%    parts; it also makes it possible to eat up the second dot, that
%    must be there to delimit the parameter text in case there is no
%    extension. We assume that there are no forward slashes in the
%    filename, so the forward slash can be used to delimit the third
%    parameter.
%
%    The flag |\xweb_FirstModule| is made true so we can find out
%    later if we are typesetting the first module (the table of
%    contents is set then).
%
%    \begin{macros}{\xwebContentsTop,\xwebContentsBot,\xweb_InputWebfile}
%    \begin{macrocode}
%<*main>
\def\xwebContentsTop{\vskip.2in}
\def\xwebContentsBot{\par\bigskip}
\def\xweb_InputWebfile#1{
    \def\setname##1.##2.##3/{\gdef\xwebJobname{##1}}
    \setname #1../
    \ifnum\c@xwebLopDepth > -10       % entry to the list of programs:
       \addcontentsline{lop}{program}{\xwebJobname}
    \fi
    \def\xwebContentsTop{\centerline{\textbf{\xwebJobname}}\vskip.2in}
    \def\xwebContentsBot{\par\bigskip}
    \global\xweb_FirstModuletrue
    \begingroup
       \let\inx\relax
       \let\fin\relax
       \let\con\relax
       \let\ch\xwebCRChanged
       \input{#1}
       \ifon \end{xwebModule} \fi % end the last module (if it is on).
    \endgroup
    % process the index and list of refinements ...
    \ifxwebIndex\xweb_HasEntries{idx}%
        \ifxweb_idxEntries  \xwebIdIndex{\xwebJobname.idx}\fi\fi
    \ifxwebRef\xweb_HasEntries{scn}%
        \ifxweb_scnEntries  \xwebRefList{\xwebJobname.scn}\fi\fi
    % clean up:
    \closeout\xweb_cont
    \onfalse % don't end the last section when starting the first section of
             % the next web.
    \xweb_UserBindings % back to the main document
}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect  |\xwebIdIndex| and |\xwebRefList| have a
%    filename argument, so that they can also be employed by the user
%    to create an index or refinement list for any web document in
%    any place, or to combine the indexes of several documents by
%    processing them with the |sort| program an including the result.
%    This can be particularly worthwile for authors of large,
%    multi-file software packages who want to have a global index of
%    their global variables, but they should almost certainly hack
%    the faked index file with a perl script or something alike to
%    mention also the filenames, because section numbers are not
%    unique through a set of web documents.
%
%    We add two special macros for this purpose, however, to take care
%    of things that are necessary to handle an index or reflist outside
%    the context of a web document.
%
%    \begin{macros}{\xwebInputIndex,\xwebInputReflist}
%    \begin{macrocode}
%<*main>
\def\xwebInputIndex#1{{
  \def\setname##1.##2\\{%
      \edef\xwebJobname{##1}
      \ifx\\##2\\%
    	 \edef\ext{idx}
      \else
    	 \edef\ext{\chop##2\\}%
      \fi}
  \def\chop##1.\\{##1}
  \expandafter\setname#1.\\
  \xwebIdIndex{\xwebJobname.\ext}
}}
\def\xwebInputReflist#1{{
  \def\setname##1.##2\\{%
      \edef\xwebJobname{##1}
      \ifx\\##2\\%
    	 \edef\ext{scn}
      \else
    	 \edef\ext{\chop##2\\}%
      \fi}
  \def\chop##1.\\{##1}
  \expandafter\setname#1.\\
  \xwebRefList{\xwebJobname.\ext}
}}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The |\ifstr| macro compares its first and second
%    arguments; if 
%    they are equal it executes the third argument. It is necessary
%    that |\edef| is used here to expand the arguments!
%
%    \begin{macro}{\ifstr}
%    \begin{macrocode}
%<*main>
\def\ifstr#1#2#3{%
   \edef\xweb_tempa{#1}%
   \edef\xweb_tempb{#2}%
   \ifx\xweb_tempa\xweb_tempb #3\fi
   }
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect The |\webfile| macro has an optional argument, that may
%    contain 
%    a comma-separated list of options. |\webfile| expands into
%    |\xweb_file|, with the optional argument always present, but
%    possibly empty.
%
%    \begin{macro}{\webfile}
%    \begin{macrocode}
%<*main>
\def\webfile{\@ifnextchar[%
   {\xweb_file}{\xweb_file[]}}
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect The square-braced argument is mandatory for |\xweb_file|.
%    The comma-separated list of options is processed using a
%    |\@for| loop.
%    The macro will complain if an unknown option is
%    encountered.
%    After that, |\xweb_InputWebfile| is called to do the real work.
%    Default values for all options will be copied from their global
%    equivalents (specified with the |\usepackage| command).
%
%    \begin{macros}{\xweb_off,\xweb_on,\xweb_file,\cwebfile}    
%    \begin{macrocode}
%<*main>
\newif\if@opt
\def\xweb_off{\let\maybe=\iffalse}
\def\xweb_on{\let\maybe=\iftrue}
\def\xweb_file[#1]#2{
   \ifxweb_GlobalIndex\xwebIndextrue\else\xwebIndexfalse\fi
   \ifxweb_GlobalRef\xwebReftrue\else\xwebReffalse\fi
   \ifxweb_GlobalRagged\xwebRaggedtrue\else\xwebRaggedfalse\fi
   \ifxweb_GlobalOC\xweb_off\else\xweb_on\fi
   \ifxweb_GlobalCon\xwebContrue\else\xwebConfalse\fi
   \ifxweb_GlobalHideFormats\xwebHideFormatstrue\else
                            \xwebHideFormatsfalse\fi
   \xweb_hypertype=\xweb_GlobalHypertype
   \@for\xweb_opt:=#1\do{
     \typeout{webfiles option: \xweb_opt}
     \@optfalse
     \ifstr{\xweb_opt}{index}{\xwebIndextrue\@opttrue}
     \ifstr{\xweb_opt}{noindex}{\xwebIndexfalse\@opttrue}
     \ifstr{\xweb_opt}{reflist}{\xwebReftrue\@opttrue}
     \ifstr{\xweb_opt}{noreflist}{\xwebReffalse\@opttrue}
     \ifstr{\xweb_opt}{raggedbottom}{\xwebRaggedtrue\@opttrue}
     \ifstr{\xweb_opt}{flushbottom}{\xwebRaggedfalse\@opttrue}
     \ifstr{\xweb_opt}{onlychanges}{\xweb_off\@opttrue}
     \ifstr{\xweb_opt}{allsections}{\xweb_on\@opttrue}
     \ifstr{\xweb_opt}{nocon}{\xwebConfalse\@opttrue}
     \ifstr{\xweb_opt}{contents}{\xwebContrue\@opttrue}
     \ifstr{\xweb_opt}{hideformats}{\xwebHideFormatstrue\@opttrue}
     \ifstr{\xweb_opt}{showformats}{\xwebHideFormatsfalse\@opttrue}
     \ifstr{\xweb_opt}{hyperref}{\xweb_hypertype=1\@opttrue}
     \ifstr{\xweb_opt}{pdftex}{\xweb_hypertype=2\@opttrue}
     \ifstr{\xweb_opt}{nohype}{\xweb_hypertype=0\@opttrue}
     \if@opt\else\PackageError{webfiles}{%
          Unknown option for the \protect\webfile\space command
        }{Possible options are: index, noindex,
          reflist, noreflist, \MessageBreak
          raggedbottom, flushbottom, onlychanges,
          allsections,\MessageBreak
          nocon, contents, hideformats, showformats,
          hyperref, pdftex, nohype}
     \fi
   }
   \xweb_SetupHrefs
   \xweb_InputWebfile{#2}}
\let\cwebfile\webfile
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The list of changed sections is a cross reference list, (nearly)
%    like all others at the end of a section. The only difference is that
%    we do not show changeflags any more---each section number in this list
%    carries a change flag by definition.
%    
%    \TeX{}nical note: The redefinition of |\*| is part of the second
%    argument of |\xwebCrossRef|. It is {\it not\/} a global redefinition.
%
%    \begin{macro}{\xwebCRChanged}
%    \begin{macrocode}
%<*main>
\def\xwebCRChanged{%
    \xwebCrossRef{The following sections were changed by the change file:}%
    \let\*\relax
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%  
%  
%    \sect The identifier index is available in the file
%    |\xwebJobname.idx|. 
%    The setup for the index is a mixture of the |theindex| environment
%    of the |article| style and DEK's index macros. It's typeset in two
%    columns; the user may specify an introductionary text for the index
%    by |\xwebIndexIntro|. If there is any introductionary text we add a
%    medium skip below.
%    
%    The paragraph layout is taken from the plain version: Each index
%    entry is a paragraph, nearly no skip between the paragraphs (just a
%    bit to prevent underfull vboxes), no paragraph indentation, ragged
%    right---but the |\parfillskip| set in such a way that almost empty
%    lines are avoided. Overfull hboxes in the index doesn't make
%    sense, so we prevent them. And we don't allow hyphenation in the
%    index, it's an identifier index after all.
%  
%    Before we read in this file, we have to bind the special cseqs used
%    therein.
%
%    \begin{macros}{\xwebIndexIntro,\xwebIndexName}
%    \begin{macrocode}
%<*main>
\newtoks\xwebIndexIntro
        \xwebIndexIntro={}
\def\xwebIndexName{Index of \texttt{\xwebJobname}}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The following text is set as the header of the index. 
%
%    \begin{macro}{\xweb_IndexTop}
%    \begin{macrocode}
%<*main>
\def\xweb_IndexTop{
    \xweb_tex
    \par\vskip 1cm plus 10mm minus 5mm\noindent 
    {\bf \xwebIndexName}%\nopagebreak\par\medskip\nopagebreak
                        %% skip already inserted by xweb_twocolumn env.
    \edef\intro{\the\xwebIndexIntro}% % is a local def
    \ifx \intro\empty
    \else
       \noindent\the\xwebIndexIntro\unskip
       \par\medskip
    \fi
}
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect If the |multicol| package is available, it will be used
%    to typeset the identifier index. The |\RequirePackage| command
%    must however be placed after |\ProcessOptions|, at the end
%    of the package file.
%
%    If the twocolumn class option is in effect, multicols cannot be
%    used; in particular, the title (ieee.cls) would be set in one
%    column. It isn't necessary too, we are in two columns already.
%    
%    \begin{macro}{\ifxweb_multicol}
%    \begin{macrocode}
%<*main>
\newif\ifxweb_multicol \xweb_multicolfalse
\IfFileExists{multicol.sty}{
  \if@twocolumn\else\xweb_multicoltrue\fi
}{}
\ifxweb_multicol
  \newenvironment{xweb_twocolumn}{\begin{multicols}{2}}{\end{multicols}}
\else
  \newenvironment{xweb_twocolumn}{
      \if@twocolumn\else
        \columnseprule\z@
        \columnsep 35\p@          % value is from article.sty
      \fi
      \twocolumn%
  }{
      \onecolumn}
\fi
%</main>
%    \end{macrocode}
%    \end{macro}
%    
%    
%    \sect Now |\xwebIdIndex| itself.  PDF\TeX\ will add an outline
%    entry for the index.
%
%    \begin{fixme}
%      |vfil| before |\xweb_IndexTop| is still not strong enough!
%      A pagebreak can occur just after it.
%    \end{fixme}
%
%    \begin{macros}{\xwebJobName,\xweb_SetupIndex,\xweb_FinishIndex,
%        \xwebIdIndex}
%    \begin{macrocode}
%<*main>
\def\xwebJobName{noname}
\def\xweb_SetupIndex{%
    \begin{xweb_twocolumn}[\xweb_IndexTop]
    \ifnum\xweb_hypertype=2
       \pdfdest name{\xwebJobname:index} fith
       \pdfoutline goto name{\xwebJobname:index}{Index}
    \fi
    % go to CR mode
    \xweb_CR
    \message{*index: }% % tell the user what we're doing
    % paragraph layout
    \begingroup
    \parskip \z@ plus .5\p@
    \parindent\z@
    \rightskip \z@ plus 2.5em
    \parfillskip \z@ plus .6\hsize
    \tolerance\@M \hyphenpenalty\@M
    % bindings
    \let\I\xwebIndexEntry
    \let\[\xwebIndexDeclared
    \let\*\xwebLapStar
}
\def\xweb_FinishIndex{
    \endgroup
    \end{xweb_twocolumn}
}
\def\xwebIdIndex#1{%
    \xweb_SetupIndex
    \@input{#1}
    \xweb_FinishIndex
}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect An index entry is typeset with the same hanging indentation as`
%    a cross reference list.
%    
%    The entry is tagged with |\.|, if it was entered by the \cweb{}
%    operator~`|@.|'. Then it shall be typeset as a string. But an indexed
%    name may also want to use |\.| as an accent. This is the same
%    situation we had at the refinement names (see
%    section~\ref{sec:refname-dot}), where we introduced |\xweb_CheckDot|
%    to handle this case. The same minor restriction as there holds here,
%    a refinement name may not consist of a single dot-accented
%    expression. (|@:|~helps in this singular case.)
%
%    \begin{macro}{\xwebIndexEntry}
%    \begin{macrocode}
%<*main>
\def\xwebIndexEntry#1,#2.{%
    \par
    \hangindent\xwebNumberListHangindent
    \leavevmode
    \xweb_CheckDot{#1}:\quad\xwebSetModNrList #2.
    }
%</main>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect The sections where identifiers are declared are noted with
%    underlined numbers. We also must not forget the default declaration of
%    |\9|, the tag for the user definable index layout.
%
%    \begin{macros}{\xwebIndexDeclared,\9}
%    \begin{macrocode}
%<*main>
\def\xwebIndexDeclared#1]{\underline{#1}}
\def\9#1{}
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect The list of the refinement names is available in the file
%    |\xwebJobname.scn|. The layout is taken from the plain version: ragged
%    right, each entry is a paragraph, the different cross reference
%    categories are separated by a quad.
%  
%    We must restore |\parfillskip| and |\*| since it was changed in the
%    index.
%
%    \begin{macros}{\xwebJobname,\xwebReflistName,\xwebRLCite,
%                   \xwebRLsCite,\xwebRLUse,\xwebRLsUse}
%    \begin{macrocode}
%<*main>
\def\xwebReflistName{List of Refinements in \texttt{\xwebJobname}}
\def\xwebRLCite{\xwebCrossRef{Cited in section}}
\def\xwebRLsCite{\xwebCrossRef{Cited in sections}}
\def\xwebRLUse{\xwebCrossRef{Used in section}}
\def\xwebRLsUse{\xwebCrossRef{Used in sections}}
%</main>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \begin{macros}{\xwebRefList,\xweb_SetupReflist}
%    \begin{macrocode}
%<*main>
\def\xweb_SetupReflist{%
    \vskip 3ex plus 7ex minus 1ex
    \xweb_tex
    \noindent 
    {\bf \xwebReflistName}\nopagebreak\par\bigskip\nopagebreak
    \ifnum\xweb_hypertype=2
       \pdfdest name{\xwebJobname:reflist} fith
       \pdfoutline goto name{\xwebJobname:reflist} {Refs}
    \fi
    \xweb_CR 
    \message{*list of refinements: }%
    % paragraph layout: like in index, but
    \parfillskip\@flushglue
    \begingroup    % different bindings...
       \def\I{\par \hangindent\xwebNumberListHangindent}%
       \def\xwebCrossRef##1##2.{\quad {\reset@font\footnotesize
          ##1~\xwebSetModNrList ##2..}}%
       \def\Q {\xwebRLCite}%
       \def\Qs{\xwebRLsCite}%
       \def\U {\xwebRLUse}%
       \def\Us{\xwebRLsUse}%
       \let\*\xwebChangeFlag
}
\def\xwebRefList#1{%
       \xweb_SetupReflist
       \@input{#1}
    \endgroup
    }
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \noindent The redefinition of |\xwebCrossRef| etc.~must be done locally
%    to prevent troubles with trailing web files: Crossref info in these
%    files would be indented!
%
%
%    
%    \chap Bells and whistles.
%  
%    \begin{fixme}
%      Just copied from the plain version. It doesn't work
%      anyhow---|\char"|{\it xy\/} usually doesn't typeset the correct
%      character. That's because this character is most probably an active
%      character; at least that's typical for the way \TeX{} systems are
%      used in Europe. I have to think about the implementation.
%    \end{fixme}
%
%    \begin{macros}{\ATL,\postATL,\noATL,\noatl}
%    \begin{macrocode}
%<*main>
\def\ATL{\par\noindent\bgroup\catcode`\_=12 \postATL} % print @l in limbo
\def\postATL#1 #2 {\bf letter \\{\uppercase{\char"#1}}
   tangles as \tentex "#2"\egroup\par}
\def\noATL#1 #2 {}
\def\noatl{\let\ATL=\noATL} % suppress output from @l
%</main>
%    \end{macrocode}
%    \end{macros}
%    
%  
%    \sect Option processing will be done at the end of the package
%    file.  We must restore our catcode and are finished.
%
%    \begin{macrocode}
%<*main>
\ProcessOptions
\ifxweb_multicol
    \RequirePackage{multicol}
\fi
\catcode`\_=\xwebCatUsCode
%\endinput
%</main>
%    \end{macrocode}
%
%    
%    \chap Spidery Webs.
%
%    The file |swebbind.sty| redefines some macros to let the above
%    things work with web systems generated with Spider.
%    This file is input by |webkernel.tex|, as provided with the
%    webfiles distribution.
%    As it is eventually input by the |\webfile| command, it is
%    inside a group that encloses the entire web document, so the
%    scope of these redefinements is automatically limited to a single
%    web: we need no ``|cwebbind.sty|'' or such.
%
%    
%    \sect First, make the underscore usable in private control
%    sequences, as in |webfiles.sty|:
%    
%    \begin{macrocode}
%<*spider>
\catcode`\_=\xwebCatLetter
\catcode`\@=\xwebCatLetter
%</spider>
%    \end{macrocode}
%
%    
%    \sect Some miscellaneous\ldots
%
%    \begin{macros}{\amp,\SS,\PP}
%    \begin{macrocode}
%<*spider>
\let\amp\&    % ampersand
\let\SS\S     % section sign
\let\PP\P     % paragraph sign
%</spider>
%    \end{macrocode}
%    \end{macros}
%    
%
%    \sect The main section tag will be a mixture of |webfiles| and
%    |webkernel.tex|: 
%
%    |#1| = number
%
%    |#2| = (level and) title
%
%    \begin{macro}{\N}
%    \begin{macrocode}
%<*spider>
\def\N#1.#2.{%
   \ifon\end{xwebModule}\fi   % webfiles
   \global\xwebGroupLevel 0% default value for group level
   \xweb_headcheck#2\xweb_headcheck     % spider: get group level and title
   {\let\*=\empty%
      \xdef\xweb_secno{#1}% webfiles: get the section number
    }%
    \message \expandafter{*\xweb_secno}%
    \xweb_PrepareSection{#1}%
    \ifon\begin{xwebModule}{\bf\xweb_ModTitle.}%
               % \xweb_ModTitle is generated by \xweb_headcheck.
       %\hskip 1em plus.1em minus.1em%
       \xweb_SpiderLopEntry{\xwebGroupLevel}%
}
%</spider>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect  The entries in the list of programs and the web's own
%    table of 
%    contents are handled by |\xweb_SpiderLopEntry|. We have to use
%    |\@unexpandable@protect|; else there will be trouble with
%    insertion of |\xweb_ModTitle| in the contents file.
%
%    \begin{macro}{\xweb_SpiderLopEntry}
%    \begin{macrocode}
%<*spider>
\def\xweb_SpiderLopEntry#1{%
    \ifnum\c@xwebLopDepth > \xwebGroupLevel
       \addcontentsline{lop}{starred}{%
       \protect\global\xwebGroupLevel #1 \thexwebModule.~\xweb_ModTitle}%
       {   \let\protect\@unexpandable@protect
           \edef\next{\write\xweb_cont{%
             \ZZ{\xweb_ModTitle}{\the\xwebGroupLevel}%
                {\xweb_secno}{\noexpand\thepage}}}%
           \next 
       }% write "\ZZ{title}{depth}{sec}{page}" to .con file
    \fi
    \ifnum\c@xwebOutlineDepth > \xwebGroupLevel   
       \xwebPDFOutline{\xweb_secno}{\xweb_ModTitle}% args: nr, title
    \fi}
%</spider>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect The following is from |webkernel|, with small additions for
%    |webfiles|. 
%    This stuff is to allow inital |=|, |1|, |2|, |3|, |4| in starred
%    modules. 
%    |=| means ``part'', don't skip page.
%    Normal starred module is |1|. 2--4 are submodules, and are
%    indented.
%
%    \begin{tabular}{ll}
%        |@*=|   &        bold name in table of contents\\
%                &        causes page eject\\
%                &        suppresses page eject following\\
%        |@*1,2| &        first level of indentation\\
%        |@*3,4| &        second level of indentation\\
%       |@*1,3| &       cause page eject\\
%       |@*2,4| &       don't cause page eject
%    \end{tabular}
%
%    \begin{macros}{\ifxweb_cancel,\xweb_ifnextchar,\xweb_ifnch,
%       \xweb_makethechar,\xweb_headcheck}
%    \begin{macrocode}
%<*spider>
\newif\ifxweb_cancel\xweb_canceltrue
\def\xweb_ifnextchar#1#2#3{\let\@tempe=#1\def\@tempa{#2}\def\@tempb{#3}%
   \xweb_ifnch}
\def\xweb_ifnch{%
    \ifx \@tempc \@tempe\let\@tempd\@tempa
    \else\let\@tempd\@tempb\fi
    \@tempd}
\def\xweb_makethechar#1{\let\@tempc=#1}

\def\xweb_headcheck#1#2\xweb_headcheck{%
    \xweb_makethechar{#1}%
    \def\theskipper{\vskip 3pt}%
                % extra skip before new starred module
    \def\xweb_ModTitle{{#2}}%
    \xweb_ifnextchar={%                                % @*= title.
        \global\xwebGroupLevel 0% webfiles
        \ifnum \xwebGroupLevel<\c@xwebSecNoEject
           \def\theskipper{\xwebMainSecSkip}%
        \fi
        \xweb_canceltrue
    }{\xweb_ifnextchar1{%                              % @*1 title.
        \global\xwebGroupLevel 1% webfiles
        \xweb_cancelfalse
        \ifnum \xwebGroupLevel<\c@xwebSecNoEject
           \def\theskipper{\xwebMainSecSkip}%
        \fi
    }{\xweb_ifnextchar2{%                              % @*2 title.
        \global\xwebGroupLevel 2% webfiles
        \xweb_cancelfalse
    }{\xweb_ifnextchar3{%                              % @*3 title.
        \global\xwebGroupLevel 3% webfiles
        \xweb_cancelfalse
        \ifnum \xwebGroupLevel<\c@xwebSecNoEject
           \def\theskipper{\xwebMainSecSkip}%
        \fi
    }{\xweb_ifnextchar4{%                              % @*4 title.
        \global\xwebGroupLevel 4% webfiles
        \xweb_cancelfalse
    }{% else                                           % @* title.
        \global\xwebGroupLevel 0% webfiles
        \ifxweb_cancel\else
           \ifnum \xwebGroupLevel<\c@xwebSecNoEject
              \def\theskipper{\xwebMainSecSkip}%
           \fi
        \fi
        \xweb_cancelfalse
        \def\xweb_ModTitle{#1{#2}}%
    }}}}}%
    \theskipper
}
%</spider>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect  Surround text in vertical bars: (already tagged with |\PB|
%    in Spider 3.0)
%
%    \begin{macro}{\CD}
%    \begin{macrocode}
%<*spider>
\def\CD#1\DC{#1}
%</spider>
%    \end{macrocode}
%    \end{macro}
%
%    
%    \sect Go into program mode:
%    this is |\P| in spider and |\B| in cweb.
%
%    \begin{macro}{\P}
%    \begin{macrocode}
%<*spider>
\def\P{\B}
%\let\P\B
%</spider>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect Spidery WEAVE Bindings:
%    these are a little different from the CWEAVE bindings.
%
%    \begin{macros}{\xweb_CweaveBindings,\0,\1,\2,\3,\4,\5,\6,\7,\8,
%       \?,\AND,\CM,\DC,\S,\G,\GG,\I,\K,\LL,\MOD,\NULL,\R,\OR,\PA,
%       \this,\V,\W,\XOR,\L,\MG,\MGA,\MM,\PP,\.,\),\O,\MRL,
%       \C,\SHC,\X,\XF,\ATH,\D,\F,\J,\=,\*,\A,\As,\Q,\Qs,\U,\Us,
%       \ET,\ETs,\xweb_UserBindings}
%    \begin{macro}{\\}
%    \begingroup\catcode`\&=12 \catcode`\|=12
%      \begin{macro}{\&}
%      \begin{macro}{\|}
%    \endgroup
%    \begin{macrocode}
%<*spider>
\def\xweb_CweaveBindings{%
    \ifx \xweb_UserBindings\relax
    \xweb_rebind
        % indentation and paragraph layout
        \xweb_break            \0%           % SPIDER
        \xweb_IncrIndent       \1%
        \xweb_DecrIndent       \2%
        \xweb_ExprBreak        \3%
        \xweb_backup           \4%
        \xweb_OptBreak         \5%
        \xweb_break            \6%
        \xweb_BigBreak         \7%
        \xweb_noindent         \8%
        % C/C++ tokens	 
        \xwebRel               \?%
        \xwebAddress           \AND
        \xwebComplement        \CM
        \xwebScope             \DC
        \xwebEquiv             \S             % SPIDER
        \xwebGe                \G
        \xwebRightShift        \GG
        \xwebNe                \I
        \xwebAssign            \K
        \xwebLeftShift         \LL
        \xwebMod               \MOD
        \xwebNull              \NULL
        \xwebNot               \R
        \xwebBinOr             \OR
        \xwebMemberRef         \PA
        \xwebThis              \this
        \xwebOr                \V
        \xwebAnd               \W
        \xwebXor               \XOR
        \xwebLE                \L             % SPIDER
        \xwebPointer           \MG
        \xwebPointerMemberRef  \MGA
        \xwebDecr              \MM
        \xwebIncr              \PP
        % more tokens
        \xwebId                \\%
        \xwebIdLetter          \|%
        \xwebRes               \&%
        \xwebString            \.%        %% ( ...Emacs...
        \xwebStringBreak       \)%
        \xwebNumber            \O              % SPIDER
        \xwebCombinedOp        \MRL
        % goes to TeX state
        \xwebComment           \C
        \xwebCxxComment        \SHC
        \xwebRefName           \X
     \xwebSpiderOutputFileName \XF
        % CWEB tokens
        \xwebMacrosHere        \ATH
        \xwebDefine            \D
        \xwebFormat            \F
        \xwebIdCat             \J
        \xwebVerbString        \=           % SPIDER
        % cross reference tags
        \xwebChangeFlag        \*%
        \xwebCRAlso            \A
        \xwebCRsAlso           \As
        \xwebCRCite            \Q
        \xwebCRsCite           \Qs
        \xwebCRUse             \U
        \xwebCRsUse            \Us
        \xwebCREt              \ET
        \xwebCRsEt             \ETs
        % finish the list
        \stop\stop
    \def\xweb_UserBindings{%
        \xweb_RestoreBindings
        \let\xweb_UserBindings\relax
        }%
    \fi
    }
%</spider>
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macros}
%
%
%    \sect |\B| in spider is Begin controlled comment.
%    But there are no controlled comments in Spider, so
%    we can leave it out.
%
%    |\def\B{\mathopen{\.{@\commentbegin}}}|
%
%
%    \sect In spider, the argument of |\M| is ended by a period.
%    The meaning of the tag is the same.
%
%    \begin{macro}{\M}
%    \begin{macrocode}
%<*spider>
\def\M#1.{%
    \ifon\end{xwebModule}\fi
    \xweb_PrepareSection{#1}%
    \ifon\begin{xwebModule}
       \ifnum\c@xwebLopDepth>9
    	  \addcontentsline{lop}{xwebsection}{%
    	     \protect\global\xwebGroupLevel 4 \thexwebModule.}%
    	     \edef\next{\write\xweb_cont{\ZZ{}{4}{\xweb_secno}%
    		    {\thepage}}}\next % \ZZ{title}{depth}{sec}{page}%
    	     {   \let\protect\@unexpandable@protect
    		 \edef\next{\write\xweb_cont{%
    		   \ZZ{}{4}{\xweb_secno}{\thepage}}}%
    		 \next 
    	     }% write "\ZZ{title}{depth}{sec}{page}" to .con file
       \fi
    }
%</spider>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect The index and the list of refinements are not given in |.inx|
%    and |.scn| files, 
%    but in the |.tex| file itself.
%    Furthermore, they are tagged a little differently:
%    \begin{quote}
%      \verb"\inx"\\
%      \meta{index}\\
%      \verb"\fin"\\
%      \meta{reflist}\\
%      \verb"\con"
%    \end{quote}
%
%    \begin{macros}{\inx,\fin,\con}
%    \begin{macrocode}
%<*spider>
\def\inx{
   \ifxwebIndex
      \xweb_SetupIndex
      \def\:{\I}
   \else
      \def\:##1.{}  % gobble \:\\{foo} 1, 2, 3.
   \fi
}
\def\fin{
   \ifxwebIndex
      \xweb_FinishIndex
   \fi
   \ifxwebRef
      \xweb_SetupReflist
      \def\:{\I}
   \else
      \def\:{}
      \def\XF##1\XF{}
      \def\X##1\X{}
      \def\U##1.{}
      \def\Us##1.{}
      \def\ET##1.{}
      \def\ETs##1.{}
   \fi
}
\def\con{
   \ifxwebRef
      \endgroup
   \fi
}
%</spider>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect Comments in Spider are not fixed; rather, the cseqs
%    |\commentbegin| and |\commentend| are set in |xweb.tex|.
%
%    \begin{macros}{\xwebComment,\xwebCommentHook,\xwebCxxComment}
%    \begin{macrocode}
%<*spider>
\def\xwebComment#1{%
    \5%                % 0.5em will be discarded on line break
    \hskip 1.5em
    \commentbegin%
    {\xweb_tex
    \xwebCommentHook
    #1%
    }%
    \commentend%
    }
\let\xwebCommentHook\relax
\let\xwebCxxComment\xwebComment
%</spider>
%    \end{macrocode}
%    \end{macros}
%    
%
%    \sect Macro definitions are not translated into preprocessor
%    directives; Spidery 
%    webs expand these themselves. Therefore they should not look like 
%    preprocessor directives: the `|#|' must be left out.
%
%    \begin{macros}{\xwebDefine,\xwebFormat}
%    \begin{macrocode}
%<*spider>
\def\xwebDefine{\xweb_macro{define}}
%\def\xwebFormat{\4\xweb_macro{format}}
\def\xwebFormat\\#1\\#2\par{\ifxwebHideFormats\else
  \4\xweb_macro{format}\\{#1} \\{#2}\par\fi}
%</spider>
%    \end{macrocode}
%    \end{macros}
%
%    
%    \sect The sequence |\XF#1:#2\XF| tags output files, instead of
%    |\X#1:\.{#2}\X|.
%    (|\XF| is bound to |\xwebSpiderOutputFileName| )
%
%    \begin{macro}{\xwebSpiderOutputFilename}
%    \begin{macrocode}
%<*spider>
\def\xwebSpiderOutputFileName#1:#2\XF{\xwebRefName{#1}:\.{#2}\X}
%</spider>
%    \end{macrocode}
%    \end{macro}
%    
%
%    \sect Restore catcodes:
%
%    \begin{macrocode}
%<*spider>
\catcode`\_=\xwebCatUsCode
\catcode`\@=\xwebCatOther
%</spider>
%    \end{macrocode}
%
% 
% \Finale
%
\endinput
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}