This file is indexed.

/usr/share/saods9/src/xpa.tcl is in saods9-data 7.2+dfsg-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
#  Copyright (C) 1999-2012
#  Smithsonian Astrophysical Observatory, Cambridge, MA, USA
#  For conditions of distribution and use, see copyright notice in "copyright"

package provide DS9 1.0

proc InitXPA {} {
    global pds9
    global env

    if {!$pds9(xpa)} {
	return
    }

    if {[info exists env(XPA_METHOD)]} {
	if {$env(XPA_METHOD) != {local}} {
	    if {[checkdns {} 5]} {
		set env(XPA_METHOD) local
		Error [msgcat::mc {XPA unable to verify hostname, setting XPA_METHOD to LOCAL}]
	    }
	}
    } else {
	if {[checkdns {} 5]} {
	    set env(XPA_METHOD) local
	    Error [msgcat::mc {XPA unable to verify hostname, setting XPA_METHOD to LOCAL}]
	}
    }

    catch {CreateXPA}
    UpdateFileMenu
}

proc CreateXPA {} {
    global xpa
    global ds9

    set xpa [xpacmdnew "DS9" $ds9(title)]

    xpacmdadd $xpa 2mass \
	{} \
	XPASend2MASS {} {} \
	XPARcvd2MASS {} "fillbuf=false"

    xpacmdadd $xpa 3d \
	{} \
	XPASend3D {} {} \
	XPARcvd3D {} "fillbuf=false"

    xpacmdadd $xpa about \
	{} \
	XPASendAbout {} {} \
	{} {} {}

    xpacmdadd $xpa align \
	{} \
	XPASendAlign {} {} \
	XPARcvdAlign {} {}

    xpacmdadd $xpa analysis \
	{} \
	XPASendAnalysis {} {} \
	XPARcvdAnalysis {} {}

    xpacmdadd $xpa array \
	{} \
	XPASendArray {} {} \
	XPARcvdArray {} "fillbuf=false"

    xpacmdadd $xpa background \
	{} \
	XPASendBg {} {} \
	XPARcvdBg {} {}

    xpacmdadd $xpa backup \
	{} \
	{} {} {} \
	XPARcvdBackup {} {}

    xpacmdadd $xpa bg \
	{} \
	XPASendBg {} {} \
	XPARcvdBg {} {}

    xpacmdadd $xpa blink \
	{} \
	XPASendBlink {} {} \
	XPARcvdBlink {} "fillbuf=false"

    xpacmdadd $xpa bin \
	{} \
	XPASendBin {} {} \
	XPARcvdBin {} "fillbuf=false"

    xpacmdadd $xpa cat \
	{} \
	XPASendCAT {} {} \
	XPARcvdCAT {} "fillbuf=false"

    xpacmdadd $xpa catalog \
	{} \
	XPASendCAT {} {} \
	XPARcvdCAT {} "fillbuf=false"

    xpacmdadd $xpa cd \
	{} \
	XPASendCD {} {} \
	XPARcvdCD {} "fillbuf=false"

    xpacmdadd $xpa cmap \
	{} \
	XPASendCmap {} {} \
	XPARcvdCmap {} "fillbuf=false"

    xpacmdadd $xpa colorbar \
	{} \
	XPASendColorbar {} {} \
	XPARcvdColorbar {} "fillbuf=false"

    xpacmdadd $xpa console \
	{} \
	{} {} {} \
	XPARcvdConsole {} "fillbuf=false"

    xpacmdadd $xpa contour \
	{} \
	XPASendContour {} {} \
	XPARcvdContour {} "fillbuf=false"

    xpacmdadd $xpa contours \
	{} \
	XPASendContour {} {} \
	XPARcvdContour {} "fillbuf=false"

    xpacmdadd $xpa crop \
	{} \
	XPASendCrop {} {} \
	XPARcvdCrop {} "fillbuf=false"

    xpacmdadd $xpa crosshair \
	{} \
	XPASendCrosshair {} {} \
	XPARcvdCrosshair {} "fillbuf=false"

    xpacmdadd $xpa cube \
	{} \
	XPASendCube {} {} \
	XPARcvdCube {} "fillbuf=false"

    xpacmdadd $xpa cursor \
	{} \
	{} {} {} \
	XPARcvdCursor {} "fillbuf=false"

    xpacmdadd $xpa data \
	{} \
	XPASendData {} {} \
	{} {} {}

    xpacmdadd $xpa datacube \
	{} \
	XPASendCube {} {} \
	XPARcvdCube {} "fillbuf=false"

    xpacmdadd $xpa dss \
	{} \
	XPASendSAO {} {} \
	XPARcvdSAO {} "fillbuf=false"

    xpacmdadd $xpa dsssao \
	{} \
	XPASendSAO {} {} \
	XPARcvdSAO {} "fillbuf=false"

    xpacmdadd $xpa dsseso \
	{} \
	XPASendESO {} {} \
	XPARcvdESO {} "fillbuf=false"

    xpacmdadd $xpa dssstsci \
	{} \
	XPASendSTSCI {} {} \
	XPARcvdSTSCI {} "fillbuf=false"

    xpacmdadd $xpa exit \
	{} \
	{} {} {} \
	XPARcvdExit {} "fillbuf=false"

    xpacmdadd $xpa export \
	{} \
	{} {} {} \
	XPARcvdExport {} "fillbuf=false"
 
    xpacmdadd $xpa file \
	{} \
	XPASendFile {} {} \
	XPARcvdFile {} "fillbuf=false"

    xpacmdadd $xpa first \
	{} \
	XPASendFIRST {} {} \
	XPARcvdFIRST {} "fillbuf=false"

    xpacmdadd $xpa fits \
	{} \
	XPASendFits {} "fillbuf=false" \
	XPARcvdFits {} "fillbuf=false"

    xpacmdadd $xpa frame \
	{} \
	XPASendFrame {} {} \
	XPARcvdFrame {} "fillbuf=false"

    xpacmdadd $xpa gif \
	{} \
	XPASendGIF {} {} \
	XPARcvdGIF {} "fillbuf=false"

    xpacmdadd $xpa grid \
	{} \
	XPASendGrid {} {} \
	XPARcvdGrid {} "fillbuf=false"

    xpacmdadd $xpa header \
	{} \
	{} {} {} \
	XPARcvdHeader {} "fillbuf=false"

    xpacmdadd $xpa height \
	{} \
	XPASendHeight {} {} \
	XPARcvdHeight {} "fillbuf=false"

    xpacmdadd $xpa iconify \
	{} \
	XPASendIconify {} {} \
	XPARcvdIconify {} "fillbuf=false"

    xpacmdadd $xpa iis \
	{} \
	XPASendIIS {} {} \
	XPARcvdIIS {} "fillbuf=false"

    xpacmdadd $xpa imexam \
	{} \
	XPASendImexam {} {} \
	{} {} {}

    xpacmdadd $xpa jpg \
	{} \
	XPASendJPEG {} {} \
	XPARcvdJPEG {} "fillbuf=false"

    xpacmdadd $xpa jpeg \
	{} \
	XPASendJPEG {} {} \
	XPARcvdJPEG {} "fillbuf=false"

    xpacmdadd $xpa lock \
	{} \
	XPASendLock {} {} \
	XPARcvdLock {} "fillbuf=false"

    xpacmdadd $xpa lower \
	{} \
	{} {} {} \
	XPARcvdLower {} "fillbuf=false"

    xpacmdadd $xpa magnifier \
	{} \
	XPASendMagnifier {} {} \
	XPARcvdMagnifier {} "fillbuf=false"

    xpacmdadd $xpa mask \
	{} \
	XPASendMask {} {} \
	XPARcvdMask {} "fillbuf=false"

    xpacmdadd $xpa match \
	{} \
	{} {} {} \
	XPARcvdMatch {} "fillbuf=false"

    xpacmdadd $xpa mecube \
	{} \
	XPASendMECube {} "fillbuf=false" \
	XPARcvdMECube {} "fillbuf=false"

    xpacmdadd $xpa memf \
	{} \
	{} {} {} \
	XPARcvdMultiFrame {} "fillbuf=false"

    xpacmdadd $xpa minmax \
	{} \
	XPASendMinMax {} {} \
	XPARcvdMinMax {} "fillbuf=false"

    xpacmdadd $xpa mode \
	{} \
	XPASendMode {} {} \
	XPARcvdMode {} "fillbuf=false"

    xpacmdadd $xpa mosaic \
	{} \
	XPASendMosaic {} {} \
	XPARcvdMosaic {} "fillbuf=false"

    xpacmdadd $xpa mosaicimage \
	{} \
	XPASendMosaicImage {} {} \
	XPARcvdMosaicImage {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa mosaicwcs \
	{} \
	XPASendMosaicWCS {} {} \
	XPARcvdMosaicWCS {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa mosaiciraf \
	{} \
	{} {} {} \
	XPARcvdMosaicIRAF {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa mosaicimagewcs \
	{} \
	XPASendMosaicImageWCS {} {} \
	XPARcvdMosaicImageWCS {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa mosaicimageiraf \
	{} \
	{} {} {} \
	XPARcvdMosaicImageIRAF {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa mosaicimagewfpc2 \
	{} \
	{} {} {} \
	XPARcvdMosaicImageWFPC2 {} "fillbuf=false"

    xpacmdadd $xpa multiframe \
	{} \
	{} {} {} \
	XPARcvdMultiFrame {} "fillbuf=false"

    xpacmdadd $xpa movie \
	{} \
	{} {} {} \
	XPARcvdMovie {} "fillbuf=false"

    xpacmdadd $xpa nameserver \
	{} \
	XPASendNRES {} {} \
	XPARcvdNRES {} "fillbuf=false"

    xpacmdadd $xpa nan \
	{} \
	XPASendNan {} {} \
	XPARcvdNan {} {}

    xpacmdadd $xpa nrrd \
	{} \
	XPASendNRRD {} {} \
	XPARcvdNRRD {} "fillbuf=false"

    xpacmdadd $xpa nvss \
	{} \
	XPASendNVSS {} {} \
	XPARcvdNVSS {} "fillbuf=false"

    xpacmdadd $xpa orient \
	{} \
	XPASendOrient {} {} \
	XPARcvdOrient {} "fillbuf=false"

    xpacmdadd $xpa {page setup} \
	{} \
	XPASendPageSetup {} {} \
	XPARcvdPageSetup {} "fillbuf=false"

    xpacmdadd $xpa pagesetup \
	{} \
	XPASendPageSetup {} {} \
	XPARcvdPageSetup {} "fillbuf=false"

    xpacmdadd $xpa pspagesetup \
	{} \
	XPASendPSPageSetup {} {} \
	XPARcvdPSPageSetup {} "fillbuf=false"

    xpacmdadd $xpa pan \
	{} \
	XPASendPan {} {} \
	XPARcvdPan {} "fillbuf=false"

    xpacmdadd $xpa pixeltable \
	{} \
	XPASendPixelTable {} {} \
	XPARcvdPixelTable {} "fillbuf=false"

    xpacmdadd $xpa plot \
	{} \
	XPASendPlot {} {} \
	XPARcvdPlot {} {}

    xpacmdadd $xpa png \
	{} \
	XPASendPNG {} {} \
	XPARcvdPNG {} "fillbuf=false"

    xpacmdadd $xpa prefs \
	{} \
	XPASendPrefs {} {} \
	XPARcvdPrefs {} "fillbuf=false"

    xpacmdadd $xpa preserve \
	{} \
	XPASendPreserve {} {} \
	XPARcvdPreserve {} "fillbuf=false"

    xpacmdadd $xpa print \
	{} \
	XPASendPrint {} {} \
	XPARcvdPrint {} "fillbuf=false"

    xpacmdadd $xpa psprint \
	{} \
	XPASendPSPrint {} {} \
	XPARcvdPSPrint {} "fillbuf=false"

    xpacmdadd $xpa quit \
	{} \
	{} {} {} \
	XPARcvdExit {} "fillbuf=false"

    xpacmdadd $xpa raise \
	{} \
	{} {} {} \
	XPARcvdRaise {} "fillbuf=false"

    xpacmdadd $xpa region \
	{} \
	XPASendRegions {} {} \
	XPARcvdRegions {} "fillbuf=false"

    xpacmdadd $xpa regions \
	{} \
	XPASendRegions {} {} \
	XPARcvdRegions {} "fillbuf=false"

    xpacmdadd $xpa restore \
	{} \
	{} {} {} \
	XPARcvdRestore {} {}

    xpacmdadd $xpa rgb \
	{} \
	XPASendRGB {} {} \
	XPARcvdRGB {} "fillbuf=false"

    xpacmdadd $xpa rgbarray \
	{} \
	XPASendRGBArray {} {} \
	XPARcvdRGBArray {} "fillbuf=false"

    xpacmdadd $xpa rgbcube \
	{} \
	XPASendRGBCube {} {} \
	XPARcvdRGBCube {} "fillbuf=false"

    xpacmdadd $xpa rgbimage \
	{} \
	XPASendRGBImage {} {} \
	XPARcvdRGBImage {} "fillbuf=false"

    xpacmdadd $xpa rotate \
	{} \
	XPASendRotate {} {} \
	XPARcvdRotate {} "fillbuf=false"

    xpacmdadd $xpa samp \
	{} \
	{} {} {} \
	XPARcvdSAMP {} "fillbuf=false"

    xpacmdadd $xpa save \
	{} \
	{} {} {} \
	XPARcvdSave {} "fillbuf=false"

    xpacmdadd $xpa saveimage \
	{} \
	{} {} {} \
	XPARcvdSaveImage {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa savefits \
	{} \
	{} {} {} \
	XPARcvdSave {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa savempeg \
	{} \
	{} {} {} \
	XPARcvdMovie {} "fillbuf=false"

    xpacmdadd $xpa scale \
	{} \
	XPASendScale {} {} \
	XPARcvdScale {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa sfits \
	{} \
	{} {} {} \
	XPARcvdSFits {} "fillbuf=false"

    xpacmdadd $xpa single \
	{} \
	XPASendSingle {} {} \
	XPARcvdSingle {} "fillbuf=false"

    xpacmdadd $xpa shm \
	{} \
	XPASendShm {} {} \
	XPARcvdShm {} "fillbuf=false"

    xpacmdadd $xpa skyview \
	{} \
	XPASendSkyView {} {} \
	XPARcvdSkyView {} "fillbuf=false"

    xpacmdadd $xpa sleep \
	{} \
	{} {} {} \
	XPARcvdSleep {} "fillbuf=false"

    xpacmdadd $xpa slice \
	{} \
	XPASendCube {} {} \
	XPARcvdCube {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa smosaic \
	{} \
	{} {} {} \
	XPARcvdSMosaic {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa smosaicwcs \
	{} \
	{} {} {} \
	XPARcvdSMosaicWCS {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa smosaiciraf \
	{} \
	{} {} {} \
	XPARcvdSMosaicIRAF {} "fillbuf=false"

    xpacmdadd $xpa smooth \
	{} \
	XPASendSmooth {} {} \
	XPARcvdSmooth {} "fillbuf=false"

    xpacmdadd $xpa source \
	{} \
	{} {} {} \
	XPARcvdSource {} "fillbuf=false"

    # backward compatibility
    xpacmdadd $xpa srgbcube \
	{} \
	{} {} {} \
	XPARcvdSRGBCube {} "fillbuf=false"

    xpacmdadd $xpa tcl \
	{} \
	{} {} {} \
	XPARcvdTcl {} {}

    xpacmdadd $xpa theme \
	{} \
	XPASendTheme {} {} \
	XPARcvdTheme {} "fillbuf=false"

    xpacmdadd $xpa threads \
	{} \
	XPASendThreads {} {} \
	XPARcvdThreads {} {}

    xpacmdadd $xpa tif \
	{} \
	XPASendTIFF {} {} \
	XPARcvdTIFF {} "fillbuf=false"

    xpacmdadd $xpa tiff \
	{} \
	XPASendTIFF {} {} \
	XPARcvdTIFF {} "fillbuf=false"

    xpacmdadd $xpa tile \
	{} \
	XPASendTile {} {} \
	XPARcvdTile {} "fillbuf=false"

    xpacmdadd $xpa update \
	{} \
	{} {} {} \
	XPARcvdUpdate {} "fillbuf=false"

    xpacmdadd $xpa url \
	{} \
	{} {} {} \
	XPARcvdURLFits {} {}

    xpacmdadd $xpa version \
	{} \
	XPASendVersion {} {} \
	{} {} {}

    xpacmdadd $xpa view \
	{} \
	XPASendView {} {} \
	XPARcvdView {} "fillbuf=false"

    xpacmdadd $xpa vo \
	{} \
	XPASendVO {} {} \
	XPARcvdVO {} "fillbuf=false"

    xpacmdadd $xpa wcs \
	{} \
	XPASendWCS {} {} \
	XPARcvdWCS {} "fillbuf=false"

    xpacmdadd $xpa web \
	{} \
	XPASendWeb {} {} \
	XPARcvdWeb {} "fillbuf=false"

    xpacmdadd $xpa width \
	{} \
	XPASendWidth {} {} \
	XPARcvdWidth {} "fillbuf=false"

    xpacmdadd $xpa zscale \
	{} \
	XPASendZScale {} {} \
	XPARcvdZScale {} "fillbuf=false"

    xpacmdadd $xpa zoom \
	{} \
	XPASendZoom {} {} \
	XPARcvdZoom {} "fillbuf=false"
}

proc XPASend2MASS {xpa cdata param} {
    InitError xpa
    catch {ProcessSend2MASSCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvd2MASS {xpa cdata param buf len} {
    XPADebug "XPARcvd2MASS" $param
    InitError xpa
    catch {set i 0; Process2MASSCmd param i}
    XPACatchError $xpa
}

proc XPASend3D {xpa cdata param} {
    InitError xpa
    catch {ProcessSend3DCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvd3D {xpa cdata param buf len} {
    XPADebug "XPARcvd3D" $param
    InitError xpa
    catch {set i 0; Process3DCmd param i}
    XPACatchError $xpa
}

proc XPASendAbout {xpa cdata param} {
    InitError xpa
    catch {ProcessSendAboutCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPASendAlign {xpa cdata param} {
    InitError xpa
    catch {ProcessSendAlignCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdAlign {xpa cdata param buf len} {
    XPADebug "XPARcvdAlign" $param
    InitError xpa
    catch {set i 0; ProcessAlignCmd param i}
    XPACatchError $xpa
}

proc XPASendAnalysis {xpa cdata param} {
    InitError xpa
    catch {ProcessSendAnalysisCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPARcvdAnalysis {xpa cdata param buf len} {
    XPADebug "XPARcvdAnalysis" $param
    InitError xpa
    catch {set i 0; ProcessAnalysisCmd param i $buf {}}
    XPACatchError $xpa
}

proc XPASendArray {xpa cdata param} {
    InitError xpa
    catch {ProcessSendArrayCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdArray {xpa cdata param buf len} {
    XPADebug "XPARcvdArray" $param
    InitError xpa
    catch {set i 0; ProcessArrayCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendBg {xpa cdata param} {
    InitError xpa
    catch {ProcessSendBgCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdBg {xpa cdata param buf len} {
    XPADebug "XPARcvdBg" $param
    InitError xpa
    catch {set i 0; ProcessBgCmd param i}
    XPACatchError $xpa
}

proc XPARcvdBackup {xpa cdata param buf len} {
    XPADebug "XPARcvdBackup" $param
    InitError xpa
    catch {set i 0; ProcessBackupCmd param i}
    XPACatchError $xpa
}

proc XPASendBlink {xpa cdata param} {
    InitError xpa
    catch {ProcessSendBlinkCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdBlink {xpa cdata param buf len} {
    XPADebug "XPARcvdBlink" $param
    InitError xpa
    catch {set i 0; ProcessBlinkCmd param i}
    XPACatchError $xpa
}

proc XPASendBin {xpa cdata param} {
    InitError xpa
    catch {ProcessSendBinCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdBin {xpa cdata param buf len} {
    XPADebug "XPARcvdBin" $param
    InitError xpa
    catch {set i 0; ProcessBinCmd param i}
    XPACatchError $xpa
}

proc XPASendCAT {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCatalogCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPARcvdCAT {xpa cdata param buf len} {
    XPADebug "XPARcvdCat" $param
    InitError xpa
    catch {set i 0; ProcessCatalogCmd param i}
    XPACatchError $xpa
}

proc XPASendCD {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCDCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdCD {xpa cdata param buf len} {
    XPADebug "XPARcvdCD" $param
    InitError xpa
    catch {set i 0; ProcessCDCmd param i}
    XPACatchError $xpa
}

proc XPARcvdConsole {xpa cdata param buf len} {
    XPADebug "XPARcvdConsole" $param
    InitError xpa
    catch {set i 0; ProcessConsoleCmd param i}
    XPACatchError $xpa
}

proc XPASendContour {xpa cdata param} {
    InitError xpa
    catch {ProcessSendContourCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPARcvdContour {xpa cdata param buf len} {
    XPADebug "XPARcvdContour" $param
    InitError xpa
    catch {set i 0; ProcessContourCmd param i}
    XPACatchError $xpa
}

proc XPASendCmap {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCmapCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdCmap {xpa cdata param buf len} {
    XPADebug "XPARcvdCmap" $param
    InitError xpa
    catch {set i 0; ProcessCmapCmd param i}
    XPACatchError $xpa
}

proc XPASendColorbar {xpa cdata param} {
    InitError xpa
    catch {ProcessSendColorbarCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdColorbar {xpa cdata param buf len} {
    XPADebug "XPARcvdColorbar" $param
    InitError xpa
    catch {set i 0; ProcessColorbarCmd param i}
    XPACatchError $xpa
}

proc XPASendCrop {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCropCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdCrop {xpa cdata param buf len} {
    XPADebug "XPARcvdCrop" $param
    InitError xpa
    catch {set i 0; ProcessCropCmd param i}
    XPACatchError $xpa
}

proc XPASendCrosshair {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCrosshairCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdCrosshair {xpa cdata param buf len} {
    XPADebug "XPARcvdCrosshair" $param
    InitError xpa
    catch {set i 0; ProcessCrosshairCmd param i}
    XPACatchError $xpa
}

proc XPASendCube {xpa cdata param} {
    InitError xpa
    catch {ProcessSendCubeCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdCube {xpa cdata param buf len} {
    XPADebug "XPARcvdCube" $param
    InitError xpa
    catch {set i 0; ProcessCubeCmd param i}
    XPACatchError $xpa
}

proc XPARcvdCursor {xpa cdata param buf len} {
    XPADebug "XPARcvdCursor" $param
    InitError xpa
    catch {set i 0; ProcessCursorCmd param i}
    XPACatchError $xpa
}

proc XPASendData {xpa cdata param} {
    InitError xpa
    catch {ProcessSendDataCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPASendSAO {xpa cdata param} {
    InitError xpa
    catch {ProcessSendSAOCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdSAO {xpa cdata param buf len} {
    XPADebug "XPARcvdSAO" $param
    InitError xpa
    catch {set i 0; ProcessSAOCmd param i}
    XPACatchError $xpa
}

proc XPASendESO {xpa cdata param} {
    InitError xpa
    catch {ProcessSendESOCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdESO {xpa cdata param buf len} {
    XPADebug "XPARcvdESO" $param
    InitError xpa
    catch {set i 0; ProcessESOCmd param i}
    XPACatchError $xpa
}

proc XPASendSTSCI {xpa cdata param} {
    InitError xpa
    catch {ProcessSendSTSCICmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdSTSCI {xpa cdata param buf len} {
    XPADebug "XPARcvdSTSCI" $param
    InitError xpa
    catch {set i 0; ProcessSTSCICmd param i}
    XPACatchError $xpa
}

proc XPARcvdExit {xpa cdata param buf len} {
    XPADebug "XPARcvdExit" $param
    InitError xpa
    catch {set i 0; ProcessQuitCmd param i}
    XPACatchError $xpa
}

proc XPARcvdExport {xpa cdata param buf len} {
    XPADebug "XPARcvdExport" $param
    InitError xpa
    catch {set i 0; ProcessExportCmd param i}
    XPACatchError $xpa
}

proc XPASendFile {xpa cdata param} {
    InitError xpa
    catch {ProcessSendFileCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdFile {xpa cdata param buf len} {
    XPADebug "XPARcvdFile" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessFileCmd param i [xparec $xpa datafd] [xparec $xpa datachan] {}}
	    win32 {ProcessFileCmd param i [xparec $xpa datafd] dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendFIRST {xpa cdata param} {
    InitError xpa
    catch {ProcessSendFIRSTCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdFIRST {xpa cdata param buf len} {
    XPADebug "XPARcvdFIRST" $param
    InitError xpa
    catch {set i 0; ProcessFIRSTCmd param i}
    XPACatchError $xpa
}

proc XPASendFits {xpa cdata param} {
    InitError xpa
    catch {ProcessSendFitsCmd xpasetbuf $xpa $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdFits {xpa cdata param buf len} {
    XPADebug "XPARcvdFits" $param
    InitError xpa
    catch {set i 0; ProcessFitsCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendFrame {xpa cdata param} {
    InitError xpa
    catch {ProcessSendFrameCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdFrame {xpa cdata param buf len} {
    XPADebug "XPARcvdFrame" $param
    InitError xpa
    catch {set i 0; ProcessFrameCmd param i}
    XPACatchError $xpa
}

proc XPASendGIF {xpa cdata param} {
    InitError xpa
    catch {
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessSendGIFCmd {} {} $param [xparec $xpa datachan] {}}
	    win32 {ProcessSendGIFCmd {} {} $param dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPARcvdGIF {xpa cdata param buf len} {
    XPADebug "XPARcvdGIF" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessGIFCmd param i [xparec $xpa datachan] {}}
	    win32 {ProcessGIFCmd param i dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendGrid {xpa cdata param} {
    InitError xpa
    catch {ProcessSendGridCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdGrid {xpa cdata param buf len} {
    XPADebug "XPARcvdGrid" $param
    InitError xpa
    catch {set i 0; ProcessGridCmd param i}
    XPACatchError $xpa
}

proc XPARcvdHeader {xpa cdata param buf len} {
    XPADebug "XPARcvdHeader" $param
    InitError xpa
    catch {set i 0; ProcessHeaderCmd param i}
    XPACatchError $xpa
}

proc XPASendHeight {xpa cdata param} {
    InitError xpa
    catch {ProcessSendHeightCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdHeight {xpa cdata param buf len} {
    XPADebug "XPARcvdHeight" $param
    InitError xpa
    catch {set i 0; ProcessHeightCmd param i}
    XPACatchError $xpa
}

proc XPASendIconify {xpa cdata param} {
    InitError xpa
    catch {ProcessSendIconifyCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdIconify {xpa cdata param buf len} {
    XPADebug "XPARcvdIconify" $param
    InitError xpa
    catch {set i 0; ProcessIconifyCmd param i}
    XPACatchError $xpa
}

proc XPASendIIS {xpa cdata param} {
    InitError xpa
    catch {ProcessSendIISCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdIIS {xpa cdata param buf len} {
    XPADebug "XPARcvdIIS" $param
    InitError xpa
    catch {set i 0; ProcessIISCmd param i}
    XPACatchError $xpa
}

proc XPASendImexam {xpa cdata param} {
    InitError xpa
    catch {ProcessSendImexamCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPASendJPEG {xpa cdata param} {
    InitError xpa
    catch {
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessSendJPEGCmd {} {} $param [xparec $xpa datachan] {}}
	    win32 {ProcessSendJPEGCmd {} {} $param dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPARcvdJPEG {xpa cdata param buf len} {
    XPADebug "XPARcvdJPEG" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessJPEGCmd param i [xparec $xpa datachan] {}}
	    win32 {ProcessJPEGCmd param i dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendLock {xpa cdata param} {
    InitError xpa
    catch {ProcessSendLockCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdLock {xpa cdata param buf len} {
    XPADebug "XPARcvdLock" $param
    InitError xpa
    catch {set i 0; ProcessLockCmd param i}
    XPACatchError $xpa
}

proc XPARcvdLower {xpa cdata param buf len} {
    XPADebug "XPARcvdLower" $param
    InitError xpa
    catch {set i 0; ProcessLowerCmd param i}
    XPACatchError $xpa
}

proc XPASendMagnifier {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMagnifierCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdMagnifier {xpa cdata param buf len} {
    XPADebug "XPARcvdMagnifier" $param
    InitError xpa
    catch {set i 0; ProcessMagnifierCmd param i}
    XPACatchError $xpa
}

proc XPASendMask {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMaskCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdMask {xpa cdata param buf len} {
    XPADebug "XPARcvdMask" $param
    InitError xpa
    catch {set i 0; ProcessMaskCmd param i}
    XPACatchError $xpa
}

proc XPARcvdMatch {xpa cdata param buf len} {
    XPADebug "XPARcvdMatch" $param
    InitError xpa
    catch {set i 0; ProcessMatchCmd param i}
    XPACatchError $xpa
}

proc XPASendMECube {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMECubeCmd xpasetbuf $xpa $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdMECube {xpa cdata param buf len} {
    XPADebug "XPARcvdMECube" $param
    InitError xpa
    catch {set i 0; ProcessMECubeCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendMinMax {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMinMaxCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdMinMax {xpa cdata param buf len} {
    XPADebug "XPARcvdMinMax" $param
    InitError xpa
    catch {set i 0; ProcessMinMaxCmd param i}
    XPACatchError $xpa
}

proc XPASendMode {xpa cdata param} {
    InitError xpa
    catch {ProcessSendModeCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdMode {xpa cdata param buf len} {
    XPADebug "XPARcvdMode" $param
    InitError xpa
    catch {set i 0; ProcessModeCmd param i}
    XPACatchError $xpa
}

proc XPASendMosaic {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMosaicCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdMosaic {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaic" $param
    InitError xpa
    catch {set i 0; ProcessMosaicCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendMosaicImage {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMosaicImageCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdMosaicImage {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicImage" $param
    InitError xpa
    catch {set i 0; ProcessMosaicImageCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPASendMosaicWCS {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMosaicWCSCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdMosaicWCS {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicWCS" $param
    InitError xpa
    catch {set i 0; ProcessMosaicWCSCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdMosaicIRAF {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicIRAF" $param
    InitError xpa
    catch {set i 0; ProcessMosaicIRAFCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPASendMosaicImageWCS {xpa cdata param} {
    InitError xpa
    catch {ProcessSendMosaicImageWCSCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdMosaicImageWCS {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicImageWCS" $param
    InitError xpa
    catch {set i 0; ProcessMosaicImageWCSCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdMosaicImageIRAF {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicImageIRAF" $param
    InitError xpa
    catch {set i 0; ProcessMosaicImageIRAFCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdMosaicImageWFPC2 {xpa cdata param buf len} {
    XPADebug "XPARcvdMosaicImageWFPC2" $param
    InitError xpa
    catch {set i 0; ProcessMosaicImageWFPC2Cmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdMovie {xpa cdata param buf len} {
    XPADebug "XPARcvdMovie" $param
    InitError xpa
    catch {set i 0; ProcessMovieCmd param i}
    XPACatchError $xpa
}

proc XPARcvdMultiFrame {xpa cdata param buf len} {
    XPADebug "XPARcvdMultiFrame" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessMultiFrameCmd param i [xparec $xpa datachan] {}}
	    win32 {ProcessMultiFrameCmd param i dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendNan {xpa cdata param} {
    InitError xpa
    catch {ProcessSendNanCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdNan {xpa cdata param buf len} {
    XPADebug "XPARcvdNan" $param
    InitError xpa
    catch {set i 0; ProcessNanCmd param i}
    XPACatchError $xpa
}

proc XPASendNRES {xpa cdata param} {
    InitError xpa
    catch {ProcessSendNRESCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdNRES {xpa cdata param buf len} {
    XPADebug "XPARcvdNRES" $param
    InitError xpa
    catch {set i 0; ProcessNRESCmd param i}
    XPACatchError $xpa
}

proc XPASendNRRD {xpa cdata param} {
    InitError xpa
    catch {ProcessSendNRRDCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdNRRD {xpa cdata param buf len} {
    XPADebug "XPARcvdNRRD" $param
    InitError xpa
    catch {set i 0; ProcessNRRDCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendNVSS {xpa cdata param} {
    InitError xpa
    catch {ProcessSendNVSSCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdNVSS {xpa cdata param buf len} {
    XPADebug "XPARcvdNVSS" $param
    InitError xpa
    catch {set i 0; ProcessNVSSCmd param i}
    XPACatchError $xpa
}

proc XPASendOrient {xpa cdata param} {
    InitError xpa
    catch {ProcessSendOrientCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdOrient {xpa cdata param buf len} {
    XPADebug "XPARcvdOrient" $param
    InitError xpa
    catch {set i 0; ProcessOrientCmd param i}
    XPACatchError $xpa
}

proc XPASendPageSetup {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPageSetupCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPageSetup {xpa cdata param buf len} {
    XPADebug "XPARcvdPageSetup" $param
    InitError xpa
    catch {set i 0; ProcessPageSetupCmd param i}
    XPACatchError $xpa
}

proc XPASendPSPageSetup {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPSPageSetupCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPSPageSetup {xpa cdata param buf len} {
    XPADebug "XPARcvdPSPageSetup" $param
    InitError xpa
    catch {set i 0; ProcessPSPageSetupCmd param i}
    XPACatchError $xpa
}

proc XPASendPan {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPanCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPan {xpa cdata param buf len} {
    XPADebug "XPARcvdPan" $param
    InitError xpa
    catch {set i 0; ProcessPanCmd param i}
    XPACatchError $xpa
}

proc XPASendPixelTable {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPixelTableCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPARcvdPixelTable {xpa cdata param buf len} {
    XPADebug "XPARcvdPixelTable" $param
    InitError xpa
    catch {set i 0; ProcessPixelTableCmd param i}
    XPACatchError $xpa
}

proc XPASendPlot {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPlotCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPlot {xpa cdata param buf len} {
    XPADebug "XPARcvdPlot" $param
    InitError xpa
    catch {set i 0; ProcessPlotCmd param i $buf {}}
    XPACatchError $xpa
}

proc XPASendPNG {xpa cdata param} {
    InitError xpa
    catch {
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessSendPNGCmd {} {} $param [xparec $xpa datachan] {}}
	    win32 {ProcessSendPNGCmd {} {} $param dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPARcvdPNG {xpa cdata param buf len} {
    XPADebug "XPARcvdPNG" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessPNGCmd param i [xparec $xpa datachan] {}}
	    win32 {ProcessPNGCmd param i dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendPrefs {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPrefsCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPrefs {xpa cdata param buf len} {
    XPADebug "XPARcvdPrefs" $param
    InitError xpa
    catch {set i 0; ProcessPrefsCmd param i}
    XPACatchError $xpa
}

proc XPASendPreserve {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPreserveCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPreserve {xpa cdata param buf len} {
    XPADebug "XPARcvdPreserve" $param
    InitError xpa
    catch {set i 0; ProcessPreserveCmd param i}
    XPACatchError $xpa
}

proc XPASendPrint {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPrintCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPrint {xpa cdata param buf len} {
    XPADebug "XPARcvdPrint" $param
    InitError xpa
    catch {set i 0; ProcessPrintCmd param i}
    XPACatchError $xpa
}

proc XPASendPSPrint {xpa cdata param} {
    InitError xpa
    catch {ProcessSendPSPrintCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdPSPrint {xpa cdata param buf len} {
    XPADebug "XPARcvdPSPrint" $param
    InitError xpa
    catch {set i 0; ProcessPSPrintCmd param i}
    XPACatchError $xpa
}

proc XPARcvdRaise {xpa cdata param buf len} {
    XPADebug "XPARcvdRaise" $param
    InitError xpa
    catch {set i 0; ProcessRaiseCmd param i}
    XPACatchError $xpa
}

proc XPASendRegions {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRegionsCmd xpasetbuf $xpa $param {} {}}
    XPACatchError $xpa
}

proc XPARcvdRegions {xpa cdata param buf len} {
    XPADebug "XPARcvdRegions" $param
    InitError xpa
    catch {set i 0; ProcessRegionsCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdRestore {xpa cdata param buf len} {
    XPADebug "XPARcvdRestore" $param
    InitError xpa
    catch {set i 0; ProcessRestoreCmd param i}
    XPACatchError $xpa
}

proc XPASendRGB {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRGBCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdRGB {xpa cdata param buf len} {
    XPADebug "XPARcvdRGB" $param
    InitError xpa
    catch {set i 0; ProcessRGBCmd param i}
    XPACatchError $xpa
}

proc XPASendRGBArray {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRGBArrayCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdRGBArray {xpa cdata param buf len} {
    XPADebug "XPARcvdRGBArray" $param
    InitError xpa
    catch {set i 0; ProcessRGBArrayCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendRGBCube {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRGBCubeCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdRGBCube {xpa cdata param buf len} {
    XPADebug "XPARcvdRGBCube" $param
    InitError xpa
    catch {set i 0; ProcessRGBCubeCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendRGBImage {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRGBImageCmd {} {} $param [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdRGBImage {xpa cdata param buf len} {
    XPADebug "XPARcvdRGBImage" $param
    InitError xpa
    catch {set i 0; ProcessRGBImageCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendRotate {xpa cdata param} {
    InitError xpa
    catch {ProcessSendRotateCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdRotate {xpa cdata param buf len} {
    XPADebug "XPARcvdRotate" $param
    InitError xpa
    catch {set i 0; ProcessRotateCmd param i}
    XPACatchError $xpa
}

proc XPARcvdSAMP {xpa cdata param buf len} {
    XPADebug "XPARcvdSamp" $param
    InitError xpa
    catch {set i 0; ProcessSAMPCmd param i}
    XPACatchError $xpa
}

proc XPARcvdSave {xpa cdata param buf len} {
    XPADebug "XPARcvdSave" $param
    InitError xpa
    catch {set i 0; ProcessSaveCmd param i}
    XPACatchError $xpa
}

proc XPARcvdSaveImage {xpa cdata param buf len} {
    XPADebug "XPARcvdSaveImage" $param
    InitError xpa
    catch {set i 0; ProcessSaveImageCmd param i}
    XPACatchError $xpa
}

proc XPASendScale {xpa cdata param} {
    InitError xpa
    catch {ProcessSendScaleCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdScale {xpa cdata param buf len} {
    XPADebug "XPARcvdScale" $param
    InitError xpa
    catch {set i 0; ProcessScaleCmd param i}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdSFits {xpa cdata param buf len} {
    XPADebug "XPARcvdSFits" $param
    InitError xpa
    catch {set i 0; ProcessSFitsCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendSingle {xpa cdata param} {
    InitError xpa
    catch {ProcessSendSingleCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdSingle {xpa cdata param buf len} {
    XPADebug "XPARcvdSingle" $param
    InitError xpa
    catch {set i 0; ProcessSingleCmd param i}
    XPACatchError $xpa
}

proc XPASendShm {xpa cdata param} {
    InitError xpa
    catch {ProcessSendShmCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdShm {xpa cdata param buf len} {
    XPADebug "XPARcvdShm" $param
    InitError xpa
    catch {set i 0; ProcessShmCmd param i 0}
    XPACatchError $xpa
}

proc XPASendSkyView {xpa cdata param} {
    InitError xpa
    catch {ProcessSendSkyViewCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdSkyView {xpa cdata param buf len} {
    XPADebug "XPARcvdSkyView" $param
    InitError xpa
    catch {set i 0; ProcessSkyViewCmd param i}
    XPACatchError $xpa
}

proc XPARcvdSleep {xpa cdata param buf len} {
    XPADebug "XPARcvdSleep" $param
    InitError xpa
    catch {set i 0; ProcessSleepCmd param i}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdSMosaic {xpa cdata param buf len} {
    XPADebug "XPARcvdSMosaic" $param
    InitError xpa
    catch {set i 0; ProcessSMosaicCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdSMosaicWCS {xpa cdata param buf len} {
    XPADebug "XPARcvdSMosaicWCS" $param
    InitError xpa
    catch {set i 0; ProcessSMosaicWCSCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdSMosaicIRAF {xpa cdata param buf len} {
    XPADebug "XPARcvdSMosaicIRAF" $param
    InitError xpa
    catch {set i 0; ProcessSMosaicIRAFCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendSmooth {xpa cdata param} {
    InitError xpa
    catch {ProcessSendSmoothCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdSmooth {xpa cdata param buf len} {
    XPADebug "XPARcvdSmooth" $param
    InitError xpa
    catch {set i 0; ProcessSmoothCmd param i}
    XPACatchError $xpa
}

proc XPARcvdSource {xpa cdata param buf len} {
    XPADebug "XPARcvdSource" $param
    InitError xpa
    catch {set i 0; ProcessSourceCmd param i}
    XPACatchError $xpa
}

# backward compatibility
proc XPARcvdSRGBCube {xpa cdata param buf len} {
    XPADebug "XPARcvdSRGBCube" $param
    InitError xpa
    catch {set i 0; ProcessSRGBCubeCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPARcvdTcl {xpa cdata param buf len} {
    XPADebug "XPARcvdTcl" $param
    InitError xpa
    catch {set i 0; ProcessTclCmd param i $buf {}}
    XPACatchError $xpa
}

proc XPASendTheme {xpa cdata param} {
    InitError xpa
    catch {ProcessSendThemeCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdTheme {xpa cdata param buf len} {
    XPADebug "XPARcvdTheme" $param
    InitError xpa
    catch {set i 0; ProcessThemeCmd param i}
    XPACatchError $xpa
}

proc XPASendThreads {xpa cdata param} {
    InitError xpa
    catch {ProcessSendThreadsCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdThreads {xpa cdata param buf len} {
    XPADebug "XPARcvdThreads" $param
    InitError xpa
    catch {set i 0; ProcessThreadsCmd param i}
    XPACatchError $xpa
}

proc XPASendTIFF {xpa cdata param} {
    InitError xpa
    catch {
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessSendTIFFCmd {} {} $param [xparec $xpa datachan] {}}
	    win32 {ProcessSendTIFFCmd {} {} $param dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPARcvdTIFF {xpa cdata param buf len} {
    XPADebug "XPARcvdTIFF" $param
    InitError xpa
    catch {
	set i 0
	global ds9
	switch $ds9(wm) {
	    x11 -
	    aqua {ProcessTIFFCmd param i [xparec $xpa datachan] {}}
	    win32 {ProcessTIFFCmd param i dummy {}}
	}
    }
    XPACatchError $xpa
}

proc XPASendTile {xpa cdata param} {
    InitError xpa
    catch {ProcessSendTileCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdTile {xpa cdata param buf len} {
    XPADebug "XPARcvdTile" $param
    InitError xpa
    catch {set i 0; ProcessTileCmd param i}
    XPACatchError $xpa
}

proc XPARcvdUpdate {xpa cdata param buf len} {
    XPADebug "XPARcvdUpdate" $param
    InitError xpa
    catch {set i 0; ProcessUpdateCmd param i}
    XPACatchError $xpa
}

proc XPARcvdURLFits {xpa cdata param buf len} {
    XPADebug "XPARcvdURLFits" $param
    InitError xpa
    catch {set i 0; ProcessURLFitsCmd param i}
    XPACatchError $xpa
}

proc XPASendVersion {xpa cdata param} {
    InitError xpa
    catch {ProcessSendVersionCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPASendView {xpa cdata param} {
    InitError xpa
    catch {ProcessSendViewCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdView {xpa cdata param buf len} {
    XPADebug "XPARcvdView" $param
    InitError xpa
    catch {set i 0; ProcessViewCmd param i}
    XPACatchError $xpa
}

proc XPASendVO {xpa cdata param} {
    InitError xpa
    catch {ProcessSendVOCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdVO {xpa cdata param buf len} {
    XPADebug "XPARcvdVO" $param
    InitError xpa
    catch {set i 0; ProcessVOCmd param i}
    # someone is setting the error state
    InitError xpa
}

proc XPASendWCS {xpa cdata param} {
    InitError xpa
    catch {ProcessSendWCSCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdWCS {xpa cdata param buf len} {
    XPADebug "XPARcvdWCS" $param
    InitError xpa
    catch {set i 0; ProcessWCSCmd param i [xparec $xpa datafd] {}}
    XPACatchError $xpa
}

proc XPASendWeb {xpa cdata param} {
    InitError xpa
    catch {ProcessSendWebCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdWeb {xpa cdata param buf len} {
    XPADebug "XPARcvdWeb" $param
    InitError xpa
    catch {set i 0; ProcessWebCmd param i}
    # someone is setting an error state
    InitError xpa
}

proc XPASendWidth {xpa cdata param} {
    InitError xpa
    catch {ProcessSendWidthCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdWidth {xpa cdata param buf len} {
    XPADebug "XPARcvdWidth" $param
    InitError xpa
    catch {set i 0; ProcessWidthCmd param i}
    XPACatchError $xpa
}

proc XPASendZoom {xpa cdata param} {
    InitError xpa
    catch {ProcessSendZoomCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdZoom {xpa cdata param buf len} {
    XPADebug "XPARcvdZoom" $param
    InitError xpa
    catch {set i 0; ProcessZoomCmd param i}
    XPACatchError $xpa
}

proc XPASendZScale {xpa cdata param} {
    InitError xpa
    catch {ProcessSendZScaleCmd xpasetbuf $xpa $param}
    XPACatchError $xpa
}

proc XPARcvdZScale {xpa cdata param buf len} {
    XPADebug "XPARcvdZScale" $param
    InitError xpa
    catch {set i 0; ProcessZScaleCmd param i}
    XPACatchError $xpa
}

proc XPAConnect {} {
    global xpa

    if [info exists xpa] {
	catch {xpafree $xpa}
	unset xpa
    }
    InitXPA

    UpdateFileMenu
}

proc XPADisconnect {} {
    global xpa

    if [info exists xpa] {
	if [catch {xpafree $xpa} result] {
	    Error "$result"
	}
	unset xpa
    } else {
	Error "[msgcat::mc {XPA not initialized}]"
    }

    UpdateFileMenu
}

proc XPAInfo {} {
    global xpa

    if [info exists xpa] {
	set r {}
	append r "[format "XPA_VERSION:\t%s" [xparec $xpa version]]\n"
	append r "[format "XPA_CLASS:\t%s"   [xparec $xpa class]]\n"
	append r "[format "XPA_NAME:\t%s"    [xparec $xpa name]]\n"
	append r "[format "XPA_METHOD:\t%s"  [xparec $xpa method]]\n"
	SimpleTextDialog xpatxt "[msgcat::mc {XPA Information}]" \
	    80 20 append bottom $r
    } else {
	Error "[msgcat::mc {XPA not initialized}]"
    }
}

# unwind xpa errors
# requires catch {} to allow a check to take place
proc XPADebug {which param} {
    global debug

    if {$debug(tcl,xpa)} {
	puts stderr "$which $param"
    }
}

proc XPACatchError {xpa} {
    global ds9
    global icursor

    global errorInfo
    if {$errorInfo != {} || $ds9(msg) != {}} {
	if {$ds9(msg) != {}} {
	    xpaerror $xpa $ds9(msg)
	} else {
	    xpaerror $xpa [lindex [split $errorInfo "\n"] 0]
	}
	InitError xpa

	# reset cursor
	set icursor(count) 0
	UnsetWatchCursor
    }
}

proc XPAMethod {} {
    global xpa

    if {[info exists xpa]} {
	return [xparec $xpa method]
    } else {
	return {}
    }
}

# Process Cmds

proc ProcessXPACmd {varname iname} {
    upvar $varname var
    upvar $iname i

    global ds9
    global pds9
    global env

    switch -- [string tolower [lindex $var $i]] {
	unix -
	inet -
	local -
	localhost {set env(XPA_METHOD) [lindex $var $i]}
	noxpans {set env(XPA_NSREGISTER) false}

	tcl {incr i; set pds9(tcl) [FromYesNo [lindex $var $i]]}

	yes -
	true -
	on -
	1 -
	no -
	false -
	off -
	0 {set pds9(xpa) [FromYesNo [lindex $var $i]]}
    }
}