summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/code/pstricks.doc
blob: e7cf2b591c9e55be774e8456a3cf3a85583bcf35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
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
%% BEGIN pstricks.doc
\def\fileversion{0.93a}
\def\filedate{93/03/12}
%
% File `pstricks.doc': PostScript macros for Generic TeX.
%%
%% See the PSTricks read-me file and the User's Guide for documentation.
%%
%% COPYRIGHT 1993, by Timothy Van Zandt, tvz@Princeton.EDU
%%
%% Copying of part or all of any file in the pstricks.tex package
%% is allowed under the following conditions only:
%% (1) You may freely distribute unchanged copies of the files. Please
%%     include the documentation when you do so.
%% (2) You may modify a renamed copy of any file, but only for personal
%%     use or use within an organization.
%% (3) You may copy fragments from the files, for personal use or for use
%%     in a macro package for distribution, as long as credit is given
%%     where credit is due.
%%
%% You are NOT ALLOWED to take money for the distribution or use of
%% these files or modified versions or fragments thereof, except for
%% a nominal charge for copying etc.
%%
% **************************************************************************
% This is `pstricks.doc', which contains the documented code for the PSTricks
% package. See the PSTricks read-me file for information on how to
% use this file.
% **************************************************************************
%
% \EndDocPreamble
%
% \CheckSum{5048}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \section{Disclaimers, Guidelines and Other Comments}
%
% \paragraph*{Disclaimer}
% These macros are extensive and were written hurriedly. Only modest attempts
% have been made to clean up and optimize the code. The internals may change
% substantially until version 1.0 comes up.
%
% \paragraph*{PostScript Guidelines}
% The following guidelines were followed for macros using PostScript
% "\special"'s:
% \begin{enumerate}
% \item Almost no "gsave" and "grestore" commands are used (reducing the
% likelihood of conflicts with dvi-to-ps drivers or an unmatched "gsave" or
% "grestore" ending up on a page).
% \item Most end-user macros (those without "@") have error-checking so that
% bad arguments or other misuse will not generate PostScript errors.
% \end{enumerate}
%
% \iffalse
% \paragraph*{Prefixes}
% (This list is not complete.) Here are the conventions on prefixes, such as
% the "pst" is "\pst@Verb":
% \begin{center}
% \begin{tabular}{ll}
% {\em Prefix} & {\em Use}\\
% "pst" & This and that.\\
% "psk" & Graphics parameters ("k"={\em key}).\\
% "psset" & Macros that set graphics parameters.\\
% "psls" & Line styles.\\
% "psfs" & Fill styles.\\
% "psas" & Arrow styles.\\
% "pscs" & Custom styles.\\
% \end{tabular}
% \end{center}
% \fi
%
% \paragraph*{Macros}
% A ``macro'' means any command sequence that is documented in this with a
% heading entry. Macros with "@" are internal, and others are part of the user
% interface. Commands that are not in the heading preceding their definition
% are internal commands of a macro, and are not meant to be used directly by
% other macros.
%
% \paragraph*{Local and global variables}
% There are various classes of scratch registers and commands:
% \begin{description}
% \item[Global] These can be changed using "\global", etc.
% \begin{LVerbatim}
%   \pst@tempg
%   \pst@temph
%   \pst@dimg
%   \pst@dimh
%   \pst@cntg
%   \pst@cnth
%   \pst@boxg
% \end{LVerbatim}
%
% \item[Local-I] These cannot be changed with "\global", but otherwise there
% are no restrictions.
% \begin{LVerbatim}
%   \next
%   \@tempa
% \end{LVerbatim}
%
% \item[Local-I]
% Changes to these must be local to the macro in which they occur (be
% grouping).
% \begin{LVerbatim}
%   \pst@tempa
%   \pst@tempb
%   \pst@tempc
%   \pst@tempd
% \end{LVerbatim}
%
% \item[Local-II] Changes to these must be local to the macro in which they
% occur, and it must be possible to use these as arguments of macros.
% \begin{LVerbatim}
%   \pst@dima
%   \pst@dimb
%   \pst@dimc
%   \pst@dimd
%   \if@pst
% \end{LVerbatim}
% There is one exception. When using these in coordinates that are processed
% directly as Cartesian coordinates rather than with "\pst@getcoor", they must
% be used in this order:
% \begin{LVerbatim}
%    (\pst@dima,\pst@dimb)(\pst@dimc,\pst@dimd)
% \end{LVerbatim}
%
% \item[Shared] These are used to share information between macros. Their
% value may be set by one macro and then used by another. Use with care. Do
% not set with "\global".
% \begin{quote}
%  \begin{tabular}{ll}
%    \em command & \em usage\\
%    "\pst@hbox" & Box created and manipulated in HR-box macros.\\
%    "\pst@coor" & PostScript code for a coordinate.\\
%    "\pst@angle" & PostScript code for an angle.\\
%    "\pst@rot"  & PostScript code for a rotation angle.\\
%    "\if@star" & This is a flag to keep track of optional "*".
%  \end{tabular}
% \end{quote}
%
% \end{description}
%
% \paragraph*{Plain \TeX\ commands}
% The commands
% \begin{LVerbatim}
%   \newbox
%   \newcount
%   \newdimen
%   \newif
%   \loop ... \repeat ... \fi
%   \z@
%   \sixt@@n
%\end{LVerbatim}
% are defined in "plain.tex" are part of most macro packages. PSTricks assumes
% that they are defined. Other than these, PSTricks only makes use of \TeX\
% primitives.
%
% \paragraph*{Dividing the file}
%
% {\bf\em Breaking up the file}\hskip 1em "pstricks.tex" can be broken up into
% the following components:
% \begin{description}
% \item[Basics] (Including color and simple rotation.) Sections \ref{Prelim},
% \ref{Config}, \ref{Header}, \ref{Errors}, \ref{Colors}, \ref{Colortab},
% \ref{Rotation:simple} and \ref{Config:revisited}.
% \item[Graphics] Sections \ref{Parameters}, \ref{Objects}, \ref{Linestyles},
% \ref{Arrowheads}, \ref{Lines}, \ref{Grids}, \ref{Fillstyles}, \ref{Frames},
% \ref{Frameboxes} and \ref{Circles}. Requires also {\bf Basics}.
% \item[Rotation] (Including picture environment.) Sections \ref{Arithmetic},
% \ref{Rotation:prelim}, \ref{Rotation:main} and \ref{Pictures}. Requires also
% {\bf Basics}.
% \end{description}
%

% \section{Preliminaries\label{Prelim}}
%
% Check whether file has been loaded already.
%    \begin{macrocode}
\csname PSTricksLoaded\endcsname
\let\PSTricksLoaded\endinput
%    \end{macrocode}
%
% Take care of the catcode of "@":
%    \begin{macrocode}
\edef\PstAtCode{\the\catcode`\@}
\catcode`\@=11\relax
%    \end{macrocode}
%
% Here are some hacks borrowed from \LaTeX{}, which are defined if \LaTeX{} is
% not being used.
%
%    \begin{macrocode}
\expandafter\ifx\csname @latexerr\endcsname\relax
  \long\def\@ifundefined#1#2#3{\expandafter\ifx\csname
    #1\endcsname\relax#2\else#3\fi}
  \def\@namedef#1{\expandafter\def\csname #1\endcsname}
  \def\@nameuse#1{\csname #1\endcsname}
  \def\@eha{%
    Your command was ignored.^^J
    Type \space I <command> <return> \space to replace
    it with another command,^^J
    or \space <return> \space to continue without it.}
  \def\@spaces{\space\space\space\space}
  \def\typeout#1{\immediate\write\@unused{#1}}
  \alloc@7\write\chardef\sixt@@n\@unused
  \def\@empty{}
  \def\@gobble#1{}
  \def\@nnil{\@nil}
  \def\@ifnextchar#1#2#3{%
    \let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}\futurelet\@tempc\@ifnch}
  \def\@ifnch{%
    \ifx\@tempc\@sptoken
      \let\@tempd\@xifnch
    \else
      \ifx\@tempc\@tempe \let\@tempd\@tempa \else \let\@tempd\@tempb \fi
    \fi
    \@tempd}
  \begingroup
    \def\:{\global\let\@sptoken= } \:
    \def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@tempc\@ifnch}
  \endgroup
\fi
%    \end{macrocode}
%
% Announce that the file is being loaded:
%    \begin{macrocode}
\typeout{`PSTricks' v\fileversion\space\space <\filedate> (tvz)}
%    \end{macrocode}
%
%
% \section{Error messages}
%
% \begin{macro}{\@pstrickserr}
% "\@pstrickserr" is analogous to "\@latexerr".
%    \begin{macrocode}
\def\@pstrickserr#1#2{%
  \begingroup
    \newlinechar`\^^J
    \edef\pst@tempc{#2}%
    \expandafter\errhelp\expandafter{\pst@tempc}%
    \typeout{%
      PSTricks error. \space See User's Guide for further information.^^J
      \@spaces\@spaces\@spaces\@spaces
      Type \space H <return> \space for immediate help.}%
    \errmessage{#1}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ehpa,\@ehpb,\@ehpc}
% Here are some extra "\errhelp" message:
%    \begin{macrocode}
\def\@ehpa{%
  Your command was ignored. Default value substituted.^^J
  Type \space <return> \space to procede.}
\def\@ehpb{%
  Your command was ignored. Will recover best I can.^^J
  Type \space <return> \space to procede.}
\def\@ehpc{%
  You better fix this before proceding.^^J
  See the PSTricks User's Guide or ask your system administrator for help.^^J
  Type \space X <return> \space to quit.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@misplaced}
%    \begin{macrocode}
\def\pst@misplaced#1{\@pstrickserr{Misplaced \string#1 command}\@ehpb}
%    \end{macrocode}
% \end{macro}
%
% \section{Scratch registers}
%
%    \begin{macrocode}
\newdimen\pst@dima
\newdimen\pst@dimb
\newdimen\pst@dimc
\newdimen\pst@dimd
\newdimen\pst@dimg
\newdimen\pst@dimh
\newbox\pst@hbox
\newbox\pst@boxg
\newcount\pst@cnta
\newcount\pst@cntb
\newcount\pst@cntc
\newcount\pst@cntd
\newcount\pst@cntg
\newcount\pst@cnth
\newif\if@pst
%    \end{macrocode}
%
%
% \section{Useful hacks}
%
% \begin{macro}{\pst@ifstar,\if@star}
%    \begin{macrocode}
\newif\if@star
\def\pst@ifstar#1{%
  \@ifnextchar*{\@startrue\def\next*{#1}\next}{\@starfalse#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@expandafter}
%    \begin{macrocode}
\def\pst@expandafter#1#2{%
  \def\next{#1}%
  \edef\@tempa{#2}%
  \ifx\@tempa\@empty
    \@pstrickserr{Unexpected empty argument!}\@ehpb
    \def\@tempa{\@empty}%
  \fi
  \expandafter\next\@tempa}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Arithmetic}
%
% \begin{macro}{\pst@dimtonum,\pst@@dimtonum}
% This macro strips the value of "#1", a dimension register, of the "pt", and
% assigns the result to "#2", a command sequence. This is used for arithmetic
% and for converting \TeX\ dimensions to PostScript.
%    \begin{macrocode}
\def\pst@dimtonum#1#2{\edef#2{\pst@@dimtonum#1}}
\def\pst@@dimtonum#1{\expandafter\pst@@@dimtonum\the#1}
{\catcode`\p=12 \catcode`\t=12 \global\@namedef{pst@@@dimtonum}#1pt{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@pyth}
% This is a piecewise-linear approximation to $("#1"^2+"#2"^2)^(1/2)$. The
% answer is assigned to "#3". All arguments should be dimension registers.
%    \begin{macrocode}
\def\pst@pyth#1#2#3{%
  \ifdim#1>#2\pst@@pyth#1#2#3\else\pst@@pyth#2#1#3\fi}
\def\pst@@pyth#1#2#3{%
  \ifdim4#1>9#2%
    #3=#1\advance#3 .2122#2%
  \else
    #3=.8384#1\advance#3 .5758#2%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@divide}
% This computes "#3"="#1"/"#2" reasonably quickly. "#1" and "#2" should be
% dimensions, and "#3" should be a command sequence.
%    \begin{macrocode}
\def\pst@divide#1#2#3{%
  \begingroup
    \pst@dimg=#1\relax\pst@dimh=#2\relax
    \pst@cnta=\pst@dimg
    \pst@cntb=1073741824
    \pst@cntc=65536
    \def\pst@tempa{\fi\ifnum}%
    \loop\ifnum\pst@cnta<\pst@cntb
      \pst@tempa\pst@cntc>\@ne
      \multiply\pst@cnta2\divide\pst@cntc2
    \repeat
    \divide\pst@dimh\pst@cntc
    \divide\pst@cnta\pst@dimh
    \global\pst@dimg\number\pst@cnta sp
  \endgroup
  \pst@dimtonum\pst@dimg#3}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Configuration file\label{Config}}
%
% \begin{macro}{\pst@configerr}
%    \begin{macrocode}
\def\pst@configerr#1{%
  \@pstrickserr{\string#1 not defined in pstricks.con}\@ehpc}
%    \end{macrocode}
% \end{macro}
%
% %    \begin{macrocode}
\def\pstVerb#1{\pst@configerr\pstVerb}
\def\pstverb#1{\pst@configerr\pstverb}
\def\pstverbscale{\pst@configerr\pstverbscale}
\def\pstrotate{\pst@configerr\pstrotate}
\def\pstheader#1{\pst@configerr\pstheader}
\def\pstdriver{\pst@configerr\pstdriver}
\@ifundefined{pstcustomize}%
  {\def\pstcustomize{\endinput\let\pstcustomize\relax}}{}
\input pstricks.con
%    \end{macrocode}
%
% \begin{macro}{\PSTricksOff}
%    \begin{macrocode}
\newif\ifPSTricks
\PSTrickstrue
\def\PSTricksOff{%
  \def\pstheader##1{}%
  \def\pstverb##1{}%
  \def\pstVerb##1{}%
  \PSTricksfalse}
%    \end{macrocode}
% \end{macro}
%
% \section{PostScript header file\label{Header}}
%
% \begin{macro}{\pst@def,\pst@ATH,\pst@useheader}
% There are three ways to use PSTricks:
% \begin{enumerate}
%   \item Use "pstricks.doc" directly. No header file is used.
% \item Use "\pst-make.tex" to generate a stripped input file for use without
% a header.
% \item Use "\pst-make.tex" to generate a header and a stripped input file for
% use with the header.
% \end{enumerate}
% PSTricks has been optimized for use with a header file (and the difference
% is speed and memory is very significant), but the flexible system described
% above makes it easier to maintain the code and allows one to use PSTricks
% with a DVI-to-PS driver that does not support header files.
%
% The following commands should be used in this ".doc" file for PostScript
% macros and other goodies related to the header file. Their behavior for each
% of the three cases list above is given below. These commands should always
% come {\em at the beginning of the line}, and should not inside conditionals.
%
% \begin{itemize}
%
% \item "\pst@def{foo}<bar>"
%   \begin{enumerate}
%     \item "\tx@foo" is defined to be "bar".
%     \item Writes
% \begin{LVerbatim}
%   \def\tx@foo{bar}
% \end{LVerbatim}
%     to "pstricks.tex".
%     \item Writes
% \begin{LVerbatim}
%    /foo { bar } def
% \end{LVerbatim}
%     to "pstricks.pro" and
% \begin{LVerbatim}
%   \def\tx@foo{foo}
% \end{LVerbatim}
%     to "pstricks.tex".
%   \end{enumerate}
%
% \item "\pst@ATH<foo>"
%   \begin{enumerate}
%     \item Gobbles "foo".
%     \item Ignores line.
%     \item Writes "foo" to "pstricks.pro".
%   \end{enumerate}
%   Note: "\pst@ATH" must come at the beginning of the line.
%
% \item "\ifx\pst@useheader\iftrue foo \else bar \fi"
%   \begin{enumerate}
%     \item Ignores "foo" and includes "bar".
%     \item Ignores "foo" and processes "bar".
%     \item Processes "foo" and ignores "bar".
%   \end{enumerate}
% Note: "\ifx\pst@useheader\iftrue", "\else" and "\fi" must each be on their
% own line.
%
% \end{itemize}
%
% "pst@make.tex" can be used to process other files at well, in the right
% order.
%
%   \begin{macrocode}
\@ifundefined{pst@def}{\def\pst@def#1<#2>{\@namedef{tx@#1}{#2 }}}{}
\@ifundefined{pst@ATH}{\def\pst@ATH<#1>{}}{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@dict}
% The PostScript dictionary "tx@Dict" is set up in the header file, if one is
% used. Otherwise, it is set up with each procedure that uses the dictionary,
% if it is not currently defined.
%    \begin{macrocode}
\pst@ATH<\% Version \fileversion, \filedate.>
\pst@ATH<\% For use with \pstdriver.>
\pst@ATH</tx@Dict 200 dict def tx@Dict begin>
\pst@ATH</ADict 25 dict def>
\pst@ATH</CM { matrix currentmatrix } bind def>
\pst@ATH</SLW /setlinewidth load def>
\pst@ATH</CLW /currentlinewidth load def>
\pst@ATH</CP /currentpoint load def>
\pst@ATH</ED { exch def } bind def>
\pst@ATH</L /lineto load def>
\pst@ATH</T /translate load def>
\ifx\pst@useheader\iftrue
  \pstheader{pstricks.pro}
  \def\pst@dict{tx@Dict begin }
  \def\pst@theheaders{pstricks.pro}
\else
  \def\pst@dict{%
    /tx@Dict where
    { pop tx@Dict begin}
    { userdict begin
        /tx@Dict 200 dict def
      end
      tx@Dict begin
        /ADict 25 dict def
        /CM { matrix currentmatrix } bind def
        /SLW /setlinewidth load def
        /CLW /currentlinewidth load def
        /CP /currentpoint load def
        /ED { exch def } bind def
        /L /lineto load def }
    ifelse }
  \def\pst@theheaders{}%
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@Verb}
%    \begin{macrocode}
\def\pst@Verb#1{\pstVerb{\pst@dict #1 end}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{PostScript hacks}
%
%
% \begin{macro}{\tx@Atan,\tx@Div}
% These are variants of "atan", and "div", that recover when result is not
% defined.
%    \begin{macrocode}
\pst@def{Atan}</atan load stopped { pop pop 0 } if>
\pst@def{Div}<dup 0 eq { pop } { div } ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@NET}
%    \begin{macrocode}
\pst@def{NET}<neg exch neg exch T>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Pyth}
% $A$ $B$ "Pyth" $(A^2 + B^2)^{1/2}$
%    \begin{macrocode}
\pst@def{Pyth}<dup mul exch dup mul add sqrt>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@PtoC}
% Polar to Cartesian:
% \begin{LVerbatim}
%   <r> <a> PtoC <x> <y>
% \end{LVerbatim}
%    \begin{macrocode}
\pst@def{PtoC}<2 copy cos mul 3 1 roll sin mul>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@PathLength}
% "PathLength" is taken from the Blue Book. It leaves on the stack the length
% of the current path.
%    \begin{macrocode}
\pst@def{PathLength@}<%
  /z z y y1 sub x x1 sub \tx@Pyth add def
  /y1 y def /x1 x def>
\pst@def{PathLength}<%
  flattenpath /z 0 def
  { /y1 ED /x1 ED /y2 y1 def /x2 x1 def } % moveto
  { /y ED /x ED \tx@PathLength@ } % lineto
  {} % curveto; ignore because of flattenpath.
  { /y y2 def /x x2 def \tx@PathLength@ } % closepath
  pathforall z>
%    \end{macrocode}
% \end{macro}
%
%
% \section{Converting \TeX\ things to PostScript}
%
% \begin{macro}{\pst@number,\tx@STP,\tx@STV}
% \begin{itemize}
% \item PSTricks' PostScript unit is 1pt, rather than 1bp, because this is
% more efficient.
% \item "\pst@number{<dimen register>}" converts <dimen> to PostScript, in
% points (pt).
% \item "\tx@STP" scales the DVI-to-PS driver's "\pstverb" environment to
% points (pt).
% \item "\tx@STV" scales the DVI-to-PS drivers's ungrouped PostScript
% "\special" environment ("\pstVerb") to points (pt).
% \end{itemize}
%    \begin{macrocode}
\pst@dimg=\pstunit\relax
\ifdim\pst@dimg=1bp
  \def\pst@stp{.996264 dup scale}
\else
  \edef\pst@stp{1 \pst@@dimtonum\pst@dimg\space div dup scale}
\fi
\pst@def{STP}<\pst@stp>
\pst@def{STV}<\pstverbscale\space\tx@STP>
\def\pst@number#1{\pst@@dimtonum#1\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@checknum}
% The first argument of "\pst@checknum" should be a number, and the second
% argument is a command. There are three possible outcomes:
% \begin{enumerate}
% \item The number is suitable for PostScript consumption, the command is set
% to the number, and "\pst@num" is set to "1" if the number is positive and to
% "2" if the number is negative.
% \item "\pst@checknum" detects that the number is not suitable for
% PostScript; "\pst@num" is set to "0", an error is given, and the command is
% defined to be {\tt 0 }.
% \item The number is not suitable for PostScript consumption, but
% "\pst@checknum" does not detect this. "\pst@num" is set to "1" or "2", and
% the command is set to some number that {\em is} suitable for PostScript.
% \end{enumerate}
%
% A trailing space is always added.
%
% "\pst@checknum" should generate no extraneous errors nor output, even if the
% first argument is a bad number.
%
% This macro is probably pretty close to optimal for what it does, as many
% variations have been tried.
%
%    \begin{macrocode}
\def\pst@checknum#1#2{%
  \edef\next{#1}%
  \ifx\next\@empty
    \let\pst@num\z@
  \else
    \expandafter\pst@@checknum\next..\@nil
  \fi
  \ifnum\pst@num=\z@
    \@pstrickserr{Bad number: `#1'. 0 substituted.}\@ehpa
    \def#2{0 }%
  \else
    \edef#2{\ifnum\pst@num=2 -\fi\the\pst@cntg.%
      \expandafter\@gobble\the\pst@cnth\space}%
  \fi}
\def\pst@@checknum{%
  \@ifnextchar-%
    {\def\pst@num{2}\expandafter\pst@@@checknum\@gobble}%
    {\def\pst@num{1}\pst@@@checknum}}
\def\pst@@@checknum#1.#2.#3\@nil{%
  \afterassignment\pst@@@@checknum\pst@cntg=0#1\relax\@nil
  \afterassignment\pst@@@@checknum\pst@cnth=1#2\relax\@nil}
\def\pst@@@@checknum#1\relax\@nil{%
  \ifx\@nil#1\@nil\else\let\pst@num\z@\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getnumii,\pst@getnumiii,\pst@getnumiv}
% These are for processing comma-separated lists of numbers. They assign the
% numbers to "\pst@tempg", "\pst@temph", etc. Use like
% \begin{LVerbatim}
%   \pst@expandafter\pst@getnumiii{foo} {} {} {} {}\@ni
% \end{LVerbatim}
% If there are too few numbers, an error results. If there are too many, the
% extra numbers are ignored.
%    \begin{macrocode}
\def\pst@getnumii#1 #2 #3\@nil{%
  \pst@checknum{#1}\pst@tempg
  \pst@checknum{#2}\pst@temph}
\def\pst@getnumiii#1 #2 #3 #4\@nil{%
  \pst@checknum{#1}\pst@tempg
  \pst@checknum{#2}\pst@temph
  \pst@checknum{#3}\pst@tempi}
\def\pst@getnumiv#1 #2 #3 #4 #5\@nil{%
  \pst@checknum{#1}\pst@tempg
  \pst@checknum{#2}\pst@temph
  \pst@checknum{#3}\pst@tempi
  \pst@checknum{#4}\pst@tempj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getdimnum}
% Like "\pst@getnumii", but first item is a dimension and second is a number.
%    \begin{macrocode}
\def\pst@getdimnum#1 #2 #3\@nil{%
  \pssetlength\pst@dimg{#1}%
  \pst@checknum{#2}\pst@tempg}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getscale}
% "\pst@getscale" can have one or two numbers in its first argument.
%    \begin{macrocode}
\def\pst@getscale#1#2{%
  \pst@expandafter\pst@getnumii{#1 #1} {} {} {}\@nil
  \edef#2{\pst@tempg\space \pst@temph\space scale }%
  \ifdim\pst@tempg\p@=\z@
    \@pstrickserr{Bad scaling argument `#1'}\@ehpa
    \def#2{}%
  \else
    \ifdim\pst@temph\p@=\z@
      \@pstrickserr{Bad scaling argument}\@ehpa
      \def#2{}%
    \else
      \ifdim\pst@tempg\p@=\p@ \ifdim\pst@temph\p@=\p@ \def#2{}\fi\fi
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getint}
%    \begin{macrocode}
\def\pst@getint#1#2{%
  \pst@cntg=#1\relax
  \edef#2{\the\pst@cntg\space}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pslbrace,\psrbrace}
% When balanced braces are used, they work without problems in "\special"'s.
% "\pslbrace" and "\psrbrace" let you use unbalanced braces.
%    \begin{macrocode}
\begingroup
  \catcode`\{=12
  \catcode`\}=12
  \catcode`\[=1
  \catcode`\]=2
  \gdef\pslbrace[{ ]
  \gdef\psrbrace[} ]
\endgroup
%    \end{macrocode}
% \end{macro}
%
%
% \section{Colors\label{Colors}}
%
% \begin{macro}{\@newcolor}
% "\@newcolor{<color>}{<spec>}", where <color> is a name and <spec> is the
% associated PostScript color specification , sets
% \begin{itemize}
%   \item "\<color>" to "\pst@color{<spec>}", and
%   \item "\color@<color>" to <spec>.
% \end{itemize}
% Then "\<color>" can be used by the user to color text, etc., and
% "\color@<color>" is used by PSTricks graphics objects to find the
% specification for <color>.
%    \begin{macrocode}
\def\@newcolor#1#2{%
  \expandafter\edef\csname #1\endcsname{\noexpand\pst@color{#2}}%
  \expandafter\edef\csname color@#1\endcsname{#2}%
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@color,\pst@endcolor}
% The argument of "\pst@color" should be a PostScript command for setting the
% color; e.g., "0 setgray". It saves the command in "\pst@currentcolor", and
% then switches to "\pst@currentcolor" at the end of the current group. The
% color changes do not extend across pages, although this capability could be
% written into the output routines (so that "\pst@currentcolor" is set at the
% beginning of the page, and headers and footers begin with "\black", etc.).
% Moving boxes cause problems, but there is no way around this until \TeX{}
% supports color internally.
%    \begin{macrocode}
\def\pst@color#1{%
  \def\pst@currentcolor{#1}\pstVerb{#1}\aftergroup\pst@endcolor}
\def\pst@endcolor{\pstVerb{\pst@currentcolor}}
\def\pst@currentcolor{0 setgray}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\altcolormode,\pst@grestore}
% The color macros defined above can conflict with other color macros.
% "\altcolormode" sets up a different scheme that uses "gsave" and "grestore"
% to reset colors. This may reduce the likelihood of such conflict. It also
% makes moving boxes less of a problem, as long as the color command is itself
% grouped within the box. However, if the scope of a color command extends
% across pages in a \TeX{} input file, unmatched "gsave"'s and "grestore"'s
% will be left on pages, wreaking havok on the output. "\pst@grestore" is
% defined to do various things that makes using "grestore" more robust.
%    \begin{macrocode}
\def\altcolormode{%
  \def\pst@color##1{%
    \pstVerb{gsave ##1}\aftergroup\pst@endcolor}%
  \def\pst@endcolor{\pstVerb{\pst@grestore}}}
\def\pst@grestore{%
  currentpoint
  matrix currentmatrix
  currentfont
  grestore
  setfont
  setmatrix
  moveto}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@usecolor}
% This looks up the color specification.
%    \begin{macrocode}
\def\pst@usecolor#1{\csname color@#1\endcsname\space}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newgray}
% "\newgray" uses PostScript's "setgray" operator.
%    \begin{macrocode}
\def\newgray#1#2{%
  \pst@checknum{#2}\pst@tempg
  \@newcolor{#1}{\pst@tempg setgray}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newrgbcolor}
% This works like "\newgray", but the color specification should consist of 3
% numbers rather than just 1, and the "setrgbcolor" operator is used.
%    \begin{macrocode}
\def\newrgbcolor#1#2{%
  \pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil
  \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi setrgbcolor}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newhsbcolor}
% This is just like "\newrgbcolor", but the "sethsbcolor" operator is used.
%    \begin{macrocode}
\def\newhsbcolor#1#2{%
  \pst@expandafter\pst@getnumiii{#2} {} {} {} {}\@nil
  \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi sethsbcolor}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newcmykcolor}
% This is like "\newrgbcolor", the color specification consists of 4 numbers
% and the "setcmykcolor" operator is used.
%    \begin{macrocode}
\def\newcmykcolor#1#2{%
  \pst@expandafter\pst@getnumiv{#2} {} {} {} {} {}\@nil
  \@newcolor{#1}{\pst@tempg \pst@temph \pst@tempi \pst@tempj setcmykcolor}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\black,\darkgray,\gray,\lightgray,\white}
% Here are some default gray definitions:
%    \begin{macrocode}
\newgray{black}{0}
\newgray{darkgray}{.25}
\newgray{gray}{.5}
\newgray{lightgray}{.75}
\newgray{white}{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\red,\green,\blue,\yellow,\cyan,\magenta}
% And some default rgb color definitions.
%    \begin{macrocode}
\newrgbcolor{red}{1 0 0}
\newrgbcolor{green}{0 1 0}
\newrgbcolor{blue}{0 0 1}
\newrgbcolor{yellow}{1 1 0}
\newrgbcolor{cyan}{0 1 1}
\newrgbcolor{magenta}{1 0 1}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Setting graphics parameters\label{Parameters}}
%
% \begin{macro}{\psset}
% For each <parameter>"="<value> pair in its argument, "\psset" invokes
% \begin{LVerbatim}
%   \psset@<parameter>{<value>}
% \end{LVerbatim}
% The value is processed and typically stored in "\ps<parameters>" if the
% value is user-accessible and "\psk@<parameter>" if not. "\psset" ignores
% spaces that follow the comma that separates key-value pairs.
%
% When initializing <parameter> in this file, preferable use
% \begin{LVerbatim}
%   \psset@<parameter>{<value>}
% \end{LVerbatim}
% so that default values can be easily extracted for the {\em User's Guide}.
%   \begin{macrocode}
\def\psset#1{\@psset#1,\@nil\ignorespaces}
\def\@psset#1,{%
  \@@psset#1==\@nil
  \@ifnextchar\@nil{\@gobble}{\@psset}}
\def\@@psset#1=#2=#3\@nil{%
  \@ifundefined{psset@#1}%
    {\@pstrickserr{Graphics parameter `#1' not defined.}\@ehpa}%
    {\@nameuse{psset@#1}{#2}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newpsstyle}
%    \begin{macrocode}
\def\psset@style#1{%
  \@ifundefined{pscs@#1}%
    {\@pstrickserr{Custom style `#1' undefined}\@ehpa}%
    {\@nameuse{pscs@#1}}}
\def\newpsstyle#1#2{\@namedef{pscs@#1}{\psset{#2}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@none}
% Use to check when a parameter value is "none".
%    \begin{macrocode}
\def\@none{none}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getcolor}
% This is used by various graphics parameters that are colors.
%    \begin{macrocode}
\def\pst@getcolor#1#2{%
  \@ifundefined{color@#1}%
    {\@pstrickserr{Color `#1' not defined}\@eha}%
    {\edef#2{#1}}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Dimensions}
%
% \begin{macro}{\psunit,\psxunit,\psyunit}
%    \begin{macrocode}
\newdimen\psunit \psunit 1cm
\newdimen\psxunit \psxunit 1cm
\newdimen\psyunit \psyunit 1cm
\let\psrunit\psunit
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pssetlength,\psaddtolength,\pssetxlength,\pssetylength}
%    \begin{macrocode}
\def\pstunit@off{\let\@psunit\ignorespaces\ignorespaces}
\def\pssetlength#1#2{%
  \let\@psunit\psunit
  \afterassignment\pstunit@off
  #1 #2\@psunit}
\def\psaddtolength#1#2{%
  \let\@psunit\psunit
  \afterassignment\pstunit@off
  \advance#1 #2\@psunit}
\def\pssetxlength#1#2{%
  \let\@psunit\psxunit
  \afterassignment\pstunit@off
  #1 #2\@psunit}
\def\pssetylength#1#2{%
  \let\@psunit\psyunit
  \afterassignment\pstunit@off
  #1 #2\@psunit}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@unit,\psset@xunit,\psset@yunit}
%    \begin{macrocode}
\def\psset@unit#1{%
  \pssetlength\psunit{#1}%
  \psxunit=\psunit
  \psyunit=\psunit}
\def\psset@runit#1{\pssetlength\psrunit{#1}}
\def\psset@xunit#1{\pssetxlength\psxunit{#1}}
\def\psset@yunit#1{\pssetylength\psyunit{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getlength,pst@@getlength}
% "#1" is a \TeX\ dimensions. "\pst@getlength" sets "#2" to the PostScript
% code for "#1", and "\pst@@getlength" set "#2" to the \TeX\ code for "#1".
%    \begin{macrocode}
\def\pst@getlength#1#2{%
  \pssetlength\pst@dimg{#1}%
  \edef#2{\pst@number\pst@dimg}}
\def\pst@@getlength#1#2{%
  \pssetlength\pst@dimg{#1}%
  \edef#2{\number\pst@dimg sp}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Normal Coordinates and angles}
%
% \begin{macro}{\pst@getcoor,\pst@coor}
% "\pst@@getcoor" should be defined to read a coordinate and convert it to
% PostScript, assigning the result to "\pst@coor" (including the trailing
% space).
%
% "\pst@getcoor" invokes "\pst@@getcoor" and then sets its second argument to
% "\pst@coor".
%    \begin{macrocode}
\def\pst@getcoor#1#2{\pst@@getcoor{#1}\let#2\pst@coor}
\def\pst@coor{0 0 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getcoors,\pst@coors}
% "\pst@getcoors" reads coordinates until there are none left, adding them
% {\em in reverse order} to "\pst@coors".
%    \begin{macrocode}
\def\pst@getcoors#1#2{%
  \def\pst@aftercoors{\addto@pscode{#1 \pst@coors }#2}%
  \def\pst@coors{}%
  \pst@@getcoors}
\def\pst@@getcoors(#1){%
  \pst@@getcoor{#1}%
  \edef\pst@coors{\pst@coor\pst@coors}%
  \@ifnextchar({\pst@@getcoors}{\pst@aftercoors}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getangle,\pst@angle}
% \n\pst@@getangle\ should be defined to read an angle and convert it to
% PostScript, assigning the result to \n\pst@angle\ (including the trailing
% space).
%
% \n\pst@getangle\ invokes \n\pst@@getangle\ and then sets its second argument
% to \n\pst@angle.
%    \begin{macrocode}
\def\pst@getangle#1#2{\pst@@getangle{#1}\let#2\pst@angle}
\def\pst@angle{0 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{getcoor@c,\NormalCoor}
% By default, coordinates are read as Cartesian coordinates by
% "\cartesian@coor".
%
% Angles are read as numbers, scaled by \n\pst@angleunit.
%
% "\NormalCoor" sets these two defaults, and also defines the translation for
% the put commands to be done by \TeX\ using Cartesian coordinates.
%    \begin{macrocode}
\def\cartesian@coor#1,#2,#3\@nil{%
  \pssetxlength\pst@dimg{#1}%
  \pssetylength\pst@dimh{#2}%
  \edef\pst@coor{\pst@number\pst@dimg \pst@number\pst@dimh}}
\def\NormalCoor{%
  \def\pst@@getcoor##1{\pst@expandafter\cartesian@coor{##1},\relax,\@nil}%
  \def\pst@@getangle##1{%
    \pst@checknum{##1}\pst@angle
    \edef\pst@angle{\pst@angle \pst@angleunit}}%
  \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@cartesian}}
\NormalCoor
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@angleunit,\degrees,\radians}
% "\degrees" sets "\pst@angleunit" to the PostScript code for scaling the
% angle, including the trailing space.
%    \begin{macrocode}
\def\degrees{\@ifnextchar[{\@degrees}{\def\pst@angleunit{}}}
\def\@degrees[#1]{%
  \pst@checknum{#1}\pst@tempg
  \edef\pst@angleunit{360 \pst@tempg div mul }%
  \ignorespaces}
\def\radians{\def\pst@angleunit{57.2956 mul }}
\def\pst@angleunit{}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Special coordinates and angles}
%
% This is a tedious but useful.
%
% \begin{macro}{\SpecialCoor}
%    \begin{macrocode}
\def\SpecialCoor{%
  \def\pst@@getcoor##1{\pst@expandafter\special@coor{##1}||\@nil}%
  \def\pst@@getangle##1{\pst@expandafter\special@angle{##1}\@empty)\@nil}%
  \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@special}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\specialcoor}
%    \begin{macrocode}
\def\special@coor#1|#2|#3\@nil{%
  \ifx#3|\relax
    \mixed@coor{#1}{#2}%
  \else
    \special@@coor#1;;\@nil
  \fi}
\def\special@@coor#1{%
  \ifcat#1a\relax
    \def\next{\node@coor#1}%
  \else
    \ifx#1[\relax
      \def\next{\Node@coor[}%
    \else
      \ifx#1!\relax
        \def\next{\raw@coor}%
      \else
        \def\next{\special@@@coor#1}%
      \fi
    \fi
  \fi
  \next}
\def\special@@@coor#1;#2;#3\@nil{%
  \ifx#3;\relax
    \polar@coor{#1}{#2}%
  \else
    \cartesian@coor#1,\relax,\@nil
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mixed@coor}
% This allows mixing of coordinate types with \n\SpecialCoor.
%    \begin{macrocode}
\def\mixed@coor#1#2{%
    \begingroup
      \specialcoor@ii#1;;\@nil
      \let\pst@tempa\pst@coor
      \specialcoor@ii#2;;\@nil
      \xdef\pst@tempg{\pst@tempa pop \pst@coor exch pop }%
    \endgroup
    \let\pst@coor\pst@tempg}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\polar@coor}
% For polar coordinates
%    \begin{macrocode}
\def\polar@coor#1#2{%
  \pssetlength\pst@dimg{#1}%
  \pst@@getangle{#2}%
  \edef\pst@coor{\pst@number\pst@dimg \pst@angle \tx@PtoC}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raw@coor}
% For raw PostScript.
%    \begin{macrocode}
\def\raw@coor#1;#2\@nil{%
  \edef\pst@coor{%
    #1 \pst@number\psyunit mul exch \pst@number\psxunit mul exch }}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\node@coor,\Node@coor}
% These are defined in "pst-node.tex".
%    \begin{macrocode}
\def\node@coor#1\@nil{%
  \@pstrickserr{You must load `pst-node.tex' to use node coordinates.}\@ehps
  \def\pst@coor{0 0 }}
\def\Node@coor{\node@coor}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\special@angle}
%    \begin{macrocode}
\def\special@angle#1#2)#3\@nil{%
  \ifx#1!\relax
    \edef\pst@angle{#2 \pst@angleunit}%
  \else
    \ifx#1(\relax
      \pst@@getcoor{#2}%
      \edef\pst@angle{\pst@coor exch \tx@Atan}%
    \else
      \pst@checknum{#1#2}\pst@angle
      \edef\pst@angle{\pst@angle \pst@angleunit}%
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Cartesian,\Polar}
% These are obsolete.
%    \begin{macrocode}
\def\Cartesian{%
  \def\cartesian@coor##1,##2,##3\@nil{%
    \pssetxlength\pst@dimg{##1}%
    \pssetylength\pst@dimh{##2}%
    \edef\pst@coor{\pst@number\pst@dimg \pst@number\pst@dimh}}%
  \@ifnextchar({\Cartesian@}{}}
\def\Cartesian@(#1,#2){%
  \pssetxlength\psxunit{#1}%
  \pssetylength\psyunit{#2}%
  \ignorespaces}
\def\Polar{%
  \def\psput@cartesian{\psput@special}%
  \def\cartesian@coor##1,##2,##3\@nil{\polar@coor{##1}{##2}}}%
%    \end{macrocode}
% \end{macro}
%
%
% \section{Basic graphics parameters}
%
%
% \begin{macro}{\psset@origin,\psk@origin}
%    \begin{macrocode}
\def\psset@origin#1{%
  \pst@@getcoor{#1}%
  \edef\psk@origin{\pst@coor \tx@NET }}
\def\psk@origin{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@swapaxes,\ifpsswapaxes}
%    \begin{macrocode}
\newif\ifswapaxes
\def\psset@swapaxes#1{%
  \@nameuse{@pst#1}%
  \if@pst
    \def\psk@swapaxes{-90 rotate -1 1 scale }%
  \else
    \def\psk@swapaxes{}%
  \fi}
\psset@swapaxes{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@showpoints,\ifshowpoints}
%    \begin{macrocode}
\newif\ifshowpoints
\def\psset@showpoints#1{\@nameuse{showpoints#1}}
\psset@showpoints{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@border,\psk@border}
%    \begin{macrocode}
\let\pst@setrepeatarrowsflag\relax
\def\psset@border#1{%
  \pst@getlength{#1}\psk@border
  \pst@setrepeatarrowsflag}
\psset@border{0pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@bordercolor,\psbordercolor}
%    \begin{macrocode}
\def\psset@bordercolor#1{\pst@getcolor{#1}\psbordercolor}
\psset@bordercolor{white}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@doubleline,\ifpsdoubleline}
%    \begin{macrocode}
\newif\ifpsdoubleline
\def\psset@doubleline#1{%
  \@nameuse{psdoubleline#1}%
  \pst@setrepeatarrowsflag}
\psset@doubleline{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@doublesep,\psdoublesep}
%    \begin{macrocode}
\def\psset@doublesep#1{\def\psdoublesep{#1}}
\psset@doublesep{1.25\pslinewidth}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@doublecolor,\psdoublecolor}
%    \begin{macrocode}
\def\psset@doublecolor#1{\pst@getcolor{#1}\psdoublecolor}
\psset@doublecolor{white}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@shadow,\ifpsshadow}
%    \begin{macrocode}
\newif\ifpsshadow
\def\psset@shadow#1{%
  \@nameuse{psshadow#1}%
  \pst@setrepeatarrowsflag}
\psset@shadow{false}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@shadowsize,\psk@shadowsize}
%    \begin{macrocode}
\def\psset@shadowsize#1{\pst@getlength{#1}\psk@shadowsize}
\psset@shadowsize{3pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@shadowangle,\psk@shadowangle}
%    \begin{macrocode}
\def\psset@shadowangle#1{\pst@getangle{#1}\psk@shadowangle}
\psset@shadowangle{-45}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@shadowcolor,\psshadowcolor}
%    \begin{macrocode}
\def\psset@shadowcolor#1{\pst@getcolor{#1}\psshadowcolor}
\psset@shadowcolor{darkgray}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@setrepeatarrowsflag}
%    \begin{macrocode}
\def\pst@repeatarrowsflag{\z@}
\def\pst@setrepeatarrowsflag{%
  \edef\pst@repeatarrowsflag{%
    \ifdim\psk@border\p@>\z@ 1\else\ifpsdoubleline 1\else
    \ifpsshadow 1\else \z@\fi\fi\fi}}
%    \end{macrocode}
% \end{macro}
%
%
%
% \section{Line styles\label{Linestyles}}
%
% For each "linestyle" <style>, the command "\psls@<style>" should be the
% PostScript code that strokes the path. The style can assume that the
% PostScript environment has linewidth equal to \n\pslinewidth\ and color
% equal to \n\pslinecolor.
%
% \begin{macro}{\pst@linetype}
% Macros that draw lines should define "\pst@linetype" (not a count register)
% to be:
% \begin{description}
% \item[1,2,$\ldots$] A closed path whose length should be divided by
% "\pst@linetype" before fitting a pattern.
% \item[0] A line that has nothing at the tips.
% \item[-1] A line with an arrow or something at the end.
% \item[-2] A line with an arrow or something at the beginning.
% \item[-3] A line with an arrow or something at each end.
% \end{description}
% This information is used by the line styles that draw dashed and dotted
% lines in order to figure out how to adjust the patterns.
% \end{macro}
%
% \begin{macro}{\psls@none}
%    \begin{macrocode}
\def\psls@none{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@linewidth,\pslinewidth}
%    \begin{macrocode}
\newdimen\pslinewidth
\def\psset@linewidth#1{\pssetlength\pslinewidth{#1}}
\psset@linewidth{.8pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@linecolor,\pslinecolor}
%    \begin{macrocode}
\def\psset@linecolor#1{\pst@getcolor{#1}\pslinecolor}
\psset@linecolor{black}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psls@solid}
%    \begin{macrocode}
\def\psls@solid{0 setlinecap stroke }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@dash,\psk@dash}
% "\psk@dash" is set to the PostScript code for the dash pattern (include the
% trailing space).
%    \begin{macrocode}
\def\psset@dash#1{%
  \pst@expandafter\psset@@dash{#1} * * *\@nil
  \edef\psk@dash{\pst@number\pst@dimg \pst@number\pst@dimh}}
\def\psset@@dash#1 #2 #3\@nil{%
  \pssetlength\pst@dimg{#1}%
  \pssetlength\pst@dimh{#2}}
\psset@dash{5pt 3pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psls@dashed}
%    \begin{macrocode}
\def\psls@dashed{\psk@dash \pst@linetype\space \tx@DashLine}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@DashLine}
% Syntax:
% \begin{Ex}
%   <dim1 dim2 linetype> "DashLine"
% \end{Ex}
% "DashLine" adjusts, and then sets, the dash pattern "[<dim1 dim2>]" so that
% it fits evenly onto a path.
%    \begin{macrocode}
\pst@def{DashLine}<%
  % "a" is set to the length of first and last black segment, as fraction of
  % usual black segment.
  dup 0 gt
  { /a .5 def \tx@PathLength exch div }
  { pop /a 1 def \tx@PathLength }
  ifelse
  /b ED             % Pattern should fit evenly in b
  /x ED             % Length of white segment.
  /y ED             % Length of black segment.
  /z y x add def    % Total length of dash pattern.
  % If pattern  is repeated n times, total length is (nz + 2(a-.5)y).
  % Set length to b, solve for n, round, and leave on stack:
  %   n = round((b - 2(a-.5)y)/z)
  b a .5 sub 2 mul y mul sub z \tx@Div round
  % Adjust x and y by factor k so that
  %   (n(kz) + 2(a-.5)(ky)) = b.
  % Solve for k and leave two copies on stack:
  %   k = b/(nz + 2(a-.5)y)
  z mul a .5 sub 2 mul y mul add b exch \tx@Div dup
  % Scale x and y, set dash, and stroke:
  y mul /y ED x mul /x ED
  % Make sure both x and y aren't zero:
  x 0 eq y 0 eq and { /x 1 def /y 1 def } if
  [ y x ] 1 a sub y mul setdash stroke>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{dotsep}
%    \begin{macrocode}
\def\psset@dotsep#1{\pst@getlength{#1}\psk@dotsep}
\psset@dotsep{3pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psls@dotted}
%    \begin{macrocode}
\def\psls@dotted{\psk@dotsep \pst@linetype\space \tx@DotLine}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@DotLine}
% Syntax:
% \begin{Ex}
%   <dim linetype> "DotLine"
% \end{Ex}
% "DotLine" adjusts, and then sets, the dash pattern to produce a dotted line
% with distance <dim> between dots so that it fits evenly onto a path. Dots
% are produced by setting dash pattern with length of white segment equal to
% distance from center of dot to center of dot, length of black segment equal
% to 0, and "linecap" equal to 1.
%    \begin{macrocode}
\pst@def{DotLine}<%
  /b \tx@PathLength def  % Path length.
  /a ED                  % \pst@linetype.
  /z ED                  % dotsep.
  /y CLW def             % linewidth (dot diameter).
  /z y z add def         % Total length of dash pattern.
  % Set b to adjusted path length that pattern should be multiple of:
  a 0 gt
    % If closed, as many dots as spaces.
    { /b b a div def }
    { a 0 eq
        % If open with no arrows, one more dot than space.
        { /b b y sub def }
        % If open one arrow, as many dots as spaces (do nothing)
        % If open two arrows, one more space than dot.
        { a -3 eq { /b b y add def } if }
      ifelse }
  ifelse
  % Let n be number of times pattern is repeated:
  %  n = round(b/z)
  % Adjust length of pattern so that it fits evenly in b:
  %  z = b/n = b/(round(b/z))
  % z is length of white segment. Length of black segment is 0.
  [ 0 b b z \tx@Div round \tx@Div dup 0 le { pop 1 } if ]
  a 0 gt                % setting dash pattern.
    % Set offset to 0 if path is closed]
    { 0 }
    % Set offset to -(y/2) if open curve begins with arrow, (y/2) otherwise:
    { y 2 div a -2 gt { neg } if }
  ifelse
  % Setting linecap to 1 produces the dots.
  setdash 1 setlinecap stroke>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@linestyle}
%    \begin{macrocode}
\def\psset@linestyle#1{%
  \@ifundefined{psls@#1}%
    {\@pstrickserr{Line style `#1' not defined}\@eha}%
    {\edef\pslinestyle{#1}}}
\psset@linestyle{solid}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Fill styles\label{Fillstyles}}
%
% For each "fillstyle" <style>, the command "\psfs@<style>" should be the
% PostScript code that fills the region. The style should not assume anything
% about the PostScript environment's "linewidth" or color.
%
% \begin{macro}{\psfs@none}
%    \begin{macrocode}
\def\psfs@none{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@fillcolor,\psfillcolor}
%    \begin{macrocode}
\def\psset@fillcolor#1{\pst@getcolor{#1}\psfillcolor}
\psset@fillcolor{white}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psfs@solid}
%    \begin{macrocode}
\def\psfs@solid{\pst@usecolor\psfillcolor fill }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hatchwidth}
%    \begin{macrocode}
\def\psset@hatchwidth#1{\pst@getlength{#1}\psk@hatchwidth}
\psset@hatchwidth{.8pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hatchsep}
%    \begin{macrocode}
\def\psset@hatchsep#1{\pst@getlength{#1}\psk@hatchsep}
\psset@hatchsep{4pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hatchcolor}
%    \begin{macrocode}
\def\psset@hatchcolor#1{\pst@getcolor{#1}\pshatchcolor}
\psset@hatchcolor{black}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hatchangle}
%    \begin{macrocode}
\def\psset@hatchangle#1{\pst@getangle{#1}\psk@hatchangle}
\psset@hatchangle{45}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psfs@hlines}
%    \begin{macrocode}
\def\psfs@hlines{%
  \psk@hatchangle rotate
  \psk@hatchwidth SLW
  \pst@usecolor\pshatchcolor
  \psk@hatchsep \tx@LineFill}
\@namedef{psfs@hlines*}{gsave \psfs@solid grestore \psfs@hlines}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@LineFill}
%    \begin{macrocode}
\pst@def{LineFill}<%
  abs CLW add /a ED              % hatchsep
  gsave
    clip
    pathbbox                   %leave llx,lly,urx,ury on stack
    a \tx@Div ceiling /y2 ED   % Number of top line to be drawn.
    /x2 ED
    a \tx@Div floor /y1 ED     % Number of bottom line to be drawn
    /x1 ED
    /n y2 y1 sub 1 add cvi def % Number of lines.
    /y1 a y1 mul def           % y-coordinate of bottom line.
    newpath 2 setlinecap
    n
    { currentstrokeadjust ==
      x1 y1 moveto
      x2 y1 L
      stroke
      /y1 y1 a add def }
    repeat
  grestore>
\pst@def{LineFill}<%
  abs CLW add /a ED              % hatchsep
  gsave
    clip
    pathbbox                   %leave llx,lly,urx,ury on stack
    a \tx@Div ceiling /y2 ED   % Number of top line to be drawn.
    /x2 ED
    a \tx@Div floor /y1 ED     % Number of bottom line to be drawn
    /x1 ED
    /n y2 y1 sub 1 add cvi def % Number of lines.
    /y1 a y1 mul def           % y-coordinate of bottom line.
    newpath 2 setlinecap
    systemdict /currentstrokeadjust known  % Level 2
    { currentstrokeadjust }
    { false }
    ifelse
    { /t { } def }
    { /t {
        transform
        0.25 sub round 0.25 add exch
        0.25 sub round 0.25 add exch
        itransform
      } bind def }
    ifelse
    n {
      x1 y1 t moveto
      x2 y1 t L
      stroke
      /y1 y1 a add def
    } repeat
  grestore>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psfs@vlines}
%    \begin{macrocode}
\def\psfs@vlines{%
  90 rotate
  \psfs@hlines}
\@namedef{psfs@vlines*}{gsave \psfs@solid grestore \psfs@vlines}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psfs@crosshatch}
%    \begin{macrocode}
\def\psfs@crosshatch{gsave \psfs@hlines grestore \psfs@vlines}
\@namedef{psfs@crosshatch*}{%
  gsave \psfs@solid grestore
  gsave \psfs@hlines grestore
  \psfs@vlines}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{fillstyle}
%    \begin{macrocode}
\def\psset@fillstyle#1{%
  \@ifundefined{psfs@#1}%
    {\@pstrickserr{Undefined fill style: `#1'}\@eha}%
    {\edef\psfillstyle{#1}}}
\psset@fillstyle{none}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Arrowheads and t-bars\label{Arrowheads}}
%
% It would be nice to use a font, with hinting.
%
% \begin{macro}{\psset@arrows,\psk@arrowA,\psk@arrowB}
% "\if@pst" is used as a flag for errors.
%    \begin{macrocode}
\def\psset@arrows#1{%
  \begingroup
    \pst@activearrows
    \xdef\pst@tempg{#1}%
  \endgroup
  \expandafter\psset@@arrows\pst@tempg\@empty-\@empty\@nil
  \if@pst\else
    \@pstrickserr{Bad arrows specification: #1}\@ehpa
  \fi}
\def\psset@@arrows#1-#2\@empty#3\@nil{%
  \@psttrue
  \def\next##1,#1-##2,##3\@nil{\def\pst@tempg{##2}}%
  \expandafter\next\pst@arrowtable,#1-#1,\@nil
  \@ifundefined{psas@\pst@tempg}%
    {\@pstfalse\def\psk@arrowA{}}%
    {\let\psk@arrowA\pst@tempg}%
  \@ifundefined{psas@#2}%
    {\@pstfalse\def\psk@arrowB{}}%
    {\def\psk@arrowB{#2}}}
\def\psk@arrowA{}
\def\psk@arrowB{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@arrowtable}
% This is a translator for "arrowA". Add to it with "\edef", as in
% \begin{LVerbatim}
%   \edef\pst@arrowtable{\pst@arrowtable,*o-o*}
% \end{LVerbatim}
%    \begin{macrocode}
\def\pst@arrowtable{,<->,<<->>,>-<,>>-<<,(-),[-]}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@activearrows}
% This redefines certain characters in case they are active, before expanding
% the "arrows" argument. Add to it with "\expandafter", as in
% \begin{LVerbatim}
%   \begingroup
%     \catcode`\:=13
%     \expandafter\gdef\expandafter\pst@activearrows
%       \expandafter{\def:{\string:}}
%   \endgroup
% \end{LVerbatim}
%    \begin{macrocode}
\begingroup
  \catcode`\<=13
  \catcode`\>=13
  \catcode`\|=13
  \gdef\pst@activearrows{\def<{\string<}\def>{\string>}\def|{\string|}}
\endgroup
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{BeginArrow,EndArrow}
% For each arrow <arrow>, "\psas@<arrow>" should be PostScript code so that
% \begin{LVerbatim}
%   <y2 x2 y1 x1> BeginArrow \psk@arrowscale \psas@<arrow> EndArrow
% \end{LVerbatim}
% \begin{itemize}
%  \item Draws an arrow with the tip at <x1 y1>, and
% \item Leaves on the stack <y2 x2 x1' y1'>, where <x1' y1'> is the position
% that a connecting line should start from.
% \end{itemize}
%
% "BeginArrow" sets up an environment so that "\psas@<arrow>" only has to draw
% an arrow pointing down and with the tip at "0 0" and , and leave the current
% point where a connecting line should start from. "EndArrow" then restores
% the original environment and translates the current point into the original
% coordinate system.
%
% A special dictionary "ADict" is used with arrows so that scratch variables
% will not conflict. The matrix is saved as "@mtrx" to indicate that the arrow
% procedures should not change this. The same is true for "@x1", "@y1", "@x2",
% "@y2" and "@angle", which are used by a patch of "BeginArrow" and "EndArrow"
% that is required for some versions of Sun's NewsPrint (see "read-me.pst").
%    \begin{macrocode}
\pst@def{BeginArrow}<%
  ADict begin
  /@mtrx CM def
  gsave
    2 copy T
    2 index sub neg exch 3 index sub exch \tx@Atan
    rotate
    newpath>
\pst@def{EndArrow}<@mtrx setmatrix CP grestore end>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{arrowscale}
%    \begin{macrocode}
\def\psset@arrowscale#1{\pst@getscale{#1}\psk@arrowscale}
\psset@arrowscale{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@arrowsize,\psk@arrowsize}
%    \begin{macrocode}
\def\psset@arrowsize#1{%
  \pst@expandafter\pst@getdimnum{#1} {} {} {}\@nil
  \edef\psk@arrowsize{\pst@number\pst@dimg \pst@tempg}}
\psset@arrowsize{2pt 3}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@arrowlength,\psk@arrowlength}
%    \begin{macrocode}
\def\psset@arrowlength#1{\pst@checknum{#1}\psk@arrowlength}
\psset@arrowlength{1.4}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@arrowinset,\psk@arrowinset}
%    \begin{macrocode}
\def\psset@arrowinset#1{\pst@checknum{#1}\psk@arrowinset}%
\psset@arrowinset{.4}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Arrow}
% Syntax:
% \begin{LVerbatim}
%   <boolean> \psk@arrowinset \psk@arrowlength \psk@arrowsize Arrow
% \end{LVerbatim}
% <boolean> is "true" for reverse arrows and "false" for normal arrows.
%    \begin{macrocode}
\pst@def{Arrow}<%
  CLW mul add dup               % width
  2 div /w ED                   % Half width
  mul dup /h ED                 % Height
  mul /a ED                     % Inset
  { 0 h T 1 -1 scale } if   % For reverse arrows
  w neg h moveto
  0 0 L
  w h L
  w neg a neg rlineto
  gsave fill grestore>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@>}
%    \begin{macrocode}
\@namedef{psas@>}{%
  false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@>>}
%    \begin{macrocode}
\@namedef{psas@>>}{%
  false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
  0 h T
  gsave
    newpath
    false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
    CP
  grestore
  CP newpath moveto
  2 copy
  L
  stroke
  moveto}
%    \end{macrocode}
% \end{macro}
%
% \begingroup
% \catcode`\<=12
% \begin{macro}{\psas@<}
%    \begin{macrocode}
\@namedef{psas@<}{%
  true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@<<}
%    \begin{macrocode}
\@namedef{psas@<<}{%
  true \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow
  CP newpath moveto 0 a neg L stroke 0 h neg T
  false \psk@arrowinset \psk@arrowlength \psk@arrowsize \tx@Arrow}
%    \end{macrocode}
% \end{macro}
% \endgroup
%
% \begin{macro}{\psset@tbarsize,\psk@tbarsize}
%    \begin{macrocode}
\def\psset@tbarsize#1{%
  \pst@expandafter\pst@getdimnum{#1} {} {} {}\@nil
  \edef\psk@tbarsize{\pst@number\pst@dimg \pst@tempg}}
\psset@tbarsize{2pt 5}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Tbar}
% Syntax
% \begin{LVerbatim}
%   \psk@tbarsize Tbar
% \end{LVerbatim}
%    \begin{macrocode}
\pst@def{Tbar}<%
  CLW mul add /z ED              % width
  z -2 div CLW 2 div moveto
  z 0 rlineto
  stroke
  0 CLW moveto>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@|}
%    \begin{macrocode}
\@namedef{psas@|}{\psk@tbarsize \tx@Tbar}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@|*}
%    \begin{macrocode}
\@namedef{psas@|*}{0 CLW -2 div T \psk@tbarsize \tx@Tbar}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@bracketlength,\psk@bracketlength}
%    \begin{macrocode}
\def\psset@bracketlength#1{\pst@checknum{#1}\psk@bracketlength}
\psset@bracketlength{.15}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Bracket,\tx@@Bracket}
% Syntax
% \begin{LVerbatim}
%   \psk@bracketlength \psk@tbarsize Bracket
% \end{LVerbatim}
%    \begin{macrocode}
\pst@def{Bracket}<%
  CLW mul add dup
  CLW sub 2 div /x ED   % adjusted half width
  mul CLW add /y ED     % y-position of height
  /z CLW 2 div def
  x neg y moveto
  x neg CLW 2 div L
  x CLW 2 div L
  x y L
  stroke
  0 CLW moveto>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@]}
%    \begin{macrocode}
\@namedef{psas@]}{\psk@bracketlength \psk@tbarsize \tx@Bracket}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@rbracketlength,\psk@rbracketlength}
%    \begin{macrocode}
\def\psset@rbracketlength#1{\pst@checknum{#1}\psk@rbracketlength}
\psset@rbracketlength{.15}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{RoundBracket}
% Syntax
% \begin{LVerbatim}
%   \psk@bracketlength \psk@tbarsize RoundBracket
% \end{LVerbatim}
%    \begin{macrocode}
\pst@def{RoundBracket}<%
  CLW mul add dup
  2 div /x ED           % half width
  mul /y ED             % height
  /mtrx CM def
  0 CLW 2 div T
  x y mul 0 ne { x y scale } if
  1 1 moveto
   .85 .5   .35  0   0 0 curveto
  -.35  0  -.85 .5  -1 1 curveto
  mtrx setmatrix
  stroke
  0 CLW moveto>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@(}
%    \begin{macrocode}
\@namedef{psas@)}{\psk@rbracketlength \psk@tbarsize \tx@RoundBracket}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@c,\psas@cc,\psas@C}
% This is not going to be used frequently, and so we don't bother defining a
% PostScript procedure in the header.
%    \begin{macrocode}
\def\psas@c{1 \psas@@c}
\def\psas@cc{0 CLW 2 div T 1 \psas@@c}
\def\psas@C{2 \psas@@c}
\def\psas@@c{%
  setlinecap
  0 0 moveto
  0 CLW 2 div L
  stroke
  0 0 moveto}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@}
%    \begin{macrocode}
\def\psas@{}
\psset@arrows{-}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Graphics objects: processing arguments}
%
% \begin{macro}{\pst@par,\addto@par,\use@par}
% Graphics objects accumulate <parameter>=<value> pairs in the command
% sequence "\pst@par". They use "\addto@par" to add to "\pst@par", and
% "\use@par" to make the parameter changes effective.
%    \begin{macrocode}
\def\pst@par{}
\def\addto@par#1{%
  \ifx\pst@par\@empty
    \def\pst@par{#1}%
  \else
    \expandafter\def\expandafter\pst@par\expandafter{\pst@par,#1}%
  \fi}
\def\use@par{%
  \ifx\pst@par\@empty\else
    \expandafter\@psset\pst@par,\@nil
    \def\pst@par{}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@object}
% Any macro, such as "\psline", that uses graphics parameters should begin as
% follows:
% \begin{LVerbatim}
%   \def\psline{\def\pst@par{}\pst@object{psline}}
%   \def\psline@i{ ... }
% \end{LVerbatim}
% "\pst@object" checkes for the optional "[<par>=<value>,...]" argument, adds
% key-value pairs to "\pst@par" if found, skips spaces, and then invokes
% "\psline@i".
%    \begin{macrocode}
\def\pst@object#1{%
  \pst@ifstar{\@ifnextchar[{\pst@@object{#1}}{\@nameuse{#1@i}}}}
\def\pst@@object#1[#2]{%
  \addto@par{#2}\@ifnextchar+{\@nameuse{#1@i}}{\@nameuse{#1@i}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\newpsobject}
% For example,
% \begin{LVerbatim}
%   \newpsobject{dottedline}{psline}{linestyle=dotted}
% \end{LVerbatim}
% has the following effect:
% \begin{LVerbatim}
%   \def\dottedline{%
%     \def\pst@par{linestyle=dotted}\pst@object{psline}}
% \end{LVerbatim}
% and thus "\dottedline" is just like "\psline", except that the default falue
% of "linestyle" is changed to "dotted".
%    \begin{macrocode}
\def\newpsobject#1#2#3{%
  \@ifundefined{#2@i}%
    {\@pstrickserr{Graphics object `#2' not defined}\@eha}%
    {\@namedef{#1}{\def\pst@par{#3}\pst@object{#2}}}\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getarrows}
% "\pst@getarrows{foo}" checks for an optional argument containing arrows, and
% then invokes "foo". The arrows argument must be followed by "(".
%    \begin{macrocode}
\def\pst@getarrows#1{\@ifnextchar({#1}{\pst@@getarrows{#1}}}
\def\pst@@getarrows#1#2{\addto@par{arrows=#2}#1}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Graphics objects: Basics \TeX\ macros\label{Objects}}
%
% Each graphics object should use one of the following:
% \begin{center}
% \begin{tabular}{ll}
% "\begin@OpenObj ... \end@OpenObj" & Open curves with arrows.\\
% "\begin@AltOpenObj ... \end@AltOpenObj" & Open curves w/o arrows.\\
% "\begin@ClosedObj ... \end@ClosedObj" & Closed curves.\\
% "\begin@SpecialObj ... \end@SpecialObj" & Other.
% \end{tabular}
% \end{center}
% This makes it possible for "\pscustom" to work by redefining these.
%
% \begin{macro}{\begin@ClosedObj,\end@ClosedObj}
%    \begin{macrocode}
\def\begin@ClosedObj{%
  \leavevmode
  \pst@killglue
  \begingroup
    \use@par
    \solid@star
    \ifpsdoubleline \pst@setdoublesep \fi
    \init@pscode}
\def\end@ClosedObj{%
    \ifpsshadow \pst@closedshadow \fi
    \ifdim\psk@border\p@>\z@ \pst@addborder \fi
    \pst@fill
    \pst@stroke
    \ifpsdoubleline \pst@doublestroke \fi
    \ifshowpoints
      \addto@pscode{Points aload length 2 div cvi /N ED \psdots@iii}%
    \fi
    \use@pscode
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\begin@OpenObj,\begin@AltOpenObj,\end@OpenObj}
%    \begin{macrocode}
\def\begin@OpenObj{%
  \begin@ClosedObj
    \let\pst@linetype\pst@arrowtype
    \pst@addarrowdef}
\def\begin@AltOpenObj{%
  \begin@ClosedObj
    \def\pst@repeatarrowsflag{\z@}%
    \def\pst@linetype{0}}
\def\end@OpenObj{%
    \ifpsshadow \pst@openshadow \fi
    \ifdim\psk@border\p@>\z@ \pst@addborder \fi
    \pst@fill
    \pst@stroke
    \ifpsdoubleline \pst@doublestroke \fi
    \ifnum\pst@repeatarrowsflag>\z@ \pst@repeatarrows \fi
    \ifshowpoints \pst@OpenShowPoints \fi
    \use@pscode
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\begin@SpecialObj,\end@SpecialObj}
%    \begin{macrocode}
\def\begin@SpecialObj{%
  \leavevmode
  \pst@killglue
  \begingroup
    \use@par
    \init@pscode}
\def\end@SpecialObj{%
    \use@pscode
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\init@pscode,\addto@pscode,\use@pscode}
% Graphics objects are built up by adding PostScript code to "\pst@code" with
% "\addto@pscode". "\use@pscode" then adds leading and trailing PostScript
% code, and (normally) inserts it in a "\special" (it also most empty
% "\pst@code"). Hacks like "\psclip", "\multips" and "\pstextpath" work by
% redefining "\use@pscode". These hacks use "\use@pscode" themselves when
% appropriate, making limited nesting of these hacks is possible. "\PSTtoEPS"
% works be redefining "\addto@pscode" so that it writes to a file. All this
% was carefully designed so that these hacks would work. Watch out!
%    \begin{macrocode}
\def\pst@code{}%
\def\init@pscode{%
  \addto@pscode{%
    \pst@number\pslinewidth SLW
    \pst@usecolor\pslinecolor}}
\def\addto@pscode#1{\xdef\pst@code{\pst@code#1\space}}
\def\use@pscode{%
  \pstverb{%
    \pst@dict
      \tx@STP
      newpath
      \psk@origin
      \psk@swapaxes
      \pst@code
     end}%
   \gdef\pst@code{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@killglue}
%    \begin{macrocode}
\def\KillGlue{%
  \def\pst@killglue{\unskip\ifdim\lastskip>\z@\expandafter\pst@killglue\fi}}
\def\DontKillGlue{\let\pst@killglue\relax}
\DontKillGlue
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\solid@star}
% The optional "*" is typically used to make a solid option. This means that
% "linestyle" is set to "none", "linewidth" is set to "0", and "fillcolor" is
% set to "linecolor".
%    \begin{macrocode}
\def\solid@star{%
  \if@star
    \pslinewidth=\z@
    \psdoublelinefalse
    \def\pslinestyle{none}%
    \def\psfillstyle{solid}%
    \let\psfillcolor\pslinecolor
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@setdoublesep}
%    \begin{macrocode}
\def\pst@setdoublesep{%
  \pst@getlength\psdoublesep\psdoublesep
  \pslinewidth=2\pslinewidth
  \advance\pslinewidth\psdoublesep\p@
  \let\pst@setdoublesep\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Shadow}
% Syntax:
% \begin{Ex}
%    <x y> Shadow
% \end{Ex}
% translates current path by <x y>.
%    \begin{macrocode}
\pst@def{Shadow}<%
  [
    { /moveto load }
    { /lineto load }
    { /curveto load }
    { /closepath load }
    pathforall
  ]
  cvx
  newpath
  3 1 roll
  T
  exec>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@closedshadow}
%    \begin{macrocode}
\def\pst@closedshadow{%
  \addto@pscode{%
    gsave
    \psk@shadowsize \psk@shadowangle \tx@PtoC
    \tx@Shadow
    \pst@usecolor\psshadowcolor
    gsave fill grestore
    stroke
    grestore
    gsave
    \pst@usecolor\psfillcolor
    gsave fill grestore
    stroke
    grestore}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@openshadow}
%    \begin{macrocode}
\def\pst@openshadow{%
  \addto@pscode{%
    gsave
      \psk@shadowsize \psk@shadowangle \tx@PtoC
      \tx@Shadow
      \pst@usecolor\psshadowcolor
      \ifx\psfillstyle\@none\else
        gsave fill grestore
      \fi
      stroke}%
  \pst@repeatarrows
  \addto@pscode{grestore}
  \ifx\psfillstyle\@none\else
    \addto@pscode{%
      gsave
      \pst@usecolor\psfillcolor
      gsave fill grestore
      stroke
      grestore}
   \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@addborder}
%    \begin{macrocode}
\def\pst@addborder{%
  \addto@pscode{%
    gsave
      \psk@border 2 mul
      CLW add SLW
      \pst@usecolor\psbordercolor
      stroke
    grestore}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@stroke}
%    \begin{macrocode}
\def\pst@stroke{%
  \ifx\pslinestyle\@none\else
    \addto@pscode{%
      gsave
        \pst@number\pslinewidth SLW
        \pst@usecolor\pslinecolor
        \@nameuse{psls@\pslinestyle}
      grestore}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@fill}
%    \begin{macrocode}
\def\pst@fill{%
  \ifx\psfillstyle\@none\else
    \addto@pscode{gsave \@nameuse{psfs@\psfillstyle} grestore}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@doublestroke}
%    \begin{macrocode}
\def\pst@doublestroke{%
  \addto@pscode{%
    gsave
      \psdoublesep SLW
      \pst@usecolor\psdoublecolor
      stroke
    grestore}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@arrowtype}
%    \begin{macrocode}
\def\pst@arrowtype{%
  \ifx\psk@arrowB\@empty 0 \else -2 \fi
  \ifx\psk@arrowA\@empty 0 \else -1 \fi
  add}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@addarrowdef,\pst@arrowdef,\pst@arrowtype}
% "ArrowA" takes two coordinates from the stack, draws the arrow with the tip
% at the top coordinate, leaves the second coordinate on the stack and leaves
% the current point where a line should join.
%
% "ArrowB" takes two coordinates from the stack, draws the arrow with the tip
% at the top coordinate, and leaves both coordinates on the stack, without
% changing the graphics state.
%
% This particular definition of "ArrowA" is important for "\pscustom".
%
% "ArrowA" and "ArrowB" might also save the arrow coordinates, because
% sometimes it is necessary to redraw the arrows (see
% "\pst@setrepeatarrowsflag").
%    \begin{macrocode}
\def\pst@addarrowdef{%
  \addto@pscode{%
    /ArrowA {
      \ifx\psk@arrowA\@empty
        \pst@oplineto
      \else
        \pst@arrowdef{A}
        moveto
      \fi
    } def
    /ArrowB {
      \ifx\psk@arrowB\@empty \else \pst@arrowdef{B} \fi
    } def}}
\def\pst@arrowdef#1{%
  \ifnum\pst@repeatarrowsflag>\z@
    /Arrow#1c [ 6 2 roll ] cvx def Arrow#1c
  \fi
  \tx@BeginArrow
  \psk@arrowscale
  \@nameuse{psas@\@nameuse{psk@arrow#1}}
  \tx@EndArrow}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@repeatarrows}
%    \begin{macrocode}
\def\pst@repeatarrows{%
  \addto@pscode{%
    gsave
    \ifx\psk@arrowA\@empty\else
      ArrowAc ArrowA pop pop
    \fi
    \ifx\psk@arrowB\@empty\else
      ArrowBc ArrowB pop pop pop pop
    \fi
    grestore}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@OpenShowPoints}
%    \begin{macrocode}
\def\pst@OpenShowPoints{%
  \addto@pscode{%
    gsave
      \psk@dotsize
      \@nameuse{psds@\psk@dotstyle}
      /TheDot {
        gsave T \psk@dotangle \psk@dotscale Dot grestore
      } def
      newpath
      Points aload length 2 div 2 sub cvi /N ED
      N 0 ge
      { \ifx\psk@arrowA\@empty
          TheDot
        \else
          pop pop
        \fi
        N { TheDot } repeat
        \ifx\psk@arrowB\@empty
          TheDot
        \else
          pop pop
        \fi }
      { N 2 mul { pop } repeat }
      ifelse
    grestore}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Custom graphics}
%
% Graphics objects using "\begin@SpecialObj" cannot be used with "\pscustom".
% It is up to the other graphics objects to be compatible with "\pscustom".
% This means:
% \begin{itemize}
% \item To use the current point as an additional coordinate, when it exists,
% the graphics object should insert "\pst@cp".
% \item For graphics objects that use "\begin@OpenObj", the "ArrowA" is
% defined by "\pscustom" to connect the top coordinate with the current point
% by a line, if there is a current point. Other graphics objects should use
% "\pst@oplineto" as a substitute for "moveto" if they wish to connect a
% coordinate to the current point if it exists.
% \end{itemize}
%
% Closed graphics objects are not under an obligation to anything particularly
% sensible the current point exists.
%
% \begin{macro}{\pscustom}
% The main graphics object modifies "\begin@OpenObj" and "\end@OpenObj" so
% that the open curves extend the current path.
%    \begin{macrocode}
\def\pscustom{\def\pst@par{}\pst@object{pscustom}}
\long\def\pscustom@i#1{%
  \begin@SpecialObj
    \solid@star
    \let\pst@ifcustom\iftrue
    \let\begin@ClosedObj\begin@CustomObj
    \let\end@ClosedObj\endgroup
    \def\begin@OpenObj{\begin@CustomObj\pst@addarrowdef}%
    \let\end@OpenObj\endgroup
    \let\begin@AltOpenObj\begin@CustomObj
    \def\begin@SpecialObj{%
      \begingroup
      \pst@misplaced{special graphics object}%
      \def\addto@pscode####1{}
      \let\end@SpecialObj\endgroup}%
    \def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}%
    \def\psclip##1{\pst@misplaced\psclip}%
    \def\pst@repeatarrowsflag{\z@}%
    \let\pst@setrepeatarrowsflag\relax
    \showpointsfalse
    \let\showpointstrue\relax
    \def\pst@linetype{\pslinetype}%
    \let\psset@liftpen\psset@@liftpen
    \psset@liftpen{\z@}%
    \def\pst@cp{/currentpoint load stopped pop }%
    \def\pst@oplineto{/lineto load stopped { moveto } if }%
    \def\pst@optcp##1##2{%
      \ifnum##1=\z@\def##2{/currentpoint load stopped { 0 0 } if }\fi}%
    \let\caddto@pscode\addto@pscode
    \def\cuse@par##1{{\use@par##1}}%
    \the\pst@customdefs
    \setbox\pst@hbox=\hbox{#1}%
    \pst@fill
    \pst@stroke
  \end@SpecialObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\begin@CustomObj,\end@CustomObj}
%    \begin{macrocode}
\def\begin@CustomObj{%
  \begingroup
    \use@par
    \addto@pscode{%
      \pst@number\pslinewidth SLW
      \pst@usecolor\pslinecolor}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@liftpen,\pst@cp,\pst@oplineto,\pst@optcp}
%    \begin{macrocode}
\def\pst@oplineto{moveto }
\def\pst@cp{}
\def\pst@optcp#1#2{}
\def\psset@liftpen#1{}
\def\psset@@liftpen#1{%
  \ifcase#1\relax
    \def\psk@liftpen{\z@}%
    \def\pst@cp{/currentpoint load stopped pop }%
    \def\pst@oplineto{/lineto load stopped { moveto } if }%
  \or
    \def\psk@liftpen{1}%
    \def\pst@cp{}%
    \def\pst@oplineto{/lineto load stopped { moveto } if }%
  \or
    \def\psk@liftpen{2}%
    \def\pst@cp{}%
    \def\pst@oplineto{moveto }%
  \fi}
\psset@liftpen{0}
\def\psk@liftpen{-1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@linetype,\pslinetype}
%    \begin{macrocode}
\def\psset@linetype#1{%
  \pst@getint{#1}\pslinetype
  \ifnum\pst@dimg<-3
    \@pstrickserr{linetype must be greater than -3}\@ehpa
    \def\pslinetype{0}%
  \fi}
\psset@linetype{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caddto@pscode}
% Commands that should only occur in "\pscustom" should use this. Obsolete?
%    \begin{macrocode}
\def\caddto@pscode#1{%
  \@pstrickserr{Command can only be used in \string\pscustom}\@ehpa}
\let\cuse@par\caddto@pscode
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@MSave,\tx@MRestore}
% It doesn't seem worth adding these to the header file.
%    \begin{macrocode}
\def\tx@MSave{%
  /msavemtrx
  [ tx@Dict /msavemtrx known { msavemtrx aload pop } if CM ]
  def }
\def\tx@MRestore{%
  tx@Dict /msavemtrx known { length 0 gt } { false } ifelse
  { /msavematrx [ msavematrx aload pop setmatrix ] def }
  if }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psmove,\psclosepath,\psgroup}
%    \begin{macrocode}
\newtoks\pst@customdefs
\pst@customdefs{%
  \def\newpath{\addto@pscode{newpath}}%
  \def\moveto(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor moveto}}%
  \def\closepath{\addto@pscode{closepath}}%
  \def\gsave{\begingroup\addto@pscode{gsave}}%
  \def\grestore{\endgroup\addto@pscode{grestore}}%
  \def\translate(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor moveto}}%
  \def\rotate#1{\pst@@getangle{#1}\addto@pscode{\pst@angle rotate}}%
  \def\scale#1{\pst@getscale{#1}\pst@tempg\addto@pscode{\pst@tempg}}%
  \def\msave{\addto@pscode{\tx@MSave}}%
  \def\mrestore{\addto@pscode{\tx@MRestore}}%
  \def\swapaxes{\addto@pscode{-90 rotate -1 1 scale}}%
  \def\stroke{\def\pst@par{}\pst@object{stroke}}%
  \def\fill{\def\pst@par{}\pst@object{fill}}%
  \def\openshadow{\def\pst@par{}\pst@object{openshadow}}%
  \def\closedshadow{\def\pst@par{}\pst@object{closedshadow}}%
  \def\movepath(#1){\pst@@getcoor{#1}\addto@pscode{\pst@coor tx@Shadow}}%
  \def\lineto{\pst@onecoor{lineto}}%
  \def\rlineto{\pst@onecoor{rlineto}}%
  \def\curveto{\pst@threecoor{curveto}}%
  \def\rcurveto{\pst@threecoor{rcurveto}}%
  \def\code#1{\addto@pscode{#1}}%
  \def\coor(#1){\pst@@getcoor{#1}\addto@pscode\pst@coor\@ifnextchar({\coor}{}}%
  \def\rcoor{\pst@getcoors{}{}}%
  \def\dim#1{\pssetlength\pst@dimg{#1}\addto@pscode{\pst@number\pst@dimg}}%
  \def\setcolor#1{%
    \@ifundefined{color@#1}{}{\addto@pscode{\use@color{#1}}}}%
  \def\arrows#1{{\psset@arrows{#1}\pst@addarrowdef}}%
  \let\file\pst@rawfile
} % END \pst@customdefs
\def\closedshadow@i{\cuse@par\pst@closedshadow}
\def\openshadow@i{\cuse@par\pst@openshadow}
\def\stroke@i{\cuse@par\pst@stroke}%
\def\fill@i{\cuse@par\pst@fill}%
\def\pst@onecoor#1(#2){%
  \pst@@getcoor{#2}%
  \addto@pscode{\pst@coor #1}}
\def\pst@threecoor#1(#2)#3(#4)#5(#6){%
  \begingroup
    \pst@getcoor{#2}\pst@tempa
    \pst@getcoor{#4}\pst@tempb
    \pst@getcoor{#6}\pst@tembc
    \addto@pscode{\pst@tempa \pst@tempb \pst@tempc #1}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\psrawfile,\pst@rawfile}
%    \begin{macrocode}
\def\pst@rawfile#1{%
  \begingroup
    \def\do##1{\catcode`##1=12\relax}"
    \dospecials
    \catcode`\%=14
    \pst@@rawfile{#1}%
  \endgroup}
\def\pst@@rawfile#1{%
  \immediate\openin1 #1
  \ifeof1
    \@pstrickserr{File `#1' not found}\@ehpa
  \else
    \immediate\read1 to \pst@tempg
    \loop
      \ifeof1 \@pstfalse\else\@psttrue\fi
    \if@pst
      \addto@pscode\pst@tempg
      \immediate\read1 to \pst@tempg
    \repeat
  \fi
  \immediate\closein1\relax}
%    \end{macrocode}
% \end{macro}
%
%
%
% \section{Graphics objects: Basic PostScript macros}
%
% \begin{macro}{SD}
%    \begin{macrocode}
\pst@def{SD}<%
  0 360 arc fill>
\pst@def{SQ}<%
  /r ED
  r r moveto
  r r neg L
  r neg r neg L
  r neg r L
  fill>
\pst@def{ST}<%
  /y ED /x ED
  x y moveto
  x neg y L
  0 x L
  fill>
\pst@def{SP}<%
  /r ED
  gsave
    0 r moveto
    4 { 72 rotate 0 r L } repeat
    fill
  grestore>
\@namedef{psds@*}{/Dot { 0 0 DS \tx@SD } def}
\@namedef{psds@o}{%
  /r2 DS CLW sub def
  /Dot { 0 0 DS \tx@SD \pst@usecolor\psfillcolor 0 0 r2 \tx@SD } def}
\@namedef{psds@square*}{%
  /r1 DS .886 mul def
  /Dot { r1 \tx@SQ } def}
\@namedef{psds@square}{%
  /r1 DS .886 mul def /r2 r1 CLW sub def
  /Dot { r1 \tx@SQ \pst@usecolor\psfillcolor r2 \tx@SQ } def}
\@namedef{psds@triangle*}{%
  /y1 DS .778 mul neg def /x1 y1 1.732 mul neg def
  /Dot { x1 y1 \tx@ST } def}
\@namedef{psds@triangle}{%
  /y1 DS .778 mul neg def /x1 y1 1.732 mul neg def
  /y2 y1 CLW add def /x2 y2 1.732 mul neg def
  /Dot { x1 y1 \tx@ST \pst@usecolor\psfillcolor x2 y2 \tx@ST } def}
\@namedef{psds@pentagon*}{%
  /r1 DS 1.149 mul def
  /Dot { r1 \tx@SP } def}
\@namedef{psds@pentagon}{%
  DS .93 mul dup 1.236 mul /r1 ED CLW sub 1.236 mul /r2 ED
  /Dot { r1 \tx@SP \pst@usecolor\psfillcolor
    r2 \tx@SP } def}
\@namedef{psds@+}{%
  /DS DS 1.253 mul def
  /Dot { DS 0 moveto DS neg 0 L stroke
    0 DS moveto 0 DS neg L stroke } def}
\@namedef{psds@|}{%
  \psk@tbarsize CLW mul add 2 div /DS ED
  /Dot { 0 DS moveto 0 DS neg L stroke } def}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{dotstyle}
%    \begin{macrocode}
\def\psset@dotstyle#1{%
  \@ifundefined{psds@#1}%
    {\@pstrickserr{Dot style `#1' not defined}\@eha}%
    {\edef\psk@dotstyle{#1}}}
\psset@dotstyle{*}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{NArray}
% Syntax:
% \begin{Ex}
%   <array of points> NArray <points>
% \end{Ex}
% Sets "n" to the number of pairs in the array, and makes sure there is an
% even number of elements.
%    \begin{macrocode}
\pst@def{NArray}<%
  aload length 2 div dup
  dup cvi eq not { exch pop } if
  /n exch cvi def>
\pst@def{NArray}<%
  /f ED
  counttomark 2 div
  dup cvi /n ED
  n eq not { exch pop } if
  f
    { ] aload /Points ED }
    { n 2 mul 1 add -1 roll pop }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Line}
% Syntax:
% \begin{Ex}
%   <array of points> Line -
% \end{Ex}
% "ArrowA" and "ArrowB" should be defined to draw arrows, and "Lineto" should
% be the procedure used to draw the path; either "lineto" or "Arcto".
%    \begin{macrocode}
\pst@def{Line}<%
  \tx@NArray
  n 0 eq not
  { n 1 eq { 0 0 /n 2 def } if
    ArrowA
    /n n 2 sub def
    n { Lineto } repeat
    CP 4 2 roll ArrowB L
    pop pop }
  if>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Arcto}
% Syntax:
% \begin{Ex}
%   <x2 y2 x1 y1> Arcto <x2 y2>
% \end{Ex}
% "r" should be set to the arc radius. Adds to the path with "arcto", with the
% corner at <x1 y1> and going towards <x2 y2>. Works even when the points are
% equal. For use with "Line" and "Polygon".
%    \begin{macrocode}
\pst@def{Arcto}<%
  /a [ 6 -2 roll ] cvx def
  a r /arcto load stopped { 5 } { 4 } ifelse { pop } repeat a>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Polygon}
% Syntax:
% \begin{Ex}
%   <array of points> Line -
% \end{Ex}
% "Lineto" should be the procedure used to draw the path; either "lineto" or
% "Arcto".
%    \begin{macrocode}
\pst@def{CheckClosed}<%
  dup n 2 mul 1 sub index eq 2 index n 2 mul 1 add index eq and
  { pop pop /n n 1 sub def }
  if>
\pst@def{Polygon}<%
  \tx@NArray
  n 2 eq { 0 0 /n 3 def } if
  n 3 lt
  { n { pop pop } repeat }
  { n 3 gt { \tx@CheckClosed } if
    n 2 mul -2 roll /y0 ED /x0 ED
    /y1 ED /x1 ED x1 y1
    /x1 x0 x1 add 2 div def
    /y1 y0 y1 add 2 div def
    x1 y1 moveto
    /n n 2 sub def
    n { Lineto } repeat
    x1 y1 x0 y0 6 4 roll
    Lineto Lineto pop pop closepath }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
%
% \section{Interpolated curves}
%
% This documentation is largely junk.
%
% There one was an alternate algorithm that had the nice property that when
% the coordinates were scaled, the interpolated curve would scale in the same
% way. It was also simpler. However, this one gives nicer looking results in
% most cases.
%
% Two parameters should be defined:
% \begin{description}
%   \item[a] Lower values make the curve tighter. (Default: 1)
% \item[b] Higher values make the curve tighter where the angle ABC is less
% than 45 degrees, and loosen the curve elsewhere. (Default: .1)
% \end{description}
% "ArrowA" and "ArrowB" should be defined as well.
%
% Each two points are connected by a single Bezier curve, using curveto. For
% each point P, let P- and P+ be the control points before and after the
% point. I.e., If A, B and C are consecutive points, then A and B are
% connected by the Bezier curve with control points A, A+, B- and B, and B and
% C are connected with control points B, B+, C- and C.
%
% The interpolation is local, meaning that control points B- and B+ depend
% only on points A, B and C.
%
% \begin{macro}{\tx@CCA,\tx@CC}
% The first three lines before "CCA" set "x1"$=Ax+$, "y1"$=Ay+$,
% "l0"$=d(A,B)$, "dx0"$=Bx-Ax$, and "dy0"$=By-Ay$. After "CCA", "x"$=Bx$,
% "y"$=By$, "dx1"$=Cx-Bx$, "dy2"$=Cy-By$, and "l1"$=d(B,C)$.
%    \begin{macrocode}
\pst@def{CCA}<%
  /y ED /x ED 2 copy
  y sub /dy1 ED x sub /dx1 ED
  /l1 dx1 dy1 \tx@Pyth def>
\pst@def{CCA}<%
  /y ED /x ED 2 copy
  y sub /dy1 ED x sub /dx1 ED
  /l1 dx1 dy1 \tx@Pyth def>
\pst@def{CC}<%
  /l0 l1 def
  /x1 x dx sub def /y1 y dy sub def
  /dx0 dx1 def /dy0 dy1 def
  \tx@CCA
%    \end{macrocode}
% The task is now to calculate $B-$ and $B+$. We first calculate the slope
% "dx" and "dy" at $B$. This tangent at $B$ should be perpendicular to the
% bisection of the angle $ABC$. Recalling that "dx0" and "dy0" ``point'' from
% $A$ to $B$, this tangency thus passes through $B+(dx,dy)$, where $(dx,dy)$
% is the average of $dx0,dy0$ and $dx1,dy1$, once these have been normalized
% to have the same length. If we normalize by dividing each by their length,
% and then multiplying both by both lengths, we get
% \begin{center}\tt\begin{tabular}{rcl}
%   dx & $=$ & l1 $\times$ dx0 $+$ l0 $\times$ dx1 \\[3pt]
%   dy & $=$ & l1 $\times$ dy0 $+$ l0 $\times$ dy1
% \end{tabular}\end{center}
%    \begin{macrocode}
  /dx dx0 l1 c exp mul dx1 l0 c exp mul add def
  /dy dy0 l1 c exp mul dy1 l0 c exp mul add def
%    \end{macrocode}
% "dx" and "dy" give us the direction of the control points $B-$ and $B+$ from
% $B$. Now we adjust the distance of these control points. The first component
% is sine of the angle ABC, so that smaller angles give closer control points.
% This is raised to the "b", so that "b" controls the extent of this
% dependency (and can even reverse the relation).
% Then this amount is multiplied times "a", which those adjusts the overall
% tightness, independently of the angle. Let's call this amount $M$. This
% amount is then divided by the length of the vector $(dx,dy)$, thereby
% normalizing this vector to unit length, and then, multiplied times the
% distance between $A$ and $B$ (for calculating $B-$). Thus, $B-$ is distance
% $M d(A,B)$ from $B$. $(x2,y2)$ are set to $B-$, thus calculated, and $B+$ is
% temporily stored in $(dx,dy)$.
%    \begin{macrocode}
  /m dx0 dy0 \tx@Atan dx1 dy1 \tx@Atan sub
     2 div cos abs b exp a mul
     dx dy \tx@Pyth \tx@Div 2 div def
  /x2 x l0 dx mul m mul sub def
  /y2 y l0 dy mul m mul sub def
  /dx l1 dx mul m mul neg def
  /dy l1 dy mul m mul neg def>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@IC,\tx@BOC,\tx@NC,\tx@EOC,\tx@BAC,\tx@NAC,\tx@EAC}
% These are the compenents of the loops that go through the lists of points
% that are to be interpolated. These are abbreviations, as follows:
% \begin{center}
% \begin{tabular}{ll}
% "IC" & Initialize Curve\\
% "BOC" & Begin Open Curve\\
% "NC" & Next Curve\\
% "EOC" & End Open Curve\\
% "BAC" & Begin Alternative Curve\\
% "NAC" & Next Alternative Curve\\
% "EAC" & End Alternative Curve
% \end{tabular}
% \end{center}
%    \begin{macrocode}
\pst@def{IC}<%
  /c c 1 add def
  c 0 lt { /c 0 def } { c 3 gt { /c 3 def } if } ifelse
  /a a 2 mul 3 div 45 cos b exp div def
  \tx@CCA /dx 0 def /dy 0 def>
\pst@def{BOC}<%
  \tx@IC \tx@CC x2 y2 x1 y1 ArrowA
  CP 4 2 roll x y curveto>
\pst@def{NC}<\tx@CC x1 y1 x2 y2 x y curveto>
\pst@def{EOC}<%
  x dx sub y dy sub 4 2 roll ArrowB 2 copy curveto>
\pst@def{BAC}<%
  \tx@IC \tx@CC x y moveto \tx@CC
  x1 y1 CP ArrowA>
\pst@def{NAC}<x2 y2 x y curveto \tx@CC x1 y1>
\pst@def{EAC}<x2 y2 x y ArrowB curveto pop pop>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{OpenCurve}
% Syntax:
% \begin{Ex}
%   <array of points> OpenCurve
% \end{Ex}
%    \begin{macrocode}
\pst@def{OpenCurve}<%
  \tx@NArray
  n 3 lt
  { n { pop pop } repeat }
  { \tx@BOC
    /n n 3 sub def
    n { \tx@NC } repeat
    \tx@EOC }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{AltCurve}
% Syntax:
% \begin{Ex}
%   <array of points> AltCurve
% \end{Ex}
%    \begin{macrocode}
\pst@def{AltCurve}<%
  { false \tx@NArray
    n 2 mul 2 roll
    [ n 2 mul 3 sub 1 roll ]
    aload /Points ED
    n 2 mul -2 roll }
  { false \tx@NArray }
  ifelse
  n 4 lt
  { n { pop pop } repeat }
  { \tx@BAC
    /n n 4 sub def
    n { \tx@NAC } repeat
    \tx@EAC }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{ClosedCurve}
% Syntax:
% \begin{Ex}
%   <array of points> ClosedCurve
% \end{Ex}
%    \begin{macrocode}
\pst@def{ClosedCurve}<%
  \tx@NArray
  n 3 lt
  { n { pop pop } repeat }
  { n 3 gt { \tx@CheckClosed } if
    6 copy n 2 mul 6 add 6 roll
    \tx@IC \tx@CC x y moveto
    n { \tx@NC } repeat
   closepath pop pop }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{curvature}
%    \begin{macrocode}
\def\psset@curvature#1{%
  \edef\pst@tempg{#1 }%
  \expandafter\psset@@curvature\pst@tempg * * * \@nil}
\def\psset@@curvature#1 #2 #3 #4\@nil{%
  \pst@checknum{#1}\pst@tempg
  \pst@checknum{#2}\pst@temph
  \pst@checknum{#3}\pst@tempi
  \edef\psk@curvature{\pst@tempg \pst@temph \pst@tempi}}
\psset@curvature{1 .1 0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pscurve}
%    \begin{macrocode}
\def\pscurve{\def\pst@par{}\pst@object{pscurve}}
\def\pscurve@i{%
  \pst@getarrows{%
    \begin@OpenObj
      \pst@getcoors[\pscurve@ii}}
\def\pscurve@ii{%
  \addto@pscode{%
    \pst@cp
    \psk@curvature\space /c ED /b ED /a ED
    \ifshowpoints true \else false \fi
    \tx@OpenCurve}%
  \end@OpenObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psecurve}
%    \begin{macrocode}
\def\psecurve{\def\pst@par{}\pst@object{psecurve}}
\def\psecurve@i{%
  \pst@getarrows{%
    \begin@OpenObj
    \pst@getcoors[\psecurve@ii}}
\def\psecurve@ii{%
  \addto@pscode{%
    \psk@curvature\space /c ED /b ED /a ED
    \ifshowpoints true \else false \fi
    \tx@AltCurve}%
  \end@OpenObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psccurve}
%    \begin{macrocode}
\def\psccurve{\def\pst@par{}\pst@object{psccurve}}
\def\psccurve@i{%
  \begin@ClosedObj
    \pst@getcoors[\psccurve@ii}
\def\psccurve@ii{%
  \addto@pscode{%
    \psk@curvature\space /c ED /b ED /a ED
    \ifshowpoints true \else false \fi
    \tx@ClosedCurve}%
  \def\pst@linetype{1}%
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Dots}
%
% It would be nice to use a font, with hinting.
%
% \begin{macro}{dotsize}
%    \begin{macrocode}
\def\psset@dotsize#1{%
  \edef\pst@tempg{#1 }%
  \expandafter\psset@@dotsize\pst@tempg -1 -1 -1\@nil}
\def\psset@@dotsize#1 #2 #3\@nil{%
  \pst@checknum{#2}\pst@tempg
  \pssetlength\pst@dimg{#1}%
  \edef\psk@dotsize{%
    /DS \pst@number\pst@dimg \pst@tempg CLW mul add 2 div def }}
\psset@dotsize{.5pt 2.5}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psset@dotscale}
%    \begin{macrocode}
\def\psset@dotscale#1{\pst@getscale{#1}\psk@dotscale}
\psset@dotscale{1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@Getangle}
%    \begin{macrocode}
\def\pst@Getangle#1#2{%
  \pst@getangle{#1}\pst@tempg
  \def\pst@temph{0. }%
  \ifx\pst@tempg\pst@temph
    \def#2{}%
  \else
    \edef#2{\pst@tempg\space rotate }%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{dotangle}
%    \begin{macrocode}
\def\psset@dotangle#1{\pst@Getangle{#1}\psk@dotangle}
\psset@dotangle{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psdots}
%    \begin{macrocode}
\def\psdots{\def\pst@par{}\pst@object{psdots}}
\def\psdots@i{%
  \begin@SpecialObj
    \pst@getcoors[\psdots@ii}
\def\psdots@ii{%
   \addto@pscode{false \tx@NArray \psdots@iii}%
 \end@SpecialObj}
\def\psdots@iii{%
  \psk@dotsize
  \@nameuse{psds@\psk@dotstyle}
  newpath
  n { gsave T \psk@dotangle \psk@dotscale Dot grestore } repeat}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{EndDot}
% Syntax
% \begin{LVerbatim}
%   {<fill>} {<displace>} EndDot
% \end{LVerbatim}
% "DS" should be defined to be the dot size.
%    \begin{macrocode}
\pst@def{EndDot}<%
  { /z DS def } { /z 0 def } ifelse
  /b ED
  0 z DS \tx@SD
  b { 0 z DS CLW sub \tx@SD } if
  0 DS z add CLW 4 div sub moveto>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@oo}
%    \begin{macrocode}
\def\psas@oo{{\pst@usecolor\psfillcolor true} true \psk@dotsize \tx@EndDot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@o}
%    \begin{macrocode}
\def\psas@o{{\pst@usecolor\psfillcolor true} false \psk@dotsize \tx@EndDot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@**}
%    \begin{macrocode}
\@namedef{psas@**}{{false} true \psk@dotsize \tx@EndDot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psas@*}
%    \begin{macrocode}
\@namedef{psas@*}{{false} false \psk@dotsize \tx@EndDot}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Lines and polygons\label{Lines}}
%
% \begin{macro}{linearc}
%    \begin{macrocode}
\newdimen\pslinearc
\def\psset@linearc#1{\pssetlength\pslinearc{#1}}
\psset@linearc{0pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psline}
%    \begin{macrocode}
\def\psline{\def\pst@par{}\pst@object{psline}}
\def\psline@i{%
  \pst@getarrows{%
    \begin@OpenObj
      \pst@getcoors[\psline@ii}}
\def\psline@ii{%
    \addto@pscode{\pst@cp \psline@iii \tx@Line}%
  \end@OpenObj}
\def\psline@iii{%
  \ifdim\pslinearc>\z@
    /r \pst@number\pslinearc def
    /Lineto { \tx@Arcto } def
  \else
    /Lineto /lineto load def
  \fi
  \ifshowpoints true \else false \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\qline}
%    \begin{macrocode}
\def\qline(#1)(#2){%
  \def\pst@par{}%
  \begin@SpecialObj
    \def\pst@linetype{0}%
    \pst@getcoor{#1}\pst@tempa
    \pst@@getcoor{#2}%
    \addto@pscode{%
      \pst@tempa moveto \pst@coor L
      \@nameuse{psls@\pslinestyle}}%
  \end@SpecialObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pspolygon}
%    \begin{macrocode}
\def\pspolygon{\def\pst@par{}\pst@object{pspolygon}}
\def\pspolygon@i{%
  \begin@ClosedObj
    \def\pst@cp{}%
    \pst@getcoors[\pspolygon@ii}
\def\pspolygon@ii{%
    \addto@pscode{\psline@iii \tx@Polygon}%
    \def\pst@linetype{1}%
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{framearc}
%    \begin{macrocode}
\def\psset@framearc#1{\pst@checknum{#1}\psk@framearc}
\psset@framearc{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{cornersize}
%    \begin{macrocode}
\def\psset@cornersize#1{%
  \pst@expandafter\psset@@cornersize{#1}\@nil}
\def\psset@@cornersize#1#2\@nil{%
  \if #1a\relax
    \def\psk@cornersize{\pst@number\pslinearc false }%
  \else
    \def\psk@cornersize{\psk@framearc true }%
  \fi}
\psset@cornersize{relative}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Frame}
% Syntax
% \begin{Ex}
%   <framearc/linearc bool x1 y1 x2 y2 dimen> "Frame"
% \end{Ex}
%    \begin{macrocode}
\pst@def{Rect}<%
  x1 y1 y2 add 2 div moveto
  x1 y2 lineto
  x2 y2 lineto
  x2 y1 lineto
  x1 y1 lineto
  closepath>
\pst@def{OvalFrame}<%
  x1 x2 eq y1 y2 eq or
  { pop pop x1 y1 moveto x2 y2 L }
  { y1 y2 sub abs x1 x2 sub abs
    2 copy gt { exch pop } { pop } ifelse
    2 div
    exch   % STACK: cornersize halfwidth boolean
    { dup 3 1 roll mul exch }
    if
    2 copy lt { pop } { exch pop } ifelse
    /b ED
    x1 y1 y2 add 2 div moveto
    x1 y2 x2 y2 b arcto
    x2 y2 x2 y1 b arcto
    x2 y1 x1 y1 b arcto
    x1 y1 x1 y2 b arcto
    16 { pop } repeat
    closepath }
  ifelse>
\pst@def{Frame}<%
  CLW mul /a ED
  3 -1 roll 2 copy gt { exch } if
  a sub /y2 ED a add /y1 ED
  2 copy gt { exch } if
  a sub /x2 ED a add /x1 ED
  1 index 0 eq { pop pop \tx@Rect } { \tx@OvalFrame } ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{dimen}
%    \begin{macrocode}
\def\psset@dimen#1{%
  \pst@expandafter\psset@@dimen{#1}\@nil}
\def\psset@@dimen#1#2\@nil{%
  \if #1o\relax
    \def\psk@dimen{.5 }%
  \else
    \if #1m\relax
      \def\psk@dimen{0 }%
    \else
      \if #1i\relax
        \def\psk@dimen{-.5 }%
      \fi
    \fi
  \fi}
\psset@dimen{outer}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psframe}
%    \begin{macrocode}
\def\psframe{\def\pst@par{}\pst@object{psframe}}
\def\psframe@i(#1){%
  \@ifnextchar({\psframe@ii(#1)}{\psframe@ii(0,0)(#1)}}
\def\psframe@ii(#1)(#2){%
  \begin@ClosedObj
    \pst@getcoor{#1}\pst@tempa
    \pst@@getcoor{#2}%
    \addto@pscode{\psk@cornersize \pst@tempa \pst@coor \psk@dimen \tx@Frame}%
    \def\pst@linetype{2}%
    \showpointsfalse
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Curves}
%
% \begin{macro}{\psbezier}
%    \begin{macrocode}
\def\psbezier{\def\pst@par{}\pst@object{psbezier}}
\def\psbezier@i{\pst@getarrows\psbezier@ii}
\def\psbezier@ii#1(#2)#3(#4)#5(#6){%
  \@ifnextchar({\psbezier@iii{1}(#2)(#4)(#6)}%
    {\psbezier@iii{\z@}(0,0)(#2)(#4)(#6)}}
\def\psbezier@iii#1(#2)(#3)(#4)(#5){%
  \begin@OpenObj
  \pst@getcoor{#2}\pst@tempa
  \pst@getcoor{#3}\pst@tempb
  \pst@getcoor{#4}\pst@tempc
  \pst@getcoor{#5}\pst@tempd
  \pst@optcp{#1}\pst@tempa
  \ifshowpoints\psbezier@iv\fi
  \addto@pscode{
    \pst@tempb \pst@tempa ArrowA
    \pst@tempc \pst@tempd ArrowB
    curveto}%
  \end@OpenObj}
\def\psbezier@iv{%
  \addto@pscode{%
    gsave
      \pst@tempa \pst@tempb \pst@tempc \pst@tempd
       newpath moveto L L L
       CLW 2 div SLW
       [ \psk@dash\space ] 0 setdash stroke
    grestore
    /Points [\pst@tempa\pst@tempb\pst@tempc\pst@tempd] def}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parabola}
%    \begin{macrocode}
\pst@def{Parab}<%
  /y0 exch def
  /x0 exch def
  /y1 exch def
  /x1 exch def
  /dx x0 x1 sub 3 div def
  /dy y0 y1 sub 3 div def
  x0 dx sub y0 dy add x1 y1 ArrowA
  x0 dx add y0 dy add x0 2 mul x1 sub y1 ArrowB
  curveto
  /Points [ x1 y1 x0 y0 x0 2 mul x1 sub y1 ] def>
\def\parabola{\def\pst@par{}\pst@object{parabola}}
\def\parabola@i{\pst@getarrows\parabola@ii}
\def\parabola@ii#1(#2)#3(#4){%
  \begin@OpenObj
    \pst@getcoor{#2}\pst@tempa
    \pst@@getcoor{#4}%
    \addto@pscode{\pst@tempa \pst@coor \tx@Parab}%
  \end@OpenObj}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Grids\label{Grids}}
%
% \begin{macro}{gridwidth}
%    \begin{macrocode}
\def\psset@gridwidth#1{\pst@getlength{#1}\psk@gridwidth}
\psset@gridwidth{.8pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{griddots}
%    \begin{macrocode}
\def\psset@griddots#1{%
  \pst@cntg=#1\relax
  \edef\psk@griddots{\the\pst@cntg}}
\psset@griddots{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{gridcolor}
%    \begin{macrocode}
\def\psset@gridcolor#1{\pst@getcolor{#1}\psgridcolor}
\psset@gridcolor{black}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{subgridwidth}
%    \begin{macrocode}
\def\psset@subgridwidth#1{\pst@getlength{#1}\psk@subgridwidth}
\psset@subgridwidth{.4pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{subgridcolor}
%    \begin{macrocode}
\def\psset@subgridcolor#1{\pst@getcolor{#1}\pssubgridcolor}
\psset@subgridcolor{gray}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{subgriddots}
%    \begin{macrocode}
\def\psset@subgriddots#1{%
  \pst@cntg=#1\relax\edef\psk@subgriddots{\the\pst@cntg}}
\psset@subgriddots{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{subgriddiv}
%    \begin{macrocode}
\def\psset@subgriddiv#1{%
  \pst@cntg=#1\relax\edef\psk@subgriddiv{\the\pst@cntg}}
\psset@subgriddiv{5}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{gridlabels}
%    \begin{macrocode}
\def\psset@gridlabels#1{\pst@getlength{#1}\psk@gridlabels}
\psset@gridlabels{10pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{gridlabelcolor}
%    \begin{macrocode}
\def\psset@gridlabelcolor#1{\pst@getcolor{#1}\psgridlabelcolor}
\psset@gridlabelcolor{black}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Grid}
% Syntax:
% \begin{Ex}
%   <x1 y1 x2 y2 x-origin y-origin x-divsize y-divsize>\\
%   <numsubdiv griddots labelcolor labelsize> "Grid"
% \end{Ex}
% Coordinates should all be integers. Font needs to be defined before invoking
% this procedure. This could probably be simplified.
%    \begin{macrocode}
\pst@def{Grid}<%
  /a 4 string def            % Empty string
  /b ED                      % Label size
  /d ED                      % Label color procedure.
  /n ED                      % Number of grid dots
  cvi dup 1 lt { pop 1 } if /c ED   % Number subdivisions
  c div dup 0 eq { pop 1 } if /cy ED
  c div dup 0 eq { pop 1 } if /cx ED  % division spacing
  cy div cvi /y ED     % origin y
  cx div cvi /x ED     % origin x
  cy div cvi /y2 ED    % y2
  cx div cvi /x2 ED    % x2
  cy div cvi /y1 ED    % y1
  cx div cvi /x1 ED    % x1
  /h y2 y1 sub 0 gt { 1 } { -1 } ifelse def  % Sign of y2-y1
  /w x2 x1 sub 0 gt { 1 } { -1 } ifelse def  % Sign of x2-x1
  b 0 gt
  { /z1 b 4 div CLW 2 div add def
    /Helvetica findfont b scalefont setfont
    /b b .95 mul CLW 2 div add def }
  if
  gsave
  n 0 gt
  { 1 setlinecap [ 0 cy n div ] 0 setdash }
  { 2 setlinecap }
  ifelse
  /c x1 def /i 500 w mul x1 add def        % Index
  /e y cy mul def /f y1 cy mul def /g y2 cy mul def
  x1 cx mul 0 T
  { newpath
    0 e moveto
    b 0 gt
    { gsave d c a cvs dup
      stringwidth pop /z2 ED
      w 0 gt {z1} {z1 z2 add neg} ifelse
      h 0 gt {b neg} {z1} ifelse
      rmoveto show grestore } if
    0 f moveto 0 g L stroke
    cx w mul 0 T
    c x2 eq c i eq or {exit} if
    /c c w add def
  } loop
  grestore
  gsave
  n 0 gt
  { 1 setlinecap [ 0 cx n div ] 0 setdash }
  { 2 setlinecap }
  ifelse
  /c y1 def /i 500 h mul y1 add def
  /e x cx mul def /f x1 cx mul def /g x2 cx mul def
  0 y1 cy mul T
  { newpath
    e 0 moveto
    b 0 gt { gsave d
      c a cvs dup
      stringwidth pop /z2 ED
      w 0 gt {z1 z2 add neg} {z1} ifelse
      h 0 gt {z1} {b neg} ifelse
      rmoveto show grestore } if
    f 0 moveto g 0 L stroke
    0 cy h mul T
    c y2 eq c i eq or {exit} if
    /c c h add def
  } loop
  grestore>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psgrid}
%    \begin{macrocode}
\def\psgrid{\def\pst@par{}\pst@object{psgrid}}
\def\psgrid@i{\@ifnextchar(%
  {\psgrid@ii}{\expandafter\psgrid@iv\pic@coor}}
\def\psgrid@ii(#1){\@ifnextchar(%
  {\psgrid@iii(#1)}{\psgrid@iv(0,0)(0,0)(#1)}}
\def\psgrid@iii(#1)(#2){\@ifnextchar(%
  {\psgrid@iv(#1)(#2)}{\psgrid@iv(#1)(#1)(#2)}}
\def\psgrid@iv(#1)(#2)(#3){%
  \begin@SpecialObj
  \pst@getcoor{#1}\pst@tempa
  \pst@getcoor{#2}\pst@tempb
  \pst@@getcoor{#3}%
  \ifnum\psk@subgriddiv>1
    \addto@pscode{gsave
    \psk@subgridwidth SLW \pst@usecolor\pssubgridcolor
    \pst@tempb \pst@coor \pst@tempa
    \pst@number\psxunit \pst@number\psyunit
    \psk@subgriddiv\space \psk@subgriddots\space
    {} 0 \tx@Grid grestore}%
  \fi
  \addto@pscode{gsave
    \psk@gridwidth SLW \pst@usecolor\psgridcolor
    \pst@tempb \pst@coor \pst@tempa
    \pst@number\psxunit \pst@number\psyunit
    1 \psk@griddots\space { \pst@usecolor\psgridlabelcolor }
    \psk@gridlabels \tx@Grid grestore}%
  \end@SpecialObj}
%    \end{macrocode}
% \end{macro}
%
% \section{LR-box commands}
%
% \begin{macro}{\ifpsmathbox,\everypsbox}
%    \begin{macrocode}
\newif\ifpsmathbox
\psmathboxtrue
\def\pst@mathflag{\z@}
\newtoks\everypsbox
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@makenotverbbox}
%    \begin{macrocode}
\long\def\pst@makenotverbbox#1#2{%
  \edef\pst@mathflag{%
    \ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}%
  \setbox\pst@hbox=\hbox{%
    \ifcase\pst@mathflag\or$\m@th\textstyle\or$\m@th\displaystyle\fi
    {\the\everypsbox#2}%
    \ifnum\pst@mathflag>\z@$\fi}%
  #1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@makeverbbox}
% There is no way to do this such that with
% \begin{LVerbatim}
%   \psframebox{\aftergroup\foo}
% \end{LVerbatim}
% "\foo" does not end up outside the box. That is why this is not the default
% mode.
%    \begin{macrocode}
\def\pst@makeverbbox#1{%
  \def\pst@afterbox{#1}%
  \edef\pst@mathflag{%
    \ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}%
  \afterassignment\pst@beginbox
  \setbox\pst@hbox\hbox}
\def\pst@beginbox{%
  \ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi
  \bgroup\aftergroup\pst@endbox
  \the\everypsbox}
\def\pst@endbox{%
  \ifnum\pst@mathflag>\z@$\fi
  \egroup
  \pst@afterbox}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psverbboxtrue,\psverbboxfalse}
%    \begin{macrocode}
\def\pst@makebox{\pst@@makebox}
\def\psverbboxtrue{\def\pst@@makebox{\pst@makeverbbox}}
\def\psverbboxfalse{\def\pst@@makebox{\pst@makenotverbbox}}
\psverbboxfalse
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@longbox,\pst@makelongbox}
% There is no way to do this such that with
% \begin{LVerbatim}
%   \psframebox{\aftergroup\foo}
% \end{LVerbatim}
% "\foo" does not end up outside the box. That is why this is not the default
% mode.
%    \begin{macrocode}
\def\pst@longbox{%
  \def\pst@makebox{%
    \gdef\pst@makebox{\pst@@makebox}%
    \pst@makelongbox}}
\def\pst@makelongbox#1{%
  \def\pst@afterbox{#1}%
  \edef\pst@mathflag{%
    \ifpsmathbox\ifmmode\ifinner 1\else 2\fi\else \z@\fi\else \z@\fi}%
  \setbox\pst@hbox\hbox\bgroup
    \aftergroup\pst@afterbox
    \ifcase\pst@mathflag\or$\m@th\or$\m@th\displaystyle\fi
    \begingroup
      \the\everypsbox}
\def\pst@endlongbox{%
     \endgroup
     \ifnum\pst@mathflag>\z@$\fi
   \egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pslongbox}
%    \begin{macrocode}
\def\pslongbox#1#2{%
  \@namedef{#1}{\pst@longbox#2}%
  \@namedef{end#1}{\pst@endlongbox}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Frame boxes\label{Frameboxes}}
%
% \begin{macro}{framesep}
%    \begin{macrocode}
\newdimen\psframesep
\def\psset@framesep#1{\pssetlength\psframesep{#1}}
\psset@framesep{3pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{boxsep}
%    \begin{macrocode}
\newif\ifpsboxsep
\def\psset@boxsep#1{\@nameuse{psboxsep#1}}
\psset@boxsep{true}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@useboxpar}
%    \begin{macrocode}
\def\pst@useboxpar{%
  \use@par
  \if@star
    \let\pslinecolor\psfillcolor
    \solid@star
    \let\solid@star\relax
  \fi
  \ifpsdoubleline \pst@setdoublesep \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psframebox}
% "\psframebox" puts its argument in an "\hbox" and draws a frame around it
% with thickness "\pst@linewidth", and with distance "\pst@framesep" between
% each side of the frame (between the line making up each side) and each side
% of the box. The result is a box with no depth and with width and height
% equal to the width and height of the original box, plus
% 2("\pslinewidth"+"\psframesep").
%
% "\pst@dima" is set to the distance between each side of the original box and
% the outer side of the frame (i.e., the side of the resulting box).
% "\pst@dimb" is set to the depth of the resulting box, "\pst@dimc" is set to
% the height plus depth of this box, and "\pst@dimd" is set to the width.
% "\psframe" does the drawing of the frame.
%    \begin{macrocode}
\def\psframebox{\def\pst@par{}\pst@object{psframebox}}
\def\psframebox@i{\pst@makebox\psframebox@ii}
\def\psframebox@ii{%
  \begingroup
    \pst@useboxpar
    \pst@dima=\pslinewidth
    \advance\pst@dima by \psframesep
    \pst@dimc=\wd\pst@hbox\advance\pst@dimc by \pst@dima
    \pst@dimb=\dp\pst@hbox\advance\pst@dimb by \pst@dima
    \pst@dimd=\ht\pst@hbox\advance\pst@dimd by \pst@dima
    \setbox\pst@hbox=\hbox{%
      \ifpsboxsep\kern\pst@dima\fi
      \begin@ClosedObj
        \addto@pscode{%
          \psk@cornersize
          \pst@number\pst@dima neg
          \pst@number\pst@dimb neg
          \pst@number\pst@dimc
          \pst@number\pst@dimd
          .5
          \tx@Frame}%
        \def\pst@linetype{2}%
        \showpointsfalse
      \end@ClosedObj
      \box\pst@hbox
      \ifpsboxsep\kern\pst@dima\fi}%
    \ifpsboxsep\dp\pst@hbox=\pst@dimb\ht\pst@hbox=\pst@dimd\fi
    \leavevmode\box\pst@hbox
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psdblframebox}
%    \begin{macrocode}
\def\psdblframebox{\def\pst@par{}\pst@object{psdblframebox}}
\def\psdblframebox@i{\addto@par{doubleline=true}\psframebox@i}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psclip,\endclip}
% Clipping involves drawing graphics objects, not grouped by "gsave" and
% "grestore", which may affect the graphics environment. Furthermore, to reset
% the clipping path, we must either use "grestore" or "initclip", neither of
% which is robust.
%    \begin{macrocode}
\def\psclip#1{%
  \leavevmode
  \begingroup
    \begin@psclip
    \begingroup
      \def\use@pscode{%
        \pstVerb{%
          \pst@dict
            /mtrxc CM def
            CP CP T
            \tx@STV
            \psk@origin
            \psk@swapaxes
            newpath
            \pst@code
            clip
            newpath
            mtrxc setmatrix
            moveto
            0 setgray
          end}%
        \gdef\pst@code{}}%
        \def\@multips(##1)(##2)##3##4{\pst@misplaced\multips}%
        \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}%
        \hbox to\z@{#1}%
    \endgroup
  \def\endpsclip{%
    \end@psclip
    \endgroup}%
  \ignorespaces}
\def\endpsclip{\pst@misplaced\endpsclip}
\let\begin@psclip\relax
\def\end@psclip{\pstVerb{currentpoint initclip moveto}}
\def\AltClipMode{%
  \def\end@psclip{\pstVerb{\pst@grestore}}%
  \def\begin@psclip{\pstVerb{gsave}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psclipbox}
%    \begin{macrocode}
\def\clipbox{\@ifnextchar[{\psclipbox@}{psclipbox@[\z@]}}
\def\clipbox@[#1]{\pst@makebox\psclipbox@@{#1}}
\def\clipbox@@#1{%
  \pssetlength\pst@dimg{#1}%
  \leavevmode\hbox{%
    \begin@psclip
    \pst@Verb{%
      CM \tx@STV CP T newpath
      /a \pst@number\pst@dimg def
      /w \pst@number{\wd\pst@hbox}a add def
      /d \pst@number{\dp\pst@hbox}a add neg def
      /h \pst@number{\ht\pst@hbox}a add def
      a neg d moveto
      a neg h L
      w h L
      w d L
      closepath
      clip
      newpath
      0 0 moveto
      setmatrix}%
    \unhbox\pst@hbox
    \end@psclip}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psshadowbox}
%    \begin{macrocode}
\def\psshadowbox{%
  \def\pst@par{}\pst@object{psshadowbox}}
\def\psshadowbox@i{\pst@makebox\psshadowbox@ii}
\def\psshadowbox@ii{%
  \begingroup
    \pst@useboxpar
    \psshadowtrue
    \psboxseptrue
    \def\psk@shadowangle{-45 }%
    \setbox\pst@hbox=\hbox{\psframebox@ii}%
    \pst@dimh=\psk@shadowsize\p@
    \pst@dimh=.7071\pst@dimh
    \pst@dimg=\dp\pst@hbox
    \advance\pst@dimg\pst@dimh
    \dp\pst@hbox=\pst@dimg
    \pst@dimg=\wd\pst@hbox
    \advance\pst@dimg\pst@dimh
    \wd\pst@hbox=\pst@dimg
    \leavevmode
    \box\pst@hbox
  \endgroup}
%
%
% \begin{macro}{\pscirclebox}
% "\pscirclebox@ii"'s argument is a hook that is used by node commands.
%    \begin{macrocode}
\def\pscirclebox{\def\pst@par{}\pst@object{pscirclebox}}
\def\pscirclebox@i{\pst@makebox{\pscirclebox@ii{}}}
\def\pscirclebox@ii#1{%
  \begingroup
    \pst@useboxpar
    \setbox\pst@hbox=\hbox{#1\pscirclebox@iii\box\pst@hbox}%
    \ifpsboxsep
      \pst@dima=.5\wd\pst@hbox
      \pst@pyth\pst@dima\pst@dimb\pst@dimc
      \advance\pst@dimc\pslinewidth
      \advance\pst@dimc\psframesep
      \setbox\pst@hbox=\hbox to2\pst@dimc{%
        \hss
        \vbox{\vskip\pst@dimc\vskip-\pst@dimb\box\pst@hbox}%
        \hss}%
      \advance\pst@dimc-\pst@dimb
      \dp\pst@hbox=\pst@dimc
    \fi
    \leavevmode\box\pst@hbox
  \endgroup}
\def\pscirclebox@iii{%
  \if@star
    \pslinewidth\z@
    \pstverb{\pst@dict \tx@STP \pst@usecolor\psfillcolor
      newpath \pscirclebox@iv \tx@SD end}%
  \else
    \begin@ClosedObj
    \def\pst@linetype{4}\showpointsfalse
    \addto@pscode{%
      \pscirclebox@iv CLW 2 div add 0 360 arc closepath}%
    \end@ClosedObj
  \fi}
\def\pscirclebox@iv{%
  \pst@number{\wd\pst@hbox}2 div
  \pst@number{\ht\pst@hbox}\pst@number{\dp\pst@hbox}add 2 div
  2 copy \pst@number{\dp\pst@hbox}sub 4 2 roll
  \tx@Pyth \pst@number\psframesep add }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psovalbox}
% The argument of "\psovalbox@ii" is a hook used by node commands.
%    \begin{macrocode}
\def\psovalbox{\def\pst@par{}\pst@object{psovalbox}}
\def\psovalbox@i{\pst@makebox{\psovalbox@ii{}}}
\def\psovalbox@ii#1{%
  \begingroup
    \pst@useboxpar
    \pst@dimd=.707\pslinewidth\advance\pst@dimd by 1.414\psframesep
    \pst@dimg=\ht\pst@hbox\advance\pst@dimg\dp\pst@hbox
    \pst@dimb=.707\pst@dimg\advance\pst@dimb\pst@dimd
    \pst@dima=.707\wd\pst@hbox\advance\pst@dima\pst@dimd
    \setbox\pst@hbox=\hbox{#1\psovalbox@iii\box\pst@hbox}%
    \ifpsboxsep
      \setbox\pst@hbox\hbox to 2\pst@dima{\hss\unhbox\pst@hbox\hss}%
      \advance\pst@dimb-.5\pst@dimg
      \pst@dimg\ht\pst@hbox
      \advance\pst@dimg\pst@dimb
      \ht\pst@hbox=\pst@dimb
      \pst@dimg=\dp\pst@hbox
      \advance\pst@dimg\pst@dimb
      \dp\pst@hbox=\pst@dimb
    \fi
    \leavevmode\box\pst@hbox
  \endgroup}
\def\psovalbox@iii{%
  \begin@ClosedObj
  \addto@pscode{%
     0 360
     \pst@number\pst@dima \pst@number\pst@dimb
     \pst@number{\wd\pst@hbox}2 div
     \pst@number\pst@dimg 2 div \pst@number{\dp\pst@hbox}sub
     \tx@Ellipse
     closepath}%
  \def\pst@linetype{2}%
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Circles, discs and ellipses\label{Circles}}
%
%
% \begin{macro}{\psset@arcsep,\psk@arcsepA,\psk@arcsepB}
%    \begin{macrocode}
\def\psset@arcsepA#1{\pst@getlength{#1}\psk@arcsepA}
\def\psset@arcsepB#1{\pst@getlength{#1}\psk@arcsepB}
\def\psset@arcsep#1{%
  \psset@arcsepA{#1}\let\psk@arcsepB\psk@arcsepA}
\psset@arcsep{0}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Arc}
% Syntax:
% \begin{LVerbatim}
%   <angle> {<arrow>} {<add/sub>} ArcArrow <angle>
% \end{LVerbatim}
% "r"=radius and "c"=57.2957/"r" should also be defined.
%    \begin{macrocode}
\pst@def{ArcArrow}<%
  /d ED     % add/sub
  /b ED     % arrow procedure
  /a ED     % angle
  gsave
    newpath
    0 -1000 moveto
    clip              % Set clippath far from arrow.
    newpath
    0 1 0 0 b         % Draw arrow to determine length.
  grestore
  c mul
  /e ED               % /e equals angle to adjust for arrow length.
  pop pop pop
  r a e d \tx@PtoC    % `a e d' is end angle for arrow.
  y add exch x add exch
  r a \tx@PtoC        % Now arrow end coor and begin coor are on stack.
  y add exch x add exch
  b pop pop pop pop   % Draw arrow, and discard coordinates.
  a e d                   % End angle of arrow.
  CLW 8 div c mul neg d>  % Adjust angle to give a little overlap.
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psarc}
%    \begin{macrocode}
\def\psarc{\def\pst@par{}\pst@object{psarc}}
\def\psarc@i{%
  \@ifnextchar({\psarc@iii}{\psarc@ii}}
\def\psarc@ii#1{\addto@par{arrows=#1}%
  \@ifnextchar({\psarc@iii}{\psarc@iii(0,0)}}
\def\psarc@iii(#1)#2#3#4{%
  \begin@OpenObj
    \pst@getangle{#3}\pst@tempa
    \pst@getangle{#4}\pst@tempb
    \pst@@getcoor{#1}%
    \pssetlength\pst@dima{#2}%
    \addto@pscode{\psarc@iv \psarc@v}%
    \gdef\psarc@type{0}%
    \showpointsfalse
  \end@OpenObj}
\def\psarc@iv{%
  \pst@coor /y ED /x ED
  /r \pst@number\pst@dima def
  /c 57.2957 r \tx@Div def
  /angleA
    \pst@tempa
    \psk@arcsepA c mul 2 div
    \ifcase \psarc@type add \or sub \fi
  def
  /angleB
    \pst@tempb
    \psk@arcsepB c mul 2 div
    \ifcase \psarc@type sub \or add \fi
  def
  \ifshowpoints\psarc@showpoints\fi
  \ifx\psk@arrowA\@empty
    \ifnum\psk@liftpen=2
      r angleA \tx@PtoC
      y add exch x add exch
      moveto
    \fi
  \fi}
\def\psarc@v{%
  x y r
  angleA
  \ifx\psk@arrowA\@empty\else
    { ArrowA CP }
    { \ifcase\psarc@type add \or sub \fi }
    \tx@ArcArrow
  \fi
  angleB
  \ifx\psk@arrowB\@empty\else
    { ArrowB }
    { \ifcase\psarc@type sub \or add \fi }
    \tx@ArcArrow
  \fi
  \ifcase\psarc@type arc \or arcn \fi}
\def\psarc@type{0}
\def\psarc@showpoints{%
  gsave
    newpath
    x y moveto
    x y r \pst@tempa \pst@tempb
    \ifcase\psarc@type arc \or arcn \fi
    closepath
    CLW 2 div SLW
    [ \psk@dash\space ] 0 setdash stroke
  grestore }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psarcn}
%    \begin{macrocode}
\def\psarcn{\def\pst@par{}\pst@object{psarcn}}
\def\psarcn@i{\def\psarc@type{1}\psarc@i}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pscircle}
%    \begin{macrocode}
\def\pscircle{\def\pst@par{}\pst@object{pscircle}}
\def\pscircle@i{\@ifnextchar({\pscircle@do}{\pscircle@do(0,0)}}
\def\pscircle@do(#1)#2{%
  \if@star
    {\use@par\qdisk(#1){#2}}%
  \else
    \begin@ClosedObj
      \pst@@getcoor{#1}%
      \pssetlength\pst@dimc{#2}%
      \def\pst@linetype{4}%
      \addto@pscode{%
        \pst@coor
        \pst@number\pst@dimc
        \psk@dimen CLW mul sub
        0 360 arc
        closepath}%
      \showpointsfalse
    \end@ClosedObj
  \fi
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\qdisk}
%    \begin{macrocode}
\def\qdisk(#1)#2{%
  \def\pst@par{}%
  \begin@SpecialObj
    \pst@@getcoor{#1}%
    \pssetlength\pst@dimg{#2}%
    \addto@pscode{\pst@coor \pst@number\pst@dimg \tx@SD}%
  \end@SpecialObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pswedge}
%    \begin{macrocode}
\def\pswedge{\def\pst@par{}\pst@object{pswedge}}
\def\pswedge@i{\@ifnextchar({\pswedge@ii}{\pswedge@ii(0,0)}}
\def\pswedge@ii(#1)#2#3#4{%
  \begin@ClosedObj
  \pssetlength\pst@dimc{#2}
  \pst@getangle{#3}\pst@tempa
  \pst@getangle{#4}\pst@tempb
  \pst@@getcoor{#1}%
  \def\pst@linetype{1}%
  \addto@pscode{%
    \pst@coor
    2 copy
    moveto
    \pst@number\pst@dimc \psk@dimen CLW mul sub % Adjusted radius
    \pst@tempa \pst@tempb
    arc
    closepath}%
    \showpointsfalse
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Ellipse}
% Syntax:
% \begin{Ex}
%   <angle1 angle2 x-radius y-radius x-origin y-origin> "Ellipse"
% \end{Ex}
%    \begin{macrocode}
\pst@def{Ellipse}<%
  /mtrx CM def
  T
  scale
  0 0 1 5 3 roll arc
  mtrx setmatrix>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\psellipse}
%    \begin{macrocode}
\def\psellipse{\def\pst@par{}\pst@object{psellipse}}
\def\psellipse@i(#1){\@ifnextchar(%
  {\psellipse@ii(#1)}{\psellipse@ii(0,0)(#1)}}
\def\psellipse@ii(#1)(#2){%
  \begin@ClosedObj
    \pst@getcoor{#1}\pst@tempa
    \pst@@getcoor{#2}%
    \addto@pscode{%
      0 360
      \pst@coor
      \ifdim\psk@dimen\p@=\z@\else
        \psk@dimen CLW mul dup 3 1 roll
        sub 3 1 roll sub exch
      \fi
      \pst@tempa
      \tx@Ellipse
      closepath}%
    \def\pst@linetype{2}%
  \end@ClosedObj}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Repetition}
%
% \begin{macro}{\multirput}
%    \begin{macrocode}
\def\multirput{%
  \begingroup\pst@getref{\pst@getrputrot\multirput@i}}
\def\multirput@i(#1){\@ifnextchar(%
  {\multirput@ii(#1)}{\multirput@ii(0,0)(#1)}}
\def\multirput@ii(#1,#2)(#3,#4)#5{%
  \pst@makebox{\multirput@iii(#1,#2)(#3,#4){#5}}}
\def\multirput@iii(#1,#2)(#3,#4)#5{%
  \pst@makesmall\pst@hbox
  \ifx\pst@rot\@empty\else\pst@rotate\pst@hbox\fi
  \pssetxlength\pst@dima{#1}\pssetylength\pst@dimb{#2}
  \pssetxlength\pst@dimc{#3}\pssetylength\pst@dimd{#4}
  \pst@cntg=#5\relax\pst@cnth=0\relax
  \leavevmode
  \loop\ifnum\pst@cntg>\pst@cnth
    \vbox to \z@{\vss\hbox to \z@{%
      \kern\pst@dima\copy\pst@hbox\hss}\vskip\pst@dimb}%
    \advance\pst@dima by\pst@dimc
    \advance\pst@dimb by\pst@dimd
    \advance\pst@cnth by 1
  \repeat
  \endgroup\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\multips}
%    \begin{macrocode}
\def\multips{\begingroup\pst@getrputrot\multips@i}
\def\multips@i(#1){\@ifnextchar({\@multips@ii(#1)}{\@multips@ii(0,0)(#1)}}
\def\@multips@ii(#1)(#2)#3#4{%
    \pst@getcoor{#1}\pst@tempa
    \pst@@getcoor{#2}%
    \pst@cnta=#3\relax
    \addto@pscode{%
      \pst@tempa T \the\pst@cnta\space \pslbrace
      gsave \ifx\pst@rot\@empty\else\pst@rot rotate \fi }%
    \hbox to\z@{%
      \def\init@pscode{%
        \addto@pscode{%
          gsave
          \pst@number\pslinewidth SLW
          \pst@usecolor\pslinecolor}}%
      \def\use@pscode{\addto@pscode{grestore}}%
      \def\psclip##1{\pst@misplaced\psclip}%
      \def\nc@object##1##2##3##4{\pst@misplaced{node connection}}%
      #4}%
    \addto@pscode{grestore \pst@coor T \psrbrace repeat}%
    \leavevmode
    \use@pscode
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Scaling\label{Scaling}}
%
% \begin{macro}{\scalebox}
%    \begin{macrocode}
\def\scalebox#1{%
  \begingroup
    \pst@getscale{#1}\pst@tempa
    \pst@makebox{\@scalebox}}
\def\@scalebox{%
    \leavevmode
    \ifx\pst@tempa\@empty
      \box\pst@hbox
    \else
      \hbox{%
        \ht\pst@hbox=\pst@temph\ht\pst@hbox%
        \dp\pst@hbox=\pst@temph\dp\pst@hbox%
        \pst@dima=\pst@tempg\wd\pst@hbox%
        \ifdim\pst@dima<\z@\kern-\pst@dima\fi
        \pst@Verb{CP CP T \pst@tempa \tx@NET}%
        \hbox to \z@{\box\pst@hbox\hss}%
        \pst@Verb{%
          CP CP T
          1 \pst@tempg\space div 1 \pst@temph\space div scale
          \tx@NET}%
        \ifdim\pst@dima>\z@\kern\pst@dima\fi}%
    \fi
  \endgroup}
\pslongbox{Scalebox}{\scalebox}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\scaleboxto}
%    \begin{macrocode}
\def\scaleboxto(#1,#2){%
  \begingroup
    \pssetlength\pst@dima{#1}%
    \pssetlength\pst@dimb{#2}%
    \pst@makebox{\@scaleboxto\@scalebox}}
\def\@scaleboxto{%
    \ifdim\pst@dima=\z@\else
      \pst@divide{\pst@dima}{\wd\pst@hbox}\pst@tempg
    \fi
    \ifdim\pst@dimb=\z@
      \let\pst@temph\pst@tempg
    \else
      \pst@dimc=\ht\pst@hbox\advance\pst@dimc\dp\pst@hbox
      \pst@divide{\pst@dimb}{\pst@dimc}\pst@temph
      \ifdim\pst@dima=\z@\let\pst@tempg\pst@temph\fi
    \fi
    \edef\pst@tempa{\pst@tempg\space\pst@temph\space scale }%
    \ifdim\pst@dima=\z@
      \ifdim\pst@dimb=\z@
        \@pstrickserr{%
          \string\scaleboxto\space dimensions cannot both be zero}\@ehpa
        \def\pst@tempa{}%
    \fi\fi}
\pslongbox{Scaleboxto}{\scaleboxto}
%    \end{macrocode}
% \end{macro}
%
% \section{Rotation: The simple version\label{Rotation:simple}}
%
% \begin{macro}{\tx@Rot}
%    \begin{macrocode}
\pst@def{Rot}<\pstrotate>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rotateleft,\rotateright,\rotatedown}
% These are pretty standard, except that they do not use "gsave" and
% "grestore".
%    \begin{macrocode}
\def\rotateleft{\pst@makebox{\@rotateleft\pst@hbox}}
\def\@rotateleft#1{%
  \leavevmode\hbox{\hskip\ht#1\hskip\dp#1\vbox{\vskip\wd#1%
  \pst@Verb{90 \tx@Rot}
  \vbox to \z@{\vss\hbox to \z@{\box#1\hss}\vskip\z@}%
  \pst@Verb{-90 \tx@Rot}}}}
\def\rotateright{\pst@makebox{\@rotateright\pst@hbox}}
\def\@rotateright#1{%
  \hbox{\hskip\ht#1\hskip\dp#1\vbox{\vskip\wd#1%
  \pst@Verb{-90 \tx@Rot}
  \vbox to \z@{\hbox to \z@{\hss\box#1}\vss}%
  \pst@Verb{90 \tx@Rot}}}}
\def\rotatedown{\pst@makebox{\@rotatedown\pst@hbox}}
\def\@rotatedown#1{%
  \hbox{\hskip\wd#1\vbox{\vskip\ht#1\vskip\dp#1%
  \pst@Verb{180 \tx@Rot}%
  \vbox to \z@{\hbox to \z@{\box#1\hss}\vss}%
  \pst@Verb{-180 \tx@Rot}}}}
\pslongbox{Rotateleft}{\rotateleft}
\pslongbox{Rotateright}{\rotateright}
\pslongbox{Rotatedown}{\rotatedown}
%    \end{macrocode}
% \end{macro}
%
%
% \section{{\tt\Backslash rput} and company}
%
% \n\rput\ and similar commands are divided into fours steps:
% \begin{enumerate}
%   \item The four arguments are collected:
%     \begin{enumerate}
% \item The reference point argument is stored in \n\refpoint@x\ and
% \n\refpoint@y.
%       \item The rotation angle is store in \n\pst@rot.
% \item The translation coordinate is passed to the command that is returned
% to after the box is made.
%       \item The RH-box is assigned to the register \n\pst@hbox.
%     \end{enumerate}
% \item The box is made zero-dimension and positioned at the reference point
% by \n\pst@makesmall.
%   \item The box is rotated by \n\pst@rotate.
%   \item The box is translated by \n\psput@.
% \end{enumerate}
%
% \subsection{Reference point}
%
% \begin{macro}{\pst@getref}
%    \begin{macrocode}
\def\pst@getref#1{%
  \@ifnextchar[%
    {\def\refpoint@x{.5}\def\refpoint@y{.5}\pst@@getref{#1}}%
    {\let\refpoint@x\relax#1}}
\def\pst@@getref#1[#2]{%
  \pst@expandafter\pst@@@getref{#2}\@empty,,\@nil#1}
\def\pst@@@getref#1#2,#3,#4\@nil{%
  \ifx\@empty#3\@empty
    \@nameuse{getref@#1}\@nameuse{getref@#2}%
  \else
    \pst@checknum{#1#2}\refpoint@x
    \pst@checknum{#3}\refpoint@y
  \fi}
\def\getref@t{\def\refpoint@y{1}}
\def\getref@b{\def\refpoint@y{0}}
\def\getref@B{\let\refpoint@y\relax}
\def\getref@l{\def\refpoint@x{0}}
\def\getref@r{\def\refpoint@x{1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@makesmall}
%    \begin{macrocode}
\def\pst@makesmall#1{%
  \ifx\refpoint@x\relax
    \setbox#1=\hbox to\z@{\hss\vbox to \z@{\vss\box#1\vss}\hss}%
  \else
    \pst@@makesmall{#1}%
  \fi}
\def\pst@@makesmall#1{%
  \pst@dimh=\refpoint@x\wd#1%
  \ifx\refpoint@y\relax
    \pst@dimg=\dp#1%
  \else
    \pst@dimg=\refpoint@y\ht#1%
    \advance\pst@dimg\refpoint@y\dp#1%
  \fi
  \setbox#1=\hbox to\z@{%
    \hskip-\pst@dimh\vbox to\z@{\vss\box#1\vskip-\pst@dimg}\hss}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Rotation}
%
% \begin{macro}{\pst@getrputrot}
%    \begin{macrocode}
\def\pst@getrputrot#1{%
  \@ifnextchar(%
    {\def\pst@rot{}#1}%
    {\pst@getrot{\@ifnextchar({#1}{#1(0,0)}}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getrot}
%    \begin{macrocode}
\def\pst@getrot#1#2{%
  \pst@expandafter{\@ifnextchar*{\pst@@@getrot}{\pst@@getrot}}{#2}\@nil
  \ifx\pst@rotlist\@empty\else
    \edef\pst@rotlist{\pst@rotlist \pst@rot add }%
  \fi
  #1}
\def\pst@@getrot#1\@nil{%
  \def\next##1@#1=##2@##3\@nil{%
    \ifx\relax##2%
      \pst@getangle{#1}\pst@rot
    \else
      \def\pst@rot{##2}%
    \fi}%
  \expandafter\next\pst@rottable @#1=\relax @\@nil}
\def\pst@@@getrot#1#2\@nil{%
  \pst@@getrot#2\@nil
  \edef\pst@rot{\pst@rotlist neg \ifx\pst@rot\@empty\else\pst@rot add \fi}}%
\def\pst@rotlist{0 }
\def\pst@rot{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@rottable}
% The trailing spaces must be included, except when empty.
%    \begin{macrocode}
\def\pst@rottable{%
  @0=%
  @U=%
  @L=90 %
  @D=180 %
  @R=-90 %
  @N=\pst@rotlist neg %
  @W=\pst@rotlist neg 90 add %
  @S=\pst@rotlist neg 180 add %
  @E=\pst@rotlist neg 90 sub }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@rotate}
% The last argument should be the register for a zero-dimensional box that is
% to be rotated. By first putting the box in a zero-dimension box centered at
% the reference point of the original box, we do not have to use "gsave" and
% "grestore".
%    \begin{macrocode}
\def\pst@rotate#1{%
  \setbox#1=\hbox{%
    \pst@Verb{\pst@rot \tx@Rot}%
    \box#1%
    \pst@Verb{\pst@rot neg \tx@Rot}}}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Translation}
%
% \begin{macro}{\psput@cartesian,\psput@special}
% \n\psput@\ is defined by the \n\NormalCoor\ and \n\SpecialCoor\ commands to
% invoke either "\psput@cartesian" or "\psput@special".
%
% "\psput@cartesian" is for Cartesian coordinates only. \TeX\ does the
% translation.
%
% "\psput@special" works for any coordinates. PostScript does the translation.
% "/lmtrx" is used to store a stack of transformation for nested translations.
%    \begin{macrocode}
\def\psput@cartesian#1{%
  \hbox to \z@{\kern\pst@dimg{\vbox to \z@{\vss\box#1\vskip\pst@dimh}\hss}}}
\def\psput@special#1{%
  \hbox{%
    \pst@Verb{{ \pst@coor } \tx@PutCoor \tx@PutBegin}%
    \box#1%
    \pst@Verb{\tx@PutEnd}}}
\pst@def{PutCoor}<%
  gsave
    CP T
    CM
    \tx@STV
    exch exec
    moveto
    setmatrix
    CP
  grestore>
\pst@def{PutBegin}<%
  /lmtrx [ tx@Dict /lmtrx known { lmtrx aload pop } if CM ] def
  CP 4 2 roll T moveto>
\pst@def{PutEnd}<CP /lmtrx [ lmtrx aload pop setmatrix ] def moveto>
%    \end{macrocode}
% \end{macro}
%
% \subsection{The real thing}
%
% \begin{macro}{\begin@psput,\end@psput}
%    \begin{macrocode}
\def\begin@psput#1{\begingroup\pst@killglue\leavevmode\pst@ifstar{#1}}%
\def\end@psput#1(#2){%
  \pst@makebox{%
    \if@star
      \setbox\pst@hbox\hbox{\psframebox*[boxsep=false]{\unhbox\pst@hbox}}%
    \fi
    #1(#2)%
    \endgroup
    \ignorespaces}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rput}
%    \begin{macrocode}
\def\rput{\begin@psput{\pst@getref{\pst@getrputrot{\end@psput\rput@i}}}}
\def\rput@i(#1){%
    \pst@makesmall\pst@hbox
    \ifx\pst@rot\@empty\else\pst@rotate\pst@hbox\fi
    \psput@{#1}\pst@hbox}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\cput}
% The first argument of "\cput@iii" is a hook used by node commands.
%    \begin{macrocode}
\def\cput{\def\pst@par{}\pst@object{cput}}
\def\cput@i{\begingroup\pst@killglue\leavevmode\pst@getrputrot\cput@ii}
\def\cput@ii(#1){\pst@makebox{\cput@iii{}(#1)}}
\def\cput@iii#1(#2){%
    \setbox\pst@hbox=\hbox{\psboxsepfalse\pscirclebox@ii{#1}}%
    \let\refpoint@x\relax
    \rput@i(#2)%
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
%
% \section{{\tt\Backslash uput} and company}
%
% The difference between "\uput" and \n\rput\ is that "\rput"'s reference
% point is replaced by labelsep and reference angle arguments.
%
% \begin{macro}{\psset@labelsep,\pslabelsep}
%    \begin{macrocode}
\newdimen\pslabelsep
\def\psset@labelsep#1{\pssetlength\pslabelsep{#1}}
\psset@labelsep{5pt}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getrefangle}
%    \begin{macrocode}
\def\pst@getrefangle#1\@nil{%
  \def\next##1@#1=##2"##3@##4\@nil{%
    \ifx\relax##2%
      \pst@getangle{#1}\pst@refangle
      \def\pst@uputref{}%
    \else
      \edef\pst@refangle{##2}%
      \edef\pst@uputref{##3}%
    \fi}%
  \expandafter\next\pst@refangletable @#1=\relax"@\@nil}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@refangletable}
%    \begin{macrocode}
\def\pst@refangletable{%
  @r=0"20%
  @u=90"02%
  @l=180"10%
  @d=-90"01%
  @ur=45"22%
  @ul=135"12%
  @dr=-135"21%
  @dl=-45"11}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\uput}
%    \begin{macrocode}
\def\uput{\begin@psput{\@ifnextchar[{\uput@ii}{\uput@i}}}
\def\uput@i#1{\pssetlength\pslabelsep{#1}\uput@ii}
\def\uput@ii[#1]{%
  \pst@expandafter\pst@getrefangle{#1}\@nil
  \pst@getrputrot{\end@psput\uput@iii}}
\def\uput@iii(#1){%
    \ifx\pst@uputref\@empty
      \uput@iv\tx@UUput
    \else
      \ifx\pst@rot\@empty
        \expandafter\uput@v\pst@uputref
      \else
        \uput@iv\tx@UUput
      \fi
    \fi
    \psput@{#1}\pst@hbox}
\def\uput@iv#1{%
  \edef\pst@coor{%
    \pst@number\pslabelsep
    \pst@number{\wd\pst@hbox}%
    \pst@number{\ht\pst@hbox}%
    \pst@number{\dp\pst@hbox}%
    \pst@refangle\space \ifx\pst@rot\@empty\else\pst@rot\space sub \fi
    \tx@Uput #1}%
  \setbox\pst@hbox=\hbox to\z@{\hss\vbox to\z@{\vss\box\pst@hbox\vss}\hss}%
  \setbox\pst@hbox=\psput@special\pst@hbox
  \ifx\pst@rot\@empty\else\pst@rotate\pst@hbox\fi}
\def\uput@v#1#2{%
  \ifnum#1>\z@\ifnum#2>\z@\pslabelsep=.707\pslabelsep\fi\fi
  \setbox\pst@hbox=\vbox to\z@{%
    \ifnum#2=1 \vskip\pslabelsep\else\vss\fi
    \hbox to\z@{%
      \ifnum#1=2 \hskip\pslabelsep\else\hss\fi
      \box\pst@hbox
      \ifnum#1=1 \hskip\pslabelsep\else\hss\fi}%
    \ifnum#2=2 \vskip\pslabelsep\else\vss\fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tx@Uput}
% I forget how this works, but it does.
%    \begin{macrocode}
\pst@def{Uput}<%
  /a ED
  add 2 div /h ED
  2 div /w ED
  /s a sin def
  /c a cos def
  /b
  s abs c abs 2 copy gt
  dup /q ED
  { pop } { exch pop } ifelse
  def
  /w1 c b div w mul def
  /h1 s b div h mul def
  q
  { w1 abs w sub dup c mul abs }
  { h1 abs h sub dup s mul abs }
  ifelse>
\pst@def{UUput}<%
  /z ED
  abs /y ED
  /x ED
  q
  { x s div c mul abs y gt }
  { x c div s mul abs y gt }
  ifelse
  { x x mul y y mul sub z z mul add sqrt z add }
  { q { x s div } { x c div } ifelse abs }
  ifelse
  a \tx@PtoC h1 add exch w1 add exch>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@getlabelsep,\Rput}
% "\Rput" is an obsolete version of "\uput".
%    \begin{macrocode}
\def\pst@getlabelsep#1{%
  \@ifnextchar[%
    {\def\refpoint@x{.5}\def\refpoint@y{.5}\pst@@getref{#1}}%
    {\pst@@getlabelsep{#1}}}
\def\pst@@getlabelsep#1#2{\pssetlength\pslabelsep{#2}\pst@getref{#1}}
\def\Rput{%
  \begin@psput{\pst@getlabelsep{\pst@getrputrot{\end@psput{\Rput@i\rput@i}}}}}
\def\Rput@i{%
  \pst@dimg=\dp\pst@hbox
  \advance\pst@dimg\pslabelsep
  \dp\pst@hbox=\pst@dimg
  \pst@dimg=\ht\pst@hbox
  \advance\pst@dimg\pslabelsep
  \ht\pst@hbox=\pst@dimg
  \setbox\pst@hbox\hbox{\kern\pslabelsep\box\pst@hbox\kern\pslabelsep}}%
%    \end{macrocode}
% \end{macro}
%
%
% \section{Pictures\label{Pictures}}
%
% \begin{macro}{\pspicture}
%    \begin{macrocode}
\def\pspicture{\begingroup\pst@ifstar\pst@picture}
\def\pst@picture{%
  \@ifnextchar[{\pst@@picture}{\pst@@picture[0]}}
\def\pst@@picture[#1]#2(#3,#4){%
 \@ifnextchar({\pst@@@picture[#1](#3,#4)}%
   {\pst@@@picture[#1](0,0)(#3,#4)}}
\def\pst@@@picture[#1](#2,#3)(#4,#5){%
  \pssetxlength\pst@dima{#2}\pssetylength\pst@dimb{#3}%
  \pssetxlength\pst@dimc{#4}\pssetylength\pst@dimd{#5}%
  \def\pst@tempa{#1}%
  \setbox\pst@hbox=\hbox\bgroup
  \begingroup\KillGlue
  \@ifundefined{@latexerr}{}{\let\unitlength\psunit}%
  \edef\pic@coor{(#2,#3)(#2,#3)(#4,#5)}\ignorespaces}
\def\pic@coor{(0,0)(0,0)(10,10)}
\def\endpspicture{%
    \pst@killglue
    \endgroup
    \egroup
    \ifdim\wd\pst@hbox=\z@\else
      \@pstrickserr{Extraneous space in the pspicture environment}%
        {Type \space <return> \space to procede.}%
    \fi
    \ht\pst@hbox=\pst@dimd
    \dp\pst@hbox=-\pst@dimb
    \setbox\pst@hbox=\hbox{%
      \kern-\pst@dima
      \ifx\pst@tempa\@empty\else
        \advance\pst@dimd-\pst@dimb
        \pst@dimd=\pst@tempa\pst@dimd
        \advance\pst@dimd\pst@dimb
        \lower\pst@dimd
      \fi
      \box\pst@hbox
      \kern\pst@dimc}%
    \if@star\setbox\pst@hbox=\hbox{\clipbox@@\z@}\fi
    \leavevmode\box\pst@hbox
  \endgroup}
\@namedef{pspicture*}{\pspicture*}
\@namedef{endpspicture*}{\endpspicture}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Overlays\label{Overlays}}
%
% Overlays work by translating invisible material. They take advantage of the
% fact that PostScript is running parallel to \TeX, and so we can redefine the
% value of some PostScript variables in order to get a different overlay
% printed each time we output a box containing overlay commands (even though
% the box has already been typeset by \TeX).
%
% \begin{macro}{BeginOverlay}
% "BeginOL" is a PostScript procedure, with syntax:
% \begin{LVerbatim}
%   (<string>) BeginOL
% \end{LVerbatim}
% If the string is not "(all)" and does not match "TheOL", then the output is
% made invisible by translating it over by the coffee pot (actually, by a
% distance "OLUnit"). Otherwise, it is made visible by translating it back to
% the page.
%
% Rather than translating the page, we could define a small clipping path off
% the page, but that would be more likely to be messed up by someone's
% "initclip" (e.g., by PSTricks' "initclip"!).
%    \begin{macrocode}
\pst@def{BeginOL}<%
  dup (all) eq exch TheOL eq or
  { IfVisible not
    { CP OLUnit T moveto
      /IfVisible true def }
    if }
  { IfVisible
    { CP OLUnit \tx@NET moveto
      /IfVisible false def }
    if }
  ifelse>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{InitOL}
% This figures out how far in the current units used by the driver is 50
% inches up and to the right. This works even though drivers use unusual
% coordinate systems (even "dvips"). This macro also defines "BOL" to be
% "BeginOL" and sets the default value of "IfVisible".
%    \begin{macrocode}
\pst@dimg=40in
\edef\pst@OLunit{\pst@number\pst@dimg}
\pst@def{InitOL}<%
  /OLUnit [ gsave CM \tx@STV \pst@OLunit
    dup moveto setmatrix CP grestore ] cvx def
  /BOL { \tx@BeginOL } def /IfVisible true def>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@initoverlay}
% This defines "TheOL" to be "#1". It must be inserted just before printing
% overlay "#1".
%    \begin{macrocode}
\def\pst@initoverlay#1{\pst@Verb{\tx@InitOL /TheOL (#1) def}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pst@overlay,\pst@endoverlay}
% "\pst@overlay" just calls "BeginOverlay".
%    \begin{macrocode}
\def\pst@overlay#1{%
  \edef\curr@overlay{#1}%
  \pst@Verb{(#1) BOL}%
  \aftergroup\pst@endoverlay}
\def\pst@endoverlay{%
  \pst@Verb{(\curr@overlay) BOL}}
\def\curr@overlay{all}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\overlaybox,\endoverlaybox,\putoverlaybox}
% "\pst@initoverlay", "\pst@overlay", and "\pst@endoverlay" are the overlays
% primitives. An interface must be set up that guarantees that "\pst@overlay"
% and "\pst@endoverlay" are only used inside a box, and that
% "\pst@initoverlay" is inserted each type the box is printed. Here is one
% such interface (see "seminar.sty" for an interface for slides). The extra
% "\begingroup" and "\endgroup" assure that each "\pst@endoverlay" is executed
% within the box.
%    \begin{macrocode}
\newbox\theoverlaybox
\def\overlaybox{%
  \setbox\theoverlaybox=\hbox\bgroup
    \begingroup
    \let\psoverlay\pst@overlay
    \def\overlaybox{%
      \@pstrickserr{Overlays cannot be nested}\@eha}%
    \def\putoverlaybox{%
      \@pstrickserr{You must end the overlay box
      before using \string\putoverlaybox}}%
    \psoverlay{main}}
\def\endoverlaybox{\endgroup\egroup}
\def\putoverlaybox#1{%
  \hbox{\pst@initoverlay{#1}\copy\theoverlaybox}}
\def\psoverlay{\@pstrickserr{\string\psoverlay\space
  can only be used after \string\overlaybox}}
%    \end{macrocode}
% \end{macro}
%
%
% \section{Configuration file -- revisited\label{Config:revisited}}
%
%    \begin{macrocode}
\ifx\pstcustomize\relax \input pstricks.con \fi
%    \end{macrocode}
%
%    \begin{macrocode}
\pst@ATH<end>
\catcode`\@=\PstAtCode\relax
\endinput
%    \end{macrocode}
%
% \endinput
%
%% END: pstricks.doc