File: range.h

package info (click to toggle)
wcstools 3.9.7-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,684 kB
  • sloc: ansic: 113,336; sh: 553; makefile: 245; lisp: 86; sed: 1
file content (1691 lines) | stat: -rw-r--r-- 91,763 bytes parent folder | download | duplicates (2)
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
/*** File libwcs/wcscat.h
 *** February 15, 2013
 *** By Jessica Mink, jmink@cfa.harvard.edu
 *** Copyright (C) 1998-2013
 *** Smithsonian Astrophysical Observatory, Cambridge, MA, USA

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

    Correspondence concerning WCSTools should be addressed as follows:
           Internet email: jmink@cfa.harvard.edu
           Postal address: Jessica Mink
                           Smithsonian Astrophysical Observatory
                           60 Garden St.
                           Cambridge, MA 02138 USA
 */

#ifndef _wcscat_h_
#define _wcscat_h_
#define MAXNMAG	20

/* Data structure for SAO TDC ASCII and binary star catalog entries */
struct Star {
    float rdum;
    float xno;		/* Catalog number */
    double ra;		/* Right Ascension (degrees) */
    double dec;		/* Declination (degrees) */
    double errra;	/* Right Ascension (degrees) */
    double errdec;	/* Declination (degrees) */
    char isp[24];	/* Spectral type or other 2-char identifier */
    short mag[MAXNMAG+1]; /* Up to MAXNMAG Magnitudes * 100 */
    double rapm;	/* RA proper motion (degrees per year) */
    double decpm;	/* Dec proper motion (degrees per year) */
    double errpmr;	/* RA proper motion error (degrees per year) */
    double errpmd;	/* Dec proper motion error (degrees per year) */
    double xmag[MAXNMAG+1]; /* Up to MAXNMAG Magnitudes */
    double num;		/* Actual star number */
    int coorsys;	/* Coordinate system (WCS_J2000, WCS_B1950,...) */
    double equinox;	/* Equinox of coordinate system as fractional year */
    double epoch;	/* Epoch of position as fractional year */
    double parallax;	/* Parallax in arcseconds */
    double pxerror;	/* Parallax error in arcseconds */
    double radvel;	/* Radial velocity in km/sec, positive away */
    double dist;	/* Distance from search center in arcseconds */
    double size;	/* Semi-major axis in arcseconds */
    int nimage;		/* Number of images for catalog position */
    int ncat;		/* Number of catalogs for catalog proper motion */
    char *entry;	/* Line copied from input catalog */
    char objname[80];	/* Object name */
    char datapath[80];	/* File pathname to data */
    int peak;		/* Peak flux per pixel in star image */
};

/* Catalog proper motion units */
#define PM_MASYR		1	/* milliarcseconds per year */
#define PM_ARCSECYR		2	/* arcseconds per year */
#define PM_DEGYR		3	/* degrees per year */
#define PM_RADYR		4	/* radians per year */
#define PM_TSECYR		5	/* seconds of time (RA) per century */
#define PM_ARCSECCEN		6	/* arcseconds per year */
#define PM_TSECCEN		7	/* seconds of time (RA) per century */
#define PM_MTSYR		8	/* milliseconds of time (RA) per year */
#define PM_ARCSECHR		9	/* arcseconds per hour (solar system) */

/* Data structure for SAO TDC ASCII and binary star catalogs */
struct StarCat {
    int star0;		/* Subtract from star number for file sequence number */
    int star1;		/* First star number in file */
    int nstars;		/* Number of stars in file */
    int stnum;		/* Star number format in catalog file:
			  <0: -stnum-character name at end instead of number
			   0:  no star i.d. numbers
			   1: Real*4 star i.d. numbers
			   2: Integer*4 <region><nnnn>
			   3: Integer*4 <region><nnnnn>
			   4: Integer*4 <nnnnnnnnn>
			   5: Character ID instead of number in ASCII files */
    int mprop;		/* 1 if proper motion is included */
			/* 2 if radial velocity is included */
    int nmag;		/* Number of magnitudes present
			   Negative for J2000 catalog */
    int nbent;		/* Number of bytes per star entry */
    int	rasorted;	/* 1 if RA-sorted, else 0 */
    int	ignore;		/* 1 if ignoring info after position and magnitude */
    FILE *ifcat;	/* File descriptor for catalog file */
    char isfil[24];	/* Star catalog file name */
    char isname[64];	/* Star catalog description */
    int  byteswapped;	/* 1 if catalog is byte-reversed from CPU */
    int  refcat;	/* Code for type of catalog (TXTCAT, BINCAT, etc.) */
    int  coorsys;	/* Coordinate system
			   B1950 J2000 Galactic Ecliptic */
    double epoch;	/* Epoch of catalog coordinates in years */
    double equinox;	/* Equinox of catalog coordinates in years */
    char inform;	/* Coordinate format
			   (B>inary D>egrees H>MS T>able U>SNO) */
    char incdir[128];	/* Catalog directory pathname */
    char incfile[32];	/* Catalog file name */
    int ncobj;		/* Length of object name in binary star entry */
    int nnfld;		/* Length of star number  */
    int nndec;		/* Number of decimal places in star number */
    int nepoch;		/* 1 if epoch of coordinates is present */
    int sptype;		/* 1 if spectral type is present in catalog */
    int plate;		/* 1 if plate or field number is present in catalog */
    char *catbuff;	/* Pointer to start of catalog */
    char *catdata;	/* Pointer to first entry in catalog */
    char *catline;	/* Pointer to current entry in catalog */
    char *catlast;	/* Pointer to one past end of last entry in catalog */
    int  istar;		/* Number of current catalog entry */
    struct TabTable *startab;	/* Structure for tab table catalog */
    int entid;		/* Entry number for ID */
    int entra;		/* Entry number for right ascension */
    int entdec;		/* Entry number for declination */
    int entmag[MAXNMAG+1]; /* Entry numbers for up to MAXNMAG magnitudes */
    int entpeak;	/* Entry number for peak counts */
    int entepoch;	/* Entry number for epoch of observation */
    int entdate;	/* Entry number for FITS-format date of observation */
    int entname;	/* Entry number for object name */
    int entadd;		/* Entry number for additional keyword */
    int entrpm;		/* Entry number for proper motion in right ascension */
    int entdpm;		/* Entry number for proper motion in declination */
    int entpx;		/* Entry number for parallax */
    int entpxe;		/* Entry number for parallax error */
    int entrv;		/* Entry number for radial velocity */
    int enttype;	/* Entry number for spectral type */
    int entsize;	/* Entry number for size of object */
    int entpath;	/* Entry number for object data pathname */
    int rpmunit;	/* Units for RA proper motion (PM_x) */
    int dpmunit;	/* Units for DEC proper motion (PM_x) */
    char *caturl;	/* set if web search, else NULL */
    char keyid[16];	/* Entry name for ID */
    char keyra[16];	/* Entry name for right ascension */
    char keydec[16];	/* Entry name for declination */
    char keymag[MAXNMAG+1][16]; /* Entry name for up to MAXNMAG magnitudes */
    char keyrpm[16];	/* Entry name for right ascension proper motion */
    char keydpm[16];	/* Entry name for declination proper motion */
    char keypeak[16];	/* Entry name for integer code */
    char keytype[16];	/* Entry name for spectral type */
    char keyrv[16];	/* Entry name for radial velocity */
    char keyadd[16];	/* Entry name for additional keyword */
    char keyepoch[16];	/* Entry name for epoch */
};

/* Data structure for tab table files */
struct TabTable {
    char *filename;	/* Name of tab table file */
    int nlines;		/* Number of entries in table */
    char *tabname;	/* Name of this table or NULL */
    char *tabbuff;	/* Pointer to start of saved tab table in memory */
    char *tabheader;	/* Pointer to start of line containing table header */
    char *tabhead;	/* Pointer to start of line containing column heading */
    char *tabdash;	/* Pointer to start of line with dashes after column headings */
    char *tabdata;	/* Pointer to start of first line of table data */
    int lhead;		/* Number of bytes before first data line */
    int iline;		/* Number of current line (1=first) */
    int lline;		/* Length in bytes of line buffer */
    char *tabline;	/* Pointer to start of current line */
    FILE *tcat;		/* File descriptor for tab table file */
    int ncols;		/* Number of columns per table entry */
    char **colname;	/* Column names */
    int *lcol;		/* Lengths of column header names */
    int *lcfld;		/* Number of columns in field (hyphens) */
    int lbuff;		/* Number of bytes in entire tab table */
};

/* Source catalog flags and subroutines */

/* Source catalog flags returned from CatCode */
#define GSC		1	/* HST Guide Star Catalog */
#define UJC		2	/* USNO UJ Star Catalog */
#define UAC		3	/* USNO A Star Catalog */
#define USAC		4	/* USNO SA Star Catalog */
#define SAO		5	/* SAO Star Catalog */
#define IRAS		6	/* IRAS Point Source Catalog */
#define PPM		7	/* PPM Star Catalog */
#define TYCHO		8	/* Tycho Star Catalog */
#define UA1		9	/* USNO A-1.0 Star Catalog */
#define UA2		10	/* USNO A-2.0 Star Catalog */
#define USA1		11	/* USNO SA-1.0 Star Catalog */
#define USA2		12	/* USNO SA-2.0 Star Catalog */
#define HIP		13	/* Hipparcos Star Catalog */
#define ACT		14	/* USNO ACT Star Catalog */
#define BSC		15	/* Yale Bright Star Catalog */
#define TYCHO2		16	/* Tycho-2 Star Catalog */
#define USNO		17	/* USNO-format plate catalog */
#define TMPSC		18	/* 2MASS All-Sky Point Source Catalog */
#define GSCACT		19	/* GSC-ACT revised Guide Star Catalog */
#define GSC2		20	/* GSC II version 2.2 */
#define UB1		21	/* USNO B-1.0 Star Catalog */
#define UCAC1		22	/* USNO CCD Astrograph Catalog 1.0 */
#define UCAC2		23	/* USNO CCD Astrograph Catalog 2.0 */
#define TMIDR2		24	/* 2MASS IDR2 Point Source Catalog */
#define YB6		25	/* USNO YB6 Catalog */
#define SDSS		26	/* Sloan Digital Sky Survey Catalog */
#define TMXSC		27	/* 2MASS Extended Source Catalog */
#define TMPSCE		28	/* 2MASS Point Source Catalog with mag errors */
#define TYCHO2E		29	/* Tycho-2 Star Catalog with magnitude errors */
#define SKY2K		30	/* SKY2000 Master Catalog */
#define SKYBOT		31	/* SKYBOT Solar System Objects */
#define UCAC3		32	/* USNO CCD Astrograph Catalog 3.0 (2009) */
#define UCAC4		33	/* USNO CCD Astrograph Catalog 4.0 (2013) */
#define TABCAT		-1	/* StarBase tab table catalog */
#define BINCAT		-2	/* TDC binary catalog */
#define TXTCAT		-3	/* TDC ASCII catalog */
#define WEBCAT		-4	/* Tab catalog via the web */
#define NUMCAT		33	/* Number of predefined catalogs */

#define EP_EP   1	/* Output epoch as fractional year */
#define EP_JD   2	/* Output epoch as Julian Date */
#define EP_MJD  3	/* Ouput epoch as Modified Julian Date */
#define EP_FD   4	/* Output epoch in FITS format (yyyy-mm-dd) */
#define EP_ISO  5	/* Output epoch in ISO format (yyyy-mm-ddThh:mm:ss) */

/* Flags for sorting catalog search results */
#define SORT_UNSET	-1	/* Catalog sort flag not set yet */
#define SORT_NONE	0	/* Do not sort catalog output */
#define SORT_MAG	1	/* Sort output by magnitude */
#define SORT_DIST	2	/* Sort output by distance from center */
#define SORT_RA		3	/* Sort output by right ascension */
#define SORT_DEC	4	/* Sort output by declination */
#define SORT_X		5	/* Sort output by image X coordinate */
#define SORT_Y		6	/* Sort output by image Y coordinate */
#define SORT_ID		7	/* Merge close catalog objects */
#define SORT_MERGE	8	/* Merge close catalog objects */

/* Shapes for SAOimage region file output */
#define WCS_CIRCLE 1	/* circle shape for SAOimage plotting */
#define WCS_SQUARE 2	/* square shape for SAOimage plotting */
#define WCS_DIAMOND 3	/* diamond shape for SAOimage plotting */
#define WCS_CROSS 4	/* cross shape for SAOimage plotting */
#define WCS_EX 5	/* x shape for SAOimage plotting */
#define WCS_VAR 6	/* variable (+ and x) shape for HSTGSC plotting */
#define WCS_PCIRCLE 11	/* pixel circle shape for SAOimage plotting */
#define WCS_PSQUARE 12	/* pixel square shape for SAOimage plotting */
#define WCS_PDIAMOND 13	/* pixel diamond shape for SAOimage plotting */
#define WCS_PCROSS 14	/* pixel cross shape for SAOimage plotting */
#define WCS_PEX 15	/* pixel ex shape for SAOimage plotting */
#define WCS_PVAR 16	/* pixel variable (+ and x) shape for HSTGSC plotting */

/* Subroutines for extracting sources from catalogs */

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __STDC__   /* Full ANSI prototypes */

/* Subroutines for reading any catalogs, including TDC ASCII catalogs */

    int ctgread(	/* Read sources by sky region from any catalog */
	char *catfile,	/* Name of reference star catalog file */
	int refcat,	/* Catalog code from wcscat.h */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nsmax,	/* Maximum number of stars to be returned */
	struct StarCat **starcat, /* Catalog data structure */
	double *tnum,	/* Array of ID numbers (returned) */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D array of magnitudes (returned) */
	int *tc,	/* Array of fluxes (returned) */
	char **tobj,	/* Array of object names (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ctgrnum(	/* Read sources by number from any catalog */
	char *catfile,	/* Name of reference star catalog file */
	int refcat,	/* Catalog code from wcscat.h */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	int match,	/* 1 to match star number exactly, else sequence num */
	struct StarCat **starcat, /* Star catalog data structure */
	double *tnum,	/* Array of source numbers to look for */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D Array of magnitudes (returned) */
	int *tpeak,	/* Array of peak counts (returned) */
	char **tkey,	/* Array of values of additional keyword */
	char **tpath,	/* Array of values of data pathnames */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ctgrdate(	/* Read sources by date from SAO TDC ASCII format catalog */
	char *catfile,	/* Name of reference star catalog file */
	int refcat,	/* Catalog code from wcscat.h */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	struct StarCat **starcat, /* Star catalog data structure */
	double date1,	/* Start time as Modified Julian Date or Julian Date */
	double date2,	/* End time as Modified Julian Date or Julian Date */
	int nmax,	/* Maximum number of stars to look for */
	double *tnum,	/* Array of source numbers (returned) */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D Array of magnitudes (returned) */
	int *tc,	/* Array of fluxes (returned) */
	char **tobj,	/* Array of object names (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ctgbin(		/* Bin sources from SAO TDC ASCII format catalog */
	char *catfile,	/* Name of reference star catalog file */
	int refcat,	/* Catalog code from wcscat.h */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude by which to sort (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ctgstar(		/* Read one star entry from ASCII catalog, 0 if OK */
	int istar,	/* Star sequence number in ASCII catalog */
	struct StarCat *sc, /* Star catalog data structure */
	struct Star *st); /* Star data structure, updated on return */
    int isacat(		/* Return 1 if string is name of ASCII catalog file */
	char *catpath);	/* Path to file to check */
    struct StarCat *ctgopen( /* Open a Starbase, TDC ASCII, or TDC binary catalog */
	char *catfile,	/* Name of reference star catalog file */
	int refcat);	/* Catalog code from wcscat.h */
    void ctgclose(	/* Close Starbase, TDC ASCII, or TDC binary catalog
			 * and free data structures */
	struct StarCat *sc); /* Star catalog data structure */

/* Subroutines for extracting sources from HST Guide Star Catalog */
    int gscread(	/* Read sources by sky region from HST Guide Star Catalog */
	int refcat,	/* Catalog code from wcscat.h (GSC or GSCACT) */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int gscrnum(	/* Read sources by ID number from HST Guide Star Catalog */
	int refcat,	/* Catalog code from wcscat.h (GSC or GSCACT) */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *gnum,	/* Array of source numbers to look for */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if >1, number of sources per log line */
    int gscbin(		/* Bin sources from HST Guide Star Catalog */
	int refcat,	/* Catalog code from wcscat.h (GSC or GSCACT) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if >1, number of sources per log line */
    void setgsclass(	/* Set GSC object class to return (<0=all) */
	int class);	/* Class of objects to return */

/* Subroutine to read GSC II catalog over the web */
    int gsc2read(	/* Read sources by sky region from GSC II Catalog */
	char *refcatname, /* Name of catalog (GSC2 for 2.2; GSC2.3 for 2.3) */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned) */
	char **gobj,	/* Array of object IDs (mixed letters and numbers) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if >1, number of sources per log line */
    char *gsc2c2t(	/* Convert GSC2 buffer from comma- to tab-separated */
	char *csvbuff);	/* Input comma-separated table */
    char *gsc2t2t(	/* Clean up GSC2 tab-separated buffer */
	char *tsvbuff);	/* Input tab-separated table */

/* Subroutine to read SDSS catalog over the web */
    int sdssread(	/* Read sources by sky region from SDSS Catalog */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned from tabread) */
	char **gobj,	/* Array of object IDs (too long for integer*4) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if >1, number of sources per log line */
    char *sdssc2t(	/* Convert SDSS buffer from comma- to tab-separated */
	char *csvbuff);	/* Input comma-separated table */

/* Subroutines to read local copy of 2MASS Point Source Catalog */
    int tmcread(	/* Read sources by sky region from 2MASS Point Source Catalog */
	int refcat,	/* Catalog code from wcscat.h (TMPSC or TMXSC or TMPSCE) */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of catalog numbers (returned) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tmcrnum(	/* Read sources by ID number from 2MASS Point Source Catalog */
	int refcat,	/* Catalog code from wcscat.h (TMPSC or TMXSC or TMPSCE) */
	int nstars,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *gnum,	/* Array of source numbers to look for */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tmcbin(		/* Bin sources from 2MASS Point Source Catalog */
	int refcat,	/* Catalog code from wcscat.h (TMPSC or TMXSC or TMPSCE) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

/* Subroutines to read local copies of USNO catalogs */
    int uacread(	/* Read sources by sky region from USNO A or SA Catalog */
	char *refcatname, /* Name of catalog (UAC, USAC, UAC2, USAC2) */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *unum,	/* Array of catalog numbers (returned) */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *uplate,	/* Array of plate numbers (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int uacrnum(	/* Read sources by ID number from USNO A or SA Catalog */
	char *refcatname, /* Name of catalog (UAC, USAC, UAC2, USAC2) */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *unum,	/* Array of source numbers to look for */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *uplate,	/* Array of plate numbers (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int uacbin(		/* Bin sources from USNO A or SA Catalog */
	char *refcatname, /* Name of catalog (UAC, USAC, UAC2, USAC2) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    void setuplate(	/* Set USNO catalog plate number to search */
	int xplate);	/* If nonzero, use objects only from this plate */
    int getuplate(void); /* Get USNO catalog plate number to search */

    int ubcread(	/* Read sources by sky region from USNO B Catalog */
	char *refcatname, /* Name of catalog (UB1 only for now) */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *unum,	/* Array of ID numbers (returned) */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double *upra,	/* Array of right ascension proper motions (returned) */
	double *updec,	/* Array of declination proper motions (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *upmni,	/* Array of number of ids and pm quality (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ubcrnum(	/* Read sources by ID number from USNO B Catalog */
	char *refcatname, /* Name of catalog (UB1 only for now) */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *unum,	/* Array of source numbers to look for */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double *upra,	/* Array of right ascension proper motions (returned) */
	double *updec,	/* Array of declination proper motions (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *upmni,	/* Array of number of ids and pm quality (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ubcbin(		/* Bin sources from USNO B Catalog */
	char *refcatname, /* Name of catalog (UB1 only for now) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

    int ucacread(	/* Read sources by sky region from USNO UCAC 1 Catalog */
	char *refcatname, /* Name of catalog (UCAC1 or UCAC2) */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ucacrnum(	/* Read sources by ID number from USNO UCAC 1 Catalog */
	char *refcatname, /* Name of catalog (UCAC1 or UCAC2) */
	int nstars,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *gnum,	/* Array of source numbers to look for */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ucacbin(	/* Bin sources from USNO UCAC 1 Catalog */
	char *refcatname, /* Name of catalog (UCAC1 or UCAC2) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

    int ujcread(	/* Read sources by sky region from USNO J Catalog */
	char *refcatname, /* Name of catalog (UJC, xxxxx.usno) */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *unum,	/* Array of catalog numbers (returned) */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *uplate,	/* Array of plate numbers (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ujcrnum(	/* Read sources by ID number from USNO J Catalog */
	char *refcatname, /* Name of catalog (UJC, xxxxx.usno) */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *unum,	/* Array of source numbers to look for */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *uplate,	/* Array of plate numbers (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ujcbin(		/* Bin sources from USNO J Catalog */
	char *refcatname, /* Name of catalog (UJC, xxxxx.usno) */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

/* Subroutines to read a local copy of the Tycho-2 catalog */
    int ty2read(	/* Read sources by sky region from Tycho 2 Catalog */
	int refcat,	/* Catalog code from wcscat.h (TYCHO2 or TYCHO2E */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ty2rnum(	/* Read sources by ID number from Tycho 2 Catalog */
	int refcat,	/* Catalog code from wcscat.h (TYCHO2 or TYCHO2E */
	int nstars,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *gnum,	/* Array of source numbers to look for */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int ty2bin(		/* Bin sources from Tycho 2 Catalog */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

/* Subroutines to read a local copy of the ACT catalog */
    int actread(	/* Read sources by sky region from USNO ACT Catalog */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int distsort,	/* 1 to sort stars by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of ID numbers (returned) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int actrnum(	/* Read sources by ID number from USNO ACT Catalog */
	int nstars,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double *gnum,	/* Array of source numbers to look for */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension proper motions (returned) */
	double *gpdec,	/* Array of declination proper motions (returned) */
	double **gmag,	/* 2-D array of magnitudes (returned) */
	int *gtype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int actbin(		/* Bin sources from USNO ACT Catalog */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

    int skybotread (	/* Find solar system objects from SkyBot */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	int distsort,	/* 1 to sort asteroids by distance from center */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Julian date for positions (current time if zero) */
	double mag1,	/* Lower limiting magnitude (none if equal to mag2) */
	double mag2,	/* Upper limiting magnitude (none if equal to mag1) */
	int sortmag,	/* Magnitude by which to sort (1 to nmag) */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *gnum,	/* Array of asteroid numbers (returned) */
	char **gobj,	/* Array of object IDs (too long for integer*4) */
	double *gra,	/* Array of right ascensions (returned) */
	double *gdec,	/* Array of declinations (returned) */
	double *gpra,	/* Array of right ascension motions (returned) */
	double *gpdec,	/* Array of declination motions (returned) */
	double **gmag,	/* 2-D array of magnitudes and other info (returned) */
	int *gtype,	/* Array of object classes (returned) */
	int nlog);	/* 1 for diagnostics */

    char *skybot2tab(	/* Convert SkyBot buffer from space- to tab-separated */
	char *csvbuff);	/* Input comma-separated table */

/* Subroutines to read SAO-TDC binary format catalogs */
    int binread(	/* Read from sky region from SAO TDC binary format catalog */
	char *bincat,	/* Name of reference star catalog file */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	struct StarCat **starcat, /* Star catalog data structure */
	double *tnum,	/* Array of ID numbers (returned) */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D array of magnitudes (returned) */
	int *tpeak,	/* Array of encoded spectral types (returned) */
	char **tobj,	/* Array of object names (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int binrnum(	/* Read sources by ID number from SAO TDC binary format catalog */
	char *bincat,	/* Name of reference star catalog file */
	int nstars,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	int match,	/* If 1, match number exactly, else number is sequence*/
	double *tnum,	/* Array of source numbers to look for */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D array of magnitudes (returned) */
	int *tpeak,	/* Array of encoded spectral types (returned) */
	char **tobj,	/* Array of object names (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int binbin(		/* Bin sources from SAO TDC binary format catalog */
	char *bincat,	/* Name of reference star catalog file */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude to use (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */

    int binstar(	/* Read one star entry from binary catalog, 0 if OK */
	struct StarCat *sc, /* Star catalog descriptor */
	struct Star *st, /* Current star entry (returned) */
	int istar);	/* Star sequence number in binary catalog */
    struct StarCat *binopen( /* Open binary catalog, returning number of entries */
	char *bincat);	/* Name of reference star catalog file */
    void binclose(	/* Close binary catalog */
	struct StarCat *sc); /* Star catalog descriptor */
    int isbin(		/* Return 1 if TDC binary catalog file, else 0 */
	char *filename); /* Name of file to check */

/* Subroutines for extracting tab table information (in tabread.c) */
    int tabread(	/* Read sources from tab table catalog */
	char *tabcatname, /* Name of reference star catalog file */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude by which to sort (1 to nmag) */
	int nstarmax,	/* Maximum number of stars to be returned */
	struct StarCat **starcat, /* Star catalog data structure */
	double *tnum,	/* Array of source numbers (returned) */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D Array of magnitudes (returned) */
	int *tpeak,	/* Array of peak counts (returned) */
	char **tkey,	/* Array of values of additional keyword */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tabrnum(	/* Read sources from tab table catalog */
	char *tabcatname, /* Name of reference star catalog file */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	struct StarCat **starcat, /* Star catalog data structure */
	int match,	/* 1 to match star number exactly, else sequence num */
	double *tnum,	/* Array of source numbers to look for */
	double *tra,	/* Array of right ascensions (returned) */
	double *tdec,	/* Array of declinations (returned) */
	double *tpra,	/* Array of right ascension proper motions (returned) */
	double *tpdec,	/* Array of declination proper motions (returned) */
	double **tmag,	/* 2-D Array of magnitudes (returned) */
	int *tpeak,	/* Array of peak counts (returned) */
	char **tkey,	/* Array of values of additional keyword */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tabbin(		/* Read sources from tab table catalog */
	char *tabcatname, /* Name of reference star catalog file */
	struct WorldCoor *wcs, /* World coordinate system for image */
	char *header,	/* FITS header for output image */
	char *image,	/* Output FITS image */
	double mag1,	/* Minimum (brightest) magnitude (no limits if equal) */
	double mag2,	/* Maximum (faintest) magnitude (no limits if equal) */
	int sortmag,	/* Magnitude by which to sort (1 to nmag) */
	double magscale, /* Scaling factor for magnitude to pixel flux
			 * (image of number of catalog objects per bin if 0) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tabxyread(	/* Read x, y, and magnitude from tab table star list */
	char *tabcatname, /* Name of reference star catalog file */
	double **xa,	/* Array of x coordinates (returned) */
	double **ya,	/* Array of y coordinates (returned) */
	double **ba,	/* Array of magnitudes (returned) */
	int **pa,	/* Array of fluxes (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int tabrkey(		/* Keyword values from tab table catalogs */
	char *tabcatname, /* Name of reference star catalog file */
	struct StarCat **starcat, /* Star catalog data structure */
	int nnum,	/* Number of stars to look for */
	double *tnum,	/* Array of source numbers to look for */
	char *keyword,	/* Keyword for which to return values */
	char **tval);	/* Returned values for specified keyword */
    struct StarCat *tabcatopen(	/* Open tab table catalog */
	char *tabpath,	/* Tab table catalog file pathname */
	struct TabTable *tabtable, /* Tab table data structure */
	int nbbuff);	/* Number of bytes in buffer; 0=read whole file */
    void tabcatclose(	/* Close tab table catalog */
	struct StarCat *sc);	/* Source catalog data structure */
    int tabstar(	/* Read one star entry from tab table catalog, 0 if OK */
	int istar,		/* Source sequence number in tab table catalog */
	struct StarCat *sc,	/* Source catalog data structure */
	struct Star *st,	/* Star data structure, updated on return */
	int verbose);		/* 1 to print error messages */
    struct TabTable *tabopen(	/* Open tab table file */
	char *tabfile,	/* Tab table catalog file name */
	int nbbuff);	/* Number of bytes in buffer; 0=read whole file */
    void tabclose(	/* Free all arrays left open by tab table structure */
	struct TabTable *tabtable); /* Tab table data structure */
    char *gettabline(	/* Find a specified line in a tab table */
	struct TabTable *tabtable, /* Tab table data structure */
	int iline);	/* Line sequence number in tab table */
    double tabgetra(	/* Return right ascension in degrees from tab table*/
	struct Tokens *tabtok,  /* Line token structure */
	int ientry);	/* sequence of entry on line */
    double tabgetdec(	/* Return declination in degrees from tab table*/
	struct Tokens *tabtok,  /* Line token structure */
	int ientry);	/* sequence of entry on line */
    double tabgetr8(	/* Return double number from tab table line */
	struct Tokens *tabtok,  /* Line token structure */
	int ientry);	/* sequence of entry on line */
    int tabgeti4(	/* Return 4-byte integer from tab table line */
	struct Tokens *tabtok,  /* Line token structure */
	int ientry);	/* sequence of entry on line */
    void settabkey(	/* Set tab table keyword to read for object */
	char *keyword);	/* column header of desired value */
    int tabgetk(	/* Get tab table entries for named column */
	struct TabTable *tabtable, /* Tab table data structure */
	struct Tokens *tabtok,  /* Line token structure */
	char *keyword,	/* column header of desired value */
	char *string,	/* character string (returned) */
	int maxchar);	/* Maximum number of characters in returned string */
    int tabgetc(	/* Get tab table entry for named column */
	struct Tokens *tabtok,  /* Line token structure */
	int ientry,	/* sequence of entry on line */
	char *string,	/* character string (returned) */
	int maxchar);	/* Maximum number of characters in returned string */
    int tabparse(		/* Aeturn column names and positions in tabtable */
	struct TabTable *tabtable); /* Tab table data structure */
    int tabcol(		/* Find column for name (case-sensitive) */
	struct TabTable *tabtable, /* Tab table data structure */
	char *keyword);	/* column header of desired value */
    int tabccol(	/* Find column for name  (case-insensitive) */
	struct TabTable *tabtable, /* Tab table data structure */
	char *keyword);	/* column header of desired value */
    int istab(		/* Return 1 if tab table file, else 0 */
	char *filename); /* Name of file to check */
    char *gettaberr();	/* Return most recent tab table error message */
    int gettabndec();	/* Return number of decimal places in tab catalog ids */

/* Subroutines to read catalogs over the web, from SCAT, HST, ESO, or SDSS servers */
    int webread(	/* Read sources by sky region from WWW catalog */
	char *caturl,	/* URL of search engine */
	char *refcatname, /* Name of catalog */
	int distsort,	/* 1 to sort stars by distance from center */
	double cra,	/* Search center J2000 right ascension in degrees */
	double cdec,	/* Search center J2000 declination in degrees */
	double dra,	/* Search half width in right ascension in degrees */
	double ddec,	/* Search half-width in declination in degrees */
	double drad,	/* Limiting separation in degrees (ignore if 0) */
	double dradi,	/* Inner edge of annulus in degrees (ignore if 0) */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	double mag1,	/* Limiting magnitudes (none if equal) */
	double mag2,	/* Limiting magnitudes (none if equal) */
	int sortmag,	/* Number of magnitude by which to limit and sort */
	int nstarmax,	/* Maximum number of stars to be returned */
	double *unum,	/* Array of ID numbers (returned) */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double *upra,	/* Array of right ascension proper motions (returned) */
	double *updec,	/* Array of declination proper motions (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *utype,	/* Array of integer catalog values (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    int webrnum(	/* Read sources by ID number from WWW catalog */
	char *caturl,	/* URL of search engine */
	char *refcatname, /* Name of catalog */
	int nnum,	/* Number of stars to look for */
	int sysout,	/* Search coordinate system */
	double eqout,	/* Search coordinate equinox */
	double epout,	/* Proper motion epoch (0.0 for no proper motion) */
	int match,	/* 1 to match star number exactly, else sequence num */
	double *unum,	/* Array of source numbers to look for */
	double *ura,	/* Array of right ascensions (returned) */
	double *udec,	/* Array of declinations (returned) */
	double *upra,	/* Array of right ascension proper motions (returned) */
	double *updec,	/* Array of declination proper motions (returned) */
	double **umag,	/* 2-D array of magnitudes (returned) */
	int *utype,	/* Array of object types (returned) */
	int nlog);	/* Verbose mode if > 1, number of sources per log line */
    char *webbuff(	/* Read URL into buffer across the web */
	char *url,	/* URL to read */
	int diag,	/* 1 to print diagnostic messages */
	int *lbuff);	/* Length of buffer (returned) */
    struct TabTable *webopen(	/* Open tab table across the web */
	char *caturl,	/* URL of search engine */
	char *srchpar,	/* Search engine parameters to append */
	int nlog);	/* 1 to print diagnostic messages */

/* Subroutines to read DAOPHOT-style catalogs of sources found in an image */
    int daoread(	/* Read image source positions from x y mag file */
	char *daocat,	/* Name of DAOFIND catalog file */
	double **xa,	/* X and Y coordinates of stars, array returned */
	double **ya,	/* X and Y coordinates of stars, array returned */
	double **ba,	/* Instrumental magnitudes of stars, array returned */
	int **pa,	/* Peak counts of stars in counts, array returned */
	int nlog);	/* 1 to print each star's position */
    int daoopen(	/* Open image source position x y mag file */
	char *daofile);	/* DAOFIND catalog file name */
    char *daoline(	/* Read line from image source position x y mag file */
	int iline,	/* Star sequence number in DAOFIND catalog */
	char *line);	/* Pointer to iline'th entry (returned updated) */

/* Subroutines for sorting tables of star positions and magnitudes from sortstar.c */
    void FluxSortStars(	/* Sort image stars by decreasing flux */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double *sb,	/* Brighness in counts */
	int *sc,	/* Other 4-byte information */
	int ns);	/* Number of stars to sort */
    void MagSortStars(	/* Sort image stars by increasing magnitude */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm,		/* Number of magnitudes per star */
	int ms);	/* Magnitude by which to sort (1 to nmag) */
    void IDSortStars(	/* Sort image stars by increasing ID Number value */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm);	/* Number of magnitudes per star */
    void RASortStars(	/* Sort image stars by increasing right ascension */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm);	/* Number of magnitudes per star */
    void DecSortStars(	/* Sort image stars by increasing declination */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm);	/* Number of magnitudes per star */
    void XSortStars(	/* Sort image stars by increasing image X value */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm);	/* Number of magnitudes per star */
    void YSortStars(	/* Sort image stars by increasing image Y value */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm);	/* Number of magnitudes per star */
    int MergeStars(	/* Merge multiple entries within given radius
			 * return mean ra, dec, proper motion, and magnitude(s) */
	double *sn,	/* Identifying number */
	double *sra,	/* Right Ascension */
	double *sdec,	/* Declination */
	double *spra,	/* Right Ascension proper motion */
	double *spdec,	/* Declination proper motion */
	double *sx,	/* Image X coordinate */
	double *sy,	/* Image Y coordinate */
	double **sm,	/* Magnitudes */
	int *sc,	/* Other 4-byte information */
	char **sobj,	/* Object name */
	int ns,		/* Number of stars to sort */
	int nm,		/* Number of magnitudes per star */
	double rad,	/* Maximum separation in arcseconds to merge */
	int log);	/* If >0, log progress every time mod number written */

/* Catalog utility subroutines from catutil.c */

/* Subroutines for dealing with catalogs */
    int RefCat(		/* Return catalog type code, title, coord. system */
	char *refcatname, /* Name of reference catalog */
	char *title,	/* Description of catalog (returned) */
	int *syscat,	/* Catalog coordinate system (returned) */
	double *eqcat,	/* Equinox of catalog (returned) */
	double *epcat,	/* Epoch of catalog (returned) */
	int *catprop,	/* 1 if proper motion in catalog (returned) */
	int *nmag);	/* Number of magnitudes in catalog (returned) */
    int CatCode(	/* Return catalog type code */
	char *refcatname); /* Name of reference catalog */
    char *CatName(	/* Return catalog name given catalog type code */
	int refcat,	/* Catalog code */
	char *refcatname); /* Name of reference catalog */
    char *CatSource(	/* Return catalog source description given catalog type code */
	int refcat,	/* Catalog code */
	char *refcatname); /* Name of reference catalog */
    void CatID(		/* Return catalog ID keyword given catalog type code */
	char *catid,	/* Catalog ID (returned) */
	int refcat);	/* Catalog code */
    double CatRad(	/* Return default search radius for given catalog */
	int refcat);	/* Catalog code */
    char *ProgName(	/* Return program name given program path used */
	char *progpath0); /* Pathname by which program is invoked */
    char *ProgCat(	/* Return catalog name given program name used */
	char *progname); /* Program name which might contain catalog code */
    void CatNum(	/* Return formatted source number */
	int refcat,	/* Catalog code */
	int nnfld,	/* Number of characters in number (from CatNumLen)
			 * Print leading zeroes if negative */
	int nndec,	/* Number of decimal places ( >= 0)
			 * Omit leading spaces if negative */
	double dnum,	/* Catalog number of source */
	char *numstr);	/* Formatted number (returned) */
    int CatNumLen(	/* Return length of source numbers */
	int refcat,	/* Catalog code */
	double maxnum,	/* Maximum ID number
			 * (Ignored for standard catalogs) */
	int nndec);	/* Number of decimal places ( >= 0) */
    int CatNdec(	/* Return number of decimal places in source numbers */
	int refcat);	/* Catalog code */
    void CatMagName(	/* Return name of specified magnitude */
	int imag,	/* Sequence number of magnitude */
	int refcat,	/* Catalog code */
	char *magname); /* Name of magnitude, returned */
    int CatMagNum(	/* Returns number of magnitude specified by letter as int */
	int imag,	/* int of magnitude letter */
	int refcat);	/* Catalog code */
    void CatTabHead (	/* Print heading for catalog search result table */
	int refcat,	/* Catalog being searched */
	int sysout,	/* Output coordinate system */
	int nnfld,	/* Number of characters in ID column */
	int mprop,	/* 1 if proper motion in catalog */
	int nmag,	/* Number of magnitudes */
	char *ranges,	/* Catalog numbers to print */
	char *keyword,	/* Column to add to tab table output */
	int gcset,	/* 1 if there are any values in gc[] */
	int tabout,	/* 1 if output is tab-delimited */
	int classd,	/* GSC object class to accept (-1=all) */
	int printxy,	/* 1 if X and Y included in output */
	char **gobj1,	/* Pointer to array of object names; NULL if none */
	FILE *fd);	/* Output file descriptor; none if NULL */
    int StrNdec(	/* Return number of decimal places in numeric string */
	char *string);	/* Numeric string */
    int NumNdec(	/* Return number of decimal places in a number */
	double number); /* Floating point number */
    void setdateform (	/* Set date format code */
	int dateform0);	/* Date format code */
    char *DateString(	/* Return string with epoch of position in desired format */
	double epoch,	/* Date as fraction of a year */
	int tabout);	/* 1 for tab-preceded output string, else space-preceded */
    void setlimdeg(	/* Limit output in degrees (1) or hh:mm:ss dd:mm:ss (0) */
	int degout);	/* 1 for fractional degrees, else sexagesimal hours, degrees */

    void SearchLim(	/* Compute limiting RA and Dec */
	double cra,	/* Longitude/Right Ascension of Center of search area in degrees */
	double cdec,	/* Latitude/Declination of search area in degrees */
	double dra,	/* Horizontal half-width in degrees */
	double ddec,	/* Vertical half-width in degrees */
	int syscoor,	/* Coordinate system */
	double *ra1,	/* Lower right ascension limit in degrees (returned) */
	double *ra2,	/* Upper right ascension limit in degrees (returned) */
	double *dec1,	/* Lower declination limit in degrees (returned) */
	double *dec2,	/* Upper declination limit in degrees (returned) */
	int verbose);	/* 1 to print limits, else 0 */
    void RefLim(	/* Compute limiting RA and Dec in new system */
	double cra,	/* Longitude/Right Ascension of Center of search area in degrees */
	double cdec,	/* Latitude/Declination of search area in degrees */
	double dra,	/* Horizontal half-width in degrees */
	double ddec,	/* Vertical half-width in degrees */
	int sysc,	/* System of search coordinates */
	int sysr,	/* System of reference catalog coordinates */
	double eqc,	/* Equinox of search coordinates in years */
	double eqr,	/* Equinox of reference catalog in years */
	double epc,	/* Epoch of search coordinates in years */
	double epr,	/* Epoch of reference catalog coordinates in years */
	double secmarg,	/* Margin in arcsec/century to catch moving stars */
	double *ramin,	/* Lower right ascension limit in degrees (returned) */
	double *ramax,	/* Upper right ascension limit in degrees (returned) */
	double *decmin,	/* Lower declination limit in degrees (returned) */
	double *decmax,	/* Upper declination limit in degrees (returned) */
	int *wrap,	/* 1 if search passes through 0:00:00 RA */
	int verbose);	/* 1 to print limits, else 0 */
    void movebuff (	/* Copy nbytes bytes from source+offs to dest+offd */
	char *source,	/* Pointer to source */
	char *dest,	/* Pointer to destination */
	int nbytes,	/* Number of bytes to move */
	int offs,	/* Offset in bytes in source from which to start copying */
	int offd);	/* Offset in bytes in destination to which to start copying */

/* Subroutines for dealing with ranges */
    struct Range *RangeInit(	/* Initialize range structure from string */
	char *string,	/* String containing numbers separated by , and - */
	int ndef);	/* Maximum allowable range value */
    int isrange(	/* Return 1 if string is a range of numbers, else 0 */
	char *string);	/* String which might be a range of numbers */
    void rstart(	/* Restart range */
	struct Range *range); /* Range structure */
    int rgetn(		/* Return number of values in all ranges */
	struct Range *range); /* Range structure */
    int rgeti4(		/* Return next number in range as integer */
	struct Range *range); /* Range structure */
    double rgetr8(	/* Return next number in range as double */
	struct Range *range); /* Range structure */

/* Subroutines for read values from keyword=value in blocks of text */
    int ageti4(		/* Extract int value from keyword= value in string */
	char *string,	/* character string containing <keyword>= <value> */
	char *keyword,	/* character string containing the name of the keyword
			 * the value of which is returned.  hget searches for a
			 * line beginning with this string.  if "[n]" or ",n" is
			 * present, the n'th token in the value is returned. */
	int *ival);	/* Integer value, returned */
    int agetr8(		/* Extract double value from keyword= value in string */
	char *string,	/* character string containing <keyword>= <value> */
	char *keyword,	/* character string containing the name of the keyword */
	double *dval);	/* Double value, returned */
    int agets(		/* Extract value from keyword= value in string */
	char *string,	/* character string containing <keyword>= <value> */
	char *keyword,	/* character string containing the name of the keyword */
	int lval,	/* Size of value in characters
			 * If negative, value ends at end of line */
	int fillblank,	/* If 0, leave blanks, strip trailing blanks
			   if non-zero, replace blanks with underscores */
	char *value);	/* String (returned) */

    int tmcid(		/* Return 1 if string is 2MASS ID, else 0 */
	char *string,	/* Character string to check */
	double *ra,	/* Right ascension (returned) */
	double *dec);	/* Declination (returned) */

/* Subroutines for VOTable output */
    int vothead(	/* Print heading for VOTable SCAT output */
	int refcat,	/* Catalog code */
	char *refcatname, /* Name of catalog */
	int mprop,	/* Proper motion flag */
	int typecol,	/* Flag for spectral type */
	int ns,		/* Number of sources found in catalog */
	double cra,	/* Search center right ascension */
	double cdec,	/* Search center declination */
	double drad);	/* Radius to search in degrees */
    void vottail();	/* Terminate VOTable SCAT output */

/* Subroutines for version/date string */
    void setrevmsg(	/* Set version/date string */
	char *revmsg);	/* Version/date string */
    char *getrevmsg(void); /* Return version/date string */

/* Subroutines for fitting and evaluating polynomials */
    void polfit(	/* Fit polynomial coefficients */
	double *x,	/* Array of independent variable points */
	double *y,	/* Array of dependent variable points */
	double x0,	/* Offset to independent variable */
	int npts,	/* Number of data points to fit */
	int nterms,	/* Number of parameters to fit */
	double *a,	/* Vector containing current fit values */
	double *stdev);	/* Standard deviation of fit (returned) */
    double polcomp(	/* Evaluate polynomial from polfit coefficients */
	double xi,	/* Independent variable */
	double x0,	/* Offset to independent variable */
	int norder,	/* Number of coefficients */
	double *a);	/* Vector containing coeffiecients */

#else /* K&R prototypes */

/* Subroutines for reading TDC ASCII catalogs (ctgread.c) */
int ctgread();		/* Read sources by sky region from SAO TDC ASCII format catalog */
int ctgrnum();		/* Read sources by number from SAO TDC ASCII format catalog */
int ctgrdate();		/* Read sources by date range from SAO TDC ASCII format catalog */
int ctgbin();		/* Bin sources from SAO TDC ASCII format catalog */
int ctgstar();		/* Read one star entry from ASCII catalog, 0 if OK */
int isacat();		/* Return 1 if string is name of ASCII catalog file */
struct StarCat *ctgopen();
void ctgclose();

/* Subroutines for extracting sources from HST Guide Star Catalog */
int gscread();		/* Read sources by sky region from HST Guide Star Catalog */
int gscrnum();		/* Read sources by ID number from HST Guide Star Catalog */
int gscbin();		/* Bin sources from HST Guide Star Catalog */
void setgsclass();	/* Set GSC object class */

/* Subroutine to read GSC II catalog over the web (gsc2read.c) */
int gsc2read();		/* Read sources by sky region from GSC II Catalog */
char *gsc2c2t();	/* Convert GSC2 buffer from comma- to tab-separated */
char *gsc2t2t();	/* Clean up GSC2 tab-separated buffer */

/* Subroutine to read SDSS catalog over the web (sdssread.c) */
int sdssread();		/* Read sources by sky region from SDSS Catalog */
char *sdssc2t();	/* Convert SDSS buffer from comma- to tab-separated */

/* Subroutines to read local copy of 2MASS Point Source Catalog (tmcread.c) */
int tmcread();		/* Read sources by sky region from 2MASS Point Source Catalog */
int tmcrnum();		/* Read sources by ID number from 2MASS Point Source Catalog */
int tmcbin();		/* Bin sources from 2MASS Point Source Catalog */

/* Subroutines to read local copies of USNO A and SA catalogs (uacread.c) */
int uacread();		/* Read sources by sky region from USNO A or SA Catalog */
int uacrnum();		/* Read sources by ID number from USNO A or SA Catalog */
int uacbin();		/* Bin sources from USNO A or SA Catalog */
void setuplate();	/* Set USNO catalog plate number to search */
int getuplate();	/* Get USNO catalog plate number to search */

/* Subroutines to read local copies of USNO B catalogs (ubcread.c) */
int ubcread();		/* Read sources by sky region from USNO B Catalog */
int ubcrnum();		/* Read sources by ID number from USNO B Catalog */
int ubcbin();		/* Bin sources from USNO B Catalog */

/* Subroutines to read local copies of USNO UCAC catalogs (ucacread.c) */
int ucacread();		/* Read sources by sky region from USNO UCAC 1 Catalog */
int ucacrnum();		/* Read sources by ID number from USNO UCAC 1 Catalog */
int ucacbin();		/* Bin sources from USNO UCAC 1 Catalog */

/* Subroutines to read local copies of USNO UJ catalog (ucacread.c) */
int ujcread();		/* Read sources by sky region from USNO J Catalog */
int ujcrnum();		/* Read sources by ID number from USNO J Catalog */
int ujcbin();		/* Bin sources from USNO J Catalog */

/* Subroutines to read a local copy of the Tycho-2 catalog (ty2read.c) */
int ty2read();		/* Read sources by sky region from Tycho 2 Catalog */
int ty2rnum();		/* Read sources by ID number from Tycho 2 Catalog */
int ty2bin();		/* Bin sources from Tycho 2 Catalog */

/* Subroutines to read a local copy of the ACT catalog (actread.c) */
int actread();		/* Read sources by sky region from USNO ACT Catalog */
int actrnum();		/* Read sources by ID number from USNO ACT Catalog */
int actbin();		/* Bin sources from USNO ACT Catalog */

/* Subroutines to retrieve solar system objects over the web from SkyBot */
int skybotread();	/* Find solar system objects from SkyBot */
char *skybot2tab();	/* Convert SkyBot returned data to Starbase table */
void setobs();		/* Set observatory using IAU code */
void setobsname();	/* Set IAU code from observatory name */

/* Subroutines to read SAO-TDC binary format catalogs (binread.c) */
int binread();		/* Read sources by sky region from SAO TDC binary format catalog */
int binrnum();		/* Read sources by ID number from SAO TDC binary format catalog */
int binbin();		/* Bin sources from SAO TDC binary format catalog */
int binstar();		/* Read one star entry from binary catalog, 0 if OK */
int isbin();
struct StarCat *binopen();
void binclose();

/* Subroutines for extracting tab table information (tabread.c) */
int tabread();		/* Read sources from tab table catalog */
int tabrnum();		/* Read sources from tab table catalog */
int tabbin();		/* Read sources from tab table catalog */
struct TabTable *tabopen();	/* Open tab table file */
struct StarCat *tabcatopen();	/* Open tab table catalog */
void tabcatclose();	/* Close tab table catalog */
int tabxyread();	/* Read x, y, and magnitude from tab table star list */
void settabkey();	/* Set tab table keyword to read for object */
char *gettabline();	/* Find a specified line in a tab table */
int tabrkey();		/* Keyword values from tab table catalogs */
int tabcol();		/* Find column for name (case-sensitive) */
int tabccol();		/* Find column for name (case-insensitive) */
int tabgetk();		/* Get tab table entries for named column */
int tabgetc();		/* Get tab table entry for named column */
int tabgeti4();		/* Return 4-byte integer from tab table line */
int tabparse();		/* Aeturn column names and positions in tabtable */
double tabgetra();	/* Return right ascension in degrees from tab table*/
double tabgetdec();	/* Return declination in degrees from tab table*/
double tabgetr8();	/* Return double number from tab table line */
void tabclose();	/* Free all arrays left open by tab table structure */
char *gettaberr();	/* Return most recent tab table error message */
int istab();		/* Return 1 if tab table file, else 0 */
int gettabndec();	/* Return number of decimal places in tab catalog ids */

/* Subroutines to read catalogs over the web, from SCAT, HST, ESO, or SDSS servers */
int webread();		/* Read sources by sky region from catalog on the World Wide Web */
int webrnum();		/* Read sources by ID number from catalog on the World Wide Web */
char *webbuff();	/* Read URL into buffer across the web */
struct TabTable *webopen();	/* Open tab table across the web */

/* Subroutines to read DAOPHOT-style catalogs of sources found in an image */
int daoread();		/* Read image source positions from x y mag file */
int daoopen();		/* Open image source position x y mag file */
char *daoline();	/* Read line from image source position x y mag file */

/* Subroutines for sorting tables of star positions and magnitudes from sortstar.c */
void FluxSortStars();	/* Sort image stars by decreasing flux */
void MagSortStars();	/* Sort image stars by increasing magnitude */
void IDSortStars();	/* Sort image stars by increasing ID Number value */
void RASortStars();	/* Sort image stars by increasing right ascension */
void DecSortStars();	/* Sort image stars by increasing declination */
void XSortStars();	/* Sort image stars by increasing image X value */
void YSortStars();	/* Sort image stars by increasing image Y value */
int MergeStars();	/* Merge multiple entries within given radius */

/* Catalog utility subroutines from catutil.c */

/* Subroutines for dealing with catalogs */
int CatCode();		/* Return catalog type code */
int RefCat();		/* Return catalog type code, title, coord. system */
char *CatName();	/* Return catalog name given catalog type code */
char *CatSource();	/* Return catalog source description given catalog type code */
char *ProgCat();	/* Return catalog name given program name used */
char *ProgName();	/* Return program name given program path used */
char *CatName();	/* Return catalog name given catalog type code */
void CatID();		/* Return catalog ID keyword given catalog type code */
void CatNum();		/* Return formatted source number */
int CatNumLen();	/* Return length of source numbers */
int CatNdec();		/* Return number of decimal places in source numbers */
void CatMagName();	/* Return name of specified magnitude */
int CatMagNum();	/* Returns number of magnitude specified by letter as int */
double CatRad();	/* Return default search radius for given catalog */
int tmcid();		/* Return 1 if string is 2MASS ID, else 0 */

int NumNdec();		/* Return number of decimal places in a number */
int StrNdec();		/* Return number of decimal places in numeric string */
void setdateform();	/* Set date format code */
void setlimdeg();	/* Limit output in degrees (1) or hh:mm:ss dd:mm:ss (0) */
char *DateString();		/* Convert epoch to output format */
void SearchLim();	/* Compute limiting RA and Dec */
void RefLim();		/* Compute limiting RA and Dec in new system */
int ageti4();		/* Extract int value from keyword= value in string */
int agetr8();		/* Extract double value from keyword= value in string */
int agets();		/* Extract value from keyword= value in string */
void bv2sp();		/* Approximate main sequence spectral type from B - V */
void moveb();		/* Copy nbytes bytes from source+offs to dest+offd */

/* Subroutines for dealing with ranges */
struct Range *RangeInit();	/* Initialize range structure from string */
int isrange();		/* Return 1 if string is a range of numbers, else 0 */
int rgetn();		/* Return number of values in all ranges */
int rgeti4();		/* Return next number in range as integer */
double rgetr8();	/* Return next number in range as double */
void rstart();		/* Restart range */

/* Subroutines for VOTable output */
int vothead();		/* Print heading for VOTable SCAT output */
void vottail();		/* Terminate VOTable SCAT output */

/* Subroutines for version/date string */
void setrevmsg();	/* Set version/date string */
char *getrevmsg();	/* Return version/date string */

/* Subroutines for fitting and evaluating polynomials */
void polfit();		/* Fit polynomial coefficients */
double polcomp();	/* Evaluate polynomial from polfit coefficients */

#endif  /* __STDC__ */

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif  /* _wcscat_h_ */

/* Sep 22 1998  New header file (star.h)
 * Oct 16 1998  Add more options for ASCII catalogs
 * Oct 20 1998  Add object name to binary files
 * Oct 21 1998	New file (wcscat.h)
 * Oct 26 1998	Combined wcscat.h and star.h
 * Oct 27 1998	Add SAOimage region shapes
 * Nov  9 1998	Add rasorted flag to catalog structure
 * Nov 20 1998	Add support for USNO A-2.0 and SA-2.0 catalogs
 * Dec  8 1998	Add support for the Hipparcos and ACT catalogs
 *
 * Jan 25 1999	Add declarations for tab table access
 * Jan 25 1999	Add declarations for dealing with ranges of numbers
 * Feb  2 1999	Add number of decimal places in star number to StarCat
 * Feb 11 1999	Add coordinate system info to star structure
 * Feb 11 1999	Change starcat.insys to starcat.coorsys for consistency
 * May 14 1999	Update Star and StarCat structure to cover tab tables
 * May 19 1999	Update StarCat structure to include epoch from catalog
 * June 4 1999	Add CatNumLen()
 * Jun 14 1999	Add SearchLim()
 * Jun 30 1999	Add isrange()
 * Jul  1 1999	Add declarations for date/time conversions in dateutil.c
 * Jul  2 1999	Add rstart()
 * Jul 26 1999	Add Yale Bright Star Catalog
 * Aug 16 1999	Add RefLim() to get converted search coordinates right
 * Aug 25 1999	Add ACT catalog
 * Sep 10 1999	Move special case setting from argument list to subroutines
 * Sep 13 1999	Add subroutines to access data structure for single stars
 * Oct  1 1999	Add structure and subroutines for tokenized strings
 * Oct 22 1999	Change cat*() to ctg*() to avoid system conflict
 * Oct 29 1999	Add tabget() subroutines
 * Nov  1 1999	Increase maximum number of tokens on a line from 20 to 100
 * Nov  2 1999	Move date utilities to fitsfile.h
 *
 * Jan 10 2000	Add column names to catalog data structure
 * Jan 11 2000	Add gettabndec()
 * Feb  9 2000	Add proper motion entry information to star data structure
 * Feb 16 2000	Add gettaberr() to return tab table error message
 * Mar  1 2000	Add isfile() and agets() to help with ASCII files
 * Mar  8 2000	Add ProgCat() to return catalog name from program name used
 * Mar  8 2000	Add ProgName() to extract program name from path used
 * Mar 10 2000	Add PropCat() to tell whether a catalog has proper motions
 * Mar 27 2000	Add tabxyread()
 * Apr  3 2000	Add option in catalog structure to ignore extra info
 * May 22 2000	Add Tycho 2 support, bv2sp()
 * May 26 2000	Add separate pointer to header in tab table structure
 * May 26 2000	Add separate pointer to table name in tab table structure
 * Jul 12 2000	Add catalog type code to ctalog data structure
 * Sep 20 2000	Add isacat() to detect ASCII catalog files
 * Sep 25 2000	Add starcat.sptype to flag spectral type in catalog
 * Oct 23 2000	Add USNO plate catalog to catalog type table
 * Oct 26 2000	Add proper motion flags for seconds and arcseconds per century
 * Oct 31 2000	Add proper motion flags for milliseconds per year
 * Nov  2 2000	Add parallax and radial velocity to star structure
 * Nov 21 2000	Add WEBCAT catalog type for tab ctalogs returned from the Web
 * Nov 22 2000	Add webread() and webrnum()
 * Nov 28 2000	Add tabparse()
 * Nov 30 2000	Add spectral type to catalog header; make star->isp 4 char.
 * Dec 13 2000	Add StrNdec() to get number of decimal places in number strings
 * Dec 15 2000	Add CatNdec() to get number of decimal places in source numbers
 * Dec 18 2000	Drop PropCat(), a cludgy proper motion flag
 *
 * Mar 22 2001	Add web search flag in catalog data structure
 * Mar 27 2001	Add shapes in pixels to SAOimage region options
 * May 14 2001	Add 2MASS Point Source Catalog flags
 * May 22 2001	Add declination sorting
 * May 24 2001	Add 2MASS Point Source Catalog subroutines
 * May 29 2001	Add length of star number to catalog structure
 * May 30 2001	Add third magnitude for tab tables to catalog structure
 * Jun 15 2001	Add CatName() and CatID()
 * Jun 19 2001	Add parallax error to catalog and star structures
 * Jun 20 2001	Add webopen(), GSC2, fourth magnitude to star and starcat
 * Jul 12 2001	Add separate web access subroutine, webbuff()
 * Jul 23 2001	Add ageti4() and agetr8()
 * Jul 24 2001	Add polfit() and polcomp()
 * Aug  8 2001	Add keyrv and option to set mprop to 2 to include rv/cz
 * Sep 10 2001	Add entry line and distance from search center to Star
 * Sep 13 2001	Add YSortStars() and SORT_Y
 * Sep 14 2001	Add lbuff to TabTable structure
 * Sep 20 2001	Add CatMagName()
 * Sep 25 2001	Move isfile() to fitsfile.h
 * Oct 16 2001	Add tabdash pointer to tabtable data structure
 *
 * Apr  9 2002	Fix typo in gettaberr() declaration
 * Apr 10 2002	Add CatMagNum()
 * May  6 2002	Increase object name length from 31 to 79 characters
 * May 13 2002	Add NumNdec(), gsc2read(), and gsc2rnum()
 * Aug  6 2002	Make magnitude entries and positions vectors of 10
 * Oct 30 2002	Add epoch keyword and FITS date to StarCat data structure
 *
 * Jan 16 2003	Add USNO-B1.0 catalog
 * Mar 24 2003	Add CatCde() to get only catalog code
 * Apr  3 2003	Add ubcread(), ubcrnum(), and FluxSortStars()
 * Apr  3 2003	Drop gsc2rnum()
 * Apr 14 2003	Add setrevmsg() and getrevmsg()
 * Apr 24 2003	Add UCAC1 and UCAC2, ucacread() and ucacrnum()
 * May 20 2003	Add TMIDR2 for 2MASS PSC Interim Data Release 2
 * Sep 16 2003	Add SORT_MERGE for scat
 * Sep 25 2003	Add *bin() subroutines for catalog binning
 * Dec  3 2003	Add USNO YB6 catalog
 *
 * Jan  5 2004	Add SDSS catalog
 * Jan 12 2004	Add 2MASS Extended Source catalog and size to star structure
 * Jan 14 2004	Add CatSource() subroutine to simplify help message creation
 * Jan 22 2004	Add setlimdeg() to print limit coordinates in degrees
 * Mar 16 2004	Add MergeStars()
 * Apr 23 2004	Add ctgrdate()
 * Aug 31 2004	Increase MAXTOKENS from 100 to 200
 * Sep  2 2004	Increase MAXTOKENS from 200 to 1000
 *
 * Jul 27 2005	Add date format codes and DateString()
 * Aug  5 2005	Add Tycho-2 and 2MASS PSC with magnitude errors
 *
 * Jan  6 2006	Add CatRad() subroutine
 * Mar 17 2006	Make vothead() int as it now returns the number of fields
 * Apr  3 2006	Add tmcid() to check for 2MASS identifiers
 * Apr  3 2006	Add setdateform() to set output date format
 * Apr 12 2006	Add SORT_ID for scat to sort catalog entries by ID number
 * Jun 20 2006	Add IDSortStars()
 *
 * Jan 10 2006	Add ANSI C function prototypes
 * Jan 11 2007	Move token access subroutines to fileutil.c/fitsfile.h
 * Mar 13 2007	Add gsc2c2t() to convert CSV GSC2 buffer to TSV table
 * Mar 13 2007	Add gobj object name to gsc2read()
 * Jul  5 2007	Add SKYBOT=31 to catalog list
 * Jul 13 2007	Add skybotread() and skybot2tab()
 * Jul 18 2007	Add tabccol() and PM_ARCSECHR for SkyBot
 * Nov 28 2007	Add moveb() which used to be local to binread()
 *
 * Oct 24 2008	Add gsct2t() to clean up tab-separated table from STScI CASB
 *
 * Sep 25 2009	Rename moveb() to movebuff()
 * Sep 25 2009	Add UCAC3 as catalog code 32
 * Oct 30 2009	Add position and proper motion error to star structure
 * Nov  2 2009	Add numbers of images and catalogs to star structure
 * Nov  3 2009	Parameterize as MAXNMAG the maximum number of magnitudes
 *
 * Apr 06 2010	Add fillblank argument to agets()
 *
 * May 16 2012	Add valmin and valmax to Range data structure
 *
 * Feb 15 2013	Add UCAC4 to list of catalog codes
 */