2
/* This file, getcol.c, contains routines that read data elements from */
3
/* a FITS image or table. There are generic datatype routines. */
5
/* The FITSIO software was written by William Pence at the High Energy */
6
/* Astrophysic Science Archive Research Center (HEASARC) at the NASA */
7
/* Goddard Space Flight Center. */
11
/*--------------------------------------------------------------------------*/
12
int ffgpxv( fitsfile *fptr, /* I - FITS file pointer */
13
int datatype, /* I - datatype of the value */
14
long *firstpix, /* I - coord of first pixel to read (1s based) */
15
long nelem, /* I - number of values to read */
16
void *nulval, /* I - value for undefined pixels */
17
void *array, /* O - array of values that are returned */
18
int *anynul, /* O - set to 1 if any values are null; else 0 */
19
int *status) /* IO - error status */
21
Read an array of values from the primary array. The datatype of the
22
input array is defined by the 2nd argument. Data conversion
23
and scaling will be performed if necessary (e.g, if the datatype of
24
the FITS array is not the same as the array being read).
25
Undefined elements will be set equal to NULVAL, unless NULVAL=0
26
in which case no checking for undefined values will be performed.
27
ANYNUL is returned with a value of .true. if any pixels are undefined.
32
OFF_T dimsize = 1, firstelem;
34
if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */
37
/* get the size of the image */
38
ffgidm(fptr, &naxis, status);
39
ffgisz(fptr, 9, naxes, status);
41
/* calculate the position of the first element in the array */
43
for (ii=0; ii < naxis; ii++)
45
firstelem += ((firstpix[ii] - 1) * dimsize);
51
the primary array is represented as a binary table:
52
each group of the primary array is a row in the table,
53
where the first column contains the group parameters
54
and the second column contains the image itself.
57
if (datatype == TBYTE)
60
ffgpvb(fptr, 1, firstelem, nelem, 0,
61
(unsigned char *) array, anynul, status);
63
ffgpvb(fptr, 1, firstelem, nelem, *(unsigned char *) nulval,
64
(unsigned char *) array, anynul, status);
66
else if (datatype == TUSHORT)
69
ffgpvui(fptr, 1, firstelem, nelem, 0,
70
(unsigned short *) array, anynul, status);
72
ffgpvui(fptr, 1, firstelem, nelem, *(unsigned short *) nulval,
73
(unsigned short *) array, anynul, status);
75
else if (datatype == TSHORT)
78
ffgpvi(fptr, 1, firstelem, nelem, 0,
79
(short *) array, anynul, status);
81
ffgpvi(fptr, 1, firstelem, nelem, *(short *) nulval,
82
(short *) array, anynul, status);
84
else if (datatype == TUINT)
87
ffgpvuk(fptr, 1, firstelem, nelem, 0,
88
(unsigned int *) array, anynul, status);
90
ffgpvuk(fptr, 1, firstelem, nelem, *(unsigned int *) nulval,
91
(unsigned int *) array, anynul, status);
93
else if (datatype == TINT)
96
ffgpvk(fptr, 1, firstelem, nelem, 0,
97
(int *) array, anynul, status);
99
ffgpvk(fptr, 1, firstelem, nelem, *(int *) nulval,
100
(int *) array, anynul, status);
102
else if (datatype == TULONG)
105
ffgpvuj(fptr, 1, firstelem, nelem, 0,
106
(unsigned long *) array, anynul, status);
108
ffgpvuj(fptr, 1, firstelem, nelem, *(unsigned long *) nulval,
109
(unsigned long *) array, anynul, status);
111
else if (datatype == TLONG)
114
ffgpvj(fptr, 1, firstelem, nelem, 0,
115
(long *) array, anynul, status);
117
ffgpvj(fptr, 1, firstelem, nelem, *(long *) nulval,
118
(long *) array, anynul, status);
120
else if (datatype == TLONGLONG)
123
ffgpvjj(fptr, 1, firstelem, nelem, 0,
124
(LONGLONG *) array, anynul, status);
126
ffgpvjj(fptr, 1, firstelem, nelem, *(LONGLONG *) nulval,
127
(LONGLONG *) array, anynul, status);
129
else if (datatype == TFLOAT)
132
ffgpve(fptr, 1, firstelem, nelem, 0,
133
(float *) array, anynul, status);
135
ffgpve(fptr, 1, firstelem, nelem, *(float *) nulval,
136
(float *) array, anynul, status);
138
else if (datatype == TDOUBLE)
141
ffgpvd(fptr, 1, firstelem, nelem, 0,
142
(double *) array, anynul, status);
145
ffgpvd(fptr, 1, firstelem, nelem, *(double *) nulval,
146
(double *) array, anynul, status);
150
*status = BAD_DATATYPE;
154
/*--------------------------------------------------------------------------*/
155
int ffgpxf( fitsfile *fptr, /* I - FITS file pointer */
156
int datatype, /* I - datatype of the value */
157
long *firstpix, /* I - coord of first pixel to read (1s based) */
158
long nelem, /* I - number of values to read */
159
void *array, /* O - array of values that are returned */
160
char *nullarray, /* O - returned array of null value flags */
161
int *anynul, /* O - set to 1 if any values are null; else 0 */
162
int *status) /* IO - error status */
164
Read an array of values from the primary array. The datatype of the
165
input array is defined by the 2nd argument. Data conversion
166
and scaling will be performed if necessary (e.g, if the datatype of
167
the FITS array is not the same as the array being read).
168
The nullarray values will = 1 if the corresponding array value is null.
169
ANYNUL is returned with a value of .true. if any pixels are undefined.
174
OFF_T dimsize = 1, firstelem;
176
if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */
179
/* get the size of the image */
180
ffgidm(fptr, &naxis, status);
181
ffgisz(fptr, 9, naxes, status);
183
/* calculate the position of the first element in the array */
185
for (ii=0; ii < naxis; ii++)
187
firstelem += ((firstpix[ii] - 1) * dimsize);
188
dimsize *= naxes[ii];
193
the primary array is represented as a binary table:
194
each group of the primary array is a row in the table,
195
where the first column contains the group parameters
196
and the second column contains the image itself.
199
if (datatype == TBYTE)
201
ffgpfb(fptr, 1, firstelem, nelem,
202
(unsigned char *) array, nullarray, anynul, status);
204
else if (datatype == TUSHORT)
206
ffgpfui(fptr, 1, firstelem, nelem,
207
(unsigned short *) array, nullarray, anynul, status);
209
else if (datatype == TSHORT)
211
ffgpfi(fptr, 1, firstelem, nelem,
212
(short *) array, nullarray, anynul, status);
214
else if (datatype == TUINT)
216
ffgpfuk(fptr, 1, firstelem, nelem,
217
(unsigned int *) array, nullarray, anynul, status);
219
else if (datatype == TINT)
221
ffgpfk(fptr, 1, firstelem, nelem,
222
(int *) array, nullarray, anynul, status);
224
else if (datatype == TULONG)
226
ffgpfuj(fptr, 1, firstelem, nelem,
227
(unsigned long *) array, nullarray, anynul, status);
229
else if (datatype == TLONG)
231
ffgpfj(fptr, 1, firstelem, nelem,
232
(long *) array, nullarray, anynul, status);
234
else if (datatype == TLONGLONG)
236
ffgpfjj(fptr, 1, firstelem, nelem,
237
(LONGLONG *) array, nullarray, anynul, status);
239
else if (datatype == TFLOAT)
241
ffgpfe(fptr, 1, firstelem, nelem,
242
(float *) array, nullarray, anynul, status);
244
else if (datatype == TDOUBLE)
246
ffgpfd(fptr, 1, firstelem, nelem,
247
(double *) array, nullarray, anynul, status);
250
*status = BAD_DATATYPE;
254
/*--------------------------------------------------------------------------*/
255
int ffgsv( fitsfile *fptr, /* I - FITS file pointer */
256
int datatype, /* I - datatype of the value */
257
long *blc, /* I - 'bottom left corner' of the subsection */
258
long *trc , /* I - 'top right corner' of the subsection */
259
long *inc, /* I - increment to be applied in each dim. */
260
void *nulval, /* I - value for undefined pixels */
261
void *array, /* O - array of values that are returned */
262
int *anynul, /* O - set to 1 if any values are null; else 0 */
263
int *status) /* IO - error status */
265
Read an section of values from the primary array. The datatype of the
266
input array is defined by the 2nd argument. Data conversion
267
and scaling will be performed if necessary (e.g, if the datatype of
268
the FITS array is not the same as the array being read).
269
Undefined elements will be set equal to NULVAL, unless NULVAL=0
270
in which case no checking for undefined values will be performed.
271
ANYNUL is returned with a value of .true. if any pixels are undefined.
277
if (*status > 0) /* inherit input status value if > 0 */
280
/* get the size of the image */
281
ffgidm(fptr, &naxis, status);
282
ffgisz(fptr, 9, naxes, status);
284
if (datatype == TBYTE)
287
ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, 0,
288
(unsigned char *) array, anynul, status);
290
ffgsvb(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned char *) nulval,
291
(unsigned char *) array, anynul, status);
293
else if (datatype == TUSHORT)
296
ffgsvui(fptr, 1, naxis, naxes, blc, trc, inc, 0,
297
(unsigned short *) array, anynul, status);
299
ffgsvui(fptr, 1, naxis, naxes,blc, trc, inc, *(unsigned short *) nulval,
300
(unsigned short *) array, anynul, status);
302
else if (datatype == TSHORT)
305
ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, 0,
306
(short *) array, anynul, status);
308
ffgsvi(fptr, 1, naxis, naxes, blc, trc, inc, *(short *) nulval,
309
(short *) array, anynul, status);
311
else if (datatype == TUINT)
314
ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, 0,
315
(unsigned int *) array, anynul, status);
317
ffgsvuk(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned int *) nulval,
318
(unsigned int *) array, anynul, status);
320
else if (datatype == TINT)
323
ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, 0,
324
(int *) array, anynul, status);
326
ffgsvk(fptr, 1, naxis, naxes, blc, trc, inc, *(int *) nulval,
327
(int *) array, anynul, status);
329
else if (datatype == TULONG)
332
ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, 0,
333
(unsigned long *) array, anynul, status);
335
ffgsvuj(fptr, 1, naxis, naxes, blc, trc, inc, *(unsigned long *) nulval,
336
(unsigned long *) array, anynul, status);
338
else if (datatype == TLONG)
341
ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, 0,
342
(long *) array, anynul, status);
344
ffgsvj(fptr, 1, naxis, naxes, blc, trc, inc, *(long *) nulval,
345
(long *) array, anynul, status);
347
else if (datatype == TLONGLONG)
350
ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, 0,
351
(LONGLONG *) array, anynul, status);
353
ffgsvjj(fptr, 1, naxis, naxes, blc, trc, inc, *(LONGLONG *) nulval,
354
(LONGLONG *) array, anynul, status);
356
else if (datatype == TFLOAT)
359
ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, 0,
360
(float *) array, anynul, status);
362
ffgsve(fptr, 1, naxis, naxes, blc, trc, inc, *(float *) nulval,
363
(float *) array, anynul, status);
365
else if (datatype == TDOUBLE)
368
ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, 0,
369
(double *) array, anynul, status);
371
ffgsvd(fptr, 1, naxis, naxes, blc, trc, inc, *(double *) nulval,
372
(double *) array, anynul, status);
375
*status = BAD_DATATYPE;
379
/*--------------------------------------------------------------------------*/
380
int ffgpv( fitsfile *fptr, /* I - FITS file pointer */
381
int datatype, /* I - datatype of the value */
382
long firstelem, /* I - first vector element to read (1 = 1st) */
383
long nelem, /* I - number of values to read */
384
void *nulval, /* I - value for undefined pixels */
385
void *array, /* O - array of values that are returned */
386
int *anynul, /* O - set to 1 if any values are null; else 0 */
387
int *status) /* IO - error status */
389
Read an array of values from the primary array. The datatype of the
390
input array is defined by the 2nd argument. Data conversion
391
and scaling will be performed if necessary (e.g, if the datatype of
392
the FITS array is not the same as the array being read).
393
Undefined elements will be set equal to NULVAL, unless NULVAL=0
394
in which case no checking for undefined values will be performed.
395
ANYNUL is returned with a value of .true. if any pixels are undefined.
399
if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */
403
the primary array is represented as a binary table:
404
each group of the primary array is a row in the table,
405
where the first column contains the group parameters
406
and the second column contains the image itself.
409
if (datatype == TBYTE)
412
ffgpvb(fptr, 1, firstelem, nelem, 0,
413
(unsigned char *) array, anynul, status);
415
ffgpvb(fptr, 1, firstelem, nelem, *(unsigned char *) nulval,
416
(unsigned char *) array, anynul, status);
418
else if (datatype == TUSHORT)
421
ffgpvui(fptr, 1, firstelem, nelem, 0,
422
(unsigned short *) array, anynul, status);
424
ffgpvui(fptr, 1, firstelem, nelem, *(unsigned short *) nulval,
425
(unsigned short *) array, anynul, status);
427
else if (datatype == TSHORT)
430
ffgpvi(fptr, 1, firstelem, nelem, 0,
431
(short *) array, anynul, status);
433
ffgpvi(fptr, 1, firstelem, nelem, *(short *) nulval,
434
(short *) array, anynul, status);
436
else if (datatype == TUINT)
439
ffgpvuk(fptr, 1, firstelem, nelem, 0,
440
(unsigned int *) array, anynul, status);
442
ffgpvuk(fptr, 1, firstelem, nelem, *(unsigned int *) nulval,
443
(unsigned int *) array, anynul, status);
445
else if (datatype == TINT)
448
ffgpvk(fptr, 1, firstelem, nelem, 0,
449
(int *) array, anynul, status);
451
ffgpvk(fptr, 1, firstelem, nelem, *(int *) nulval,
452
(int *) array, anynul, status);
454
else if (datatype == TULONG)
457
ffgpvuj(fptr, 1, firstelem, nelem, 0,
458
(unsigned long *) array, anynul, status);
460
ffgpvuj(fptr, 1, firstelem, nelem, *(unsigned long *) nulval,
461
(unsigned long *) array, anynul, status);
463
else if (datatype == TLONG)
466
ffgpvj(fptr, 1, firstelem, nelem, 0,
467
(long *) array, anynul, status);
469
ffgpvj(fptr, 1, firstelem, nelem, *(long *) nulval,
470
(long *) array, anynul, status);
472
else if (datatype == TLONGLONG)
475
ffgpvjj(fptr, 1, firstelem, nelem, 0,
476
(LONGLONG *) array, anynul, status);
478
ffgpvjj(fptr, 1, firstelem, nelem, *(LONGLONG *) nulval,
479
(LONGLONG *) array, anynul, status);
481
else if (datatype == TFLOAT)
484
ffgpve(fptr, 1, firstelem, nelem, 0,
485
(float *) array, anynul, status);
487
ffgpve(fptr, 1, firstelem, nelem, *(float *) nulval,
488
(float *) array, anynul, status);
490
else if (datatype == TDOUBLE)
493
ffgpvd(fptr, 1, firstelem, nelem, 0,
494
(double *) array, anynul, status);
497
ffgpvd(fptr, 1, firstelem, nelem, *(double *) nulval,
498
(double *) array, anynul, status);
502
*status = BAD_DATATYPE;
506
/*--------------------------------------------------------------------------*/
507
int ffgpf( fitsfile *fptr, /* I - FITS file pointer */
508
int datatype, /* I - datatype of the value */
509
long firstelem, /* I - first vector element to read (1 = 1st) */
510
long nelem, /* I - number of values to read */
511
void *array, /* O - array of values that are returned */
512
char *nullarray, /* O - array of null value flags */
513
int *anynul, /* O - set to 1 if any values are null; else 0 */
514
int *status) /* IO - error status */
516
Read an array of values from the primary array. The datatype of the
517
input array is defined by the 2nd argument. Data conversion
518
and scaling will be performed if necessary (e.g, if the datatype of
519
the FITS array is not the same as the array being read).
520
The nullarray values will = 1 if the corresponding array value is null.
521
ANYNUL is returned with a value of .true. if any pixels are undefined.
525
if (*status > 0 || nelem == 0) /* inherit input status value if > 0 */
529
the primary array is represented as a binary table:
530
each group of the primary array is a row in the table,
531
where the first column contains the group parameters
532
and the second column contains the image itself.
535
if (datatype == TBYTE)
537
ffgpfb(fptr, 1, firstelem, nelem,
538
(unsigned char *) array, nullarray, anynul, status);
540
else if (datatype == TUSHORT)
542
ffgpfui(fptr, 1, firstelem, nelem,
543
(unsigned short *) array, nullarray, anynul, status);
545
else if (datatype == TSHORT)
547
ffgpfi(fptr, 1, firstelem, nelem,
548
(short *) array, nullarray, anynul, status);
550
else if (datatype == TUINT)
552
ffgpfuk(fptr, 1, firstelem, nelem,
553
(unsigned int *) array, nullarray, anynul, status);
555
else if (datatype == TINT)
557
ffgpfk(fptr, 1, firstelem, nelem,
558
(int *) array, nullarray, anynul, status);
560
else if (datatype == TULONG)
562
ffgpfuj(fptr, 1, firstelem, nelem,
563
(unsigned long *) array, nullarray, anynul, status);
565
else if (datatype == TLONG)
567
ffgpfj(fptr, 1, firstelem, nelem,
568
(long *) array, nullarray, anynul, status);
570
else if (datatype == TLONGLONG)
572
ffgpfjj(fptr, 1, firstelem, nelem,
573
(LONGLONG *) array, nullarray, anynul, status);
575
else if (datatype == TFLOAT)
577
ffgpfe(fptr, 1, firstelem, nelem,
578
(float *) array, nullarray, anynul, status);
580
else if (datatype == TDOUBLE)
582
ffgpfd(fptr, 1, firstelem, nelem,
583
(double *) array, nullarray, anynul, status);
586
*status = BAD_DATATYPE;
590
/*--------------------------------------------------------------------------*/
591
int ffgcv( fitsfile *fptr, /* I - FITS file pointer */
592
int datatype, /* I - datatype of the value */
593
int colnum, /* I - number of column to write (1 = 1st col) */
594
long firstrow, /* I - first row to write (1 = 1st row) */
595
long firstelem, /* I - first vector element to read (1 = 1st) */
596
long nelem, /* I - number of values to read */
597
void *nulval, /* I - value for undefined pixels */
598
void *array, /* O - array of values that are returned */
599
int *anynul, /* O - set to 1 if any values are null; else 0 */
600
int *status) /* IO - error status */
602
Read an array of values from a table column. The datatype of the
603
input array is defined by the 2nd argument. Data conversion
604
and scaling will be performed if necessary (e.g, if the datatype of
605
the FITS array is not the same as the array being read).
606
Undefined elements will be set equal to NULVAL, unless NULVAL=0
607
in which case no checking for undefined values will be performed.
608
ANYNUL is returned with a value of true if any pixels are undefined.
613
if (*status > 0) /* inherit input status value if > 0 */
616
if (datatype == TBIT)
618
ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status);
620
else if (datatype == TBYTE)
623
ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
624
(unsigned char *) array, cdummy, anynul, status);
626
ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(unsigned char *)
627
nulval, (unsigned char *) array, cdummy, anynul, status);
629
else if (datatype == TUSHORT)
632
ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
633
(unsigned short *) array, cdummy, anynul, status);
635
ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 1,
636
*(unsigned short *) nulval,
637
(unsigned short *) array, cdummy, anynul, status);
639
else if (datatype == TSHORT)
642
ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
643
(short *) array, cdummy, anynul, status);
645
ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(short *)
646
nulval, (short *) array, cdummy, anynul, status);
648
else if (datatype == TUINT)
651
ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
652
(unsigned int *) array, cdummy, anynul, status);
654
ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 1,
655
*(unsigned int *) nulval, (unsigned int *) array, cdummy, anynul,
658
else if (datatype == TINT)
661
ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
662
(int *) array, cdummy, anynul, status);
664
ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(int *)
665
nulval, (int *) array, cdummy, anynul, status);
667
else if (datatype == TULONG)
670
ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
671
(unsigned long *) array, cdummy, anynul, status);
673
ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 1,
674
*(unsigned long *) nulval,
675
(unsigned long *) array, cdummy, anynul, status);
677
else if (datatype == TLONG)
680
ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
681
(long *) array, cdummy, anynul, status);
683
ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(long *)
684
nulval, (long *) array, cdummy, anynul, status);
686
else if (datatype == TLONGLONG)
689
ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0,
690
(LONGLONG *) array, cdummy, anynul, status);
692
ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(LONGLONG *)
693
nulval, (LONGLONG *) array, cdummy, anynul, status);
695
else if (datatype == TFLOAT)
698
ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0.,
699
(float *) array, cdummy, anynul, status);
701
ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(float *)
702
nulval,(float *) array, cdummy, anynul, status);
704
else if (datatype == TDOUBLE)
707
ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, 0.,
708
(double *) array, cdummy, anynul, status);
710
ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 1, *(double *)
711
nulval, (double *) array, cdummy, anynul, status);
713
else if (datatype == TCOMPLEX)
716
ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
717
1, 1, 0., (float *) array, cdummy, anynul, status);
719
ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
720
1, 1, *(float *) nulval, (float *) array, cdummy, anynul, status);
722
else if (datatype == TDBLCOMPLEX)
725
ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
726
1, 1, 0., (double *) array, cdummy, anynul, status);
728
ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
729
1, 1, *(double *) nulval, (double *) array, cdummy, anynul, status);
732
else if (datatype == TLOGICAL)
735
ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, 0,
736
(char *) array, cdummy, anynul, status);
738
ffgcll(fptr, colnum, firstrow, firstelem, nelem, 1, *(char *) nulval,
739
(char *) array, cdummy, anynul, status);
741
else if (datatype == TSTRING)
746
ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1,
747
cdummy, (char **) array, cdummy, anynul, status);
750
ffgcls(fptr, colnum, firstrow, firstelem, nelem, 1, (char *)
751
nulval, (char **) array, cdummy, anynul, status);
754
*status = BAD_DATATYPE;
758
/*--------------------------------------------------------------------------*/
759
int ffgcf( fitsfile *fptr, /* I - FITS file pointer */
760
int datatype, /* I - datatype of the value */
761
int colnum, /* I - number of column to write (1 = 1st col) */
762
long firstrow, /* I - first row to write (1 = 1st row) */
763
long firstelem, /* I - first vector element to read (1 = 1st) */
764
long nelem, /* I - number of values to read */
765
void *array, /* O - array of values that are returned */
766
char *nullarray, /* O - array of null value flags */
767
int *anynul, /* O - set to 1 if any values are null; else 0 */
768
int *status) /* IO - error status */
770
Read an array of values from a table column. The datatype of the
771
input array is defined by the 2nd argument. Data conversion
772
and scaling will be performed if necessary (e.g, if the datatype of
773
the FITS array is not the same as the array being read).
774
ANYNUL is returned with a value of true if any pixels are undefined.
777
void *nulval; /* dummy argument */
780
if (*status > 0) /* inherit input status value if > 0 */
783
nulval = &dnulval; /* set to a harmless value; this is never used */
785
if (datatype == TBIT)
787
ffgcx(fptr, colnum, firstrow, firstelem, nelem, (char *) array, status);
789
else if (datatype == TBYTE)
791
ffgclb(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(unsigned char *)
792
nulval, (unsigned char *) array, nullarray, anynul, status);
794
else if (datatype == TUSHORT)
796
ffgclui(fptr, colnum, firstrow, firstelem, nelem, 1, 2,
797
*(unsigned short *) nulval,
798
(unsigned short *) array, nullarray, anynul, status);
800
else if (datatype == TSHORT)
802
ffgcli(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(short *)
803
nulval, (short *) array, nullarray, anynul, status);
805
else if (datatype == TUINT)
807
ffgcluk(fptr, colnum, firstrow, firstelem, nelem, 1, 2,
808
*(unsigned int *) nulval, (unsigned int *) array, nullarray, anynul,
811
else if (datatype == TINT)
813
ffgclk(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(int *)
814
nulval, (int *) array, nullarray, anynul, status);
816
else if (datatype == TULONG)
818
ffgcluj(fptr, colnum, firstrow, firstelem, nelem, 1, 2,
819
*(unsigned long *) nulval,
820
(unsigned long *) array, nullarray, anynul, status);
822
else if (datatype == TLONG)
824
ffgclj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(long *)
825
nulval, (long *) array, nullarray, anynul, status);
827
else if (datatype == TLONGLONG)
829
ffgcljj(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(LONGLONG *)
830
nulval, (LONGLONG *) array, nullarray, anynul, status);
832
else if (datatype == TFLOAT)
834
ffgcle(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(float *)
835
nulval,(float *) array, nullarray, anynul, status);
837
else if (datatype == TDOUBLE)
839
ffgcld(fptr, colnum, firstrow, firstelem, nelem, 1, 2, *(double *)
840
nulval, (double *) array, nullarray, anynul, status);
842
else if (datatype == TCOMPLEX)
844
ffgcle(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
845
1, 2, *(float *) nulval, (float *) array, nullarray, anynul, status);
847
else if (datatype == TDBLCOMPLEX)
849
ffgcld(fptr, colnum, firstrow, (firstelem - 1) * 2 + 1, nelem * 2,
850
1, 2, *(double *) nulval, (double *) array, nullarray, anynul, status);
853
else if (datatype == TLOGICAL)
855
ffgcll(fptr, colnum, firstrow, firstelem, nelem, 2, *(char *) nulval,
856
(char *) array, nullarray, anynul, status);
858
else if (datatype == TSTRING)
860
ffgcls(fptr, colnum, firstrow, firstelem, nelem, 2, (char *)
861
nulval, (char **) array, nullarray, anynul, status);
864
*status = BAD_DATATYPE;