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
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
|
%!PS-Adobe-3.0
%%Creator: Basser Lout Version 3.19 (March 2000)
%%CreationDate: Mon Apr 3 16:16:36 2000
%%DocumentData: Binary
%%DocumentNeededResources: (atend)
%%DocumentSuppliedResources: (atend)
%%DocumentMedia: A4 595 842 0 white ()
%%PageOrder: Ascend
%%Pages: (atend)
%%BoundingBox: 0 0 595 842
%%EndComments
%%BeginProlog
%%BeginResource: procset LoutStartUp
/m { 3 1 roll moveto show } bind def
/mo { 3 1 roll moveto true charpath stroke } bind def
/s { exch currentpoint exch pop moveto show } bind def
/so { exch currentpoint exch pop moveto true charpath stroke } bind def
/k { exch neg 0 rmoveto show } bind def
/ko { exch neg 0 rmoveto true charpath stroke } bind def
/ul { gsave setlinewidth dup 3 1 roll
moveto lineto stroke grestore } bind def
/in { 1440 mul } def
/cm { 567 mul } def
/pt { 20 mul } def
/em { 120 mul } def
/sp { louts mul } def
/vs { loutv mul } def
/ft { loutf mul } def
/dg { } def
/LoutGraphic {
/louts exch def
/loutv exch def
/loutf exch def
/ymark exch def
/xmark exch def
/ysize exch def
/xsize exch def
} def
/LoutGr2 { gsave translate LoutGraphic gsave } def
/LoutFont
{ findfont exch scalefont setfont
} bind def
/LoutRecode {
{ findfont dup length dict begin
{1 index /FID ne {def} {pop pop} ifelse} forall
/Encoding exch def
currentdict end definefont pop
}
stopped pop
} bind def
/BeginEPSF {
/LoutEPSFState save def
/dict_count countdictstack def
/op_count count 1 sub def
userdict begin
/showpage { } def
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [] 0 setdash newpath
/languagelevel where
{ pop languagelevel
1 ne
{ false setstrokeadjust false setoverprint
} if
} if
} bind def
/EndEPSF {
count op_count sub { pop } repeat
countdictstack dict_count sub { end } repeat
LoutEPSFState restore
} bind def
%%EndResource
%%BeginResource: encoding vec2
/vec2 [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/at /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 /bracketleft /backslash /bracketright /asciicircum /underscore
/quoteleft /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 /braceleft /bar /braceright /asciitilde /.notdef
/quotesinglbase /quotedblbase /ellipsis /OE /oe /quotedblleft /quotedblright /fi
/fl /endash /emdash /bullet /dagger /daggerdbl /florin /fraction
/dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
/dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def
%%EndResource
%%BeginResource: procset LoutTabPrependGraphic
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/tabf.lpg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PostScript @SysPrependGraphic file for @Tab %
% %
% To assist in avoiding name clashes, the names %
% of all these symbols begin with "ltab". %
% %
% Jeffrey H. Kingston %
% 24 September 1991 %
% 22 December 1992 %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% linewidth ltabhs -
% horizontal single line
/ltabhs
{ 0 0 moveto xsize 0 lineto
setlinewidth 0 setlinecap stroke
} def
% linewidth ltabhsp -
% horizontal single line with projecting ends
/ltabhsp
{ 0 0 moveto xsize 0 lineto
setlinewidth 2 setlinecap stroke
} def
% linewidth ltabhd -
% horizontal double line
/ltabhd
{ dup dup
0 0 moveto xsize 0 lineto
0 exch 3 mul moveto xsize exch 3 mul lineto
setlinewidth 0 setlinecap stroke
} def
% linewidth ltabhdb -
% horizontal double line below mark
/ltabhdb
{ dup dup
0 0 moveto xsize 0 lineto
0 exch -3 mul moveto xsize exch -3 mul lineto
setlinewidth 0 setlinecap stroke
} def
% linewidth ltabhdnw -
% horizontal double line with northwest corner
/ltabhdnw
{ dup dup dup dup
0 0 moveto xsize 0 lineto
xsize exch 3 mul moveto
-3 mul exch 3 mul lineto
-3 mul 0 lineto
setlinewidth 0 setlinejoin 2 setlinecap stroke
} def
% linewidth ltabhdne -
% horizontal double line with northeast corner
/ltabhdne
{ dup dup dup dup
0 0 moveto xsize 0 lineto
0 exch 3 mul moveto
3 mul xsize add exch 3 mul lineto
3 mul xsize add 0 lineto
setlinewidth 0 setlinejoin 2 setlinecap stroke
} def
% linewidth ltabhdsw -
% horizontal double line with southwest corner
/ltabhdsw
{ dup dup dup dup
0 0 moveto xsize 0 lineto
xsize exch -3 mul moveto
-3 mul exch -3 mul lineto
-3 mul 0 lineto
setlinewidth 0 setlinejoin 2 setlinecap stroke
} def
% linewidth ltabhdse -
% horizontal double line with southeast corner
/ltabhdse
{ dup dup dup dup
0 0 moveto xsize 0 lineto
0 exch -3 mul moveto
3 mul xsize add exch -3 mul lineto
3 mul xsize add 0 lineto
setlinewidth 0 setlinejoin 2 setlinecap stroke
} def
% linewidth ltabvs -
% vertical single line
/ltabvs
{ 0 0 moveto 0 ysize lineto
setlinewidth 0 setlinecap stroke
} def
% linewidth ltabvd -
% vertical double line
/ltabvd
{ dup dup
0 0 moveto 0 ysize lineto
-3 mul 0 moveto -3 mul ysize lineto
setlinewidth 0 setlinecap stroke
} def
% linewidth ltabvdr -
% vertical double line to right of mark
/ltabvdr
{ dup dup
0 0 moveto 0 ysize lineto
3 mul 0 moveto 3 mul ysize lineto
setlinewidth 0 setlinecap stroke
} def
%%EndResource
%%BeginResource: procset LoutTblPrependGraphic
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/tblf.lpg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PostScript @SysPrependGraphic file for @Tbl Jeffrey H. Kingston %
% Version 1.0 June 1998 %
% %
% To assist in avoiding name clashes, the names of all symbols %
% defined here begin with "ltbl". %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% painting (i.e. filling): - ltblwhite - (etc.)
/ltblnopaint { } def
/ltblnochange { fill } def
/ltbldarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
/ltblblue { 0.0 0.0 1.0 setrgbcolor fill } def
/ltbllightblue { 0.5 0.5 1.0 setrgbcolor fill } def
/ltbldarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
/ltblgreen { 0.0 1.0 0.0 setrgbcolor fill } def
/ltbllightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
/ltbldarkred { 0.5 0.0 0.0 setrgbcolor fill } def
/ltblred { 1.0 0.0 0.0 setrgbcolor fill } def
/ltbllightred { 1.0 0.5 0.5 setrgbcolor fill } def
/ltbldarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
/ltblcyan { 0.0 1.0 1.0 setrgbcolor fill } def
/ltbllightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
/ltbldarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
/ltblmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
/ltbllightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
/ltbldarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
/ltblyellow { 1.0 1.0 0.0 setrgbcolor fill } def
/ltbllightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
/ltbldarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
/ltblgray { 0.5 0.5 0.5 setrgbcolor fill } def
/ltbllightgray { 0.8 0.8 0.8 setrgbcolor fill } def
/ltbldarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
/ltblgrey { 0.5 0.5 0.5 setrgbcolor fill } def
/ltbllightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
/ltblblack { 0.0 0.0 0.0 setrgbcolor fill } def
/ltblwhite { 1.0 1.0 1.0 setrgbcolor fill } def
%%EndResource
%%BeginResource: procset LoutFigPrependGraphic
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/figf.lpg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PostScript @SysPrependGraphic file for @Fig Jeffrey H. Kingston %
% Version 2.0 (includes CIRCUM label) January 1992 %
% %
% To assist in avoiding name clashes, the names of all symbols %
% defined here begin with "lfig". However, this is not feasible %
% with user-defined labels and some labels used by users. %
% %
% <point> is two numbers, a point. %
% <length> is one number, a length %
% <angle> is one number, an angle in degrees %
% <dashlength> is one number, the preferred length of a dash %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
errordict begin
/handleerror
{
{ /Times-Roman findfont 8 pt scalefont setfont
0 setgray 4 pt 4 pt moveto
$error /errorname get
dup lfigdict exch known
{ lfigdict exch get }
{ 30 string cvs } ifelse
show
( Command: ) show
$error /command get 30 string cvs show
} stopped {} if
showpage stop
} def
end
% concat strings: <string> <string> lfigconcat <string>
% must be defined outside lfigdict since used in lfigpromotelabels
/lfigconcat
{ 2 copy length exch length add string
dup 0 4 index putinterval
dup 3 index length 3 index putinterval
3 1 roll pop pop
} def
% <string> lfigdebugprint -
% must be defined outside lfigdict since used in arbitrary places
% /lfigdebugprint
% { print
% (; operand stack:\n) print
% count copy
% count 2 idiv
% { ==
% (\n) print
% } repeat
% (\n) print
% } def
/lfigdict 120 dict def
lfigdict begin
% error messages
/dictfull (dictfull error: too many labels?) def
/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def
/execstackoverflow (execstackoverflow error: figure nested too deeply?) def
/limitcheck (limitcheck error: figure nested too deeply or too large?) def
/syntaxerror (syntaxerror error: syntax error in text of figure?) def
/typecheck (typecheck error: syntax error in text of figure?) def
/undefined (undefined error: unknown or misspelt label?) def
/VMError (VMError error: run out of memory?) def
% push pi onto stack: - lfigpi <num>
/lfigpi 3.14159 def
% arc directions
/clockwise false def
/anticlockwise true def
% maximum of two numbers: <num> <num> lfigmax <num>
/lfigmax { 2 copy gt { pop } { exch pop } ifelse } def
% minimum of two numbers: <num> <num> lfigmin <num>
/lfigmin { 2 copy lt { pop } { exch pop } ifelse } def
% add two points: <point> <point> lfigpadd <point>
/lfigpadd { exch 3 1 roll add 3 1 roll add exch } def
% subtract first point from second: <point> <point> lfigpsub <point>
/lfigpsub { 3 2 roll sub 3 1 roll exch sub exch } def
% max two points: <point> <point> lfigpmax <point>
/lfigpmax { exch 3 1 roll lfigmax 3 1 roll lfigmax exch } def
% min two points: <point> <point> lfigpmin <point>
/lfigpmin { exch 3 1 roll lfigmin 3 1 roll lfigmin exch } def
% scalar multiplication: <point> <num> lfigpmul <point>
/lfigpmul { dup 3 1 roll mul 3 1 roll mul exch } def
% point at angle and distance: <point> <length> <angle> lfigatangle <point>
/lfigatangle { 2 copy cos mul 3 1 roll sin mul lfigpadd } def
% angle from one point to another: <point> <point> lfigangle <angle>
/lfigangle { lfigpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
% distance between two points: <point> <point> lfigdistance <length>
/lfigdistance { lfigpsub dup mul exch dup mul add sqrt } def
% difference in x coords: <point> <point> lfigxdistance <length>
/lfigxdistance { pop 3 1 roll pop sub } def
%difference in y coords: <point> <point> lfigydistance <length>
/lfigydistance { 3 1 roll pop sub exch pop } def
% stroke a solid line: <length> <dashlength> lfigsolid -
/lfigsolid
{ pop pop [] 0 setdash stroke
} def
% stroke a lfigdashed line: <length> <dashlength> lfigdashed -
/lfigdashed
{ 2 copy div 2 le 1 index 0 le or
{ exch pop 1 pt lfigmax [ exch dup ] 0 setdash }
{ dup [ exch 4 2 roll 2 copy div
1 sub 2 div ceiling dup 4 1 roll
1 add mul sub exch div ] 0 setdash
} ifelse stroke
} def
% stroke a lfigcdashed line: <length> <dashlength> lfigcdashed -
/lfigcdashed
{ 2 copy le 1 index 0 le or
{ exch pop 1 pt lfigmax [ exch dup ] dup 0 get 2 div setdash }
{ dup [ 4 2 roll exch 2 copy exch div
2 div ceiling div 1 index sub
] exch 2 div setdash
} ifelse stroke
} def
% stroke a dotted line: <length> <dashlength> lfigdotted -
/lfigdotted
{ 2 copy le 1 index 0 le or
{ exch pop 1 pt lfigmax [ exch 0 exch ] 0 setdash }
{ 1 index exch div ceiling div
[ 0 3 2 roll ] 0 setdash
} ifelse stroke
} def
% stroke a noline line: <length> <dashlength> lfignoline -
/lfignoline
{ pop pop
} def
% painting (i.e. filling): - lfigwhite - (etc.)
/lfignopaint { } def
/lfignochange { fill } def
/lfigdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
/lfigblue { 0.0 0.0 1.0 setrgbcolor fill } def
/lfiglightblue { 0.5 0.5 1.0 setrgbcolor fill } def
/lfigdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
/lfiggreen { 0.0 1.0 0.0 setrgbcolor fill } def
/lfiglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
/lfigdarkred { 0.5 0.0 0.0 setrgbcolor fill } def
/lfigred { 1.0 0.0 0.0 setrgbcolor fill } def
/lfiglightred { 1.0 0.5 0.5 setrgbcolor fill } def
/lfigdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
/lfigcyan { 0.0 1.0 1.0 setrgbcolor fill } def
/lfiglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
/lfigdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
/lfigmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
/lfiglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
/lfigdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
/lfigyellow { 1.0 1.0 0.0 setrgbcolor fill } def
/lfiglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
/lfigdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
/lfiggray { 0.5 0.5 0.5 setrgbcolor fill } def
/lfiglightgray { 0.8 0.8 0.8 setrgbcolor fill } def
/lfigdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
/lfiggrey { 0.5 0.5 0.5 setrgbcolor fill } def
/lfiglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
/lfigblack { 0.0 0.0 0.0 setrgbcolor fill } def
/lfigwhite { 1.0 1.0 1.0 setrgbcolor fill } def
% line caps (and joins, not currently used)
/lfigbutt 0 def
/lfiground 1 def
/lfigprojecting 2 def
/lfigmiter 0 def
/lfigbevel 2 def
% shape and labels of the @Box symbol
/lfigbox
{
0 0 /SW lfigpointdef
xsize 0 /SE lfigpointdef
xsize ysize /NE lfigpointdef
0 ysize /NW lfigpointdef
SE 0.5 lfigpmul /S lfigpointdef
NW 0.5 lfigpmul /W lfigpointdef
W SE lfigpadd /E lfigpointdef
S NW lfigpadd /N lfigpointdef
NE 0.5 lfigpmul /CTR lfigpointdef
[ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef
SW SE NE NW SW
} def
% shape and labels of the @CurveBox symbol
/lfigcurvebox
{
xsize 0.5 mul ysize 0.5 mul /CTR lfigpointdef
xsize 0.5 mul 0 /S lfigpointdef
xsize ysize 0.5 mul /E lfigpointdef
xsize 0.5 mul ysize /N lfigpointdef
0 ysize 0.5 mul /W lfigpointdef
xmark 0.293 mul xmark 0.293 mul /SW lfigpointdef
xsize xmark 0.293 mul sub xmark 0.293 mul /SE lfigpointdef
xsize xmark 0.293 mul sub ysize xmark 0.293 mul sub /NE lfigpointdef
xmark 0.293 mul ysize xmark 0.293 mul sub /NW lfigpointdef
[ xsize ysize 0.5 lfigpmul xmark /lfigcurveboxcircum cvx ] lfigcircumdef
xmark 0
xsize xmark sub 0
[ xsize xmark sub xmark ]
xsize xmark
xsize ysize xmark sub
[ xsize xmark sub ysize xmark sub ]
xsize xmark sub ysize
xmark ysize
[ xmark ysize xmark sub ]
0 ysize xmark sub
0 xmark
[ xmark xmark ]
xmark 0
} def
% shadow of the @ShadowBox symbol
% its shape and labels are done, somewhat inaccurately, with lfigbox
/lfigshadow
{ xmark 2 mul 0 moveto xsize 0 lineto
xsize ysize xmark 2 mul sub lineto
xsize xmark sub ysize xmark 2 mul sub lineto
xsize xmark sub xmark lineto
xmark 2 mul xmark lineto closepath fill
} def
% shape and labels of the @Square symbol
/lfigsquare
{
xsize ysize 0.5 lfigpmul /CTR lfigpointdef
CTR xsize xsize ysize ysize lfigpmax 0.5 lfigpmul lfigpadd /NE lfigpointdef
CTR 0 0 CTR NE lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef
CTR 0 0 CTR NE lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef
CTR 0 0 CTR NE lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef
SW 0.5 lfigpmul SE 0.5 lfigpmul lfigpadd /S lfigpointdef
NW 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /N lfigpointdef
SW 0.5 lfigpmul NW 0.5 lfigpmul lfigpadd /W lfigpointdef
SE 0.5 lfigpmul NE 0.5 lfigpmul lfigpadd /E lfigpointdef
[ CTR NE lfigpsub /lfigboxcircum cvx ] lfigcircumdef
SW SE NE NW SW
} def
% shape and labels of the @Diamond symbol
/lfigdiamond
{
xsize 0 0.5 lfigpmul /S lfigpointdef
0 ysize 0.5 lfigpmul /W lfigpointdef
S W lfigpadd /CTR lfigpointdef
CTR W lfigpadd /N lfigpointdef
CTR S lfigpadd /E lfigpointdef
[ xsize ysize 0.5 lfigpmul /lfigdiamondcircum cvx ] lfigcircumdef
S E N W S
} def
% shape and labels of the @Ellipse symbol
/lfigellipse
{
xsize 0 0.5 lfigpmul /S lfigpointdef
0 ysize 0.5 lfigpmul /W lfigpointdef
S W lfigpadd /CTR lfigpointdef
CTR W lfigpadd /N lfigpointdef
CTR S lfigpadd /E lfigpointdef
CTR xsize 0 0.3536 lfigpmul lfigpadd 0 ysize 0.3536 lfigpmul lfigpadd /NE lfigpointdef
0 ysize 0.3536 lfigpmul CTR xsize 0 0.3536 lfigpmul lfigpadd lfigpsub /SE lfigpointdef
xsize 0 0.3536 lfigpmul CTR lfigpsub 0 ysize 0.3536 lfigpmul lfigpadd /NW lfigpointdef
0 ysize 0.3536 lfigpmul xsize 0 0.3536 lfigpmul CTR lfigpsub lfigpsub /SW lfigpointdef
[ xsize ysize 0.5 lfigpmul /lfigellipsecircum cvx ] lfigcircumdef
S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
} def
% shape and labels of the @Circle symbol
/lfigcircle
{
xsize ysize 0.5 lfigpmul /CTR lfigpointdef
CTR xsize 0 ysize 0 lfigpmax 0.5 lfigpmul lfigpadd /E lfigpointdef
CTR 0 0 CTR E lfigdistance 45 lfigatangle lfigpadd /NE lfigpointdef
CTR 0 0 CTR E lfigdistance 90 lfigatangle lfigpadd /N lfigpointdef
CTR 0 0 CTR E lfigdistance 135 lfigatangle lfigpadd /NW lfigpointdef
CTR 0 0 CTR E lfigdistance 180 lfigatangle lfigpadd /W lfigpointdef
CTR 0 0 CTR E lfigdistance 225 lfigatangle lfigpadd /SW lfigpointdef
CTR 0 0 CTR E lfigdistance 270 lfigatangle lfigpadd /S lfigpointdef
CTR 0 0 CTR E lfigdistance 315 lfigatangle lfigpadd /SE lfigpointdef
[ S E lfigpsub /lfigellipsecircum cvx ] lfigcircumdef
S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
} def
% shape and labels of the @HLine and @HArrow symbols
/lfighline
{
0 ymark lfigprevious /FROM lfigpointdef
xsize ymark lfigprevious /TO lfigpointdef
} def
% shape and labels of the @VLine and @VArrow symbols
/lfigvline
{
xmark ysize lfigprevious /FROM lfigpointdef
xmark 0 lfigprevious /TO lfigpointdef
} def
% points of a polygon around base with given no of sides, vert init angle:
% <sides> <angle> figpolygon <point> ... <point>
/lfigpolygon
{ xsize ysize 0.5 lfigpmul /CTR lfigpointdef
90 sub CTR 2 copy lfigmax 5 3 roll
[ 4 copy pop /lfigpolycircum cvx ] lfigcircumdef
exch dup 360 exch div exch
1 1 3 2 roll
{ 4 string cvs (P) exch lfigconcat cvn
6 copy pop pop lfigatangle 2 copy 10 2 roll
3 2 roll lfigpointdef
dup 3 1 roll add exch
} for
pop lfigatangle
} def
% next array element: <array> <index> lfiggetnext <array> <index> <any> true
% or <array> <index> false
/lfiggetnext
{ 2 copy exch length ge
{ false }
{ 2 copy get exch 1 add exch true } ifelse
} def
% check whether thing is number: <any> lfigisnumbertype <any> <bool>
/lfigisnumbertype
{ dup type dup
/integertype eq exch /realtype eq or
} def
% check whether thing is an array: <any> lfigisarraytype <any> <bool>
/lfigisarraytype { dup type /arraytype eq } def
% get next item: <array> <index> lfiggetnextitem <array> <index> 0
% or <array> <index> <array> 1
% or <array> <index> <point> 2
/lfiggetnextitem
{ lfiggetnext
{ lfigisarraytype
{ 1
}
{ lfigisnumbertype
{ 3 1 roll
lfiggetnext
{ lfigisnumbertype
{ 4 3 roll exch 2
}
{ pop 3 2 roll pop 0
} ifelse
}
{ 3 2 roll pop 0
} ifelse
}
{ pop 0
} ifelse
} ifelse
}
{ 0
} ifelse
} def
% set arc path: bool x1 y1 x2 y2 x0 y0 lfigsetarc <angle> <angle> <dist>
% the path goes from x1 y1 to x2 y2 about centre x0 y0,
% anticlockwise if bool is true else clockwise.
% The orientations of backwards pointing and forwards pointing
% arrowheads are returned in the two angles, and
% the length of the arc is returned in <dist>.
/lfigsetarc
{
20 dict begin
matrix currentmatrix 8 1 roll
2 copy translate 2 copy 8 2 roll
4 2 roll lfigpsub 6 2 roll lfigpsub
dup /y1 exch def dup mul /y1s exch def
dup /x1 exch def dup mul /x1s exch def
dup /y2 exch def dup mul /y2s exch def
dup /x2 exch def dup mul /x2s exch def
y1s y2s eq
{ -1
}
{ y1s x2s mul y2s x1s mul sub y1s y2s sub div
} ifelse
/da exch def
x1s x2s eq
{ -1
}
{ x1s y2s mul x2s y1s mul sub x1s x2s sub div
} ifelse
/db exch def
da 0 gt db 0 gt and
{ /LMax da sqrt db sqrt lfigmax def
/scalex da sqrt LMax div def
/scaley db sqrt LMax div def
scalex scaley scale
0 0 LMax
0 0 x1 scalex mul y1 scaley mul lfigangle
0 0 x2 scalex mul y2 scaley mul lfigangle
2 copy eq { 360 add } if
2 copy 8 2 roll
5 index { arc } { arcn } ifelse
2 index 1 index
{ 90 sub } { 90 add } ifelse
dup sin scaley mul exch cos scalex mul atan
2 index 2 index
{ 90 add } { 90 sub } ifelse
dup sin scaley mul exch cos scalex mul atan
5 2 roll % res1 res2 ang1 ang2 anticlockwise
{ exch sub } { sub } ifelse
dup 0 le { 360 add } if lfigpi mul LMax mul 180 div
}
{ 0 0 x1 y1 lfigdistance 0 0 x2 y2 lfigdistance eq
0 0 x1 y1 lfigdistance 0 gt and
{ 0 0
0 0 x1 y1 lfigdistance
0 0 x1 y1 lfigangle
0 0 x2 y2 lfigangle
2 copy eq { 360 add } if
2 copy 8 2 roll
5 index { arc } { arcn } ifelse
2 index 1 index
{ 90 sub } { 90 add } ifelse
2 index 2 index
{ 90 add } { 90 sub } ifelse
5 2 roll % res1 res2 ang1 ang2 clockwise
{ exch sub } { sub } ifelse
dup 0 le { 360 add } if lfigpi mul 0 0 x1 y1 lfigdistance mul 180 div
}
{ x2 y2 lineto pop
x2 y2 x1 y1 lfigangle
x1 y1 x2 y2 lfigangle
x1 y1 x2 y2 lfigdistance
} ifelse
} ifelse
4 -1 roll setmatrix
end
} def
% lfigsetcurve: set up a Bezier curve from x0 y0 to x3 y3
% and return arrowhead angles and length of curve (actually 0)
% x0 y0 x1 y1 x2 y2 x3 y3 lfigsetcurve <angle> <angle> <length>
/lfigsetcurve
{ 8 copy curveto pop pop
lfigangle
5 1 roll
4 2 roll lfigangle
exch
0
} def
% lfigpaintpath: paint a path of the given shape
% /paint [ shape ] lfigpaintpath -
/lfigpaintpath
{
10 dict begin
0 newpath
/prevseen false def
/curveseen false def
{ lfiggetnextitem
dup 0 eq { pop exit }
{ 1 eq
{ /curveseen true def
/curve exch def
curve length 0 eq { /curveseen false def } if
}
{ /ycurr exch def
/xcurr exch def
prevseen
{ curveseen
{ curve length 4 eq
{ xprev yprev
curve 0 get curve 1 get
curve 2 get curve 3 get
xcurr ycurr
lfigsetcurve pop pop pop
}
{ xprev yprev xcurr ycurr
curve length 1 ge { curve 0 get } { 0 } ifelse
curve length 2 ge { curve 1 get } { 0 } ifelse
curve length 3 ge { curve 2 get } { true } ifelse
7 1 roll
lfigsetarc pop pop pop
} ifelse
}
{ xcurr ycurr lineto
} ifelse
}
{ xcurr ycurr moveto
} ifelse
/xprev xcurr def
/yprev ycurr def
/prevseen true def
/curveseen false def
} ifelse
} ifelse
} loop pop pop cvx exec
end
} def
% stroke a path of the given shape in the given linestyle and dash length.
% Return the origin and angle of the backward and forward arrow heads.
% dashlength /linestyle [shape] lfigdopath [<point> <angle>] [<point> <angle>]
/lfigdopath
{
10 dict begin
0
/prevseen false def
/curveseen false def
/backarrow [] def
/fwdarrow [] def
{
lfiggetnextitem
dup 0 eq { pop exit }
{
1 eq
{ /curveseen true def
/curve exch def
curve length 0 eq { /prevseen false def } if
}
{ /ycurr exch def
/xcurr exch def
prevseen
{ newpath xprev yprev moveto
curveseen
{ curve length 4 eq
{ xprev yprev
curve 0 get curve 1 get
curve 2 get curve 3 get
xcurr ycurr lfigsetcurve
}
{ xprev yprev xcurr ycurr
curve length 1 ge { curve 0 get } { 0 } ifelse
curve length 2 ge { curve 1 get } { 0 } ifelse
curve length 3 ge { curve 2 get } { true } ifelse
7 1 roll
lfigsetarc
} ifelse
}
{ xcurr ycurr lineto
xcurr ycurr xprev yprev lfigangle dup 180 sub
xprev yprev xcurr ycurr lfigdistance
} ifelse
6 index 6 index cvx exec
[ xprev yprev 5 -1 roll ]
backarrow length 0 eq
{ /backarrow exch def }
{ pop } ifelse
[ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
} if
/xprev xcurr def
/yprev ycurr def
/prevseen true def
/curveseen false def
} ifelse
} ifelse
} loop
pop pop pop pop
backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse
fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse
end
} def
% lfigdoarrow: draw an arrow head of given form
% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] lfigdoarrow -
/lfigdoarrow
{ matrix currentmatrix 8 1 roll
dup 0 get 1 index 1 get translate
2 get rotate
[ 2 index neg 2 index 0 0
3 index 3 index neg
1 index 10 index mul 0
7 index 7 index ]
4 1 roll pop pop pop
dup 3 1 roll
gsave lfigpaintpath grestore lfigdopath pop pop
setmatrix
} def
% arrow head styles
/lfigopen 0.0 def
/lfighalfopen 0.5 def
/lfigclosed 1.0 def
% stroke no arrows, forward, back, and both
/lfignoarrow { pop pop pop pop pop pop pop pop } def
/lfigforward { 7 -1 roll lfigdoarrow pop } def
/lfigback { 8 -2 roll pop lfigdoarrow } def
/lfigboth { 8 -1 roll 7 copy lfigdoarrow pop 7 -1 roll lfigdoarrow } def
% lfigprevious: return previous point on path
/lfigprevious
{ lfigisnumbertype
{ 2 copy }
{ lfigisarraytype
{ 2 index 2 index }
{ 0 0 }
ifelse
} ifelse
} def
% label a point in 2nd top dictionary: <point> /name lfigpointdef -
/lfigpointdef
{
% (Entering lfigpointdef) lfigdebugprint
[ 4 2 roll transform
/itransform cvx ] cvx
currentdict end
3 1 roll
% currentdict length currentdict maxlength lt
% { def }
% { exec moveto (too many labels) show stop }
% ifelse
def
begin
% (Leaving lfigpointdef) lfigdebugprint
} def
% promote labels from second top to third top dictionary
% <string> lfigpromotelabels -
/lfigpromotelabels
{
% (Entering lfigpromotelabels) lfigdebugprint
currentdict end exch currentdict end
{ exch 20 string cvs 2 index
(@) lfigconcat exch lfigconcat cvn exch def
} forall pop begin
% (Leaving lfigpromotelabels) lfigdebugprint
} def
% show labels (except CIRCUM): - lfigshowlabels -
/lfigshowlabels
{
% (Entering lfigshowlabels) lfigdebugprint
currentdict end
currentdict
{ 1 index 20 string cvs (CIRCUM) search % if CIRCUM in key
{ pop pop pop pop pop }
{ pop cvx exec 2 copy
newpath 1.5 pt 0 360 arc
0 setgray fill
/Times-Roman findfont 8 pt scalefont setfont
moveto 0.2 cm 0.1 cm rmoveto 20 string cvs show
}
ifelse
} forall
begin
% (Leaving lfigshowlabels) lfigdebugprint
} def
% fix an angle to 0 <= res < 360: <angle> lfigfixangle <angle>
/lfigfixangle
{
% (Entering lfigfixangle) lfigdebugprint
{ dup 0 ge { exit } if
360 add
} loop
{ dup 360 lt { exit } if
360 sub
} loop
% (Leaving lfigfixangle) lfigdebugprint
} def
% find point on circumference of box: alpha a b lfigboxcircum x y
/lfigboxcircum
{
% (Entering lfigboxcircum) lfigdebugprint
4 dict begin
/b exch def
/a exch def
lfigfixangle /alpha exch def
0 0 a b lfigangle /theta exch def
% if alpha <= theta, return (a, a*tan(alpha))
alpha theta le
{ a a alpha sin mul alpha cos div }
{
% else if alpha <= 180 - theta, return (b*cot(alpha), b)
alpha 180 theta sub le
{ b alpha cos mul alpha sin div b }
{
% else if alpha <= 180 + theta, return (-a, -a*tan(alpha))
alpha 180 theta add le
{ a neg a neg alpha sin mul alpha cos div }
{
% else if alpha <= 360 - theta, return (-b*cot(alpha), -b)
alpha 360 theta sub le
{ b neg alpha cos mul alpha sin div b neg }
{
% else 360 - theta <= alpha, return (a, a*tan(alpha))
a a alpha sin mul alpha cos div
} ifelse
} ifelse
} ifelse
} ifelse
end
% (Leaving lfigboxcircum) lfigdebugprint
} def
% find quadratic roots (assume a != 0): a b c lfigqroots x1 x2 2
% or x2 1
% or 0
/lfigqroots
{
4 dict begin
/c exch def
/b exch def
/a exch def
/disc b b mul 4 a c mul mul sub def
disc 0 lt
{ 0
}
{ disc 0 eq
{ b neg 2 a mul div
1
}
{ b neg disc sqrt add 2 a mul div
b neg disc sqrt sub 2 a mul div
2
}
ifelse
}
ifelse
end
} def
% work our which quadrant: <angle> lfigquadrant <0-3>
/lfigquadrant
{ dup 90 lt
{ pop 0
}
{ dup 180 lt
{ pop 1
}
{ 270 lt
{ 2
}
{ 3
} ifelse
} ifelse
} ifelse
} def
% find curvebox circum, assuming upper right quadrant: alpha a b xmk lfigcb x y
/lfigcb
{
6 dict begin
/xmk exch def
/b exch def
/a exch def
/alpha exch def
/theta1 0 0 a b xmk sub lfigangle def
/theta2 0 0 a xmk sub b lfigangle def
alpha theta1 le
{ % if alpha <= theta1, return (a, a*tan(alpha))
a a alpha sin mul alpha cos div
}
{ alpha theta2 ge
{ % else if alpha > theta2, return (b*cot(alpha), b)
b alpha cos mul alpha sin div b
}
{
% else, return the intersection of line and circle
a xmk sub b xmk sub xmk 0 0 alpha lfigcircleintersect
dup 0 eq
{ % should never happen, just return any reasonable point
pop
a b 0.5 lfigpmul
}
{ 1 eq
{ % should never happen, just return the point on top of stack
}
{ % the usual case, two points on stack, return the larger
lfigpmax
} ifelse
} ifelse
} ifelse
} ifelse
end
} def
% find point on circumference of curvebox: alpha a b xmk lfigcurveboxcircum x y
/lfigcurveboxcircum
{
% (Entering lfigcurveboxcircum) lfigdebugprint
5 dict begin
/xmk exch def
/b exch def
/a exch def
lfigfixangle /alpha exch def
% work out which quadrant we are in, and reflect accordingly
/quad alpha lfigquadrant def
quad 0 eq
{ alpha a b xmk lfigcb
}
{ quad 1 eq
{ 180 alpha sub a b xmk lfigcb exch neg exch
}
{ quad 2 eq
{ alpha 180 sub a b xmk lfigcb neg exch neg exch
}
{ 360 alpha sub a b xmk lfigcb neg
} ifelse
} ifelse
} ifelse
end
% (Leaving lfigcurveboxcircum) lfigdebugprint
} def
% find point on circumference of diamond: alpha a b lfigdiamondcircum x y
/lfigdiamondcircum
{
% (Entering lfigdiamondcircum) lfigdebugprint
4 dict begin
/b exch def
/a exch def
lfigfixangle /alpha exch def
b alpha cos abs mul a alpha sin abs mul add /denom exch def
a b mul alpha cos mul denom div
a b mul alpha sin mul denom div
end
% (Leaving lfigdiamondcircum) lfigdebugprint
} def
% find point on circumference of ellipse: alpha a b lfigellipsecircum x y
/lfigellipsecircum
{
% (Entering lfigellipsecircum) lfigdebugprint
4 dict begin
/b exch def
/a exch def
lfigfixangle /alpha exch def
b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def
a b mul alpha cos mul denom div
a b mul alpha sin mul denom div
end
% (Leaving lfigellipsecircum) lfigdebugprint
} def
% find point of intersection of two lines each defined by two points
% x1 y1 x2 y2 x3 y3 x4 y4 lfiglineintersect x y
/lfiglineintersect
{
% (Entering lfiglineintersect) lfigdebugprint
13 dict begin
/y4 exch def
/x4 exch def
/y3 exch def
/x3 exch def
/y2 exch def
/x2 exch def
/y1 exch def
/x1 exch def
x2 x1 sub /x21 exch def
x4 x3 sub /x43 exch def
y2 y1 sub /y21 exch def
y4 y3 sub /y43 exch def
y21 x43 mul y43 x21 mul sub /det exch def
% calculate x
y21 x43 mul x1 mul
y43 x21 mul x3 mul sub
y3 y1 sub x21 mul x43 mul add
det div
% calculate y
x21 y43 mul y1 mul
x43 y21 mul y3 mul sub
x3 x1 sub y21 mul y43 mul add
det neg div
end
% (Leaving lfiglineintersect) lfigdebugprint
} def
% find point on circumference of polygon
% alpha radius num theta lfigpolycircum x y
/lfigpolycircum
{
% (Entering lfigpolycircum) lfigdebugprint
13 dict begin
/theta exch def
/num exch def
/radius exch def
/alpha exch def
% calculate delta, the angle from theta to alpha
alpha theta sub lfigfixangle
% calculate the angle which is the multiple of 360/num closest to delta
360 num div div truncate 360 num div mul theta add /anglea exch def
% calculate the next multiple of 360/num after anglea
anglea 360 num div add /angleb exch def
% intersect the line through these two points with the alpha line
anglea cos anglea sin angleb cos angleb sin
0 0 alpha cos 2 mul alpha sin 2 mul
lfiglineintersect radius lfigpmul
end
% (Leaving lfigpolycircum) lfigdebugprint
} def
% find point of intersection of a point and a circle
% x0 y0 r x1 y1 theta lfigcircleintersect xa ya xb yb 2
% or xb yb 1
% or 0
/lfigcircleintersect
{
% (Entering lfigcircleintersect) lfigdebugprint
15 dict begin
/theta exch def
/y1 exch def
/x1 exch def
/r exch def
/y0 exch def
/x0 exch def
% if sin(theta) = 0 then line is horizontal and y must be y1
theta sin abs 0.00001 lt
{
/a 1 def
/b -2 x0 mul def
/c x0 dup mul y1 y0 sub dup mul add r dup mul sub def
a b c lfigqroots dup
0 eq
{ pop
0
}
{ 1 eq
{ y1 1
}
{ y1 exch y1 2
} ifelse
} ifelse
}
{
/ct theta cos theta sin div def
/a ct ct mul 1 add def
/b ct x1 x0 sub mul y1 add y0 sub 2 mul def
/c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def
a b c lfigqroots dup
0 eq
{ pop
0
}
{ 1 eq
{ y1 add /yb exch def
yb y1 sub ct mul x1 add /xb exch def
xb yb 1
}
{ y1 add /ya exch def
ya y1 sub ct mul x1 add /xa exch def
y1 add /yb exch def
yb y1 sub ct mul x1 add /xb exch def
xa ya xb yb 2
} ifelse
} ifelse
} ifelse
end
% (Leaving lfigcircleintersect) lfigdebugprint
} def
% add CIRCUM operator with this body: <array> lfigcircumdef -
/lfigcircumdef
{ % (Entering lfigcircumdef) lfigdebugprint
/CIRCUM exch cvx
currentdict end
3 1 roll
% currentdict length currentdict maxlength lt
% { def }
% { exec moveto (too many labels) show stop }
% ifelse
def
begin
% (Leaving lfigcircumdef) lfigdebugprint
} def
end
%%EndResource
%%BeginResource: procset LoutGraphPrependGraphic
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/graphf.lpg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PostScript @SysPrependGraphic file for @Graph (Version 1.0) %
% %
% Version 1.0 by Jeffrey H. Kingston, December 1993. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
errordict begin
/handleerror
{
{ /Times-Roman findfont 8 pt scalefont setfont
0 setgray 4 pt 4 pt moveto
$error /errorname get
dup lgraphdict exch known
{ lgraphdict exch get }
{ 30 string cvs } ifelse
show
( Command: ) show
$error /command get 30 string cvs show
} stopped {} if
showpage stop
} def
end
/lgraphdict 200 dict def
lgraphdict begin
% error messages
/dictfull (dictfull error) def
/dictstackoverflow (dictstackoverflow error) def
/execstackoverflow (execstackoverflow error: expression too complex?) def
/limitcheck (limitcheck error: graph too complex or too large?) def
/syntaxerror (syntaxerror error: syntax error in text of graph?) def
/typecheck (typecheck error: syntax error in text of graph?) def
/undefined (undefined error: unknown or misspelt symbol?) def
/rangecheck (rangecheck error: undefined expression (e.g. divide by zero)?) def
/VMError (VMError error: run out of memory?) def
% random number between x and y inclusive: x y dorand num
/dorand { 1 index sub 1 add rand exch mod add } def
% log to given base: base num dolog num
/dolog { ln exch ln div } def
% maximum of two numbers: <num> <num> max <num>
/max { 2 copy gt { pop } { exch pop } ifelse } def
% add two points: <point> <point> padd <point>
/padd { exch 3 1 roll add 3 1 roll add exch } def
% subtract first point from second: <point> <point> psub <point>
/psub { 3 2 roll sub 3 1 roll exch sub exch } def
% distance between two points: <point> <point> distance <length>
/distance { psub dup mul exch dup mul add sqrt } def
% point at angle and distance: <point> <length> <angle> atangle <point>
/atangle { 2 copy cos mul 3 1 roll sin mul padd } def
% angle from one point to another: <point> <point> angle <angle>
/angle { psub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
% set up for line
% - linesetup <length> <dashlength>
/linesetup
{ newpath
xcurr ycurr trpoint xprev yprev trpoint
4 copy moveto lineto distance dashlength
} def
% set up for icon-avoiding line
% - ilinesetup <length> <dashlength>
/ilinesetup
{ newpath
xprev yprev trpoint xcurr ycurr trpoint 4 copy
4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle
6 2 roll 4 2 roll
4 copy angle symbolsize 1.5 mul exch 4 2 roll pop pop atangle
4 copy moveto lineto distance dashlength
} def
% stroke a solid line: <length> <dashlength> solid -
/solid
{ pop pop [] 0 setdash linewidth setlinewidth stroke
} def
% stroke a dashed line: <length> <dashlength> dashed -
/dashed
{ 2 copy 2 mul le 1 index 0 le or
{ exch pop 1 pt max [ exch dup ] 0 setdash }
{ dup [ exch 4 2 roll 2 copy div
1 sub 2 div ceiling dup 4 1 roll
1 add mul sub exch div ] 0 setdash
} ifelse linewidth setlinewidth stroke
} def
% stroke a cdashed line: <length> <dashlength> cdashed -
/cdashed
{ 2 copy le 1 index 0 le or
{ exch pop 1 pt max [ exch dup ] dup 0 get 2 div setdash }
{ dup [ 4 2 roll exch 2 copy exch div
2 div ceiling div 1 index sub
] exch 2 div setdash
} ifelse linewidth setlinewidth stroke
} def
% stroke a dotted line: <length> <dashlength> dotted -
/dotted
{ 2 copy le 1 index 0 le or
{ exch pop 1 pt max [ exch 0 exch ] 0 setdash }
{ 1 index exch div ceiling div 0.99999 mul
[ 0 3 2 roll ] 0 setdash
} ifelse gsave 1 setlinecap linewidth setlinewidth stroke grestore newpath
} def
% stroke a noline line: <length> <dashlength> noline -
/noline
{ pop pop
} def
% stroke a y histogram: - yhisto -
/yhisto
{ xprev yleft trpoint yextra sub moveto
xprev yprev trpoint lineto
xcurr yprev trpoint lineto
xcurr yleft trpoint yextra sub lineto
linewidth setlinewidth stroke
} def
% stroke an x histogram: - xhisto -
/xhisto
{ xleft yprev trpoint exch xextra sub exch moveto
xcurr yprev trpoint lineto
xcurr ycurr trpoint lineto
xleft ycurr trpoint exch xextra sub exch lineto
linewidth setlinewidth stroke
} def
% stroke a surface y histogram: - surfaceyhisto -
/surfaceyhisto
{ firstpair
{ xprev yleft trpoint yextra sub moveto
xprev yprev trpoint lineto
}
{ xprev yprev trpoint moveto
} ifelse
xcurr yprev trpoint lineto
lastpair
{ xcurr yleft trpoint yextra sub lineto
}
{ xcurr ycurr trpoint lineto
} ifelse
linewidth setlinewidth stroke
} def
% stroke a surface x histogram: - surfacexhisto -
/surfacexhisto
{ firstpair
{ xleft yprev trpoint exch xextra sub exch moveto
}
{ xprev yprev trpoint moveto
} ifelse
xcurr yprev trpoint lineto
xcurr ycurr trpoint lineto
lastpair
{ xleft ycurr trpoint exch xextra sub exch lineto
} if
linewidth setlinewidth stroke
} def
% stroke a filled y histogram: - filledyhisto -
/filledyhisto
{
linewidth setlinewidth
xprev yleft trpoint exch currentlinewidth 2 div add exch yextra sub moveto
xprev yprev trpoint exch currentlinewidth 2 div add exch lineto
xcurr yprev trpoint exch currentlinewidth 2 div sub exch lineto
xcurr yleft trpoint exch currentlinewidth 2 div sub exch yextra sub lineto
closepath fill
} def
% stroke a filled x histogram: - filledxhisto -
/filledxhisto
{
linewidth setlinewidth
xleft yprev trpoint currentlinewidth 2 div add exch xextra sub exch moveto
xcurr yprev trpoint currentlinewidth 2 div add lineto
xcurr ycurr trpoint currentlinewidth 2 div sub lineto
xleft ycurr trpoint currentlinewidth 2 div sub exch xextra sub exch lineto
closepath fill
} def
% cross: show a small cross
/cross
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg symbolsize neg rmoveto
symbolsize 2 mul symbolsize 2 mul rlineto
0 symbolsize -2 mul rmoveto
symbolsize -2 mul symbolsize 2 mul rlineto
[] 0 setdash stroke
} def
% plus: show a small plus
/plus
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg 0 rmoveto
symbolsize 2 mul 0 rlineto
symbolsize neg symbolsize neg rmoveto
0 symbolsize 2 mul rlineto
[] 0 setdash stroke
} def
% square: show a small square
/square
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg symbolsize neg rmoveto
symbolsize 2 mul 0 rlineto
0 symbolsize 2 mul rlineto
symbolsize -2 mul 0 rlineto
closepath [] 0 setdash stroke
} def
% filledsquare: show a small filled square
/filledsquare
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg symbolsize neg rmoveto
symbolsize 2 mul 0 rlineto
0 symbolsize 2 mul rlineto
symbolsize -2 mul 0 rlineto
closepath gsave [] 0 setdash stroke grestore fill
} def
% diamond: show a small diamond
/diamond
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg 0 rmoveto
symbolsize symbolsize neg rlineto
symbolsize symbolsize rlineto
symbolsize neg symbolsize rlineto
closepath [] 0 setdash stroke
} def
% filleddiamond: show a small filled diamond
/filleddiamond
{ newpath
xcurr ycurr trpoint moveto
symbolsize neg 0 rmoveto
symbolsize symbolsize neg rlineto
symbolsize symbolsize rlineto
symbolsize neg symbolsize rlineto
closepath gsave [] 0 setdash stroke grestore fill
} def
% circle: show a small circle
/circle
{ newpath
xcurr ycurr trpoint symbolsize 0 360 arc [] 0 setdash stroke
} def
% filledcircle: show a small filled circle
/filledcircle
{ newpath
xcurr ycurr trpoint symbolsize 0 360 arc gsave [] 0 setdash stroke grestore fill
} def
% triangle: show a small triangle
/triangle
{ newpath
xcurr ycurr trpoint moveto
0 symbolsize 1.5 mul rmoveto
symbolsize neg symbolsize -2.5 mul rlineto
symbolsize 2 mul 0 rlineto
closepath [] 0 setdash stroke
} def
% filledtriangle: show a small filled triangle
/filledtriangle
{ newpath
xcurr ycurr trpoint moveto
0 symbolsize 1.5 mul rmoveto
symbolsize neg symbolsize -2.5 mul rlineto
symbolsize 2 mul 0 rlineto
closepath gsave [] 0 setdash stroke grestore fill
} def
%plog: like log only with a base, and protected from failing if <= 0
% base x plog res
/plog { dup 0 le { pop pop 0 } { ln exch ln div } ifelse } def
% xtr: transform one x value logarithmically if xlog > 1
% <num> xtr <num>
/xtr
{ xlog 1 gt
{ xlog exch plog
} if
} def
% ytr: transform one y value logarithmically if ylog > 1
% <num> ytr <num>
/ytr
{ ylog 1 gt
{ ylog exch plog
} if
} def
% % trpoint: transform (x, y) in graph space into (x', y') in print space
% % x y trpoint x' y'
% /trpoint
% { exch xtr trxmin sub trxmax trxmin sub div xwidth mul xextra add
% exch ytr trymin sub trymax trymin sub div ywidth mul yextra add
% } def
% trpoint: transform (x, y) in graph space into (x', y') in print space
% x y trpoint x' y'
/trpoint
{ exch xtr xdecr { trxmax exch sub } { trxmin sub } ifelse
trxmax trxmin sub div xwidth mul xextra add
exch ytr ydecr { trymax exch sub } { trymin sub } ifelse
trymax trymin sub div ywidth mul yextra add
} def
% yonly: interpolate x values 1, 2, ... into data
% [ data ] yonly [ newdata ]
/yonly
{ dup /tmp exch def
length [ exch 1 exch 1 exch
{ dup tmp exch 1 sub get
} for
]
} def
% xonly: interpolate y values 1, 2, ... into data
% [ data ] yonly [ newdata ]
/xonly
{ dup /tmp exch def
length [ exch 1 exch 1 exch
{ dup tmp exch 1 sub get exch
} for
]
} def
% xandy: no interpolation of x or y values
% [ data ] xandy [ data ]
/xandy {} def
% expstringwidth: calculate width of string containing optional exponent
% <string> expstringwidth <width>
/expstringwidth
{ (^) search
{ exch pop stringwidth pop exch stringwidth pop 0.7 mul add }
{ stringwidth pop }
ifelse
} def
% expstringshow: show string containing optional exponent
% <string> expstringshow -
/expstringshow
{ (^) search
{ exch pop show 0 0.5 ft rmoveto
gsave currentfont 0.7 scalefont setfont show grestore
}
{ show
}
ifelse
} def
% concatenate two strings: <string> <string> strconcat <string>
/strconcat
{ 2 copy length exch length add string
dup 0 4 index putinterval
dup 3 index length 3 index putinterval
3 1 roll pop pop
} def
% lgen: generate one label automatically
% num lgen num string
/lgen { dup 20 string cvs } def
% loglgen: generate one logarithmic label (with exponent)
% <base> <exponent> loglgen <string>
/loglgen
{ 20 string cvs exch 20 string cvs
(^) strconcat exch strconcat
} def
% printxtick: print one x tick
% xpos printxtick -
/printxtick
{ newpath
yleft trpoint moveto 0 yextra neg rmoveto
0 xticklength neg rlineto [] 0 setdash stroke
} def
% printxlabel: print one x label
% (xlabel) xpos printxlabel -
/printxlabel
{ yleft trpoint moveto 0 yextra neg rmoveto
0 xticklength neg rmoveto 0 0.9 ft neg rmoveto
xlog 1 gt { 0 0.3 ft neg rmoveto } if
dup expstringwidth -2 div 0 rmoveto expstringshow
} def
% printytick: print one y tick
% ypos printytick -
/printytick
{ newpath
xleft exch trpoint moveto xextra neg 0 rmoveto
yticklength neg 0 rlineto [] 0 setdash stroke
} def
% printylabel: print one y label
% (ylabel) ypos printylabel -
/printylabel
{ xleft exch trpoint moveto xextra neg 0 rmoveto
yticklength neg 0 rmoveto -0.3 ft -0.3 ft rmoveto
dup expstringwidth neg 0 rmoveto expstringshow
} def
% printrtick: print one r tick
% ypos printrtick -
/printrtick
{ newpath
xright exch trpoint moveto xextra 0 rmoveto
rticklength 0 rlineto [] 0 setdash stroke
} def
% printrlabel: print one r label
% (rlabel) ypos printrlabel -
/printrlabel
{ xright exch trpoint moveto xextra 0 rmoveto
rticklength 0 rmoveto 0.3 ft -0.3 ft rmoveto
expstringshow
} def
% printticks: print ticks and labels
% /tickproc /labelproc [ tickandlabeldata ] min printticks -
/printticks
{ /prev exch def
{ dup type dup dup /integertype eq exch /realtype eq or
{ pop dup /prev exch def 2 index cvx exec
}
{ /stringtype eq
{ prev 2 index cvx exec
}
{ pop
} ifelse
} ifelse
} forall
pop pop
} def
% printxaxistick: print one x axis tick
% xpos printxaxistick -
/printxaxistick
{ newpath
yaxis trpoint moveto 0 xticklength -2 div rmoveto
0 xticklength rlineto [] 0 setdash stroke
} def
% printxaxislabel: print one x axis label
% (xlabel) xpos printxaxislabel -
/printxaxislabel
{ yaxis trpoint moveto
0 xticklength -2 div rmoveto 0 0.9 ft neg rmoveto
xlog 1 gt { 0 0.3 ft neg rmoveto } if
dup expstringwidth -2 div 0 rmoveto expstringshow
} def
% printyaxistick: print one y axis tick
% ypos printyaxistick -
/printyaxistick
{ newpath
xaxis exch trpoint moveto
yticklength -2 div 0 rmoveto
yticklength 0 rlineto [] 0 setdash stroke
} def
% printyaxislabel: print one y axis label
% (ylabel) ypos printyaxislabel -
/printyaxislabel
{ xaxis exch trpoint moveto
yticklength -2 div 0 rmoveto -0.3 ft -0.3 ft rmoveto
dup expstringwidth neg 0 rmoveto expstringshow
} def
% <val> minmax -
% perform minv := min(minv, val); maxv := max(maxv, val)
% allowing for the possibility of minv, maxv, val being false (undefined)
/minmax
{ dup false eq
{ pop }
{ minv false eq
{ dup /minv exch def /maxv exch def }
{ dup minv lt
{ /minv exch def }
{ dup maxv gt
{ /maxv exch def }
{ pop }
ifelse
} ifelse
} ifelse
} ifelse
} def
% <ticks> ticksundef <ticks> <bool>
% returns true iff the ticks array is undefined (one false entry)
/ticksundef
{ dup length 1 eq
{ dup 0 get false eq
}
{ false }
ifelse
} def
% <number> integral <boolean>
% true if the number has an integral value
/integral { dup round eq } def
% ticksep ticks xory alldata minval maxval axis base ticksandlimits ticks min max base
% ticksandlimits: sort out value of x or y ticks and limits and log base
/ticksandlimits
{ /base exch def
/minv false def
/maxv false def
% min and max of user-supplied minval, maxval, and axis
minmax minmax minmax
% min and max of data points
{ 0 get dup dup length 1 sub 3 index exch 2 exch
{ get minmax dup
} for pop pop
} forall
pop dup
% min and max of tick values
{ dup type /stringtype eq
{ pop } { minmax } ifelse
} forall
% fix minv and maxv if undefined (false) or equal
minv false eq
{ /minv -1 def /maxv 1 def }
{ minv maxv eq
{ minv 0 lt
{ /minv 2 minv mul def /maxv 0 def
}
{ minv 0 eq
{ /minv -1 def /maxv 1 def
}
{ /minv 0 def /maxv 2 maxv mul def
} ifelse
} ifelse
} if
} ifelse
% invent ticks if undefined
ticksundef
{ pop /ticksep exch def
% if base is reasonable and minv is positive, logarithmic ticks
base 1 gt minv 0 gt and
{
% get integral log of minv and maxv
/logminv base minv plog floor cvi def
/logmaxv base maxv plog ceiling cvi def
% if minv close to base, make it 1; reset minv and maxv
logminv 1 eq logmaxv 4 ge and { /logminv 0 def } if
/minv base logminv exp def
/maxv base logmaxv exp def
% ticks := [ base**logminv, ... , base**logmaxv ]
[ logminv 1 logmaxv
{ dup base exch exp
exch base exch loglgen
} for
]
}
{ % non-logarithmic ticks
{
% fix tick separation if undefined (0) or too small
/base 0 def
/delta maxv minv sub def
ticksep delta 30 div le
{ /ticksep 10 delta log 1 sub ceiling exp def
ticksep delta 2 div ge
{ /ticksep ticksep 2 div def }
{ ticksep delta 5 div lt
{ /ticksep 2 ticksep mul def
} if
} ifelse
} if
% adjust minv and maxv to be multiples of ticksep
/minv minv ticksep div floor ticksep mul def
/maxv maxv ticksep div ceiling ticksep mul def
/delta maxv minv sub def
% if minv or maxv near zero, move to zero and redo
minv ticksep eq
{ /minv 0 def }
{ maxv ticksep neg eq { /maxv 0 def } { exit } ifelse
} ifelse
} loop
% if minv, maxv, and ticksep are all integral, set "makeint" to true
/makeint minv integral maxv integral ticksep integral and and def
% ticks := [ minv, minv+ticksep, ... , maxv ]
[ 0 1 delta ticksep div round
{ ticksep mul minv add makeint { cvi } if lgen }
for
]
} ifelse
}
{ exch pop
} ifelse
minv maxv base
} def
% xset: set up all data for x axis, including limits and ticks
% xticksep xticks 0 alldata xmin xmax xlog xextra xdecr xaxis xticklength xset -
/xset
{ /xticklength exch def
/xaxis exch def
/xdecr exch def
/xextra exch def
xaxis exch ticksandlimits
/xlog exch def /xmax exch def /xmin exch def /xticks exch def
/xleft xdecr { xmax } { xmin } ifelse def
/xright xdecr { xmin } { xmax } ifelse def
/xwidth xsize xextra 2 mul sub def
/trxmin xmin xtr def /trxmax xmax xtr def
} def
% yset: set up all data for y axis, including limits and yticks
% yticksep yticks 0 alldata ymin ymax ylog yextra ydecr yaxis yticklength yset -
/yset
{ /yticklength exch def
/yaxis exch def
/ydecr exch def
/yextra exch def
yaxis exch ticksandlimits
/ylog exch def /ymax exch def /ymin exch def /yticks exch def
/yleft ydecr { ymax } { ymin } ifelse def
/yright ydecr { ymin } { ymax } ifelse def
/ywidth ysize yextra 2 mul sub def
/trymin ymin ytr def /trymax ymax ytr def
} def
% rset: set up all data for y axis (again), but including limits and rticks
% rticksep rticks 0 alldata ymin ymax ylog yextra ydecr yaxis rticklength rset -
/rset
{ /rticklength exch def
/yaxis exch def
/ydecr exch def
/yextra exch def
yaxis exch ticksandlimits
/ylog exch def /ymax exch def /ymin exch def /rticks exch def
/yleft ydecr { ymax } { ymin } ifelse def
/yright ydecr { ymin } { ymax } ifelse def
/ywidth ysize yextra 2 mul sub def
/trymin ymin ytr def /trymax ymax ytr def
} def
% norset: set up data for no rticks
% - norset -
/norset
{ /rticklength 0 def
/rticks [] def
} def
% framestyle: print a frame around the graph
/framestyle
{ 0 0 moveto xsize 0 lineto xsize ysize lineto
0 ysize lineto closepath stroke
/printxtick /printxlabel xticks xleft printticks
/printytick /printylabel yticks ymin printticks
/printrtick /printrlabel rticks ymin printticks
} def
% nonestyle: print nothing around the graph
/nonestyle
{
} def
% axesstyle: print axes for the graph (unless axis values missing)
/axesstyle
{
xaxis false eq yaxis false eq or
{ framestyle }
{ xaxis yaxis trpoint dup 0 exch moveto xsize exch lineto
dup 0 moveto ysize lineto stroke
/printxaxistick /printxaxislabel xticks xleft printticks
/printyaxistick /printyaxislabel yticks ymin printticks
} ifelse
} def
% rundata: run all data sets
/rundata
{ alldata
{ gsave
dup dup dup dup
4 get /dopaint exch def
3 get /initrun exch def
2 get /pairs exch def
1 get /points exch def
0 get /data exch def
dopaint
{ data length 4 ge
{ initrun
newpath
data 0 get ymin trpoint yextra sub moveto
0 2 data length 2 sub
{ dup 1 add
data exch get /ycurr exch def
data exch get /xcurr exch def
xcurr ycurr trpoint lineto
} for
data dup length 2 sub get ymin trpoint yextra sub lineto
closepath fill
} if
} if
initrun
data length 2 ge
{
/xcurr data 0 get def
/ycurr data 1 get def
points
data length 4 ge
{ 2 2 data length 2 sub
{ /xprev xcurr def
/yprev ycurr def
dup dup 2 eq /firstpair exch def
data length 2 sub eq /lastpair exch def
dup 1 add
data exch get /ycurr exch def
data exch get /xcurr exch def
pairs
points
} for
} if
} if
grestore
} forall
} def
end
%%EndResource
%%BeginResource: procset LoutFigPrependGraphic
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/diagf.lpg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% PostScript @SysPrependGraphic file for @Diag Jeffrey H. Kingston %
% Version 2.0 (includes CIRCUM label) September 1996 %
% %
% To assist in avoiding name clashes, the names of all symbols %
% defined here begin with "ldiag". However, this is not feasible %
% with user-defined labels and some labels used by users. %
% %
% <point> is two numbers, a point. %
% <length> is one number, a length %
% <angle> is one number, an angle in degrees %
% <dashlength> is one number, the preferred length of a dash %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
errordict begin
/handleerror
{
{ /Times-Roman findfont 8 pt scalefont setfont
0 setgray 4 pt 4 pt moveto
$error /errorname get
dup ldiagdict exch known
{ ldiagdict exch get }
{ 50 string cvs } ifelse
show
( Command: ) show
$error /command get 50 string cvs show
} stopped {} if
showpage stop
} def
end
% begin diagram: <maxlabels> ldiagbegin -
% must be defined outside ldiagdict since it loads it
/ldiagbegin
{ xsize 0 0 ysize ldiagdict begin
5 -1 roll /ldiagmaxlabels exch def
(@Diag) ldiagpushtagdict
/OOY ldiagpointdef /OOX ldiagpointdef 0 0 /OOO ldiagpointdef
} def
% end diagram: - ldiagend -
/ldiagend
{ ldiagpoptagdict end
} def
% concat strings: <string> <string> ldiagconcat <string>
% must be defined outside ldiagdict since used in ldiagpromotelabels
/ldiagconcat
{ 2 copy length exch length add string
dup 0 4 index putinterval
dup 3 index length 3 index putinterval
3 1 roll pop pop
} def
/ldiagdebugposy 432 def
/ldiagdebugposx 72 def
% <string> <int> ldiagdebugprint -
% must be defined outside ldiagdict since used in arbitrary places
% print count or <int> stack entries, which ever is the smaller
/ldiagdebugprint
{
exch
gsave
initgraphics
ldiagdebugposy 72 lt
{ /ldiagdebugposx ldiagdebugposx 144 add store
/ldiagdebugposy 432 store
}
{
/ldiagdebugposy ldiagdebugposy 12 sub store
} ifelse
ldiagdebugposx ldiagdebugposy moveto
/Times-Roman findfont 10 scalefont setfont
0 setgray show
count 1 sub 2 copy lt { pop } { exch pop } ifelse 1 sub
0 exch 1 exch
{
/ldiagdebugposy ldiagdebugposy 12 sub store
ldiagdebugposx 12 add ldiagdebugposy moveto
index 50 string cvs show
} for
grestore
} def
/ldiagdict 200 dict def
ldiagdict begin
% error messages
/dictfull (dictfull error: too many labels?) def
/dictstackoverflow (dictstackoverflow error: labels nested too deeply?) def
/execstackoverflow (execstackoverflow error: figure nested too deeply?) def
/limitcheck (limitcheck error: figure nested too deeply or too large?) def
/syntaxerror (syntaxerror error: syntax error in text of figure?) def
/typecheck (typecheck error: syntax error in text of figure?) def
/undefined (undefined error: unknown or misspelt label?) def
/VMError (VMError error: run out of memory?) def
% push pi onto stack: - ldiagpi <num>
/ldiagpi 3.14159 def
% push e onto stack: - ldiage <num>
/ldiage 2.71828 def
% arc directions
/clockwise false def
/anticlockwise true def
% test equality between two angles: <angle> <angle> ldiagangleeq <bool>
/ldiagangleeq { ldiagfixangle exch ldiagfixangle eq } def
% test inequality between two angles: <angle> <angle> ldiaganglene <bool>
/ldiaganglene { ldiagangleeq not } def
% maximum of two numbers: <num> <num> ldiagmax <num>
/ldiagmax { 2 copy gt { pop } { exch pop } ifelse } def
% minimum of two numbers: <num> <num> ldiagmin <num>
/ldiagmin { 2 copy lt { pop } { exch pop } ifelse } def
% add two points: <point> <point> ldiagpadd <point>
/ldiagpadd
{
% (Entering padd) 4 ldiagdebugprint
exch 3 1 roll add 3 1 roll add exch
% (Leaving padd) 2 ldiagdebugprint
} def
% subtract first point from second: <point> <point> ldiagpsub <point>
/ldiagpsub { 3 2 roll sub 3 1 roll exch sub exch } def
% max two points: <point> <point> ldiagpmax <point>
/ldiagpmax { exch 3 1 roll ldiagmax 3 1 roll ldiagmax exch } def
% min two points: <point> <point> ldiagpmin <point>
/ldiagpmin { exch 3 1 roll ldiagmin 3 1 roll ldiagmin exch } def
% scalar multiplication: <point> <num> ldiagpmul <point>
/ldiagpmul { dup 3 1 roll mul 3 1 roll mul exch } def
% point at angle and distance: <point> <length> <angle> ldiagatangle <point>
/ldiagatangle { 2 copy cos mul 3 1 roll sin mul ldiagpadd } def
% angle from one point to another: <point> <point> ldiagangleto <angle>
/ldiagangleto { ldiagpsub 2 copy 0 eq exch 0 eq and {pop} {exch atan} ifelse } def
% distance between two points: <point> <point> ldiagdistance <length>
/ldiagdistance { ldiagpsub dup mul exch dup mul add sqrt } def
% stroke a solid line: <length> <dashlength> ldiagsolid -
/ldiagsolid
{ pop pop [] 0 setdash 1 setlinecap stroke
} def
% stroke a dashed line: <length> <dashlength> ldiagdashed -
/ldiagdashed
{ 2 copy div 2 le 1 index 0 le or
{ exch pop 1 pt ldiagmax [ exch dup ] 0 setdash }
{ dup [ exch 4 2 roll 2 copy div
1 sub 2 div ceiling dup 4 1 roll
1 add mul sub exch div ] 0 setdash
} ifelse 0 setlinecap stroke
} def
% stroke a cdashed line: <length> <dashlength> ldiagcdashed -
/ldiagcdashed
{ % (Entering ldiagcdashed) 2 ldiagdebugprint
2 copy le 1 index 0 le or
{ exch pop 1 pt ldiagmax [ exch dup ] dup 0 get 2 div setdash }
{ dup [ 4 2 roll exch 2 copy exch div
2 div ceiling div 1 index sub
] exch 2 div setdash
} ifelse 0 setlinecap stroke
% (Leaving ldiagcdashed) 0 ldiagdebugprint
} def
% stroke a dotted line: <length> <dashlength> ldiagdotted -
/ldiagdotted
{ 2 copy le 1 index 0 le or
{ exch pop 1 pt ldiagmax [ exch 0 exch ] 0 setdash }
{ 1 index exch div ceiling div
[ 0 3 2 roll ] 0 setdash
} ifelse 1 setlinecap stroke
} def
% stroke a noline line: <length> <dashlength> ldiagnoline -
/ldiagnoline
{ pop pop
} def
% painting (i.e. filling): - ldiagwhite - (etc.)
/ldiagnopaint { } def
/ldiagnochange { fill } def
/ldiagdarkblue { 0.0 0.0 0.5 setrgbcolor fill } def
/ldiagblue { 0.0 0.0 1.0 setrgbcolor fill } def
/ldiaglightblue { 0.5 0.5 1.0 setrgbcolor fill } def
/ldiagdarkgreen { 0.0 0.5 0.0 setrgbcolor fill } def
/ldiaggreen { 0.0 1.0 0.0 setrgbcolor fill } def
/ldiaglightgreen { 0.5 1.0 0.5 setrgbcolor fill } def
/ldiagdarkred { 0.5 0.0 0.0 setrgbcolor fill } def
/ldiagred { 1.0 0.0 0.0 setrgbcolor fill } def
/ldiaglightred { 1.0 0.5 0.5 setrgbcolor fill } def
/ldiagdarkcyan { 0.0 0.5 0.5 setrgbcolor fill } def
/ldiagcyan { 0.0 1.0 1.0 setrgbcolor fill } def
/ldiaglightcyan { 0.5 1.0 1.0 setrgbcolor fill } def
/ldiagdarkmagenta { 0.5 0.0 0.5 setrgbcolor fill } def
/ldiagmagenta { 1.0 0.0 1.0 setrgbcolor fill } def
/ldiaglightmagenta { 1.0 0.5 1.0 setrgbcolor fill } def
/ldiagdarkyellow { 0.5 0.5 0.0 setrgbcolor fill } def
/ldiagyellow { 1.0 1.0 0.0 setrgbcolor fill } def
/ldiaglightyellow { 1.0 1.0 0.5 setrgbcolor fill } def
/ldiagdarkgray { 0.2 0.2 0.2 setrgbcolor fill } def
/ldiaggray { 0.5 0.5 0.5 setrgbcolor fill } def
/ldiaglightgray { 0.8 0.8 0.8 setrgbcolor fill } def
/ldiagdarkgrey { 0.2 0.2 0.2 setrgbcolor fill } def
/ldiaggrey { 0.5 0.5 0.5 setrgbcolor fill } def
/ldiaglightgrey { 0.8 0.8 0.8 setrgbcolor fill } def
/ldiagblack { 0.0 0.0 0.0 setrgbcolor fill } def
/ldiagwhite { 1.0 1.0 1.0 setrgbcolor fill } def
% shape and labels of the @Box symbol
/ldiagbox
{
0 0 /SW ldiagpointdef
xsize 0 /SE ldiagpointdef
xsize ysize /NE ldiagpointdef
0 ysize /NW ldiagpointdef
SE 0.5 ldiagpmul /S ldiagpointdef
NW 0.5 ldiagpmul /W ldiagpointdef
W SE ldiagpadd /E ldiagpointdef
S NW ldiagpadd /N ldiagpointdef
NE 0.5 ldiagpmul /CTR ldiagpointdef
0 dg /S@ANGLE ldiagangledef
45 dg /SE@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
135 dg /NE@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
225 dg /NW@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
315 dg /SW@ANGLE ldiagangledef
[ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef
SW SE NE NW SW
} def
% shape and labels of the @CurveBox symbol
% <margin> ldiagcurvebox <shape>
/ldiagcurvebox
{
% (Entering ldiagcurvebox) 1 ldiagdebugprint
ldiagdecodelength /cbmgn exch def
xsize 0.5 mul ysize 0.5 mul /CTR ldiagpointdef
xsize 0.5 mul 0 /S ldiagpointdef
xsize ysize 0.5 mul /E ldiagpointdef
xsize 0.5 mul ysize /N ldiagpointdef
0 ysize 0.5 mul /W ldiagpointdef
cbmgn 0.293 mul cbmgn 0.293 mul /SW ldiagpointdef
xsize cbmgn 0.293 mul sub cbmgn 0.293 mul /SE ldiagpointdef
xsize cbmgn 0.293 mul sub ysize cbmgn 0.293 mul sub /NE ldiagpointdef
cbmgn 0.293 mul ysize cbmgn 0.293 mul sub /NW ldiagpointdef
0 dg /S@ANGLE ldiagangledef
45 dg /SE@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
135 dg /NE@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
225 dg /NW@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
315 dg /SW@ANGLE ldiagangledef
[ xsize ysize 0.5 ldiagpmul cbmgn /ldiagcurveboxcircum cvx ] ldiagcircumdef
cbmgn 0
xsize cbmgn sub 0
[ xsize cbmgn sub cbmgn ]
xsize cbmgn
xsize ysize cbmgn sub
[ xsize cbmgn sub ysize cbmgn sub ]
xsize cbmgn sub ysize
cbmgn ysize
[ cbmgn ysize cbmgn sub ]
0 ysize cbmgn sub
0 cbmgn
[ cbmgn cbmgn ]
cbmgn 0
% (Leaving ldiagcurvebox) 0 ldiagdebugprint
} def
% shadow of the @ShadowBox symbol
% its shape and labels are done, somewhat inaccurately, with ldiagbox
% <shadowmargin> ldiagshadow -
/ldiagshadow
{
/lfshm exch def
lfshm 0 moveto
0 lfshm neg rlineto
xsize 0 rlineto
0 ysize rlineto
lfshm neg 0 rlineto
xsize 0 lineto
closepath fill
} def
% shape and labels of the @Square symbol
/ldiagsquare
{
xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
CTR xsize xsize ysize ysize ldiagpmax 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef
CTR 0 0 CTR NE ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef
CTR 0 0 CTR NE ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef
CTR 0 0 CTR NE ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef
SW 0.5 ldiagpmul SE 0.5 ldiagpmul ldiagpadd /S ldiagpointdef
NW 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /N ldiagpointdef
SW 0.5 ldiagpmul NW 0.5 ldiagpmul ldiagpadd /W ldiagpointdef
SE 0.5 ldiagpmul NE 0.5 ldiagpmul ldiagpadd /E ldiagpointdef
0 dg /S@ANGLE ldiagangledef
45 dg /SE@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
135 dg /NE@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
225 dg /NW@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
315 dg /SW@ANGLE ldiagangledef
[ CTR NE ldiagpsub /ldiagboxcircum cvx ] ldiagcircumdef
SW SE NE NW SW
} def
% shape and labels of the @Diamond symbol
/ldiagdiamond
{
xsize 0 0.5 ldiagpmul /S ldiagpointdef
0 ysize 0.5 ldiagpmul /W ldiagpointdef
S W ldiagpadd /CTR ldiagpointdef
CTR W ldiagpadd /N ldiagpointdef
CTR S ldiagpadd /E ldiagpointdef
E N ldiagpadd 0.5 ldiagpmul /NE ldiagpointdef
N W ldiagpadd 0.5 ldiagpmul /NW ldiagpointdef
S W ldiagpadd 0.5 ldiagpmul /SW ldiagpointdef
S E ldiagpadd 0.5 ldiagpmul /SE ldiagpointdef
0 dg /S@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
S E ldiagangleto /SE@ANGLE ldiagangledef
E N ldiagangleto /NE@ANGLE ldiagangledef
N W ldiagangleto /NW@ANGLE ldiagangledef
W S ldiagangleto /SW@ANGLE ldiagangledef
[ xsize ysize 0.5 ldiagpmul /ldiagdiamondcircum cvx ] ldiagcircumdef
S E N W S
} def
% shape and labels of the @Ellipse symbol
/ldiagellipse
{
xsize 0 0.5 ldiagpmul /S ldiagpointdef
0 ysize 0.5 ldiagpmul /W ldiagpointdef
S W ldiagpadd /CTR ldiagpointdef
CTR W ldiagpadd /N ldiagpointdef
CTR S ldiagpadd /E ldiagpointdef
CTR xsize 0 0.3536 ldiagpmul ldiagpadd 0 ysize 0.3536 ldiagpmul ldiagpadd /NE ldiagpointdef
0 ysize 0.3536 ldiagpmul CTR xsize 0 0.3536 ldiagpmul ldiagpadd ldiagpsub /SE ldiagpointdef
xsize 0 0.3536 ldiagpmul CTR ldiagpsub 0 ysize 0.3536 ldiagpmul ldiagpadd /NW ldiagpointdef
0 ysize 0.3536 ldiagpmul xsize 0 0.3536 ldiagpmul CTR ldiagpsub ldiagpsub /SW ldiagpointdef
[ xsize ysize 0.5 ldiagpmul /ldiagellipsecircum cvx ] ldiagcircumdef
0 dg /S@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
S E ldiagangleto /SE@ANGLE ldiagangledef
E N ldiagangleto /NE@ANGLE ldiagangledef
N W ldiagangleto /NW@ANGLE ldiagangledef
W S ldiagangleto /SW@ANGLE ldiagangledef
S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
} def
% shape and labels of the @Circle symbol
/ldiagcircle
{
xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
CTR xsize 0 ysize 0 ldiagpmax 0.5 ldiagpmul ldiagpadd /E ldiagpointdef
CTR 0 0 CTR E ldiagdistance 45 ldiagatangle ldiagpadd /NE ldiagpointdef
CTR 0 0 CTR E ldiagdistance 90 ldiagatangle ldiagpadd /N ldiagpointdef
CTR 0 0 CTR E ldiagdistance 135 ldiagatangle ldiagpadd /NW ldiagpointdef
CTR 0 0 CTR E ldiagdistance 180 ldiagatangle ldiagpadd /W ldiagpointdef
CTR 0 0 CTR E ldiagdistance 225 ldiagatangle ldiagpadd /SW ldiagpointdef
CTR 0 0 CTR E ldiagdistance 270 ldiagatangle ldiagpadd /S ldiagpointdef
CTR 0 0 CTR E ldiagdistance 315 ldiagatangle ldiagpadd /SE ldiagpointdef
[ S E ldiagpsub /ldiagellipsecircum cvx ] ldiagcircumdef
0 dg /S@ANGLE ldiagangledef
45 dg /SE@ANGLE ldiagangledef
90 dg /E@ANGLE ldiagangledef
135 dg /NE@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
225 dg /NW@ANGLE ldiagangledef
270 dg /W@ANGLE ldiagangledef
315 dg /SW@ANGLE ldiagangledef
S [ CTR ] E [ CTR ] N [ CTR ] W [ CTR ] S
} def
% shape and labels of the @VLine and @VArrow symbols
/ldiagvline
{
xmark ysize ldiagprevious /FROM ldiagpointdef
xmark 0 ldiagprevious /TO ldiagpointdef
} def
% points of a polygon around base with given no of sides, vert init angle:
% <sides> <angle> ldiagpolygon <point> ... <point>
/ldiagpolygon
{ exch round cvi exch
xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
90 sub CTR 2 copy ldiagmax 5 3 roll
[ 4 copy pop /ldiagpolycircum cvx ] ldiagcircumdef
exch dup 360 exch div exch
1 1 3 2 roll
{ 4 string cvs (P) exch ldiagconcat
3 copy exch pop (@ANGLE) ldiagconcat cvn exch 90 add exch ldiagangledef
cvn 6 copy pop pop ldiagatangle 2 copy 10 2 roll
3 2 roll ldiagpointdef
dup 3 1 roll add exch
} for
pop ldiagatangle
} def
% shape and labels of the @Isosceles triangle symbol
/ldiagisosceles
{
xsize ysize 0.5 ldiagpmul /CTR ldiagpointdef
0 0 /SW ldiagpointdef
xsize 0 /SE ldiagpointdef
xsize 0.5 mul ysize /N ldiagpointdef
xsize 0.5 mul 0 /S ldiagpointdef
SE 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NE ldiagpointdef
SW 0.5 ldiagpmul N 0.5 ldiagpmul ldiagpadd /NW ldiagpointdef
[ xsize ysize /ldiagisoscelescircum cvx ] ldiagcircumdef
0 dg /SW@ANGLE ldiagangledef
0 dg /SE@ANGLE ldiagangledef
180 dg /N@ANGLE ldiagangledef
0 dg /S@ANGLE ldiagangledef
SE N ldiagangleto /NE@ANGLE ldiagangledef
N SW ldiagangleto /NW@ANGLE ldiagangledef
SW SE N SW
} def
% next array element: <array> <index> ldiaggetnext <array> <index> <any> true
% or <array> <index> false
/ldiaggetnext
{ 2 copy exch length ge
{ false }
{ 2 copy get exch 1 add exch true } ifelse
} def
% check whether thing is number: <any> ldiagisnumbertype <any> <bool>
/ldiagisnumbertype
{ dup type dup
/integertype eq exch /realtype eq or
} def
% check whether thing is an array: <any> ldiagisarraytype <any> <bool>
/ldiagisarraytype { dup type /arraytype eq } def
% check whether thing is an array: <any> ldiagisnametype <any> <bool>
/ldiagisnametype { dup type /nametype eq } def
% get next item: <array> <index> ldiaggetnextitem <array> <index> 0
% or <array> <index> <array> 1
% or <array> <index> <point> 2
/ldiaggetnextitem
{ ldiaggetnext
{ ldiagisarraytype
{ 1
}
{ ldiagisnumbertype
{ 3 1 roll
ldiaggetnext
{ ldiagisnumbertype
{ 4 3 roll exch 2
}
{ pop 3 2 roll pop 0
} ifelse
}
{ 3 2 roll pop 0
} ifelse
}
{ pop 0
} ifelse
} ifelse
}
{ 0
} ifelse
} def
% approximate equality: num1 num2 approxeq <boolean>
/approxeq
{ dup 0 eq
{ pop 0 eq
}
{ dup 3 1 roll sub exch div abs 0.001 lt
} ifelse
} def
% set arc path: bool x1 y1 x2 y2 x0 y0 ldiagsetarc <angle> <angle> <dist>
% the path goes from x1 y1 to x2 y2 about centre x0 y0,
% anticlockwise if bool is true else clockwise.
% The orientations of backwards pointing and forwards pointing
% arrowheads are returned in the two angles, and
% the length of the arc is returned in <dist>.
/ldiagsetarc
{
% (Entering ldiagsetarc) 7 ldiagdebugprint
20 dict begin
matrix currentmatrix 8 1 roll
2 copy translate 2 copy 8 2 roll
4 2 roll ldiagpsub 6 2 roll ldiagpsub
dup /y1 exch def dup mul /y1s exch def
dup /x1 exch def dup mul /x1s exch def
dup /y2 exch def dup mul /y2s exch def
dup /x2 exch def dup mul /x2s exch def
/dist1 0 0 x1 y1 ldiagdistance def
/dist2 0 0 x2 y2 ldiagdistance def
y1s y2s approxeq
{ -1
}
{ y1s x2s mul y2s x1s mul sub y1s y2s sub div
} ifelse
/da exch def
x1s x2s approxeq
{ -1
}
{ x1s y2s mul x2s y1s mul sub x1s x2s sub div
} ifelse
/db exch def
da 0 gt db 0 gt and
{
% ( case 1, ellipse) 0 ldiagdebugprint
/LMax da sqrt db sqrt ldiagmax def
/scalex da sqrt LMax div def
/scaley db sqrt LMax div def
scalex scaley scale
0 0 LMax
0 0 x1 scalex mul y1 scaley mul ldiagangleto
0 0 x2 scalex mul y2 scaley mul ldiagangleto
2 copy eq { 360 add } if
2 copy 8 2 roll
5 index { arc } { arcn } ifelse
2 index 1 index
{ 90 sub } { 90 add } ifelse
dup sin scaley mul exch cos scalex mul atan
2 index 2 index
{ 90 add } { 90 sub } ifelse
dup sin scaley mul exch cos scalex mul atan
5 2 roll % res1 res2 ang1 ang2 anticlockwise
{ exch sub } { sub } ifelse
dup 0 le { 360 add } if ldiagpi mul LMax mul 180 div
}
{
dist1 dist2 approxeq
% x1 y1 dist1 ( x1 y1, d) 3 ldiagdebugprint pop pop pop
% x2 y2 dist2 ( x2 y2, d) 3 ldiagdebugprint pop pop pop
{
% ( case 2, circle) 0 ldiagdebugprint
0 0
dist1
0 0 x1 y1 ldiagangleto
0 0 x2 y2 ldiagangleto
2 copy eq { 360 add } if
2 copy 8 2 roll
5 index { arc } { arcn } ifelse
2 index 1 index
{ 90 sub } { 90 add } ifelse
2 index 2 index
{ 90 add } { 90 sub } ifelse
5 2 roll % res1 res2 ang1 ang2 clockwise
{ exch sub } { sub } ifelse
dup 0 le { 360 add } if
ldiagpi mul dist1 mul 180 div
}
{
% ( case 3, line) 0 ldiagdebugprint
x2 y2 lineto pop
x2 y2 x1 y1 ldiagangleto
x1 y1 x2 y2 ldiagangleto
x1 y1 x2 y2 ldiagdistance
} ifelse
} ifelse
4 -1 roll setmatrix
end
% (Leaving ldiagsetarc) 3 ldiagdebugprint
} def
% ldiagsetcurve: set up a Bezier curve from x0 y0 to x3 y3
% and return arrowhead angles and length of curve (actually 0)
% x0 y0 x1 y1 x2 y2 x3 y3 ldiagsetcurve <angle> <angle> <length>
/ldiagsetcurve
{ 8 copy curveto pop pop
ldiagangleto
5 1 roll
4 2 roll ldiagangleto
exch
0
} def
% ldiagsetpath: convert a Diag path into a PostScript path
% [ shape ] ldiagsetpath
/ldiagsetpath
{
10 dict begin
0 newpath
/prevseen false def
/curveseen false def
{ ldiaggetnextitem
dup 0 eq { pop exit }
{ 1 eq
{ /curveseen true def
/curve exch def
curve length 0 eq { /curveseen false def } if
}
{ /ycurr exch def
/xcurr exch def
prevseen
{ curveseen
{ curve length 4 eq
{ xprev yprev
curve 0 get curve 1 get
curve 2 get curve 3 get
xcurr ycurr
ldiagsetcurve pop pop pop
}
{ xprev yprev xcurr ycurr
curve length 1 ge { curve 0 get } { 0 } ifelse
curve length 2 ge { curve 1 get } { 0 } ifelse
curve length 3 ge { curve 2 get } { true } ifelse
7 1 roll
ldiagsetarc pop pop pop
} ifelse
}
{ xcurr ycurr lineto
} ifelse
}
{ xcurr ycurr moveto
} ifelse
/xprev xcurr def
/yprev ycurr def
/prevseen true def
/curveseen false def
} ifelse
} ifelse
} loop pop pop
end
} def
% ldiagpaintpath: paint a path of the given shape
% /paint [ shape ] ldiagpaintpath -
/ldiagpaintpath
{
ldiagsetpath cvx exec
} def
% stroke a path of the given shape in the given linestyle and dash length.
% Return the origin and angle of the backward and forward arrow heads.
% dashlength /linestyle [shape] ldiagdopath [<point> <angle>] [<point> <angle>]
/ldiagdopath
{
10 dict begin
0
/prevseen false def
/curveseen false def
/backarrow [] def
/fwdarrow [] def
{
ldiaggetnextitem
dup 0 eq { pop exit }
{
1 eq
{ /curveseen true def
/curve exch def
curve length 0 eq { /prevseen false def } if
}
{ /ycurr exch def
/xcurr exch def
prevseen
{ newpath xprev yprev moveto
curveseen
{ curve length 4 eq
{ xprev yprev
curve 0 get curve 1 get
curve 2 get curve 3 get
xcurr ycurr ldiagsetcurve
}
{ xprev yprev xcurr ycurr
curve length 1 ge { curve 0 get } { 0 } ifelse
curve length 2 ge { curve 1 get } { 0 } ifelse
curve length 3 ge { curve 2 get } { true } ifelse
7 1 roll
ldiagsetarc
} ifelse
}
{ xcurr ycurr lineto
xcurr ycurr xprev yprev ldiagangleto dup 180 sub
xprev yprev xcurr ycurr ldiagdistance
} ifelse
6 index 6 index cvx exec
[ xprev yprev 5 -1 roll ]
backarrow length 0 eq
{ /backarrow exch def }
{ pop } ifelse
[ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
} if
/xprev xcurr def
/yprev ycurr def
/prevseen true def
/curveseen false def
} ifelse
} ifelse
} loop
pop pop pop pop
backarrow length 0 eq { [ 0 0 0 ] } { backarrow } ifelse
fwdarrow length 0 eq { [ 0 0 0 ] } { fwdarrow } ifelse
end
} def
% stroke a path of the given shape in the given linestyle and dash length.
% dashlength [ /linestyle ] [shape] ldiagdosegpath -
/ldiagdosegpath
{
12 dict begin
1 index /seg exch def
1 index length /seglength exch def
0 /segcount exch def
0
/prevseen false def
/curveseen false def
/backarrow [] def
/fwdarrow [] def
{
ldiaggetnextitem
dup 0 eq { pop exit }
{
1 eq
{ /curveseen true def
/curve exch def
curve length 0 eq { /prevseen false def } if
}
{ /ycurr exch def
/xcurr exch def
prevseen
{ newpath xprev yprev moveto
curveseen
{ curve length 4 eq
{ xprev yprev
curve 0 get curve 1 get
curve 2 get curve 3 get
xcurr ycurr ldiagsetcurve
}
{ xprev yprev xcurr ycurr
curve length 1 ge { curve 0 get } { 0 } ifelse
curve length 2 ge { curve 1 get } { 0 } ifelse
curve length 3 ge { curve 2 get } { true } ifelse
7 1 roll
ldiagsetarc
} ifelse
}
{ xcurr ycurr lineto
xcurr ycurr xprev yprev ldiagangleto dup 180 sub
xprev yprev xcurr ycurr ldiagdistance
} ifelse
6 index seg segcount seglength mod get cvx exec
/segcount segcount 1 add def
[ xprev yprev 5 -1 roll ]
backarrow length 0 eq
{ /backarrow exch def }
{ pop } ifelse
[ xcurr ycurr 4 -1 roll ] /fwdarrow exch def
} if
/xprev xcurr def
/yprev ycurr def
/prevseen true def
/curveseen false def
} ifelse
} ifelse
} loop
pop pop pop pop
end
} def
% ldiagnodebegin: start of node parameters
% ldiagnodebegin -
/ldiagnodebegin
{ % (Entering ldiagnodebegin) 0 ldiagdebugprint
ldiagmaxlabels dict begin
} def
% ldiagnodeend: end of node parameters (so do the node)
% <outline> <dashlength> <style> <linewidth> <paint> ldiagnodeend -
/ldiagnodeend
{
% (Entering ldiagnodeend) 0 ldiagdebugprint
end % matches begin in ldiagnodebegin
4 index gsave ldiagpaintpath grestore
3 index ldiagsetpath clip newpath
2 mul setlinewidth
3 -1 roll ldiagdosegpath
% (Leaving ldiagnodeend) 0 ldiagdebugprint
} def
% ldiaglinkbegin: start of link parameters
% <direct> ldiaglinkbegin -
/ldiaglinkbegin
{ ldiagmaxlabels dict begin
1 eq /direct exch def
} def
% ldiaglinkend: end of link parameters (so do the link)
% <outline> <dashlength> <style> <linewidth> ldiaglinkend -
/ldiaglinkend
{
end % matches begin in ldiaglinkbegin
setlinewidth
3 -1 roll ldiagdosegpath
} def
% ldiagdoarrow: draw an arrow head of given form
% dashlength /lstyle /pstyle hfrac height width [ <point> <angle> ] ldiagdoarrow -
/ldiagdoarrow
{ matrix currentmatrix 8 1 roll
dup 0 get 1 index 1 get translate
2 get rotate
[ 2 index neg 2 index 0 0
3 index 3 index neg
1 index 10 index mul 0
7 index 7 index ]
4 1 roll pop pop pop
dup 3 1 roll
gsave ldiagpaintpath grestore ldiagdopath pop pop
setmatrix
} def
% arrow head styles
/ldiagopen 0.0 def
/ldiaghalfopen 0.5 def
/ldiagclosed 1.0 def
% stroke no arrows, forward, back, and both
/ldiagnoarrow { pop pop pop pop pop pop pop pop } def
/ldiagforward { 7 -1 roll ldiagdoarrow pop } def
/ldiagback { 8 -2 roll pop ldiagdoarrow } def
/ldiagboth { 8 -1 roll 7 copy ldiagdoarrow pop 7 -1 roll ldiagdoarrow } def
% ldiagprevious: return previous point on path
/ldiagprevious
{ ldiagisnumbertype
{ 2 copy }
{ ldiagisarraytype
{ 2 index 2 index }
{ 0 0 }
ifelse
} ifelse
} def
% Tag dictionary operators
%
% Diag's tag dictionaries are kept on the same stack as other dictionaries,
% since there is nowhere else to put them. However, they are managed like
% a separate stack using the following operators:
%
% <tag> ldiagpushtagdict - Push a new, empty tag dictionary
% ldiagtoptagdict dict Find the top tag dictionary
% ldiagpoptagdict - Pop and destroy the top tag dictionary
% ldiagpopuptagdict - Pop top tag dict and promote its entries
% ldiagdebugtagdict - Debug print of dictionary stack
%
% They are distinguished from other dictionaries by containing /ldiagtagdict,
% whose value is the <tag> which is used by ldiagpopuptagdict,
% and they are hopefully never the target of any non-tag definition because
% they are never the top dictionary, since push places the new dict second.
/ldiagpushtagdict
{ ldiagmaxlabels dict dup
currentdict end exch begin begin
exch /ldiagtagdict exch put
} def
/ldiagtoptagdict
{ /ldiagtagdict where not
{ (Diag internal error: no tag dictionary) show stop
} if
} def
/ldiagpoptagdict
{
% (Entering poptagdict) 0 ldiagdebugprint
% ldiagdebugtagdict
mark
{ currentdict end
dup /ldiagtagdict known
{ exit
} if
} loop
pop
counttomark
{ begin
} repeat
pop
% (Leaving poptagdict) 0 ldiagdebugprint
% ldiagdebugtagdict
} def
% promote labels from top tag dictionary to second top tag dictionary
% each prefixed by <string>@ if <string> (value of /ldiagtagdict) is not empty
% - ldiagpopuptagdict -
/ldiagpopuptagdict
{
ldiagtagdict
% (Entering ldiagpopuptagdict) 1 ldiagdebugprint
% ldiagdebugtagdict
ldiagtoptagdict ldiagpoptagdict ldiagtoptagdict exch
{ exch 50 string cvs 3 index
dup length 0 ne
{ (@) ldiagconcat
} if
exch ldiagconcat cvn exch 2 index 3 1 roll put
} forall
pop pop
% (Leaving ldiagpopuptagdict) 0 ldiagdebugprint
% ldiagdebugtagdict
} def
% debug tag dictionary stack
/ldiagdebugtagdict
{ (Entering ldiagdebugtagdict) 0 ldiagdebugprint
30 array dictstack
{ dup /ldiagtagdict known
{ dup /ldiagtagdict get 0 ldiagdebugprint
{ pop 50 string cvs ( ) exch ldiagconcat
dup 0 ldiagdebugprint
pop
}
forall
}
{ pop (other) 0 ldiagdebugprint
} ifelse
} forall
(Leaving ldiagdebugtagdict) 0 ldiagdebugprint
} def
% label a point in top tag dictionary: <point> /name ldiagpointdef -
/ldiagpointdef
{
% (Entering ldiagpointdef) 3 ldiagdebugprint
[ 4 2 roll transform /itransform cvx ] cvx
ldiagtoptagdict 3 1 roll put
% (Leaving ldiagpointdef) 0 ldiagdebugprint
} def
% label an angle in top tag dictionary: <angle> /name ldiagangledef -
/ldiagangledef
{
% (Entering ldiagangledef) 2 ldiagdebugprint
exch ldiagfixangle ldiagtoptagdict 3 1 roll put
% (Leaving ldiagangledef) 0 ldiagdebugprint
} def
% add CIRCUM operator with this body: <array> ldiagcircumdef -
/ldiagcircumdef
{ % (Entering ldiagcircumdef) 1 ldiagdebugprint
/CIRCUM exch cvx
ldiagtoptagdict 3 1 roll put
% currentdict end
% 3 1 roll
% def
% begin
% (Leaving ldiagcircumdef) 0 ldiagdebugprint
} def
% show points (except CIRCUM and ANGLE): - ldiagshowpoints -
/ldiagshowpoints
{
% (Entering ldiagshowpoints) 0 ldiagdebugprint
ldiagtoptagdict
{ 1 index 50 string cvs
(ldiagdebugpos) search
{ pop pop pop pop pop }
{
(CIRCUM) search % if CIRCUM in key
{ pop pop pop pop pop }
{
(ANGLE) search % if ANGLE in key
{
pop pop pop pop pop
}
{
(ldiagtagdict) search
{
pop pop pop pop pop
}
{
pop cvx exec
newpath 2.0 pt 0 360 arc 0 setgray fill pop
} ifelse
} ifelse
} ifelse
} ifelse
} forall
% (Leaving ldiagshowpoints) 0 ldiagdebugprint
} def
/ldiagshowtags
{
% (Entering ldiagshowtags) 0 ldiagdebugprint
ldiagtoptagdict
{ 1 index 50 string cvs
% dup 0 ldiagdebugprint
(ldiagdebugpos) search
{ pop pop pop pop pop }
{
(CIRCUM) search % if CIRCUM in key
{ pop pop pop pop pop }
{
(ANGLE) search % if ANGLE in key
{
pop pop pop pop pop
}
{
(ldiagtagdict) search
{
pop pop pop pop pop
}
{
pop cvx exec 2 copy
gsave
newpath 2.0 pt 0 360 arc 0 setgray fill
/Times-Roman findfont 8 pt scalefont setfont
translate 40 rotate 0.2 cm 0.1 cm moveto 20 string cvs show
grestore
} ifelse
} ifelse
} ifelse
} ifelse
} forall
% (Leaving ldiagshowtags) 0 ldiagdebugprint
} def
% show angles: - ldiagshowangles -
/ldiagshowangles
{
% (Entering ldiagshowangles) 0 ldiagdebugprint
ldiagtoptagdict
{ 1 index 20 string cvs
% dup 0 ldiagdebugprint
(ldiagdebugpos) search
{ pop pop pop pop pop }
{
(ldiagtagdict) search
{
pop pop pop pop pop
}
{
(CIRCUM) search % if CIRCUM in key
{ pop pop pop pop pop }
{
(@ANGLE) search % if ANGLE in key, draw the angle at the point
{
% (showing ANGLE) 5 ldiagdebugprint
gsave exch pop exch pop cvx
% (about to execute) 1 ldiagdebugprint
exec translate rotate 0.8 0.8 scale pop
newpath 0 0 2.0 pt 0 360 arc 0 setgray fill
newpath 4 pt 0 moveto 9 pt 0 lineto
9 pt 1.5 pt lineto 11 pt 0 lineto 9 pt -1.5 pt lineto
9 pt 0 lineto [] 0 setdash 4 pt setlinewidth 0 setlinejoin
stroke grestore
% (finished ANGLE) 5 ldiagdebugprint
}
{
% else must be a point, we aren't showing those
pop pop pop
} ifelse
} ifelse
} ifelse
} ifelse
} forall
% (Leaving ldiagshowangles) 0 ldiagdebugprint
} def
% fix an angle to 0 <= res < 360: <angle> ldiagfixangle <angle>
/ldiagfixangle
{
% (Entering ldiagfixangle) 1 ldiagdebugprint
{ dup 0 ge { exit } if
360 add
} loop
{ dup 360 lt { exit } if
360 sub
} loop
% (Leaving ldiagfixangle) 1 ldiagdebugprint
} def
% find point on circumference of box: alpha a b ldiagboxcircum x y
/ldiagboxcircum
{
% (Entering ldiagboxcircum) 3 ldiagdebugprint
4 dict begin
/b exch def
/a exch def
ldiagfixangle /alpha exch def
0 0 a b ldiagangleto /theta exch def
% if alpha <= theta, return (a, a*tan(alpha))
alpha theta le
{ a a alpha sin mul alpha cos div }
{
% else if alpha <= 180 - theta, return (b*cot(alpha), b)
alpha 180 theta sub le
{ b alpha cos mul alpha sin div b }
{
% else if alpha <= 180 + theta, return (-a, -a*tan(alpha))
alpha 180 theta add le
{ a neg a neg alpha sin mul alpha cos div }
{
% else if alpha <= 360 - theta, return (-b*cot(alpha), -b)
alpha 360 theta sub le
{ b neg alpha cos mul alpha sin div b neg }
{
% else 360 - theta <= alpha, return (a, a*tan(alpha))
a a alpha sin mul alpha cos div
} ifelse
} ifelse
} ifelse
} ifelse
end
% (Leaving ldiagboxcircum) 2 ldiagdebugprint
} def
% find quadratic roots (assume a != 0): a b c ldiagqroots x1 x2 2
% or x2 1
% or 0
/ldiagqroots
{
4 dict begin
/c exch def
/b exch def
/a exch def
/disc b b mul 4 a c mul mul sub def
disc 0 lt
{ 0
}
{ disc 0 eq
{ b neg 2 a mul div
1
}
{ b neg disc sqrt add 2 a mul div
b neg disc sqrt sub 2 a mul div
2
}
ifelse
}
ifelse
end
} def
% work our which quadrant: <angle> ldiagquadrant <0-3>
/ldiagquadrant
{ dup 90 lt
{ pop 0
}
{ dup 180 lt
{ pop 1
}
{ 270 lt
{ 2
}
{ 3
} ifelse
} ifelse
} ifelse
} def
% find curvebox circum, assuming upper right quadrant: alpha a b xmk ldiagcb x y
/ldiagcb
{
6 dict begin
/xmk exch def
/b exch def
/a exch def
/alpha exch def
/theta1 0 0 a b xmk sub ldiagangleto def
/theta2 0 0 a xmk sub b ldiagangleto def
alpha theta1 le
{ % if alpha <= theta1, return (a, a*tan(alpha))
a a alpha sin mul alpha cos div
}
{ alpha theta2 ge
{ % else if alpha > theta2, return (b*cot(alpha), b)
b alpha cos mul alpha sin div b
}
{
% else, return the intersection of line and circle
a xmk sub b xmk sub xmk 0 0 alpha ldiagcircleintersect
dup 0 eq
{ % should never happen, just return any reasonable point
pop
a b 0.5 ldiagpmul
}
{ 1 eq
{ % should never happen, just return the point on top of stack
}
{ % the usual case, two points on stack, return the larger
ldiagpmax
} ifelse
} ifelse
} ifelse
} ifelse
end
} def
% find point on circumference of curvebox: alpha a b xmk ldiagcurveboxcircum x y
/ldiagcurveboxcircum
{
% (Entering ldiagcurveboxcircum) 4 ldiagdebugprint
5 dict begin
/xmk exch def
/b exch def
/a exch def
ldiagfixangle /alpha exch def
% work out which quadrant we are in, and reflect accordingly
/quad alpha ldiagquadrant def
quad 0 eq
{ alpha a b xmk ldiagcb
}
{ quad 1 eq
{ 180 alpha sub a b xmk ldiagcb exch neg exch
}
{ quad 2 eq
{ alpha 180 sub a b xmk ldiagcb neg exch neg exch
}
{ 360 alpha sub a b xmk ldiagcb neg
} ifelse
} ifelse
} ifelse
end
% (Leaving ldiagcurveboxcircum) 2 ldiagdebugprint
} def
% find point on circumference of diamond: alpha a b ldiagdiamondcircum x y
/ldiagdiamondcircum
{
% (Entering ldiagdiamondcircum) 3 ldiagdebugprint
4 dict begin
/b exch def
/a exch def
ldiagfixangle /alpha exch def
b alpha cos abs mul a alpha sin abs mul add /denom exch def
a b mul alpha cos mul denom div
a b mul alpha sin mul denom div
end
% (Leaving ldiagdiamondcircum) 2 ldiagdebugprint
} def
% find point on circumference of ellipse: alpha a b ldiagellipsecircum x y
/ldiagellipsecircum
{
% (Entering ldiagellipsecircum) 3 ldiagdebugprint
4 dict begin
/b exch def
/a exch def
ldiagfixangle /alpha exch def
b alpha cos mul dup mul a alpha sin mul dup mul add sqrt /denom exch def
a b mul alpha cos mul denom div
a b mul alpha sin mul denom div
end
% (Leaving ldiagellipsecircum) 2 ldiagdebugprint
} def
% find point on circumference of isosceles: alpha a b ldiagisoscelescircum x y
/ldiagisoscelescircum
{
% (Entering ldiagisoscelescircum) 3 ldiagdebugprint
7 dict begin
/b exch def
/a exch def
/alpha exch ldiagfixangle def
/theta1 90 def
/theta2 a b 0.5 ldiagpmul 0 0 ldiagangleto def
/theta3 a b 0.5 ldiagpmul a 0 ldiagangleto def
alpha theta1 ge alpha theta2 le and
{ 0 0 a 2 div b
}
{ alpha theta2 ge alpha theta3 le and
{ 0 0 a 0
}
{ a 0 a 2 div b
} ifelse
} ifelse
a 2 div b 2 div 2 copy 1 ft alpha ldiagatangle ldiaglineintersect
a 2 div b 2 div 4 2 roll ldiagpsub
end
% (Leaving ldiagisoscelescircum) 2 ldiagdebugprint
} def
% find point of intersection of two lines each defined by two points
% x1 y1 x2 y2 x3 y3 x4 y4 ldiaglineintersect x y
/ldiaglineintersect
{
% (Entering ldiaglineintersect) 8 ldiagdebugprint
13 dict begin
/y4 exch def
/x4 exch def
/y3 exch def
/x3 exch def
/y2 exch def
/x2 exch def
/y1 exch def
/x1 exch def
x2 x1 sub /x21 exch def
x4 x3 sub /x43 exch def
y2 y1 sub /y21 exch def
y4 y3 sub /y43 exch def
y21 x43 mul y43 x21 mul sub /det exch def
% calculate x
y21 x43 mul x1 mul
y43 x21 mul x3 mul sub
y3 y1 sub x21 mul x43 mul add
det div
% calculate y
x21 y43 mul y1 mul
x43 y21 mul y3 mul sub
x3 x1 sub y21 mul y43 mul add
det neg div
end
% (Leaving ldiaglineintersect) 2 ldiagdebugprint
} def
% find point on circumference of polygon
% alpha radius num theta ldiagpolycircum x y
/ldiagpolycircum
{
% (Entering ldiagpolycircum) 4 ldiagdebugprint
13 dict begin
/theta exch def
/num exch def
/radius exch def
/alpha exch def
% calculate delta, the angle from theta to alpha
alpha theta sub ldiagfixangle
% calculate the angle which is the multiple of 360/num closest to delta
360 num div div truncate 360 num div mul theta add /anglea exch def
% calculate the next multiple of 360/num after anglea
anglea 360 num div add /angleb exch def
% intersect the line through these two points with the alpha line
anglea cos anglea sin angleb cos angleb sin
0 0 alpha cos 2 mul alpha sin 2 mul
ldiaglineintersect radius ldiagpmul
end
% (Leaving ldiagpolycircum) 2 ldiagdebugprint
} def
% find point of intersection of a line and a circle
% x0 y0 r x1 y1 theta ldiagcircleintersect xa ya xb yb 2
% or xb yb 1
% or 0
/ldiagcircleintersect
{
% (Entering ldiagcircleintersect) 6 ldiagdebugprint
15 dict begin
/theta exch def
/y1 exch def
/x1 exch def
/r exch def
/y0 exch def
/x0 exch def
% if sin(theta) = 0 then line is horizontal and y must be y1
theta sin abs 0.00001 lt
{
/a 1 def
/b -2 x0 mul def
/c x0 dup mul y1 y0 sub dup mul add r dup mul sub def
a b c ldiagqroots dup
0 eq
{ pop
0
}
{ 1 eq
{ y1 1
}
{ y1 exch y1 2
} ifelse
} ifelse
}
{
/ct theta cos theta sin div def
/a ct ct mul 1 add def
/b ct x1 x0 sub mul y1 add y0 sub 2 mul def
/c x1 x0 sub dup mul y1 y0 sub dup mul add r dup mul sub def
a b c ldiagqroots dup
0 eq
{ pop
0
}
{ 1 eq
{ y1 add /yb exch def
yb y1 sub ct mul x1 add /xb exch def
xb yb 1
}
{ y1 add /ya exch def
ya y1 sub ct mul x1 add /xa exch def
y1 add /yb exch def
yb y1 sub ct mul x1 add /xb exch def
xa ya xb yb 2
} ifelse
} ifelse
} ifelse
end
% (Leaving ldiagcircleintersect) 1 ldiagdebugprint
} def
% find line which is the perpendicular bisector of two points, defined
% by two points
% x1 y1 x2 y2 ldiaglinebetween x3 y3 x4 y4
/ldiaglinebetween
{ % (Entering ldiaglinebetween) 4 ldiagdebugprint
/y2 exch def /x2 exch def
/y1 exch def /x1 exch def
% let x3, y3 be the point halfway between the two points
x1 y1 x2 y2 ldiagpadd 0.5 ldiagpmul
/y3 exch def /x3 exch def
% find a point perpendicular to x3, y3
x3 y3 50 x1 y1 x2 y2 ldiagangleto 90 dg add ldiagatangle
% plus x3 y3 gives the two points
x3 y3
% (Leaving ldiaglinebetween) 4 ldiagdebugprint
} def
% find <proc>@<string>: <proc> <string> ldiagfindlabel <any> true
% <proc> <string> false
/ldiagfindlabel
{
% (Entering ldiagfindlabel) 2 ldiagdebugprint
exch dup length 1 ne
{ exch false
% (Leaving ldiagfindabel (length not 1)) 3 ldiagdebugprint
}
{ dup 0 get type /nametype ne
{ exch false
% (Leaving ldiagfindabel (not a name)) 3 ldiagdebugprint
}
{ dup 0 get 50 string cvs (@) ldiagconcat 2 index ldiagconcat dup where
{ exch get exch pop exch pop cvx exec true
% (Leaving ldiagfindlabel with success) 100 ldiagdebugprint
}
{
pop exch false
% (Leaving ldiagfindabel (concat not sensible)) 3 ldiagdebugprint
} ifelse
} ifelse
} ifelse
} bind def
% execute <proc>@<string> or else default: <proc> <string> ldiagdolabel <various>
/ldiagdolabel
{
% (Entering ldiagdolabel) 2 ldiagdebugprint
ldiagfindlabel not
{
dup (CIRCUM) eq
{ pop pop pop 0 0
}
{
dup (ANGLE) eq
{ pop pop 0
}
{ pop cvx exec
} ifelse
} ifelse
} if
% (Leaving ldiagdolabel) 2 ldiagdebugprint
} bind def
% execute a proc depending on whether number is negative, zero, or positive
% procneg proczero procpos number ldiagsigncase <anything>
/ldiagsigncase
{
% (Entering ldiagsigncase) 4 ldiagdebugprint
dup 0 lt
{ pop pop pop exec
}
{ 0 gt
{ exch pop exch pop exec
}
{ pop exch pop exec
} ifelse
} ifelse
% (Leaving ldiagsigncase) 0 ldiagdebugprint
} bind def
% execute proci if angle is in ith quadrant
% proc45 proc270 proc180 proc90 proc0 proc315 proc225 proc135 angle ldiagquadcase <anything>
/ldiagquadcase
{
% (Entering ldiagquadcase) 9 ldiagdebugprint
round ldiagfixangle cvi dup 90 mod 0 eq
{ 90 idiv 4 add } { 90 idiv } ifelse
8 exch roll pop pop pop pop pop pop pop exec
% (Leaving ldiagquadcase) 0 ldiagdebugprint
} bind def
% decode Lout length into PostScript length
% <string> ldiagdecodelength <number>
/ldiagdecodelength
{
% (Entering ldiagdecodelength) 1 ldiagdebugprint
(f) search
{ exch pop exch pop cvr ft
}
{ (c) search
{ exch pop exch pop cvr cm
}
{ (p) search
{ exch pop exch pop cvr pt
}
{ (m) search
{ exch pop exch pop cvr em
}
{ (s) search
{ exch pop exch pop cvr sp
}
{ (v) search
{ exch pop exch pop cvr vs
}
{ (i) search
{ exch pop exch pop cvr in
}
{ pop 0
} ifelse
} ifelse
} ifelse
} ifelse
} ifelse
} ifelse
} ifelse
% (Leaving ldiagdecodelength) 1 ldiagdebugprint
} def
% implement aabout function
% logical form: <circum> <extra> <centre> aabout <point>
% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx aabout <point>
/ldiagaabout
{
/centre exch def
/extra exch def
/circum exch def
/ZXCTR [ centre ] cvx def
/ZFCTR [ circum (CTR) ldiagdolabel ] cvx def
/ZAREF ZFCTR ZXCTR ldiagangleto def
/ZAMIN 0 dg def
/ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN sub
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMIN sub ldiagatangle
ldiagpadd ] cvx def
/ZAMAX 90 dg def
/ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX sub
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMAX sub ldiagatangle
ldiagpadd ] cvx def
1 1 20
{ /xval exch def
/ZAMID ZAMIN ZAMAX add 0.5 mul def
/ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID sub
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMID sub ldiagatangle
ldiagpadd ] cvx def
ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt
{
/ZAMAX [ ZAMID ] cvx def
/ZPMAX [ ZPMID ] cvx def
}
{
/ZAMIN [ ZAMID ] cvx def
/ZPMIN [ ZPMID ] cvx def
} ifelse
} for
ZPMID
} def
% implement cabout function
% logical form: <circum> <extra> <centre> cabout <point>
% actual form: { <labelorpoint> } cvlit <length> [ <point> ] cvx cabout <point>
/ldiagcabout
{
/centre exch def
/extra exch def
/circum exch def
/ZXCTR [ centre ] cvx def
/ZFCTR [ circum (CTR) ldiagdolabel ] cvx def
/ZAREF ZFCTR ZXCTR ldiagangleto def
/ZAMIN 0 dg def
/ZPMIN [ circum (CTR) ldiagdolabel ZAREF ZAMIN add
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMIN add ldiagatangle
ldiagpadd ] cvx def
/ZAMAX 90 dg def
/ZPMAX [ circum (CTR) ldiagdolabel ZAREF ZAMAX add
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMAX add ldiagatangle
ldiagpadd ] cvx def
1 1 20
{ /xval exch def
/ZAMID ZAMIN ZAMAX add 0.5 mul def
/ZPMID [ circum (CTR) ldiagdolabel ZAREF ZAMID add
circum (CIRCUM) ldiagdolabel ldiagpadd
0 0 extra ZAREF ZAMID add ldiagatangle
ldiagpadd ] cvx def
ZPMID ZXCTR ldiagdistance ZFCTR ZXCTR ldiagdistance gt
{
/ZAMAX [ ZAMID ] cvx def
/ZPMAX [ ZPMID ] cvx def
}
{
/ZAMIN [ ZAMID ] cvx def
/ZPMIN [ ZPMID ] cvx def
} ifelse
} for
ZPMID
} def
% fromarrowlength toarrowlength { from } { to } xindent zindent ldiaglinepath -
/ldiaglinepath
{
% (entering ldiaglinepath) 0 ldiagdebugprint
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto
/FROM@ANGLE ldiagangledef
from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
/FROM ldiagpointdef
FROM@ANGLE /TO@ANGLE ldiagangledef
to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef
FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
FROM@ANGLE /LMID@ANGLE ldiagangledef
/XINDENT xindent FROM LMID ldiagdistance ldiagmin def
FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
/ZINDENT zindent TO LMID ldiagdistance ldiagmin def
0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef
FROM@ANGLE /LTO@ANGLE ldiagangledef
direct { FROM TO } { FROM LFROM LMID LTO TO } ifelse
% (leaving ldiaglinepath) 0 ldiagdebugprint
} def
% fromarrowlength toarrowlength { from } { to } xindent zindent pathgap ldiagdoublelinepath -
/ldiagdoublelinepath
{
% (entering ldiagdoublelinepath) 0 ldiagdebugprint
/pathgap exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagangleto
/FROM@ANGLE ldiagangledef
from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
/FROM ldiagpointdef
FROM@ANGLE /TO@ANGLE ldiagangledef
to (CTR) ldiagdolabel TO@ANGLE 180 dg sub to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TO@ANGLE 180 dg sub ldiagatangle ldiagpadd /TO ldiagpointdef
FROM 0.5 ldiagpmul TO 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
FROM@ANGLE /LMID@ANGLE ldiagangledef
/XINDENT xindent FROM LMID ldiagdistance ldiagmin def
FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
/ZINDENT zindent TO LMID ldiagdistance ldiagmin def
0 0 ZINDENT FROM@ANGLE ldiagatangle TO ldiagpsub /LTO ldiagpointdef
FROM@ANGLE /LTO@ANGLE ldiagangledef
direct {
FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
[]
FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
}
{
FROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
LFROM pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
LMID pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
LTO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
TO pathgap 2 div FROM@ANGLE 90 dg sub ldiagatangle
[]
FROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
LFROM pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
LMID pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
LTO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
TO pathgap 2 div FROM@ANGLE 90 dg add ldiagatangle
} ifelse
% (leaving ldiagdoublelinepath) 0 ldiagdebugprint
} def
% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagacurvepath -
/ldiagacurvepath
{
% (entering ldiagacurvepath) 0 ldiagdebugprint
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
%/B1 bias 0.02 ft ldiagmax def
%/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def
%/BIAS B1 B2 ldiagmin def
/BIAS bias 0.02 ft ldiagmax def
/XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul
to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def
/XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel
ldiagangleto 90 dg sub ldiagatangle ldiagpadd ] cvx def
/CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween
to (CTR) ldiagdolabel XTOP ldiaglinebetween
ldiaglineintersect ] cvx def
from fromarrowlength [ CTR ] cvx ldiagaabout /FROM ldiagpointdef
from (CTR) ldiagdolabel FROM ldiagdistance 0 gt
{ from (CTR) ldiagdolabel FROM ldiagangleto
}
{ CTR FROM ldiagangleto 90 dg add
} ifelse /FROM@ANGLE ldiagangledef
to toarrowlength [ CTR ] cvx ldiagcabout /TO ldiagpointdef
TO to (CTR) ldiagdolabel ldiagdistance 0 gt
{ TO to (CTR) ldiagdolabel ldiagangleto
}
{ CTR TO ldiagangleto 90 dg add
} ifelse /TO@ANGLE ldiagangledef
/RADIUS CTR FROM ldiagdistance def
CTR 0 0 RADIUS CTR FROM ldiagangleto 360 dg CTR TO ldiagangleto
add CTR FROM ldiagangleto sub cvi 360 mod 0.5 mul add
ldiagatangle ldiagpadd /LMID ldiagpointdef
CTR LMID ldiagangleto 90 dg add /LMID@ANGLE ldiagangledef
/XINDENT xindent FROM LMID ldiagdistance ldiagmin def
CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle
ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef
CTR LFROM ldiagangleto 90 dg add /LFROM@ANGLE ldiagangledef
/ZINDENT zindent TO LMID ldiagdistance ldiagmin def
CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add
ldiagatangle ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef
CTR LTO ldiagangleto 90 dg add /LTO@ANGLE ldiagangledef
direct
{ FROM [CTR] TO }
{ FROM [CTR] LFROM [CTR] LMID [CTR] LTO [CTR] TO }
ifelse
% (leaving ldiagacurvepath) 0 ldiagdebugprint
} def
% fromarrowlen toarrowlen { from } { to } xindent zindent bias ldiagccurvepath -
/ldiagccurvepath
{
% (entering ldiagccurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
%/B1 bias 0.02 ft ldiagmax def
%/B2 from (CTR) ldiagdolabel to (CTR) ldiagdolabel ldiagdistance 0.5 mul def
%/BIAS B1 B2 ldiagmin def
/BIAS bias 0.02 ft ldiagmax def
/XMID [ from (CTR) ldiagdolabel 0.5 ldiagpmul
to (CTR) ldiagdolabel 0.5 ldiagpmul ldiagpadd ] cvx def
/XTOP [ XMID 0 0 BIAS from (CTR) ldiagdolabel to (CTR) ldiagdolabel
ldiagangleto 90 dg add ldiagatangle ldiagpadd ] cvx def
/CTR [ from (CTR) ldiagdolabel XTOP ldiaglinebetween
to (CTR) ldiagdolabel XTOP ldiaglinebetween ldiaglineintersect ] cvx def
from fromarrowlength [ CTR ] cvx ldiagcabout /FROM ldiagpointdef
from (CTR) ldiagdolabel FROM ldiagdistance 0 gt
{ from (CTR) ldiagdolabel FROM ldiagangleto }
{ CTR FROM ldiagangleto 90 dg sub }
ifelse /FROM@ANGLE ldiagangledef
to toarrowlength [ CTR ] cvx ldiagaabout /TO ldiagpointdef
TO to (CTR) ldiagdolabel ldiagdistance 0 gt
{ TO to (CTR) ldiagdolabel ldiagangleto }
{ CTR TO ldiagangleto 90 dg sub }
ifelse /TO@ANGLE ldiagangledef
/RADIUS [ CTR FROM ldiagdistance ] cvx def
CTR 0 0 RADIUS CTR TO ldiagangleto 360 dg CTR FROM ldiagangleto add
CTR TO ldiagangleto sub cvi 360 cvi mod 2 div add ldiagatangle
ldiagpadd /LMID ldiagpointdef
CTR LMID ldiagangleto 90 dg sub /LMID@ANGLE ldiagangledef
/XINDENT [ xindent FROM LMID ldiagdistance ldiagmin ] cvx def
CTR 0 0 RADIUS CTR FROM 0 0 XINDENT FROM@ANGLE ldiagatangle ldiagpadd
ldiagangleto ldiagatangle ldiagpadd /LFROM ldiagpointdef
CTR LFROM ldiagangleto 90 dg sub /LFROM@ANGLE ldiagangledef
/ZINDENT [ zindent TO LMID ldiagdistance ldiagmin ] cvx def
CTR 0 0 RADIUS CTR TO 0 0 ZINDENT TO@ANGLE 180 dg add ldiagatangle
ldiagpadd ldiagangleto ldiagatangle ldiagpadd /LTO ldiagpointdef
CTR LTO ldiagangleto 90 dg sub /LTO@ANGLE ldiagangledef
direct
{ FROM [CTR clockwise] TO }
{ FROM [CTR clockwise] LFROM [CTR clockwise]
LMID [CTR clockwise] LTO [CTR clockwise] TO }
ifelse
% (leaving ldiagccurvepath) 0 ldiagdebugprint
} def
% farr tarr { from } { to } xindent zindent [frompt] [topt] ldiagbezierpath -
/ldiagbezierpath
{
% (entering ldiagbezierpath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
cvx /topt exch def
cvx /frompt exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel frompt ldiagangleto /FROM@ANGLE ldiagangledef
from (CTR) ldiagdolabel FROM@ANGLE from (CIRCUM) ldiagdolabel
ldiagpadd 0 0 fromarrowlength FROM@ANGLE ldiagatangle ldiagpadd
/FROM ldiagpointdef
topt to (CTR) ldiagdolabel ldiagangleto /TO@ANGLE ldiagangledef
to (CTR) ldiagdolabel TO@ANGLE 180 dg add to (CIRCUM) ldiagdolabel
ldiagpadd 0 0 toarrowlength TO@ANGLE 180 dg add ldiagatangle ldiagpadd
/TO ldiagpointdef
FROM 0 0 xindent FROM@ANGLE ldiagatangle ldiagpadd
/LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
TO 0 0 zindent TO@ANGLE 180 dg add ldiagatangle ldiagpadd
/LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
FROM TO ldiagpadd frompt ldiagpadd topt ldiagpadd 0.25 ldiagpmul
/LMID ldiagpointdef
FROM [frompt topt] TO
% (leaving ldiagbezierpath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent ldiagvhlinepath -
/ldiagvhlinepath
{
% (entering ldiagvhlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def
/FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
/TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
FANG /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
TANG 180 dg add /TO@ANGLE ldiagangledef
/FDIST [ FROM CTR ldiagdistance ] cvx def
/TDIST [ TO CTR ldiagdistance ] cvx def
/XINDENT [ xindent FDIST ldiagmin ] cvx def
/ZINDENT [ zindent TDIST ldiagmin ] cvx def
FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
CTR /LMID ldiagpointdef
0 0 1 ft FANG 180 dg add ldiagatangle
0 0 1 ft TANG 180 dg add ldiagatangle
ldiagangleto /LMID@ANGLE ldiagangledef
FROM LFROM LMID LTO TO
% (leaving ldiagvhlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent radius ldiagvhcurvepath -
/ldiagvhcurvepath
{
% (entering ldiagvhcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/CTR [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel exch pop ] cvx def
/FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
/TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
FANG /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
TANG 180 dg add /TO@ANGLE ldiagangledef
/FDIST [ FROM CTR ldiagdistance ] cvx def
/TDIST [ TO CTR ldiagdistance ] cvx def
/RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def
/XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def
/ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def
FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
/FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def
/TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
/XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd
0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd
/LMID ldiagpointdef
FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef
FROM LFROM FCTR
{[XCTR clockwise]} {} {} {} {} {[XCTR]} {[XCTR clockwise]} {[XCTR]}
FCTR TCTR ldiagangleto ldiagquadcase
TCTR LTO TO
% (leaving ldiagvhcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent ldiaghvlinepath -
/ldiaghvlinepath
{
% (entering ldiaghvlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def
/FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
/TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
FANG /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
TANG 180 dg add /TO@ANGLE ldiagangledef
/FDIST [ FROM CTR ldiagdistance ] cvx def
/TDIST [ TO CTR ldiagdistance ] cvx def
/XINDENT [ xindent FDIST ldiagmin ] cvx def
/ZINDENT [ zindent TDIST ldiagmin ] cvx def
FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
CTR /LMID ldiagpointdef
0 0 1 ft FANG 180 dg add ldiagatangle
0 0 1 ft TANG 180 dg add ldiagatangle ldiagangleto
/LMID@ANGLE ldiagangledef
FROM LFROM LMID LTO TO
% (leaving ldiaghvlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent radius ldiaghvcurvepath -
/ldiaghvcurvepath
{
% (entering ldiaghvcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/CTR [ to (CTR) ldiagdolabel pop from (CTR) ldiagdolabel exch pop ] cvx def
/FANG [ from (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
/TANG [ to (CTR) ldiagdolabel CTR ldiagangleto ] cvx def
from (CTR) ldiagdolabel FANG from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength FANG ldiagatangle ldiagpadd /FROM ldiagpointdef
FANG /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel TANG to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength TANG ldiagatangle ldiagpadd /TO ldiagpointdef
TANG 180 dg add /TO@ANGLE ldiagangledef
/FDIST [ FROM CTR ldiagdistance ] cvx def
/TDIST [ TO CTR ldiagdistance ] cvx def
/RADIUS [ radius FDIST TDIST ldiagmin ldiagmin ] cvx def
/XINDENT [ xindent FDIST RADIUS sub ldiagmin ] cvx def
/ZINDENT [ zindent TDIST RADIUS sub ldiagmin ] cvx def
FROM 0 0 XINDENT FANG ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
TO 0 0 ZINDENT TANG ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
/FCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd ] cvx def
/TCTR [ CTR 0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
/XCTR [ CTR 0 0 RADIUS FROM@ANGLE 180 dg add ldiagatangle ldiagpadd
0 0 RADIUS TO@ANGLE ldiagatangle ldiagpadd ] cvx def
XCTR 0 0 RADIUS XCTR CTR ldiagangleto ldiagatangle ldiagpadd
/LMID ldiagpointdef
FCTR TCTR ldiagangleto /LMID@ANGLE ldiagangledef
FROM LFROM FCTR
{[XCTR]} {} {} {} {} {[XCTR clockwise]} {[XCTR]} {[XCTR clockwise]}
FCTR TCTR ldiagangleto ldiagquadcase
TCTR LTO TO
% (leaving ldiaghvcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias ldiaglvrlinepath -
/ldiaglvrlinepath
{
% (entering ldiaglvrlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
180 dg /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef
0 dg /TO@ANGLE ldiagangledef
/XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def
XLEFT FROM exch pop /P1 ldiagpointdef
XLEFT TO exch pop /P2 ldiagpointdef
/VERT [ P1 P2 ldiagangleto ] cvx def
P1 P1 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef
P2 P2 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef
P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
VERT /LMID@ANGLE ldiagangledef
/XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
/ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def
XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef
180 dg /LFROM@ANGLE ldiagangledef
ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef
0 dg /LTO@ANGLE ldiagangledef
FROM LFROM P1 LMID P2 LTO TO
% (leaving ldiaglvrlinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias radius ldiaglvrcurvepath -
/ldiaglvrcurvepath
{
% (entering ldiaglvrcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel 180 dg from (CIRCUM) ldiagdolabel ldiagpadd 0 0
fromarrowlength 180 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
180 dg /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel 180 dg to (CIRCUM) ldiagdolabel ldiagpadd 0 0
toarrowlength 180 dg ldiagatangle ldiagpadd /TO ldiagpointdef
0 dg /TO@ANGLE ldiagangledef
/XLEFT [ FROM pop TO pop ldiagmin bias sub ] cvx def
/XP1 [ XLEFT FROM exch pop ] cvx def
/XP2 [ XLEFT TO exch pop ] cvx def
/VERT [ XP1 XP2 ldiagangleto ] cvx def
XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
VERT /LMID@ANGLE ldiagangledef
/XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def
/ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def
XINDENT 0 FROM ldiagpsub /LFROM ldiagpointdef
180 dg /LFROM@ANGLE ldiagangledef
ZINDENT 0 TO ldiagpsub /LTO ldiagpointdef
0 dg /LTO@ANGLE ldiagangledef
/RADIUS [ radius XP1 XP2 ldiagdistance 2 div ldiagmin ] cvx def
/XP1PRE [ XP1 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
/XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
/XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd
/P1 ldiagpointdef
XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef
/XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def
/XP2POST [ XP2 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
/XP2CTR [ XP2PRE 0 0 RADIUS 0 dg ldiagatangle ldiagpadd ] cvx def
XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd
/P2 ldiagpointdef
XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef
FROM LFROM XP1PRE
{ } { [XP1CTR] P1 [XP1CTR] } { } { [XP1CTR clockwise] P1 [XP1CTR clockwise] }
{ } { } { } { } VERT round ldiagquadcase
XP1POST LMID XP2PRE
{ } { [XP2CTR] P2 [XP2CTR] } { } { [XP2CTR clockwise] P2 [XP2CTR clockwise] }
{ } { } { } { } VERT round ldiagquadcase
XP2POST LTO TO
% (leaving ldiaglvrcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias ldiagrvllinepath -
/ldiagrvllinepath
{
% (entering ldiagrvllinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
0 dg /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef
180 dg /TO@ANGLE ldiagangledef
/XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def
XRIGHT FROM exch pop /P1 ldiagpointdef
XRIGHT TO exch pop /P2 ldiagpointdef
/VERT [ P1 P2 ldiagangleto ] cvx def
P1 P1 0 0 1 ft 0 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
ldiagpadd ldiagangleto /P1@ANGLE ldiagangledef
P2 P2 0 0 1 ft 180 dg ldiagatangle ldiagpadd 0 0 1 ft VERT ldiagatangle
ldiagpadd ldiagangleto /P2@ANGLE ldiagangledef
P1 0.5 ldiagpmul P2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
VERT /LMID@ANGLE ldiagangledef
/XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
/ZINDENT [ zindent P2 TO ldiagdistance ldiagmin ] cvx def
FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef
0 dg /LFROM@ANGLE ldiagangledef
TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef
180 dg /LTO@ANGLE ldiagangledef
FROM LFROM P1 LMID P2 LTO TO
% (leaving ldiagrvllinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias radius ldiagrvlcurvepath -
/ldiagrvlcurvepath
{
% (entering ldiagrvlcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
from (CTR) ldiagdolabel 0 dg from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength 0 dg ldiagatangle ldiagpadd /FROM ldiagpointdef
0 dg /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel 0 dg to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength 0 dg ldiagatangle ldiagpadd /TO ldiagpointdef
180 dg /TO@ANGLE ldiagangledef
/XRIGHT [ FROM pop TO pop ldiagmax bias add ] cvx def
/XP1 [ XRIGHT FROM exch pop ] cvx def
/XP2 [ XRIGHT TO exch pop ] cvx def
/VERT [ XP1 XP2 ldiagangleto ] cvx def
XP1 0.5 ldiagpmul XP2 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
VERT /LMID@ANGLE ldiagangledef
/XINDENT [ xindent FROM XP1 ldiagdistance ldiagmin ] cvx def
/ZINDENT [ zindent XP2 TO ldiagdistance ldiagmin ] cvx def
FROM XINDENT 0 ldiagpadd /LFROM ldiagpointdef
0 dg /LFROM@ANGLE ldiagangledef
TO ZINDENT 0 ldiagpadd /LTO ldiagpointdef
180 dg /LTO@ANGLE ldiagangledef
/RADIUS [ radius XP1 XP2 ldiagdistance 0.5 mul ldiagmin ] cvx def
/XP1PRE [ XP1 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
/XP1POST [ XP1 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
/XP1CTR [ XP1PRE 0 0 RADIUS VERT ldiagatangle ldiagpadd ] cvx def
XP1CTR 0 0 RADIUS XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd
/P1 ldiagpointdef
XP1PRE XP1POST ldiagangleto /P1@ANGLE ldiagangledef
/XP2PRE [ 0 0 RADIUS VERT ldiagatangle XP2 ldiagpsub ] cvx def
/XP2POST [ XP2 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
/XP2CTR [ XP2PRE 0 0 RADIUS 180 dg ldiagatangle ldiagpadd ] cvx def
XP2CTR 0 0 RADIUS XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd
/P2 ldiagpointdef
XP2PRE XP2POST ldiagangleto /P2@ANGLE ldiagangledef
FROM LFROM XP1PRE
{} {[XP1CTR clockwise] P1 [XP1CTR clockwise]} {} {[XP1CTR] P1 [XP1CTR]}
{} {} {} {} VERT round ldiagquadcase
XP1POST LMID XP2PRE
{} {[XP2CTR clockwise] P2 [XP2CTR clockwise]} {} {[XP2CTR] P2 [XP2CTR]}
{} {} {} {} VERT round ldiagquadcase
XP2POST LTO TO
% (leaving ldiagrvlcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias fbias tbias ldiagdwraplinepath -
/ldiagdwraplinepath
{
% (entering ldiagdwraplinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/tbias exch def
/fbias exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop
lt { 180 dg } { 0 dg } ifelse ] cvx def
from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd 0 0
fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
DIRN /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
DIRN /TO@ANGLE ldiagangledef
FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef
DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P1@ANGLE ldiagangledef
TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd
/P4 ldiagpointdef
DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P4@ANGLE ldiagangledef
/YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd
exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd
exch pop ldiagmin bias 0 ldiagmax sub ] cvx def
P1 pop YC /P2 ldiagpointdef
P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef
P4 pop YC /P3 ldiagpointdef
P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef
/XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
/ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def
TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
DIRN 180 dg sub /LMID@ANGLE ldiagangledef
FROM P1 P2 P3 P4 TO
% (leaving ldiagdwraplinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias fbias tbias radius
% ldiagdwrapcurvepath -
/ldiagdwrapcurvepath
{
% (entering ldiagdwrapcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/tbias exch def
/fbias exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
{ 180 dg } { 0 dg } ifelse ] cvx def
/CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
{ anticlockwise } { clockwise } ifelse ] cvx def
from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
DIRN /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
DIRN /TO@ANGLE ldiagangledef
/XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def
/XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def
/YC [ from (CTR) ldiagdolabel 270 dg from (CIRCUM) ldiagdolabel ldiagpadd
exch pop to (CTR) ldiagdolabel 270 dg to (CIRCUM) ldiagdolabel ldiagpadd
exch pop ldiagmin bias 0 ldiagmax sub ] cvx def
/XP2 [ XP1 pop YC ] cvx def
/XP3 [ XP4 pop YC ] cvx def
/RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef
XP1CTR P1 ldiagangleto DIRN add 90 dg sub /P1@ANGLE ldiagangledef
/RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef
XP2CTR P2 ldiagangleto DIRN add 90 dg sub /P2@ANGLE ldiagangledef
/RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef
XP3CTR P3 ldiagangleto DIRN add 90 dg sub /P3@ANGLE ldiagangledef
/RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance
ldiagmin ldiagmin ] cvx def
/XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef
XP4CTR P4 ldiagangleto DIRN add 90 dg sub /P4@ANGLE ldiagangledef
/XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def
FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
DIRN 180 dg sub /LMID@ANGLE ldiagangledef
/ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def
TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
FROM LFROM
XP1PRE [XP1CTR CLOCK] XP1POST
XP2PRE [XP2CTR CLOCK] XP2POST
LMID
XP3PRE [XP3CTR CLOCK] XP3POST
XP4PRE [XP4CTR CLOCK] XP4POST
LTO TO
% (leaving ldiagdwrapcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias fbias tbias ldiaguwraplinepath -
/ldiaguwraplinepath
{
% (entering ldiaguwraplinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/tbias exch def
/fbias exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
{ 180 dg } { 0 dg } ifelse ] cvx def
from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
DIRN /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
DIRN /TO@ANGLE ldiagangledef
FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd /P1 ldiagpointdef
DIRN 180 dg eq { 135 dg } { 45 dg } ifelse /P1@ANGLE ldiagangledef
TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd
/P4 ldiagpointdef
DIRN 180 dg eq { 225 dg } { -45 dg } ifelse /P4@ANGLE ldiagangledef
/YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd
exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd
exch pop ldiagmax bias 0 ldiagmax add ] cvx def
P1 pop YC /P2 ldiagpointdef
P4@ANGLE 180 dg sub /P2@ANGLE ldiagangledef
P4 pop YC /P3 ldiagpointdef
P1@ANGLE 180 dg sub /P3@ANGLE ldiagangledef
/XINDENT [ xindent FROM P1 ldiagdistance ldiagmin ] cvx def
FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
/ZINDENT [ zindent TO P4 ldiagdistance ldiagmin ] cvx def
TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
P2 0.5 ldiagpmul P3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
DIRN 180 dg sub /LMID@ANGLE ldiagangledef
FROM P1 P2 P3 P4 TO
% (leaving ldiaguwraplinepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% farr tarr { from } { to } xindent zindent bias fbias tbias radius
% ldiaguwrapcurvepath -
/ldiaguwrapcurvepath
{
% (entering ldiaguwrapcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
/radius exch def
/tbias exch def
/fbias exch def
/bias exch def
/zindent exch def
/xindent exch def
cvlit /to exch def
cvlit /from exch def
/toarrowlength exch def
/fromarrowlength exch def
/DIRN [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
{ 180 dg } { 0 dg } ifelse ] cvx def
/CLOCK [ from (CTR) ldiagdolabel pop to (CTR) ldiagdolabel pop lt
{ clockwise } { anticlockwise } ifelse ] cvx def
from (CTR) ldiagdolabel DIRN from (CIRCUM) ldiagdolabel ldiagpadd
0 0 fromarrowlength DIRN ldiagatangle ldiagpadd /FROM ldiagpointdef
DIRN /FROM@ANGLE ldiagangledef
to (CTR) ldiagdolabel DIRN 180 dg add to (CIRCUM) ldiagdolabel ldiagpadd
0 0 toarrowlength DIRN 180 dg add ldiagatangle ldiagpadd /TO ldiagpointdef
DIRN /TO@ANGLE ldiagangledef
/XP1 [ FROM 0 0 fbias 0 ldiagmax DIRN ldiagatangle ldiagpadd ] cvx def
/XP4 [ TO 0 0 tbias 0 ldiagmax DIRN 180 dg add ldiagatangle ldiagpadd ] cvx def
/YC [ from (CTR) ldiagdolabel 90 dg from (CIRCUM) ldiagdolabel ldiagpadd
exch pop to (CTR) ldiagdolabel 90 dg to (CIRCUM) ldiagdolabel ldiagpadd
exch pop ldiagmax bias 0 ldiagmax add ] cvx def
/XP2 [ XP1 pop YC ] cvx def
/XP3 [ XP4 pop YC ] cvx def
/RP1 [ radius XP1 FROM ldiagdistance XP1 XP2 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP1PRE [ XP1 0 0 RP1 XP1 FROM ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP1POST [ XP1 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP1CTR [ XP1PRE 0 0 RP1 XP1 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP1CTR 0 0 RP1 XP1CTR XP1 ldiagangleto ldiagatangle ldiagpadd /P1 ldiagpointdef
XP1CTR P1 ldiagangleto DIRN add 90 dg add /P1@ANGLE ldiagangledef
/RP2 [ radius XP1 XP2 ldiagdistance 2 div XP2 XP3 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP2PRE [ XP2 0 0 RP2 XP2 XP1 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP2POST [ XP2 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP2CTR [ XP2PRE 0 0 RP2 XP2 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP2CTR 0 0 RP2 XP2CTR XP2 ldiagangleto ldiagatangle ldiagpadd /P2 ldiagpointdef
XP2CTR P2 ldiagangleto DIRN add 90 dg add /P2@ANGLE ldiagangledef
/RP3 [ radius XP2 XP3 ldiagdistance 2 div XP3 XP4 ldiagdistance 2 div
ldiagmin ldiagmin ] cvx def
/XP3PRE [ XP3 0 0 RP3 XP3 XP2 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP3POST [ XP3 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP3CTR [ XP3PRE 0 0 RP3 XP3 XP4 ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP3CTR 0 0 RP3 XP3CTR XP3 ldiagangleto ldiagatangle ldiagpadd /P3 ldiagpointdef
XP3CTR P3 ldiagangleto DIRN add 90 dg add /P3@ANGLE ldiagangledef
/RP4 [ radius XP4 XP3 ldiagdistance 2 div XP4 TO ldiagdistance
ldiagmin ldiagmin ] cvx def
/XP4PRE [ XP4 0 0 RP4 XP4 XP3 ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP4POST [ XP4 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
/XP4CTR [ XP4PRE 0 0 RP4 XP4 TO ldiagangleto ldiagatangle ldiagpadd ] cvx def
XP4CTR 0 0 RP4 XP4CTR XP4 ldiagangleto ldiagatangle ldiagpadd /P4 ldiagpointdef
XP4CTR P4 ldiagangleto DIRN add 90 dg add /P4@ANGLE ldiagangledef
/XINDENT [ xindent FROM XP1PRE ldiagdistance ldiagmin ] cvx def
FROM 0 0 XINDENT DIRN ldiagatangle ldiagpadd /LFROM ldiagpointdef
FROM@ANGLE /LFROM@ANGLE ldiagangledef
XP2 0.5 ldiagpmul XP3 0.5 ldiagpmul ldiagpadd /LMID ldiagpointdef
DIRN 180 dg sub /LMID@ANGLE ldiagangledef
/ZINDENT [ zindent TO XP4POST ldiagdistance ldiagmin ] cvx def
TO 0 0 ZINDENT DIRN 180 dg add ldiagatangle ldiagpadd /LTO ldiagpointdef
TO@ANGLE /LTO@ANGLE ldiagangledef
FROM LFROM
XP1PRE [XP1CTR CLOCK] XP1POST
XP2PRE [XP2CTR CLOCK] XP2POST
LMID
XP3PRE [XP3CTR CLOCK] XP3POST
XP4PRE [XP4CTR CLOCK] XP4POST
LTO TO
% (leaving ldiaguwrapcurvepath) 0 ldiagdebugprint
% count ( stack size is) 1 ldiagdebugprint pop
} def
% shape and labels of the @SolidArrowHead symbol
% - ldiagsolidarrowhead -
/ldiagsolidarrowhead
{
0 0 xsize ysize 0.5 mul 0 ysize
} def
% shape and labels of the @OpenArrowHead symbol
% <pathwidth> ldiagopenarrowhead -
/ldiagopenarrowhead
{
/pathwidth exch def
/PSW [ 0 0 ] cvx def
/PNW [ 0 ysize ] cvx def
/PE [ xsize ysize 0.5 mul ] cvx def
/REL [ 0 0 pathwidth PE PNW ldiagangleto 90 add ldiagatangle ] cvx def
/PNA [ 0 ysize 0.5 mul pathwidth 0.5 mul add ] cvx def
/PSA [ 0 ysize 0.5 mul pathwidth 0.5 mul sub ] cvx def
/PNI [ PNA PNA xsize 0 ldiagpadd PNW REL ldiagpadd
PE REL ldiagpadd ldiaglineintersect ] cvx def
/PSI [ 0 pathwidth PNI ldiagpsub ] cvx def
PSW PE PNW PNI PNA PSA PSI PSW
} def
% shape and labels of the @HalfOpenArrowHead symbol
% <pathwidth> ldiaghalfopenarrowhead -
/ldiaghalfopenarrowhead
{
/pathwidth exch def
0 0
xsize ysize 0.5 mul
0 ysize
xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul add
0 ysize 0.5 mul pathwidth 0.5 mul add
0 ysize 0.5 mul pathwidth 0.5 mul sub
xsize 0.3 mul ysize 0.5 mul pathwidth 0.5 mul sub
0 0
} def
% shape and labels of the @SolidCurvedArrowHead symbol
% - ldiagsolidcurvedarrowhead -
/ldiagsolidcurvedarrowhead
{
0 0
[0 0 xsize ysize 0.5 mul ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect clockwise]
xsize ysize 0.5 mul
[xsize ysize 0.5 mul 0 ysize ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect clockwise]
0 ysize
} def
% shape and labels of the @OpenCurvedArrowHead symbol
% <pathwidth> ldiagopencurvedarrowhead -
/ldiagopencurvedarrowhead
{
/pathwidth exch def
/LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect
] cvx def
/UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect
] cvx def
/PW2 [ pathwidth 0.5 mul ] cvx def
/UMID [
0 ysize 0.5 mul PW2 add
xsize ysize 0.5 mul PW2 add
0 ysize 0 0 1 ft UR 0 ysize ldiagangleto 90 add ldiagatangle
ldiagpadd 0 ysize ldiaglineintersect
] cvx def
/LMID [ 0 pathwidth UMID ldiagpsub ] cvx def
0 0
[LR clockwise]
xsize ysize 0.5 mul
[UR clockwise]
0 ysize
UMID
0 ysize 0.5 mul PW2 add
0 ysize 0.5 mul PW2 sub
LMID
0 0
} def
% shape and labels of the @HalfOpenCurvedArrowHead symbol
% <pathwidth> ldiaghalfopencurvedarrowhead -
/ldiaghalfopencurvedarrowhead
{
/pathwidth exch def
/LR [ 0 0 xsize ysize 0.5 mul ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect
] cvx def
/UR [ xsize ysize 0.5 mul 0 ysize ldiaglinebetween
xsize 0 xsize ysize ldiaglineintersect
] cvx def
/BR [ 0 0 LR 0 ysize UR ldiaglineintersect ] cvx def
/BRAD [ 0 0 BR ldiagdistance ] cvx def
/PW2 [ pathwidth 0.5 mul ] cvx def
/XDIST [ BRAD dup mul PW2 dup mul sub sqrt ] cvx def
/UMID [ BR XDIST PW2 ldiagpadd ] cvx def
/LMID [ BR XDIST 0 PW2 sub ldiagpadd ] cvx def
0 0
[LR clockwise]
xsize ysize 0.5 mul
[UR clockwise]
0 ysize
[BR clockwise]
UMID
0 ysize 0.5 mul PW2 add
0 ysize 0.5 mul PW2 sub
LMID
[BR clockwise]
0 0
} def
end
%%EndResource
%%BeginResource: procset LoutBasicSetup
% @PrependGraphic file /export/home/6monthspace/jeff/lout.lib/include/bsf.lpg
% width height linethickness louteuro -
% draw a Euro symbol of this width and height with this line thickness
/louteuro {
20 dict begin
/eurothick exch def
/euroheight exch def
/eurowidth exch def
/eurostrokewidth euroheight 0.8 mul def
/eurostep eurothick 60 cos mul 60 sin div def
/eurotheta 40 def
% llx lly width thickness louteurobox -
% draw angled box starting at (llx, lly) with given width and thickness
/louteurobox
{
/euroboxthick exch def
/euroboxwidth exch def
newpath moveto euroboxwidth 0 rlineto
eurostep euroboxthick rlineto
euroboxwidth neg 0 rlineto closepath fill
} def
% lower cross stroke
0 euroheight 2 div eurothick 1.5 mul sub
eurostrokewidth eurothick louteurobox
% upper cross stroke
0 euroheight 2 div eurothick 0.5 mul add
eurostrokewidth eurostep 2 mul add eurothick louteurobox
% circular part
/eurohctr eurowidth euroheight 2 div eurotheta cos mul sub def
/eurovctr euroheight 2 div def
newpath
eurohctr eurovctr eurovctr eurotheta 350 eurotheta sub arc
eurohctr eurovctr eurovctr eurothick sub 365 eurotheta sub eurotheta arcn
closepath fill
end
} def
% path for @FullWidthRule symbol
/LoutRule
{ 0 0 moveto xsize 0 lineto
} def
% path for @Box symbol
/LoutBox
{ 0 0 moveto xsize 0 lineto
xsize ysize lineto 0 ysize lineto
closepath
} def
% path for @CurveBox symbol
/LoutCurveBox
{ xmark 0 moveto
xsize xmark sub xmark xmark 270 360 arc
xsize xmark sub ysize xmark sub xmark 0 90 arc
xmark ysize xmark sub xmark 90 180 arc
xmark xmark xmark 180 270 arc
closepath
} def
% path for @ShadowBox symbol
/LoutShadowBox
{ xmark 2 mul 0 moveto xsize 0 lineto
xsize ysize xmark 2 mul sub lineto
xsize xmark sub ysize xmark 2 mul sub lineto
xsize xmark sub xmark lineto
xmark 2 mul xmark lineto
closepath
} def
% set up dictionary containing margin note data: parity LoutMargSet -
/LoutMargSet
{ /LoutMargDict 12 dict def
LoutMargDict begin
/parity exch def
/matr matrix currentmatrix def
/rightx xsize def
/lefty ysize def % highest allowable point for top of next left note
/righty ysize def % highest allowable point for top of next right note
/max { 2 copy gt { pop } { exch pop } ifelse } def
/min { 2 copy lt { pop } { exch pop } ifelse } def
end
} def
%translate coordinate system for marginal notes: type LoutMargShift -
% where type 0 is left margin, 1 is right margin, 2 is outer, 3 is inner
/LoutMargShift
{ LoutMargDict begin
% y coordinate of top of note, in margin coords, before vertical adjust
0 ysize transform matr itransform exch pop
% decide whether left or right margin based on type and parity
exch [ 0 1 parity 1 parity sub ] exch get 0 eq
{
% left margin: adjust top of note downwards if overlaps previous note
lefty min
% bottom of note is new lefty position and also translate position
ysize sub dup /lefty exch def
% want right edge of note at coordinate zero
xsize neg exch
}
{
% right margin: adjust top of note downwards if overlaps previous note
righty min
% bottom of note is new righty position and also translate position
ysize sub dup /righty exch def
% want left edge of note at coordinate rightx
rightx exch
} ifelse
% stack now contains coord of bottom left corner in margin coordinates
matr setmatrix translate
end
} def
% create LoutPageDict with left, right, foot, top for @Place symbol users
/LoutPageSet
{
/LoutPageDict 5 dict def
LoutPageDict begin
/matr matrix currentmatrix def
/left 0 def
/right xsize def
/foot 0 def
/top ysize def
end
} def
%%EndResource
%%EndProlog
%%BeginSetup
%%IncludeResource: font Times-Roman
/Times-Romanfnt82 vec2 /Times-Roman LoutRecode
/fnt82 { /Times-Romanfnt82 LoutFont } def
%%IncludeResource: font Helvetica
/Helveticafnt35 vec2 /Helvetica LoutRecode
/fnt35 { /Helveticafnt35 LoutFont } def
%%IncludeResource: font Symbol
/fnt78 { /Symbol LoutFont } def
%%EndSetup
%%Page: 11 1
%%BeginPageSetup
%%PageResources: font Times-Roman
%%+ font Times-Italic
%%+ font Times-Bold
%%+ font Helvetica
/pgsave save def
%%IncludeResource: font Times-Italic
/Times-Italicfnt83 vec2 /Times-Italic LoutRecode
/fnt83 { /Times-Italicfnt83 LoutFont } def
%%IncludeResource: font Times-Bold
/Times-Boldfnt84 vec2 /Times-Bold LoutRecode
/fnt84 { /Times-Boldfnt84 LoutFont } def
0.0500 dup scale 10 setlinewidth
%%EndPageSetup
gsave
0 0 translate
240 fnt82 0.0 0.0 0.0 setrgbcolor 11900 16840 0 16840 240 288 60 LoutGraphic
gsave
LoutPageSet
grestore
gsave
0 16840 translate
0.0000 rotate
9066 14006 0 14006 240 288 60 1417 -15423 LoutGr2
1 LoutMargSet
grestore
240 fnt83 0 13843(1.10.)m 574(Notes)s 1174(on)s 1468(P)s 19(erl)k
1920(and)s 2346(P)s 19(od)k 240 fnt84 8839 13840(11)m
0 13250(1.10.)m 591(Notes)s 1216(on)s 1525(P)s 4(erl)k
2000(and)s 2441(P)s 4(od)k 240 fnt82 480 12818(The)m
923(Perl)s 1378(programming)s 2749(language)s 153 fnt82 3609 12907(1)m
240 fnt82 3744 12818(is)m 3970(quite)s 4520(a)s 4702(dif\207cult)s
5533(one)s 5951(for)s 6305(the)s 220 fnt35 6668 12815(prg2lout)m
240 fnt82 7532 12818(program)m 8418(to)s 8673(deal)s 0 12530(with,)m
526(and)s 924(our)s 1297(boast)s 1855(that)s 2267(programs)s
3215(can)s 3598(be)s 3873(included)s 4749(with)s 5225(`absolutely)s
6335(no)s 6621(modi\207cations')s 8029(is)s 8233(not)s 8592(quite)s
0 12242(true)m 427(for)s 765(Perl.)s 480 11868(Here)m 1000(is)s
1211(the)s 1560(complete)s 2493(list)s 2844(of)s 3116(problem)s
3974(areas.)s 4629(In)s 4885(most)s 5411(cases)s 5967(the)s
6316(ef)s 6(fect)k 6912(is)s 7123(to)s 7363(get)s
7716(the)s 8065(formatting)s 0 11580(wrong)m 675(o)s 3(v)k 3(er)k
1164(a)s 1341(short)s 1889(re)s 3(gion,)k 2615(which)s
3267(is)s 3488(not)s 3864(perhaps)s 4670(so)s 4946(disastrous;)s
6025(and)s 6439(it)s 6642(should)s 7349(be)s 7642(easy)s
8131(to)s 8381(modify)s 0 11292(your)m 507(Perl)s 955(program)s
1834(without)s 2634(changing)s 3574(its)s 3859(meaning,)s 4799(to)s
5046(w)s 2(ork)k 5606(around)s 6338(these)s 6894(problems.)s
7957(After)s 8529(all,)s 8883(in)s 0 11004(Perl)m 439(there)s
972(is)s 1182(al)s 2(w)k 2(ays)k 1893(more)s
2440(than)s 2909(one)s 3311(w)s 2(ay)k 3762(to)s
4001(do)s 4294(it.)s 0 10499(1.)m 240 fnt83 480 10501(Her)m 8(e-documents)k
240 fnt82 2108 10499(such)m 2604(as)s 960 10047(<<"EOF")m 960 9759(These lines will be read as though)m
960 9471(enclosed in double quotes)m 960 9183(EOF)m 480 8729(will)m 910(be)s 1196(handled)s
2017(correctly)s 2923(only)s 3407(if)s 3629(the)s 3981(string)s
4583(used)s 5084(to)s 5327(terminate)s 6289(the)s 6641(document)s
7649(is)s 7864(one)s 8270(of)s 240 fnt83 8546 8731(EOF)m
240 fnt82 9019 8729(,)m 240 fnt83 480 8443(EO)m 9(T)k
240 fnt82 941 8441(,)m 240 fnt83 1040 8443(END)m 240 fnt82
1514 8441(,)m 1613(and)s 2009(the)s 2348(empty)s 2992(string.)s
3692(This)s 4160(terminating)s 5305(string)s 5894(may)s 6352(be)s
6626(enclosed)s 7512(in)s 7747(all)s 8032(three)s 8556(kinds)s
480 8153(of)m 761(quotes,)s 1504(or)s 1773(in)s 2027(none.)s
2668(An)s 3(ything)k 3633(after)s 4140(the)s 4498(<<)s
4833(symbol)s 5604(on)s 5911(the)s 6270(same)s 6827(line)s
7252(will)s 7689(be)s 7981(treated)s 8699(as)s 8960(a)s
480 7865(string,)m 1131(which)s 1773(means)s 2435(that)s 2853(stack)s 2(ed)k
3626(here-documents)s 5204(will)s 5630(not)s 5996(be)s 6278(printed)s
7013(properly)s 15(.)k 0 7362(2.)m 480(When)s 220 fnt35
1115 7359(prg2lout)m 240 fnt82 1969 7362(is)m 2186(scanning)s 3096(the)s
3451(program)s 4327(looking)s 5118(for)s 5463(the)s 5817(be)s 3(ginning)k
6832(of)s 7109(a)s 7281(le)s 3(xical)k 7976(unit,)s
8461(it)s 8660(may)s 480 7074(come)m 1074(upon)s 1632(a)s
220 fnt35 1819 7071(/)m 240 fnt82 1964 7074(character)m 9(,)k
2957(and)s 3382(this)s 240 fnt83 3799 7076(initial)m 220 fnt35
4450 7071(/)m 240 fnt82 4594 7074(\(not)m 5060(subsequent)s 6205(ones)s
6716(in)s 6980(the)s 7349(same)s 7917(le)s 3(xical)k
8626(unit\))s 480 6786(it)m 691(\207nds)s 1227(dif\207cult)s 2062(to)s
2320(interpret,)s 3254(since)s 3820(it)s 4031(may)s 4517(be)s
4818(the)s 5185(be)s 3(ginning)k 6212(of)s 6502(a)s
6687(re)s 3(gular)k 7439(e)s 3(xpression,)k 8585(to)s
8844(be)s 480 6498(formatted)m 1460(lik)s 2(e)k 1865(a)s
2024(string,)s 2668(or)s 2920(it)s 3105(may)s 3564(be)s
3839(a)s 3998(complete)s 4923(le)s 3(xical)k 5604(unit)s
6029(denoting)s 6913(di)s 6(vision.)k 7835(The)s 8256(program)s
480 6210(chooses)m 1308(the)s 1675(re)s 3(gular)k 2427(e)s 3(xpression)k
3524(\(or)s 3881(equi)s 6(v)k 6(alently)k 15(,)k
5162(string\))s 5853(interpretation)s 7216(if)s 7452(the)s 220 fnt35
7819 6207(/)m 240 fnt82 7962 6210(character)m 8916(is)s 480 5922(immediately)m
1714(preceded)s 2620(by)s 220 fnt35 2900 5919(q)m 240 fnt82
3009 5922(,)m 220 fnt35 3101 5919(qq)m 240 fnt82 3332 5922(,)m
220 fnt35 3424 5919(qx)m 240 fnt82 3654 5922(,)m 220 fnt35
3747 5919(qw)m 240 fnt82 4025 5922(,)m 220 fnt35 4117 5919(qr)m
240 fnt82 4312 5922(,)m 220 fnt35 4405 5919(m)m 240 fnt82
4574 5922(,)m 220 fnt35 4666 5919(s)m 240 fnt82 4769 5922(,)m
220 fnt35 4861 5919(y)m 240 fnt82 4969 5922(,)m 5062(or)s
220 fnt35 5306 5919(tr)m 240 fnt82 5440 5922(.)m 5590(It)s
5780(also)s 6203(chooses)s 6998(the)s 7331(re)s 3(gular)k
8049(e)s 3(xpression)k 480 5634(interpretation)m 1834(if)s 2063(the)s
220 fnt35 2423 5631(/)m 240 fnt82 2558 5634(character)m 3504(is)s
3726(immediately)s 4986(preceded)s 5918(by)s 6224(zero,)s 6754(one,)s
7219(or)s 7489(tw)s 2(o)k 7911(space)s 8510(or)s
8781(tab)s 480 5346(characters,)m 1549(which)s 2186(are)s 2528(themselv)s 3(es)k
3633(immediately)s 4876(preceded)s 5792(by)s 6081(a)s 6242(complete)s
7169(le)s 3(xical)k 7852(unit)s 8279(which)s 8916(is)s
480 5058(either)m 220 fnt35 1078 5055(=)m 240 fnt82 1198 5058(,)m
220 fnt35 1300 5055(=~)m 240 fnt82 1543 5058(,)m 220 fnt35
1645 5055(!~)m 240 fnt82 1821 5058(,)m 220 fnt35 1923 5055(split)m
240 fnt82 2308 5058(,)m 2410(or)s 220 fnt35 2664 5055(if)m
240 fnt82 2770 5058(.)m 2929(Otherwise)s 3961(it)s 4148(chooses)s
4952(the)s 5295(di)s 6(vision)k 6112(interpretation.)s 7557(In)s
7808(the)s 8151(rare)s 8571(cases)s 480 4770(where)m 1120(this)s
1517(rule)s 1945(f)s 2(ails,)k 2460(you)s 2876(can)s
3266(force)s 220 fnt35 3812 4767(prg2lout)m 240 fnt82 4661 4770(to)m
4901(choose)s 5622(the)s 5971(re)s 3(gular)k 6705(e)s 3(xpression)k
7783(interpretation)s 480 4482(by)m 777(placing)s 1537(an)s 220 fnt35
1823 4479(m)m 240 fnt82 2055 4482(in)m 2301(front)s 2829(of)s
3103(the)s 3454(initial)s 220 fnt35 4068 4479(/)m 240 fnt82
4195 4482(\(this)m 4673(does)s 5167(not)s 5536(change)s 6273(the)s
6624(meaning)s 7504(of)s 7778(the)s 8130(program\),)s 480 4194(and)m
910(you)s 1352(can)s 1768(force)s 2341(the)s 2716(di)s 6(vision)k
3565(interpretation)s 4935(by)s 5256(placing)s 6040(at)s 6299(least)s
6823(three)s 7383(spaces)s 8085(before)s 8778(the)s 220 fnt35
480 3903(/)m 240 fnt82 604 3906(character)m 13(.)k 0 3448(3.)m
480(The)s 220 fnt35 910 3445(prg2lout)m 240 fnt82 1761 3448(program)m
2634(recognises)s 3697(complete)s 4632(substitution)s 5808(operators,)s 6807(such)s
7306(as)s 220 fnt35 7559 3445(s/abc/ABC/)m 240 fnt82 8722 3448(and)m
220 fnt35 480 3157(s{abc}{ABC})m 240 fnt82 1677 3160(,)m 1799(as)s
2065(indi)s 6(vidual)k 3100(le)s 3(xical)k 3804(units,)s
4392(and)s 4812(it)s 5019(formats)s 5815(them)s 6369(as)s
6635(it)s 6843(does)s 7349(strings.)s 8166(Ho)s 6(we)k 6(v)k 3(er)k 9(,)k
480 2872(its)m 774(rule)s 1219(for)s 1575(deciding)s 2470(where)s
3128(these)s 3693(units)s 4227(end)s 4650(is)s 4878(rather)s
5512(simple-minded:)s 7130(at)s 7380(the)s 7746(start,)s 8281(it)s
8492(w)s 2(orks)k 480 2584(out)m 846(what)s 1372(character)s
2306(\207nishes)s 3089(the)s 3438(unit)s 3870(\(in)s 4193(the)s
4541(e)s 3(xamples)k 5493(abo)s 3(v)k 3(e,)k
220 fnt35 6167 2581(/)m 240 fnt82 6291 2584(and)m 220 fnt35
6696 2581(})m 240 fnt82 6820 2584(respecti)m 6(v)k 3(ely\),)k
8152(and)s 8557(scans)s 480 2296(along)m 1070(until)s 1569(it)s
1767(reaches)s 2540(the)s 2894(second)s 3622(occurrence)s 4732(of)s
5009(this)s 5411(character)s 6351(not)s 6722(preceded)s 7649(by)s
7949(the)s 220 fnt35 8303 2293(\\)m 240 fnt82 8433 2296(escape)m
480 2008(character)m 13(.)k 1505(This)s 1981(is)s 2191(inadequate)s
3283(in)s 3526(tw)s 2(o)k 3936(respects.)s 4869(Firstly)s 15(,)k
220 fnt35 960 1510(s{{}}{})m 240 fnt82 480 1016(is)m 698(a)s
872(complete)s 1812(le)s 3(g)k 1(al)k 2336(substitution)s
3517(e)s 3(xpression)k 4602(in)s 4853(Perl,)s 5353(b)s 4(ut)k
220 fnt35 5723 1013(prg2lout)m 240 fnt82 6579 1016(will)m 7013(think)s
7575(it)s 7775(ends)s 8273(after)s 8778(the)s 480 728(second)m
220 fnt35 1203 725(})m 240 fnt82 1267 728(,)m 1374(and)s
1778(so)s 2044(format)s 2740(the)s 3088(rest)s 3492(of)s
3763(it)s 3955(wrongly)s 15(.)k 4902(Secondly)s 15(,)k
5885(and)s 6289(more)s 6836(seriously)s 15(,)k 1134 0 0 0 240 288 60 0 307 LoutGr2
0 0 moveto xsize 0 lineto stroke
grestore
grestore
122 fnt82
0 112(1)m 192 fnt82 58 42(My)m 368(thanks)s 909(to)s
1101(Mark)s 1563(Summer\207eld)s 2598(for)s 2868(help)s 3241(with)s
3627(Perl)s 3978(and)s 4302(Pod.)s
grestore
grestore
grestore
pgsave restore
showpage
%%Page: 12 2
%%BeginPageSetup
%%PageResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%+ font Helvetica
/pgsave save def
%%IncludeResource: font Times-Bold
/Times-Boldfnt84 vec2 /Times-Bold LoutRecode
/fnt84 { /Times-Boldfnt84 LoutFont } def
%%IncludeResource: font Times-Italic
/Times-Italicfnt83 vec2 /Times-Italic LoutRecode
/fnt83 { /Times-Italicfnt83 LoutFont } def
0.0500 dup scale 10 setlinewidth
%%EndPageSetup
gsave
0 0 translate
240 fnt82 0.0 0.0 0.0 setrgbcolor 11900 16840 0 16840 240 288 60 LoutGraphic
gsave
LoutPageSet
grestore
gsave
0 16840 translate
0.0000 rotate
9066 14006 0 14006 240 288 60 1417 -15423 LoutGr2
0 LoutMargSet
grestore
240 fnt84 0 13840(12)m 240 fnt83 5981 13843(Chapter)m 6831(1.)s
7105(Computer)s 8128(Pr)s 10(o)k 2(gr)k 3(ams)k
220 fnt35 960 13207(s{abc}<ABC>)m 240 fnt82 480 12713(is)m 711(also)s
1171(allo)s 6(wed)k 2001(in)s 2266(Perl,)s 2778(b)s 4(ut)k
220 fnt35 3162 12710(prg2lout)m 240 fnt82 4031 12713(does)m 4543(not)s
4930(understand)s 6060(that)s 6499(the)s 6869(\207nishing)s 7781(character)s
8737(can)s 480 12425(change)m 1215(in)s 1459(this)s 1856(w)s 2(ay)k 15(,)k
2346(so)s 2613(in)s 2858(this)s 3255(e)s 3(xample)k
4119(it)s 4312(will)s 4739(k)s 2(eep)k 5244(scanning)s
6149(fore)s 6(v)k 3(er)k 9(,)k 6928(looking)s
7714(for)s 8053(the)s 8403(second)s 220 fnt35 480 12134(})m
240 fnt82 604 12137(character)m 9(,)k 1576(which)s 2218(is)s
2428(disastrous.)s 0 11640(Further)m 763(w)s 2(ork)k 1314(may)s
1780(eliminate)s 2724(some)s 3285(of)s 3556(these)s 4103(problems.)s
480 11266(The)m 953(Pod)s 1429(language)s 2394(is)s 2650(used)s
3192(by)s 3531(Perl)s 4015(programmers)s 5386(for)s 5769(creating)s
6636(documentation,)s 8210(and)s 8660(may)s 0 10978(be)m 313(found)s
961(within)s 1660(Perl)s 2131(programs)s 3116(or)s 3406(standing)s
4301(alone.)s 5015(Lout)s 5558(supports)s 6451(both)s 6965(arrangements)s
8335(without)s 0 10690(an)m 3(y)k 418(special)s 1157(action)s
1819(by)s 2134(the)s 2503(user)s 13(.)k 3073(At)s
3393(the)s 3762(be)s 3(ginning)k 4792(of)s 5084(the)s
220 fnt35 5453 10687(per)m -3(l)k 240 fnt82 5888 10690(setup)m
6467(line,)s 6953(the)s 7322(follo)s 6(wing)k 8320(line)s
8756(has)s 0 10402(been)m 509(placed:)s 220 fnt35 480 9901(@SysInclude { pod })m
240 fnt82 0 9403(Thus,)m 576(asking)s 1244(for)s 1571(Perl)s
2000(al)s 2(w)k 2(ays)k 2700(gi)s 6(v)k 3(es)k
3237(you)s 3641(Pod)s 4062(as)s 4301(well.)s 4866(If)s
5085(you)s 5490(are)s 5826(using)s 6388(your)s 6876(o)s 6(wn)k
7330(setup)s 7877(\207les)s 8316(for)s 8643(both)s 0 9115(languages,)m
1068(it)s 1265(is)s 1480(probably)s 2390(better)s 2998(to)s
3242(break)s 3839(this)s 4240(connection)s 5352(by)s 5651(deleting)s
6479(this)s 6880(line)s 7299(from)s 7828(your)s 8332(cop)s 2(y)k
8855(of)s 0 8827(the)m 220 fnt35 348 8824(per)m -3(l)k
240 fnt82 762 8827(setup)m 1320(\207le)s 1681(and)s 2085(placing)s
220 fnt35 480 8326(@Include { m)m 3(ypod })k 480 8038(@Include { m)m 3(yper)k -3(l })k
240 fnt82 0 7540(at)m 232(the)s 580(start)s 1050(of)s
1321(your)s 1820(document)s 2824(in)s 3067(the)s 3415(usual)s
3975(w)s 2(ay)k 15(.)k 480 7166(Because)m 1341(Pod)s
1781(is)s 2000(a)s 2174(documentation)s 3662(language)s 4591(rather)s
5215(than)s 5693(a)s 5868(programming)s 7231(language,)s 8211(the)s
8568(setup)s 0 6878(\207le)m 376(options)s 1148(listed)s 1739(in)s
1998(Section)s 2787(1.4)s 3157(are)s 3520(mostly)s 4241(of)s
4527(no)s 4836(rele)s 6(v)k 6(ance.)k 5919(So)s
6241(for)s 6594(Pod)s 7041(only)s 7537(these)s 8100(ha)s 4(v)k 3(e)k
8617(been)s 0 6590(discarded)m 987(and)s 1405(replaced)s 2285(by)s
2593(a)s 2772(completely)s 3902(dif)s 6(ferent)k 4791(set)s
5129(of)s 5414(options,)s 6239(controlling)s 7355(such)s 7864(things)s
8514(as)s 8778(the)s 0 6302(size)m 448(of)s 741(headings)s
1664(and)s 2090(the)s 2460(g)s 1(aps)k 2970(between)s
3846(list)s 4219(items,)s 4864(which)s 5528(you)s 5964(can)s
6375(\207nd)s 6828(documented)s 8077(in)s 8342(the)s 220 fnt35
8712 6299(pod)m 240 fnt82 0 6014(setup)m 558(\207le.)s 480 5640(The)m
955(only)s 1483(kno)s 6(wn)k 2234(problem)s 3139(with)s
3669(Pod)s 4147(formatting)s 5256(is)s 5513(that)s 5979(the)s
220 fnt35 6375 5637(E<>)m 240 fnt82 6874 5640(constructs)m 7942(enclosing)s
8960(a)s 0 5352(character)m 963(number)s 1783(or)s 2072(a)s
2267(`non-numeric)s 3650(HTML)s 4415(entity')s 5100(\(to)s 5447(quote)s
6065(the)s 6442(author)s 7142(of)s 7443(Pod\))s 7973(will)s
8429(appear)s 0 5064(v)m 3(erbatim)k 906(rather)s 1522(than)s
1991(being)s 2576(replaced)s 3443(by)s 3737(the)s 4085(characters)s
5103(the)s 3(y)k 5566(represent.)s
grestore
grestore
grestore
pgsave restore
showpage
%%Trailer
%%DocumentNeededResources: font Courier
%%+ font Helvetica
%%+ font Symbol
%%+ font Times-Roman
%%+ font Times-Italic
%%+ font Times-Bold
%%+ font Times-Italic
%%DocumentSuppliedResources: procset LoutStartUp
%%+ procset LoutTabPrependGraphic
%%+ procset LoutTblPrependGraphic
%%+ procset LoutFigPrependGraphic
%%+ procset LoutGraphPrependGraphic
%%+ procset LoutFigPrependGraphic
%%+ procset LoutBasicSetup
%%+ encoding vec2
%%Pages: 2
%%EOF
|