1 /*  The FITSIO software was written by William Pence at the High Energy    */
2 /*  Astrophysic Science Archive Research Center (HEASARC) at the NASA      */
3 /*  Goddard Space Flight Center.                                           */
4 /*
5 
6 Copyright (Unpublished--all rights reserved under the copyright laws of
7 the United States), U.S. Government as represented by the Administrator
8 of the National Aeronautics and Space Administration.  No copyright is
9 claimed in the United States under Title 17, U.S. Code.
10 
11 Permission to freely use, copy, modify, and distribute this software
12 and its documentation without fee is hereby granted, provided that this
13 copyright notice and disclaimer of warranty appears in all copies.
14 
15 DISCLAIMER:
16 
17 THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,
18 EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
19 ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
20 IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE
22 DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE
23 SOFTWARE WILL BE ERROR FREE.  IN NO EVENT SHALL NASA BE LIABLE FOR ANY
24 DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR
25 CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY
26 CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
27 CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY
28 PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED
29 FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR
30 SERVICES PROVIDED HEREUNDER."
31 
32 */
33 
34 #ifndef _FITSIO_H
35 #define _FITSIO_H
36 
37 #define CFITSIO_VERSION 4.0.0
38 #define CFITSIO_MICRO 0
39 #define CFITSIO_MINOR 0
40 #define CFITSIO_MAJOR 4
41 #define CFITSIO_SONAME 9
42 
43 /* the SONAME is incremented in a new release if the binary shared */
44 /* library (on linux and Mac systems) is not backward compatible */
45 /* with the previous release of CFITSIO */
46 
47 
48 /* CFITS_API is defined below for use on Windows systems.  */
49 /* It is used to identify the public functions which should be exported. */
50 /* This has no effect on non-windows platforms where "WIN32" is not defined */
51 
52 #if defined (WIN32)
53   #if defined(cfitsio_EXPORTS)
54     #define CFITS_API __declspec(dllexport)
55   #else
56     #define CFITS_API  /* __declspec(dllimport) */
57   #endif /* CFITS_API */
58 #else /* defined (WIN32) */
59  #define CFITS_API
60 #endif
61 
62 #include <stdio.h>
63 
64 /* the following was provided by Michael Greason (GSFC) to fix a */
65 /*  C/Fortran compatibility problem on an SGI Altix system running */
66 /*  SGI ProPack 4 [this is a Novell SuSE Enterprise 9 derivative]  */
67 /*  and using the Intel C++ and Fortran compilers (version 9.1)  */
68 #if defined(__INTEL_COMPILER) && defined(__itanium__)
69 #  define mipsFortran 1
70 #  define _MIPS_SZLONG 64
71 #endif
72 
73 #if defined(linux) || defined(__APPLE__) || defined(__sgi)
74 #  include <sys/types.h>  /* apparently needed on debian linux systems */
75 #endif                    /* to define off_t                           */
76 
77 #include <stdlib.h>  /* apparently needed to define size_t with gcc 2.8.1 */
78 #include <limits.h>  /* needed for LLONG_MAX and INT64_MAX definitions */
79 
80 /* Define the datatype for variables which store file offset values. */
81 /* The newer 'off_t' datatype should be used for this purpose, but some */
82 /* older compilers do not recognize this type, in which case we use 'long' */
83 /* instead.  Note that _OFF_T is defined (or not) in stdio.h depending */
84 /* on whether _LARGEFILE_SOURCE is defined in sys/feature_tests.h  */
85 /* (at least on Solaris platforms using cc)  */
86 
87 /*  Debian systems require: "(defined(linux) && defined(__off_t_defined))" */
88 /*  the mingw-w64 compiler requires: "(defined(__MINGW32__) && defined(_OFF_T_DEFINED))" */
89 #if defined(_OFF_T) \
90     || (defined(linux) && defined(__off_t_defined)) \
91     || (defined(__MINGW32__) && defined(_OFF_T_DEFINED)) \
92     || defined(_MIPS_SZLONG) || defined(__APPLE__) || defined(_AIX)
93 #    define OFF_T off_t
94 #elif defined(__BORLANDC__) || (defined(_MSC_VER) && (_MSC_VER>= 1400))
95 #    define OFF_T long long
96 #else
97 #    define OFF_T long
98 #endif
99 
100 /* this block determines if the the string function name is
101     strtol or strtoll, and whether to use %ld or %lld in printf statements */
102 
103 /*
104    The following 2 cases for that Athon64 were removed on 4 Jan 2006;
105    they appear to be incorrect now that LONGLONG is always typedef'ed
106    to 'long long'
107     ||  defined(__ia64__)   \
108     ||  defined(__x86_64__) \
109 */
110 #if (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \
111     ||  defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__))  \
112     ||  defined(__powerpc64__) || defined(__64BIT__) \
113     ||  (defined(_MIPS_SZLONG) &&  _MIPS_SZLONG == 64) \
114     ||  defined( _MSC_VER)|| defined(__BORLANDC__)
115 
116 #   define USE_LL_SUFFIX 0
117 #else
118 #   define USE_LL_SUFFIX 1
119 #endif
120 
121 /*
122    Determine what 8-byte integer data type is available.
123   'long long' is now supported by most compilers, but
124   older MS Visual C++ compilers before V7.0 use '__int64' instead.
125 */
126 
127 #ifndef LONGLONG_TYPE   /* this may have been previously defined */
128 #if defined(_MSC_VER)   /* Microsoft Visual C++ */
129 
130 #if (_MSC_VER < 1300)   /* versions earlier than V7.0 do not have 'long long' */
131     typedef __int64 LONGLONG;
132     typedef unsigned __int64 ULONGLONG;
133 
134 #else                   /* newer versions do support 'long long' */
135     typedef long long LONGLONG;
136     typedef unsigned long long ULONGLONG;
137 
138 #endif
139 
140 #elif defined( __BORLANDC__)  /* for the Borland 5.5 compiler, in particular */
141     typedef __int64 LONGLONG;
142     typedef unsigned __int64 ULONGLONG;
143 #else
144     typedef long long LONGLONG;
145     typedef unsigned long long ULONGLONG;
146 #endif
147 
148 #define LONGLONG_TYPE
149 #endif
150 
151 #ifndef LONGLONG_MAX
152 
153 #ifdef LLONG_MAX
154 /* Linux and Solaris definition */
155 #define LONGLONG_MAX LLONG_MAX
156 #define LONGLONG_MIN LLONG_MIN
157 
158 #elif defined(LONG_LONG_MAX)
159 #define LONGLONG_MAX LONG_LONG_MAX
160 #define LONGLONG_MIN LONG_LONG_MIN
161 
162 #elif defined(__LONG_LONG_MAX__)
163 /* Mac OS X & CYGWIN defintion */
164 #define LONGLONG_MAX __LONG_LONG_MAX__
165 #define LONGLONG_MIN (-LONGLONG_MAX -1LL)
166 
167 #elif defined(INT64_MAX)
168 /* windows definition */
169 #define LONGLONG_MAX INT64_MAX
170 #define LONGLONG_MIN INT64_MIN
171 
172 #elif defined(_I64_MAX)
173 /* windows definition */
174 #define LONGLONG_MAX _I64_MAX
175 #define LONGLONG_MIN _I64_MIN
176 
177 #elif (defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )) \
178     ||  defined(__sparcv9)  \
179     ||  defined(__ia64__)   \
180     ||  defined(__x86_64__) \
181     ||  defined(_SX)        \
182     ||  defined(__powerpc64__) || defined(__64BIT__) \
183     ||  (defined(_MIPS_SZLONG) &&  _MIPS_SZLONG == 64)
184 /* sizeof(long) = 64 */
185 #define LONGLONG_MAX  9223372036854775807L /* max 64-bit integer */
186 #define LONGLONG_MIN (-LONGLONG_MAX -1L)   /* min 64-bit integer */
187 
188 #else
189 /*  define a default value, even if it is never used */
190 #define LONGLONG_MAX  9223372036854775807LL /* max 64-bit integer */
191 #define LONGLONG_MIN (-LONGLONG_MAX -1LL)   /* min 64-bit integer */
192 
193 #endif
194 #endif  /* end of ndef LONGLONG_MAX section */
195 
196 
197 /* ================================================================= */
198 
199 
200 /*  The following exclusion if __CINT__ is defined is needed for ROOT */
201 #ifndef __CINT__
202 #include "longnam.h"
203 #endif
204 
205 #define NIOBUF  40  /* number of IO buffers to create (default = 40) */
206           /* !! Significantly increasing NIOBUF may degrade performance !! */
207 
208 #define IOBUFLEN 2880    /* size in bytes of each IO buffer (DONT CHANGE!) */
209 
210 /* global variables */
211 
212 #define FLEN_FILENAME 1025 /* max length of a filename  */
213 #define FLEN_KEYWORD   75  /* max length of a keyword (HIERARCH convention) */
214 #define FLEN_CARD      81  /* length of a FITS header card */
215 #define FLEN_VALUE     71  /* max length of a keyword value string */
216 #define FLEN_COMMENT   73  /* max length of a keyword comment string */
217 #define FLEN_ERRMSG    81  /* max length of a FITSIO error message */
218 #define FLEN_STATUS    31  /* max length of a FITSIO status text string */
219 
220 #define TBIT          1  /* codes for FITS table data types */
221 #define TBYTE        11
222 #define TSBYTE       12
223 #define TLOGICAL     14
224 #define TSTRING      16
225 #define TUSHORT      20
226 #define TSHORT       21
227 #define TUINT        30
228 #define TINT         31
229 #define TULONG       40
230 #define TLONG        41
231 #define TINT32BIT    41  /* used when returning datatype of a column */
232 #define TFLOAT       42
233 #define TULONGLONG   80
234 #define TLONGLONG    81
235 #define TDOUBLE      82
236 #define TCOMPLEX     83
237 #define TDBLCOMPLEX 163
238 
239 #define TYP_STRUC_KEY 10
240 #define TYP_CMPRS_KEY 20
241 #define TYP_SCAL_KEY  30
242 #define TYP_NULL_KEY  40
243 #define TYP_DIM_KEY   50
244 #define TYP_RANG_KEY  60
245 #define TYP_UNIT_KEY  70
246 #define TYP_DISP_KEY  80
247 #define TYP_HDUID_KEY 90
248 #define TYP_CKSUM_KEY 100
249 #define TYP_WCS_KEY   110
250 #define TYP_REFSYS_KEY 120
251 #define TYP_COMM_KEY  130
252 #define TYP_CONT_KEY  140
253 #define TYP_USER_KEY  150
254 
255 
256 #define INT32BIT int  /* 32-bit integer datatype.  Currently this       */
257                       /* datatype is an 'int' on all useful platforms   */
258                       /* however, it is possible that that are cases    */
259                       /* where 'int' is a 2-byte integer, in which case */
260                       /* INT32BIT would need to be defined as 'long'.   */
261 
262 #define BYTE_IMG      8  /* BITPIX code values for FITS image types */
263 #define SHORT_IMG    16
264 #define LONG_IMG     32
265 #define LONGLONG_IMG 64
266 #define FLOAT_IMG   -32
267 #define DOUBLE_IMG  -64
268                          /* The following 2 codes are not true FITS         */
269                          /* datatypes; these codes are only used internally */
270                          /* within cfitsio to make it easier for users      */
271                          /* to deal with unsigned integers.                 */
272 #define SBYTE_IMG     10
273 #define USHORT_IMG    20
274 #define ULONG_IMG     40
275 #define ULONGLONG_IMG 80
276 
277 #define IMAGE_HDU  0  /* Primary Array or IMAGE HDU */
278 #define ASCII_TBL  1  /* ASCII table HDU  */
279 #define BINARY_TBL 2  /* Binary table HDU */
280 #define ANY_HDU   -1  /* matches any HDU type */
281 
282 #define READONLY  0    /* options when opening a file */
283 #define READWRITE 1
284 
285 /* adopt a hopefully obscure number to use as a null value flag */
286 /* could be problems if the FITS files contain data with these values */
287 #define FLOATNULLVALUE -9.11912E-36F
288 #define DOUBLENULLVALUE -9.1191291391491E-36
289 
290 /* compression algorithm codes */
291 #define NO_DITHER -1
292 #define SUBTRACTIVE_DITHER_1 1
293 #define SUBTRACTIVE_DITHER_2 2
294 #define MAX_COMPRESS_DIM     6
295 #define RICE_1      11
296 #define GZIP_1      21
297 #define GZIP_2      22
298 #define PLIO_1      31
299 #define HCOMPRESS_1 41
300 #define BZIP2_1     51  /* not publicly supported; only for test purposes */
301 #define NOCOMPRESS  -1
302 
303 #ifndef TRUE
304 #define TRUE 1
305 #endif
306 
307 #ifndef FALSE
308 #define FALSE 0
309 #endif
310 
311 #define CASESEN   1   /* do case-sensitive string match */
312 #define CASEINSEN 0   /* do case-insensitive string match */
313 
314 #define GT_ID_ALL_URI  0   /* hierarchical grouping parameters */
315 #define GT_ID_REF      1
316 #define GT_ID_POS      2
317 #define GT_ID_ALL      3
318 #define GT_ID_REF_URI 11
319 #define GT_ID_POS_URI 12
320 
321 #define OPT_RM_GPT      0
322 #define OPT_RM_ENTRY    1
323 #define OPT_RM_MBR      2
324 #define OPT_RM_ALL      3
325 
326 #define OPT_GCP_GPT     0
327 #define OPT_GCP_MBR     1
328 #define OPT_GCP_ALL     2
329 
330 #define OPT_MCP_ADD     0
331 #define OPT_MCP_NADD    1
332 #define OPT_MCP_REPL    2
333 #define OPT_MCP_MOV     3
334 
335 #define OPT_MRG_COPY    0
336 #define OPT_MRG_MOV     1
337 
338 #define OPT_CMT_MBR      1
339 #define OPT_CMT_MBR_DEL 11
340 
341 typedef struct        /* structure used to store table column information */
342 {
343     char ttype[70];   /* column name = FITS TTYPEn keyword; */
344     LONGLONG tbcol;       /* offset in row to first byte of each column */
345     int  tdatatype;   /* datatype code of each column */
346     LONGLONG trepeat;    /* repeat count of column; number of elements */
347     double tscale;    /* FITS TSCALn linear scaling factor */
348     double tzero;     /* FITS TZEROn linear scaling zero point */
349     LONGLONG tnull;   /* FITS null value for int image or binary table cols */
350     char strnull[20]; /* FITS null value string for ASCII table columns */
351     char tform[10];   /* FITS tform keyword value  */
352     long  twidth;     /* width of each ASCII table column */
353 }tcolumn;
354 
355 #define VALIDSTRUC 555  /* magic value used to identify if structure is valid */
356 
357 typedef struct      /* structure used to store basic FITS file information */
358 {
359     int filehandle;   /* handle returned by the file open function */
360     int driver;       /* defines which set of I/O drivers should be used */
361     int open_count;   /* number of opened 'fitsfiles' using this structure */
362     char *filename;   /* file name */
363     int validcode;    /* magic value used to verify that structure is valid */
364     int only_one;     /* flag meaning only copy the specified extension */
365     int noextsyntax;  /* flag for file opened with request to ignore extended syntax*/
366     LONGLONG filesize; /* current size of the physical disk file in bytes */
367     LONGLONG logfilesize; /* logical size of file, including unflushed buffers */
368     int lasthdu;      /* is this the last HDU in the file? 0 = no, else yes */
369     LONGLONG bytepos; /* current logical I/O pointer position in file */
370     LONGLONG io_pos;  /* current I/O pointer position in the physical file */
371     int curbuf;       /* number of I/O buffer currently in use */
372     int curhdu;       /* current HDU number; 0 = primary array */
373     int hdutype;      /* 0 = primary array, 1 = ASCII table, 2 = binary table */
374     int writemode;    /* 0 = readonly, 1 = readwrite */
375     int maxhdu;       /* highest numbered HDU known to exist in the file */
376     int MAXHDU;       /* dynamically allocated dimension of headstart array */
377     LONGLONG *headstart; /* byte offset in file to start of each HDU */
378     LONGLONG headend;   /* byte offest in file to end of the current HDU header */
379     LONGLONG ENDpos;    /* byte offest to where the END keyword was last written */
380     LONGLONG nextkey;   /* byte offset in file to beginning of next keyword */
381     LONGLONG datastart; /* byte offset in file to start of the current data unit */
382     int imgdim;         /* dimension of image; cached for fast access */
383     LONGLONG imgnaxis[99]; /* length of each axis; cached for fast access */
384     int tfield;          /* number of fields in the table (primary array has 2 */
385     int startcol;        /* used by ffgcnn to record starting column number */
386     LONGLONG origrows;   /* original number of rows (value of NAXIS2 keyword)  */
387     LONGLONG numrows;    /* number of rows in the table (dynamically updated) */
388     LONGLONG rowlength;  /* length of a table row or image size (bytes) */
389     tcolumn *tableptr;   /* pointer to the table structure */
390     LONGLONG heapstart;  /* heap start byte relative to start of data unit */
391     LONGLONG heapsize;   /* size of the heap, in bytes */
392 
393          /* the following elements are related to compressed images */
394 
395     /* these record the 'requested' options to be used when the image is compressed */
396     int request_compress_type;  /* requested image compression algorithm */
397     long request_tilesize[MAX_COMPRESS_DIM]; /* requested tiling size */
398     float request_quantize_level;  /* requested quantize level */
399     int request_quantize_method ;  /* requested  quantizing method */
400     int request_dither_seed;     /* starting offset into the array of random dithering */
401     int request_lossy_int_compress; /* lossy compress integer image as if float image? */
402     int request_huge_hdu;          /* use '1Q' rather then '1P' variable length arrays */
403     float request_hcomp_scale;     /* requested HCOMPRESS scale factor */
404     int request_hcomp_smooth;      /* requested HCOMPRESS smooth parameter */
405 
406     /* these record the actual options that were used when the image was compressed */
407     int compress_type;      /* type of compression algorithm */
408     long tilesize[MAX_COMPRESS_DIM]; /* size of compression tiles */
409     float quantize_level;   /* floating point quantization level */
410     int quantize_method;   /* floating point pixel quantization algorithm */
411     int dither_seed;      /* starting offset into the array of random dithering */
412 
413     /* other compression parameters */
414     int compressimg; /* 1 if HDU contains a compressed image, else 0 */
415     char zcmptype[12];      /* compression type string */
416     int zbitpix;            /* FITS data type of image (BITPIX) */
417     int zndim;              /* dimension of image */
418     long znaxis[MAX_COMPRESS_DIM];  /* length of each axis */
419     long maxtilelen;        /* max number of pixels in each image tile */
420     long maxelem;	    /* maximum byte length of tile compressed arrays */
421 
422     int cn_compressed;	    /* column number for COMPRESSED_DATA column */
423     int cn_uncompressed;    /* column number for UNCOMPRESSED_DATA column */
424     int cn_gzip_data;       /* column number for GZIP2 lossless compressed data */
425     int cn_zscale;	    /* column number for ZSCALE column */
426     int cn_zzero;	    /* column number for ZZERO column */
427     int cn_zblank;          /* column number for the ZBLANK column */
428 
429     double zscale;          /* scaling value, if same for all tiles */
430     double zzero;           /* zero pt, if same for all tiles */
431     double cn_bscale;       /* value of the BSCALE keyword in header */
432     double cn_bzero;        /* value of the BZERO keyword (may be reset) */
433     double cn_actual_bzero; /* actual value of the BZERO keyword  */
434     int zblank;             /* value for null pixels, if not a column */
435 
436     int rice_blocksize;     /* first compression parameter: Rice pixels/block */
437     int rice_bytepix;       /* 2nd compression parameter:   Rice bytes/pixel */
438     float hcomp_scale;      /* 1st hcompress compression parameter */
439     int hcomp_smooth;       /* 2nd hcompress compression parameter */
440 
441     int  *tilerow;          /* row number of the array of uncompressed tiledata */
442     long *tiledatasize;     /* length of the array of tile data in bytes */
443     int *tiletype;          /* datatype of the array of tile (TINT, TSHORT, etc) */
444     void **tiledata;        /* array of uncompressed tile of data, for row *tilerow */
445     void **tilenullarray;   /* array of optional array of null value flags */
446     int *tileanynull;       /* anynulls in the array of tile? */
447 
448     char *iobuffer;         /* pointer to FITS file I/O buffers */
449     long bufrecnum[NIOBUF]; /* file record number of each of the buffers */
450     int dirty[NIOBUF];     /* has the corresponding buffer been modified? */
451     int ageindex[NIOBUF];  /* relative age of each buffer */
452 } FITSfile;
453 
454 typedef struct         /* structure used to store basic HDU information */
455 {
456     int HDUposition;  /* HDU position in file; 0 = first HDU */
457     FITSfile *Fptr;   /* pointer to FITS file structure */
458 }fitsfile;
459 
460 typedef struct  /* structure for the iterator function column information */
461 {
462      /* elements required as input to fits_iterate_data: */
463 
464     fitsfile *fptr;     /* pointer to the HDU containing the column */
465     int      colnum;    /* column number in the table (use name if < 1) */
466     char     colname[70]; /* name (= TTYPEn value) of the column (optional) */
467     int      datatype;  /* output datatype (converted if necessary  */
468     int      iotype;    /* = InputCol, InputOutputCol, or OutputCol */
469 
470     /* output elements that may be useful for the work function: */
471 
472     void     *array;    /* pointer to the array (and the null value) */
473     long     repeat;    /* binary table vector repeat value */
474     long     tlmin;     /* legal minimum data value */
475     long     tlmax;     /* legal maximum data value */
476     char     tunit[70]; /* physical unit string */
477     char     tdisp[70]; /* suggested display format */
478 
479 } iteratorCol;
480 
481 #define InputCol         0  /* flag for input only iterator column       */
482 #define InputOutputCol   1  /* flag for input and output iterator column */
483 #define OutputCol        2  /* flag for output only iterator column      */
484 
485 /*=============================================================================
486 *
487 *       The following wtbarr typedef is used in the fits_read_wcstab() routine,
488 *       which is intended for use with the WCSLIB library written by Mark
489 *       Calabretta, http://www.atnf.csiro.au/~mcalabre/index.html
490 *
491 *       In order to maintain WCSLIB and CFITSIO as independent libraries it
492 *       was not permissible for any CFITSIO library code to include WCSLIB
493 *       header files, or vice versa.  However, the CFITSIO function
494 *       fits_read_wcstab() accepts an array of structs defined by wcs.h within
495 *       WCSLIB.  The problem then was to define this struct within fitsio.h
496 *       without including wcs.h, especially noting that wcs.h will often (but
497 *       not always) be included together with fitsio.h in an applications
498 *       program that uses fits_read_wcstab().
499 *
500 *       Of the various possibilities, the solution adopted was for WCSLIB to
501 *       define "struct wtbarr" while fitsio.h defines "typedef wtbarr", a
502 *       untagged struct with identical members.  This allows both wcs.h and
503 *       fitsio.h to define a wtbarr data type without conflict by virtue of
504 *       the fact that structure tags and typedef names share different
505 *       namespaces in C. Therefore, declarations within WCSLIB look like
506 *
507 *          struct wtbarr *w;
508 *
509 *       while within CFITSIO they are simply
510 *
511 *          wtbarr *w;
512 *
513 *       but as suggested by the commonality of the names, these are really the
514 *       same aggregate data type.  However, in passing a (struct wtbarr *) to
515 *       fits_read_wcstab() a cast to (wtbarr *) is formally required.
516 *===========================================================================*/
517 
518 #ifndef WCSLIB_GETWCSTAB
519 #define WCSLIB_GETWCSTAB
520 
521 typedef struct {
522    int  i;                      /* Image axis number.                       */
523    int  m;                      /* Array axis number for index vectors.     */
524    int  kind;                   /* Array type, 'c' (coord) or 'i' (index).  */
525    char extnam[72];             /* EXTNAME of binary table extension.       */
526    int  extver;                 /* EXTVER  of binary table extension.       */
527    int  extlev;                 /* EXTLEV  of binary table extension.       */
528    char ttype[72];              /* TTYPEn of column containing the array.   */
529    long row;                    /* Table row number.                        */
530    int  ndim;                   /* Expected array dimensionality.           */
531    int  *dimlen;                /* Where to write the array axis lengths.   */
532    double **arrayp;             /* Where to write the address of the array  */
533                                 /* allocated to store the array.            */
534 } wtbarr;
535 
536 /*  The following exclusion if __CINT__ is defined is needed for ROOT */
537 #ifndef __CINT__
538 /*  the following 3 lines are needed to support C++ compilers */
539 #ifdef __cplusplus
540 extern "C" {
541 #endif
542 #endif
543 
544 int CFITS_API fits_read_wcstab(fitsfile *fptr, int nwtb, wtbarr *wtb, int *status);
545 
546 /*  The following exclusion if __CINT__ is defined is needed for ROOT */
547 #ifndef __CINT__
548 #ifdef __cplusplus
549 }
550 #endif
551 #endif
552 
553 #endif /* WCSLIB_GETWCSTAB */
554 
555 /* error status codes */
556 
557 #define CREATE_DISK_FILE -106 /* create disk file, without extended filename syntax */
558 #define OPEN_DISK_FILE   -105 /* open disk file, without extended filename syntax */
559 #define SKIP_TABLE       -104 /* move to 1st image when opening file */
560 #define SKIP_IMAGE       -103 /* move to 1st table when opening file */
561 #define SKIP_NULL_PRIMARY -102 /* skip null primary array when opening file */
562 #define USE_MEM_BUFF     -101  /* use memory buffer when opening file */
563 #define OVERFLOW_ERR      -11  /* overflow during datatype conversion */
564 #define PREPEND_PRIMARY    -9  /* used in ffiimg to insert new primary array */
565 #define SAME_FILE         101  /* input and output files are the same */
566 #define TOO_MANY_FILES    103  /* tried to open too many FITS files */
567 #define FILE_NOT_OPENED   104  /* could not open the named file */
568 #define FILE_NOT_CREATED  105  /* could not create the named file */
569 #define WRITE_ERROR       106  /* error writing to FITS file */
570 #define END_OF_FILE       107  /* tried to move past end of file */
571 #define READ_ERROR        108  /* error reading from FITS file */
572 #define FILE_NOT_CLOSED   110  /* could not close the file */
573 #define ARRAY_TOO_BIG     111  /* array dimensions exceed internal limit */
574 #define READONLY_FILE     112  /* Cannot write to readonly file */
575 #define MEMORY_ALLOCATION 113  /* Could not allocate memory */
576 #define BAD_FILEPTR       114  /* invalid fitsfile pointer */
577 #define NULL_INPUT_PTR    115  /* NULL input pointer to routine */
578 #define SEEK_ERROR        116  /* error seeking position in file */
579 #define BAD_NETTIMEOUT    117  /* bad value for file download timeout setting */
580 
581 #define BAD_URL_PREFIX    121  /* invalid URL prefix on file name */
582 #define TOO_MANY_DRIVERS  122  /* tried to register too many IO drivers */
583 #define DRIVER_INIT_FAILED 123  /* driver initialization failed */
584 #define NO_MATCHING_DRIVER 124  /* matching driver is not registered */
585 #define URL_PARSE_ERROR    125  /* failed to parse input file URL */
586 #define RANGE_PARSE_ERROR  126  /* failed to parse input file URL */
587 
588 #define	SHARED_ERRBASE	(150)
589 #define	SHARED_BADARG	(SHARED_ERRBASE + 1)
590 #define	SHARED_NULPTR	(SHARED_ERRBASE + 2)
591 #define	SHARED_TABFULL	(SHARED_ERRBASE + 3)
592 #define	SHARED_NOTINIT	(SHARED_ERRBASE + 4)
593 #define	SHARED_IPCERR	(SHARED_ERRBASE + 5)
594 #define	SHARED_NOMEM	(SHARED_ERRBASE + 6)
595 #define	SHARED_AGAIN	(SHARED_ERRBASE + 7)
596 #define	SHARED_NOFILE	(SHARED_ERRBASE + 8)
597 #define	SHARED_NORESIZE	(SHARED_ERRBASE + 9)
598 
599 #define HEADER_NOT_EMPTY  201  /* header already contains keywords */
600 #define KEY_NO_EXIST      202  /* keyword not found in header */
601 #define KEY_OUT_BOUNDS    203  /* keyword record number is out of bounds */
602 #define VALUE_UNDEFINED   204  /* keyword value field is blank */
603 #define NO_QUOTE          205  /* string is missing the closing quote */
604 #define BAD_INDEX_KEY     206  /* illegal indexed keyword name */
605 #define BAD_KEYCHAR       207  /* illegal character in keyword name or card */
606 #define BAD_ORDER         208  /* required keywords out of order */
607 #define NOT_POS_INT       209  /* keyword value is not a positive integer */
608 #define NO_END            210  /* couldn't find END keyword */
609 #define BAD_BITPIX        211  /* illegal BITPIX keyword value*/
610 #define BAD_NAXIS         212  /* illegal NAXIS keyword value */
611 #define BAD_NAXES         213  /* illegal NAXISn keyword value */
612 #define BAD_PCOUNT        214  /* illegal PCOUNT keyword value */
613 #define BAD_GCOUNT        215  /* illegal GCOUNT keyword value */
614 #define BAD_TFIELDS       216  /* illegal TFIELDS keyword value */
615 #define NEG_WIDTH         217  /* negative table row size */
616 #define NEG_ROWS          218  /* negative number of rows in table */
617 #define COL_NOT_FOUND     219  /* column with this name not found in table */
618 #define BAD_SIMPLE        220  /* illegal value of SIMPLE keyword  */
619 #define NO_SIMPLE         221  /* Primary array doesn't start with SIMPLE */
620 #define NO_BITPIX         222  /* Second keyword not BITPIX */
621 #define NO_NAXIS          223  /* Third keyword not NAXIS */
622 #define NO_NAXES          224  /* Couldn't find all the NAXISn keywords */
623 #define NO_XTENSION       225  /* HDU doesn't start with XTENSION keyword */
624 #define NOT_ATABLE        226  /* the CHDU is not an ASCII table extension */
625 #define NOT_BTABLE        227  /* the CHDU is not a binary table extension */
626 #define NO_PCOUNT         228  /* couldn't find PCOUNT keyword */
627 #define NO_GCOUNT         229  /* couldn't find GCOUNT keyword */
628 #define NO_TFIELDS        230  /* couldn't find TFIELDS keyword */
629 #define NO_TBCOL          231  /* couldn't find TBCOLn keyword */
630 #define NO_TFORM          232  /* couldn't find TFORMn keyword */
631 #define NOT_IMAGE         233  /* the CHDU is not an IMAGE extension */
632 #define BAD_TBCOL         234  /* TBCOLn keyword value < 0 or > rowlength */
633 #define NOT_TABLE         235  /* the CHDU is not a table */
634 #define COL_TOO_WIDE      236  /* column is too wide to fit in table */
635 #define COL_NOT_UNIQUE    237  /* more than 1 column name matches template */
636 #define BAD_ROW_WIDTH     241  /* sum of column widths not = NAXIS1 */
637 #define UNKNOWN_EXT       251  /* unrecognizable FITS extension type */
638 #define UNKNOWN_REC       252  /* unrecognizable FITS record */
639 #define END_JUNK          253  /* END keyword is not blank */
640 #define BAD_HEADER_FILL   254  /* Header fill area not blank */
641 #define BAD_DATA_FILL     255  /* Data fill area not blank or zero */
642 #define BAD_TFORM         261  /* illegal TFORM format code */
643 #define BAD_TFORM_DTYPE   262  /* unrecognizable TFORM datatype code */
644 #define BAD_TDIM          263  /* illegal TDIMn keyword value */
645 #define BAD_HEAP_PTR      264  /* invalid BINTABLE heap address */
646 
647 #define BAD_HDU_NUM       301  /* HDU number < 1 or > MAXHDU */
648 #define BAD_COL_NUM       302  /* column number < 1 or > tfields */
649 #define NEG_FILE_POS      304  /* tried to move before beginning of file  */
650 #define NEG_BYTES         306  /* tried to read or write negative bytes */
651 #define BAD_ROW_NUM       307  /* illegal starting row number in table */
652 #define BAD_ELEM_NUM      308  /* illegal starting element number in vector */
653 #define NOT_ASCII_COL     309  /* this is not an ASCII string column */
654 #define NOT_LOGICAL_COL   310  /* this is not a logical datatype column */
655 #define BAD_ATABLE_FORMAT 311  /* ASCII table column has wrong format */
656 #define BAD_BTABLE_FORMAT 312  /* Binary table column has wrong format */
657 #define NO_NULL           314  /* null value has not been defined */
658 #define NOT_VARI_LEN      317  /* this is not a variable length column */
659 #define BAD_DIMEN         320  /* illegal number of dimensions in array */
660 #define BAD_PIX_NUM       321  /* first pixel number greater than last pixel */
661 #define ZERO_SCALE        322  /* illegal BSCALE or TSCALn keyword = 0 */
662 #define NEG_AXIS          323  /* illegal axis length < 1 */
663 
664 #define NOT_GROUP_TABLE         340
665 #define HDU_ALREADY_MEMBER      341
666 #define MEMBER_NOT_FOUND        342
667 #define GROUP_NOT_FOUND         343
668 #define BAD_GROUP_ID            344
669 #define TOO_MANY_HDUS_TRACKED   345
670 #define HDU_ALREADY_TRACKED     346
671 #define BAD_OPTION              347
672 #define IDENTICAL_POINTERS      348
673 #define BAD_GROUP_ATTACH        349
674 #define BAD_GROUP_DETACH        350
675 
676 #define BAD_I2C           401  /* bad int to formatted string conversion */
677 #define BAD_F2C           402  /* bad float to formatted string conversion */
678 #define BAD_INTKEY        403  /* can't interprete keyword value as integer */
679 #define BAD_LOGICALKEY    404  /* can't interprete keyword value as logical */
680 #define BAD_FLOATKEY      405  /* can't interprete keyword value as float */
681 #define BAD_DOUBLEKEY     406  /* can't interprete keyword value as double */
682 #define BAD_C2I           407  /* bad formatted string to int conversion */
683 #define BAD_C2F           408  /* bad formatted string to float conversion */
684 #define BAD_C2D           409  /* bad formatted string to double conversion */
685 #define BAD_DATATYPE      410  /* bad keyword datatype code */
686 #define BAD_DECIM         411  /* bad number of decimal places specified */
687 #define NUM_OVERFLOW      412  /* overflow during datatype conversion */
688 
689 # define DATA_COMPRESSION_ERR 413  /* error in imcompress routines */
690 # define DATA_DECOMPRESSION_ERR 414 /* error in imcompress routines */
691 # define NO_COMPRESSED_TILE  415 /* compressed tile doesn't exist */
692 
693 #define BAD_DATE          420  /* error in date or time conversion */
694 
695 #define PARSE_SYNTAX_ERR  431  /* syntax error in parser expression */
696 #define PARSE_BAD_TYPE    432  /* expression did not evaluate to desired type */
697 #define PARSE_LRG_VECTOR  433  /* vector result too large to return in array */
698 #define PARSE_NO_OUTPUT   434  /* data parser failed not sent an out column */
699 #define PARSE_BAD_COL     435  /* bad data encounter while parsing column */
700 #define PARSE_BAD_OUTPUT  436  /* Output file not of proper type          */
701 
702 #define ANGLE_TOO_BIG     501  /* celestial angle too large for projection */
703 #define BAD_WCS_VAL       502  /* bad celestial coordinate or pixel value */
704 #define WCS_ERROR         503  /* error in celestial coordinate calculation */
705 #define BAD_WCS_PROJ      504  /* unsupported type of celestial projection */
706 #define NO_WCS_KEY        505  /* celestial coordinate keywords not found */
707 #define APPROX_WCS_KEY    506  /* approximate WCS keywords were calculated */
708 
709 #define NO_CLOSE_ERROR    999  /* special value used internally to switch off */
710                                /* the error message from ffclos and ffchdu */
711 
712 /*------- following error codes are used in the grparser.c file -----------*/
713 #define	NGP_ERRBASE		(360)			/* base chosen so not to interfere with CFITSIO */
714 #define	NGP_OK			(0)
715 #define	NGP_NO_MEMORY		(NGP_ERRBASE + 0)	/* malloc failed */
716 #define	NGP_READ_ERR		(NGP_ERRBASE + 1)	/* read error from file */
717 #define	NGP_NUL_PTR		(NGP_ERRBASE + 2)	/* null pointer passed as argument */
718 #define	NGP_EMPTY_CURLINE	(NGP_ERRBASE + 3)	/* line read seems to be empty */
719 #define	NGP_UNREAD_QUEUE_FULL	(NGP_ERRBASE + 4)	/* cannot unread more then 1 line (or single line twice) */
720 #define	NGP_INC_NESTING		(NGP_ERRBASE + 5)	/* too deep include file nesting (inf. loop ?) */
721 #define	NGP_ERR_FOPEN		(NGP_ERRBASE + 6)	/* fopen() failed, cannot open file */
722 #define	NGP_EOF			(NGP_ERRBASE + 7)	/* end of file encountered */
723 #define	NGP_BAD_ARG		(NGP_ERRBASE + 8)	/* bad arguments passed */
724 #define	NGP_TOKEN_NOT_EXPECT	(NGP_ERRBASE + 9)	/* token not expected here */
725 
726 /*  The following exclusion if __CINT__ is defined is needed for ROOT */
727 #ifndef __CINT__
728 /*  the following 3 lines are needed to support C++ compilers */
729 #ifdef __cplusplus
730 extern "C" {
731 #endif
732 #endif
733 
734 int CFITS2Unit( fitsfile *fptr );
735 CFITS_API fitsfile* CUnit2FITS(int unit);
736 
737 /*----------------  FITS file URL parsing routines -------------*/
738 int CFITS_API fits_get_token (char **ptr, char *delimiter, char *token, int *isanumber);
739 int CFITS_API fits_get_token2(char **ptr, char *delimiter, char **token, int *isanumber, int *status);
740 char  CFITS_API *fits_split_names(char *list);
741 int CFITS_API ffiurl(  char *url,  char *urltype, char *infile,
742                     char *outfile, char *extspec, char *rowfilter,
743                     char *binspec, char *colspec, int *status);
744 int CFITS_API ffifile (char *url,  char *urltype, char *infile,
745                     char *outfile, char *extspec, char *rowfilter,
746                     char *binspec, char *colspec, char *pixfilter, int *status);
747 int CFITS_API ffifile2 (char *url,  char *urltype, char *infile,
748                     char *outfile, char *extspec, char *rowfilter,
749                     char *binspec, char *colspec, char *pixfilter, char *compspec, int *status);
750 int CFITS_API ffrtnm(char *url, char *rootname, int *status);
751 int CFITS_API ffexist(const char *infile, int *exists, int *status);
752 int CFITS_API ffexts(char *extspec, int *extnum,  char *extname, int *extvers,
753           int *hdutype, char *colname, char *rowexpress, int *status);
754 int CFITS_API ffextn(char *url, int *extension_num, int *status);
755 int CFITS_API ffurlt(fitsfile *fptr, char *urlType, int *status);
756 int CFITS_API ffbins(char *binspec, int *imagetype, int *haxis,
757                       char colname[4][FLEN_VALUE], double *minin,
758                       double *maxin, double *binsizein,
759                       char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],
760                       char binname[4][FLEN_VALUE], double *weight, char *wtname,
761                       int *recip, int *status);
762 int CFITS_API ffbinr(char **binspec, char *colname, double *minin,
763                         double *maxin, double *binsizein, char *minname,
764                         char *maxname, char *binname, int *status);
765 int CFITS_API fits_copy_cell2image(fitsfile *fptr, fitsfile *newptr, char *colname,
766                       long rownum, int *status);
767 int CFITS_API fits_copy_image2cell(fitsfile *fptr, fitsfile *newptr, char *colname,
768                       long rownum, int copykeyflag, int *status);
769 int CFITS_API fits_copy_pixlist2image(fitsfile *infptr, fitsfile *outfptr, int firstkey,       /* I - first HDU record number to start with */
770            int naxis, int *colnum, int *status);
771 int CFITS_API ffimport_file( char *filename, char **contents, int *status );
772 int CFITS_API ffrwrg( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges,
773       long *minrow, long *maxrow, int *status);
774 int CFITS_API ffrwrgll( char *rowlist, LONGLONG maxrows, int maxranges, int *numranges,
775       LONGLONG *minrow, LONGLONG *maxrow, int *status);
776 /*----------------  FITS file I/O routines -------------*/
777 int CFITS_API fits_init_cfitsio(void);
778 int CFITS_API ffomem(fitsfile **fptr, const char *name, int mode, void **buffptr,
779            size_t *buffsize, size_t deltasize,
780            void *(*mem_realloc)(void *p, size_t newsize),
781            int *status);
782 int CFITS_API ffopen(fitsfile **fptr, const char *filename, int iomode, int *status);
783 int CFITS_API ffopentest(int soname, fitsfile **fptr, const char *filename, int iomode, int *status);
784 
785 int CFITS_API ffdopn(fitsfile **fptr, const char *filename, int iomode, int *status);
786 int CFITS_API ffeopn(fitsfile **fptr, const char *filename, int iomode,
787      char *extlist, int *hdutype, int *status);
788 int CFITS_API fftopn(fitsfile **fptr, const char *filename, int iomode, int *status);
789 int CFITS_API ffiopn(fitsfile **fptr, const char *filename, int iomode, int *status);
790 int CFITS_API ffdkopn(fitsfile **fptr, const char *filename, int iomode, int *status);
791 int CFITS_API ffreopen(fitsfile *openfptr, fitsfile **newfptr, int *status);
792 int CFITS_API ffinit(  fitsfile **fptr, const char *filename, int *status);
793 int CFITS_API ffdkinit(fitsfile **fptr, const char *filename, int *status);
794 int CFITS_API ffimem(fitsfile **fptr,  void **buffptr,
795            size_t *buffsize, size_t deltasize,
796            void *(*mem_realloc)(void *p, size_t newsize),
797            int *status);
798 int CFITS_API fftplt(fitsfile **fptr, const char *filename, const char *tempname,
799            int *status);
800 int CFITS_API ffflus(fitsfile *fptr, int *status);
801 int CFITS_API ffflsh(fitsfile *fptr, int clearbuf, int *status);
802 int CFITS_API ffclos(fitsfile *fptr, int *status);
803 int CFITS_API ffdelt(fitsfile *fptr, int *status);
804 int CFITS_API ffflnm(fitsfile *fptr, char *filename, int *status);
805 int CFITS_API ffflmd(fitsfile *fptr, int *filemode, int *status);
806 int CFITS_API fits_delete_iraf_file(const char *filename, int *status);
807 
808 /*---------------- utility routines -------------*/
809 
810 float CFITS_API ffvers(float *version);
811 void CFITS_API ffupch(char *string);
812 void CFITS_API ffgerr(int status, char *errtext);
813 void CFITS_API ffpmsg(const char *err_message);
814 void CFITS_API ffpmrk(void);
815 int  CFITS_API ffgmsg(char *err_message);
816 void CFITS_API ffcmsg(void);
817 void CFITS_API ffcmrk(void);
818 void CFITS_API ffrprt(FILE *stream, int status);
819 void CFITS_API ffcmps(char *templt, char *colname, int  casesen, int *match,
820            int *exact);
821 int CFITS_API fftkey(const char *keyword, int *status);
822 int CFITS_API fftrec(char *card, int *status);
823 int CFITS_API ffnchk(fitsfile *fptr, int *status);
824 int CFITS_API ffkeyn(const char *keyroot, int value, char *keyname, int *status);
825 int CFITS_API ffnkey(int value, const char *keyroot, char *keyname, int *status);
826 int CFITS_API ffgkcl(char *card);
827 int CFITS_API ffdtyp(const char *cval, char *dtype, int *status);
828 int CFITS_API ffinttyp(char *cval, int *datatype, int *negative, int *status);
829 int CFITS_API ffpsvc(char *card, char *value, char *comm, int *status);
830 int CFITS_API ffgknm(char *card, char *name, int *length, int *status);
831 int CFITS_API ffgthd(char *tmplt, char *card, int *hdtype, int *status);
832 int CFITS_API ffmkky(const char *keyname, char *keyval, const char *comm, char *card, int *status);
833 int CFITS_API fits_translate_keyword(char *inrec, char *outrec, char *patterns[][2],
834           int npat, int n_value, int n_offset, int n_range, int *pat_num,
835           int *i, int *j,  int *m, int *n, int *status);
836 int CFITS_API fits_translate_keywords(fitsfile *infptr, fitsfile *outfptr,
837           int firstkey, char *patterns[][2],
838           int npat, int n_value, int n_offset, int n_range, int *status);
839 int CFITS_API ffasfm(char *tform, int *datacode, long *width, int *decim, int *status);
840 int CFITS_API ffbnfm(char *tform, int *datacode, long *repeat, long *width, int *status);
841 int CFITS_API ffbnfmll(char *tform, int *datacode, LONGLONG *repeat, long *width, int *status);
842 int CFITS_API ffgabc(int tfields, char **tform, int space, long *rowlen, long *tbcol,
843            int *status);
844 int CFITS_API fits_get_section_range(char **ptr,long *secmin,long *secmax,long *incre,
845               int *status);
846 /* ffmbyt should not normally be used in application programs, but it is
847    defined here as a publicly available routine because there are a few
848    rare cases where it is needed
849 */
850 int CFITS_API ffmbyt(fitsfile *fptr, LONGLONG bytpos, int ignore_err, int *status);
851 /*----------------- write single keywords --------------*/
852 int CFITS_API ffpky(fitsfile *fptr, int datatype, const char *keyname, void *value,
853           const char *comm, int *status);
854 int CFITS_API ffprec(fitsfile *fptr, const char *card, int *status);
855 int CFITS_API ffpcom(fitsfile *fptr, const char *comm, int *status);
856 int CFITS_API ffpunt(fitsfile *fptr, const char *keyname, const char *unit, int *status);
857 int CFITS_API ffphis(fitsfile *fptr, const char *history, int *status);
858 int CFITS_API ffpdat(fitsfile *fptr, int *status);
859 int CFITS_API ffverifydate(int year, int month, int day, int *status);
860 int CFITS_API ffgstm(char *timestr, int *timeref, int *status);
861 int CFITS_API ffgsdt(int *day, int *month, int *year, int *status);
862 int CFITS_API ffdt2s(int year, int month, int day, char *datestr, int *status);
863 int CFITS_API fftm2s(int year, int month, int day, int hour, int minute, double second,
864           int decimals, char *datestr, int *status);
865 int CFITS_API ffs2dt(char *datestr, int *year, int *month, int *day, int *status);
866 int CFITS_API ffs2tm(char *datestr, int *year, int *month, int *day, int *hour,
867           int *minute, double *second, int *status);
868 int CFITS_API ffpkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);
869 int CFITS_API ffpkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
870 int CFITS_API ffpkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
871 int CFITS_API ffplsw(fitsfile *fptr, int *status);
872 int CFITS_API ffpkyl(fitsfile *fptr, const char *keyname, int  value, const char *comm, int *status);
873 int CFITS_API ffpkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);
874 int CFITS_API ffpkyuj(fitsfile *fptr, const char *keyname, ULONGLONG value, const char *comm, int *status);
875 int CFITS_API ffpkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
876           int *status);
877 int CFITS_API ffpkye(fitsfile *fptr, const char *keyname, float  value, int decim, const char *comm,
878           int *status);
879 int CFITS_API ffpkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
880           int *status);
881 int CFITS_API ffpkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
882           int *status);
883 int CFITS_API ffpkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
884           int *status);
885 int CFITS_API ffpkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
886           int *status);
887 int CFITS_API ffpkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
888           int *status);
889 int CFITS_API ffpkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
890           int *status);
891 int CFITS_API ffpkyt(fitsfile *fptr, const char *keyname, long intval, double frac, const char *comm,
892           int *status);
893 int CFITS_API ffptdm( fitsfile *fptr, int colnum, int naxis, long naxes[], int *status);
894 int CFITS_API ffptdmll( fitsfile *fptr, int colnum, int naxis, LONGLONG naxes[], int *status);
895 
896 /*----------------- write array of keywords --------------*/
897 int CFITS_API ffpkns(fitsfile *fptr, const char *keyroot, int nstart, int nkey, char *value[],
898            char *comm[], int *status);
899 int CFITS_API ffpknl(fitsfile *fptr, const char *keyroot, int nstart, int nkey, int *value,
900            char *comm[], int *status);
901 int CFITS_API ffpknj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, long *value,
902            char *comm[], int *status);
903 int CFITS_API ffpknjj(fitsfile *fptr, const char *keyroot, int nstart, int nkey, LONGLONG *value,
904            char *comm[], int *status);
905 int CFITS_API ffpknf(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value,
906            int decim, char *comm[], int *status);
907 int CFITS_API ffpkne(fitsfile *fptr, const char *keyroot, int nstart, int nkey, float *value,
908            int decim, char *comm[], int *status);
909 int CFITS_API ffpkng(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value,
910            int decim, char *comm[], int *status);
911 int CFITS_API ffpknd(fitsfile *fptr, const char *keyroot, int nstart, int nkey, double *value,
912            int decim, char *comm[], int *status);
913 int CFITS_API ffcpky(fitsfile *infptr,fitsfile *outfptr,int incol,int outcol,
914            char *rootname, int *status);
915 
916 /*----------------- write required header keywords --------------*/
917 int CFITS_API ffphps( fitsfile *fptr, int bitpix, int naxis, long naxes[], int *status);
918 int CFITS_API ffphpsll( fitsfile *fptr, int bitpix, int naxis, LONGLONG naxes[], int *status);
919 int CFITS_API ffphpr( fitsfile *fptr, int simple, int bitpix, int naxis, long naxes[],
920             LONGLONG pcount, LONGLONG gcount, int extend, int *status);
921 int CFITS_API ffphprll( fitsfile *fptr, int simple, int bitpix, int naxis, LONGLONG naxes[],
922             LONGLONG pcount, LONGLONG gcount, int extend, int *status);
923 int CFITS_API ffphtb(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype,
924           long *tbcol, char **tform, char **tunit, const char *extname, int *status);
925 int CFITS_API ffphbn(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype,
926           char **tform, char **tunit, const char *extname, LONGLONG pcount, int *status);
927 int CFITS_API ffphext( fitsfile *fptr, const char *xtension, int bitpix, int naxis, long naxes[],
928             LONGLONG pcount, LONGLONG gcount, int *status);
929 /*----------------- write template keywords --------------*/
930 int CFITS_API ffpktp(fitsfile *fptr, const char *filename, int *status);
931 
932 /*------------------ get header information --------------*/
933 int CFITS_API ffghsp(fitsfile *fptr, int *nexist, int *nmore, int *status);
934 int CFITS_API ffghps(fitsfile *fptr, int *nexist, int *position, int *status);
935 
936 /*------------------ move position in header -------------*/
937 int CFITS_API ffmaky(fitsfile *fptr, int nrec, int *status);
938 int CFITS_API ffmrky(fitsfile *fptr, int nrec, int *status);
939 
940 /*------------------ read single keywords -----------------*/
941 int CFITS_API ffgnxk(fitsfile *fptr, char **inclist, int ninc, char **exclist,
942            int nexc, char *card, int  *status);
943 int CFITS_API ffgrec(fitsfile *fptr, int nrec,      char *card, int *status);
944 int CFITS_API ffgcrd(fitsfile *fptr, const char *keyname, char *card, int *status);
945 int CFITS_API ffgstr(fitsfile *fptr, const char *string, char *card, int *status);
946 int CFITS_API ffgunt(fitsfile *fptr, const char *keyname, char *unit, int  *status);
947 int CFITS_API ffgkyn(fitsfile *fptr, int nkey, char *keyname, char *keyval, char *comm,
948            int *status);
949 int CFITS_API ffgkey(fitsfile *fptr, const char *keyname, char *keyval, char *comm,
950            int *status);
951 
952 int CFITS_API ffgky( fitsfile *fptr, int datatype, const char *keyname, void *value,
953            char *comm, int *status);
954 int CFITS_API ffgkys(fitsfile *fptr, const char *keyname, char *value, char *comm, int *status);
955 int CFITS_API ffgksl(fitsfile *fptr, const char *keyname, int *length, int *status);
956 int CFITS_API ffgkls(fitsfile *fptr, const char *keyname, char **value, char *comm, int *status);
957 int CFITS_API ffgsky(fitsfile *fptr, const char *keyname, int firstchar, int maxchar,
958                char *value, int *valuelen, char *comm, int *status);
959 int CFITS_API fffree(void *value,  int  *status);
960 int CFITS_API fffkls(char *value, int *status);
961 int CFITS_API ffgkyl(fitsfile *fptr, const char *keyname, int *value, char *comm, int *status);
962 int CFITS_API ffgkyj(fitsfile *fptr, const char *keyname, long *value, char *comm, int *status);
963 int CFITS_API ffgkyjj(fitsfile *fptr, const char *keyname, LONGLONG *value, char *comm, int *status);
964 int CFITS_API ffgkyujj(fitsfile *fptr, const char *keyname, ULONGLONG *value, char *comm, int *status);
965 int CFITS_API ffgkye(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status);
966 int CFITS_API ffgkyd(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status);
967 int CFITS_API ffgkyc(fitsfile *fptr, const char *keyname, float *value, char *comm,int *status);
968 int CFITS_API ffgkym(fitsfile *fptr, const char *keyname, double *value,char *comm,int *status);
969 int CFITS_API ffgkyt(fitsfile *fptr, const char *keyname, long *ivalue, double *dvalue,
970            char *comm, int *status);
971 int CFITS_API ffgtdm(fitsfile *fptr, int colnum, int maxdim, int *naxis, long naxes[],
972            int *status);
973 int CFITS_API ffgtdmll(fitsfile *fptr, int colnum, int maxdim, int *naxis, LONGLONG naxes[],
974            int *status);
975 int CFITS_API ffdtdm(fitsfile *fptr, char *tdimstr, int colnum, int maxdim,
976            int *naxis, long naxes[], int *status);
977 int CFITS_API ffdtdmll(fitsfile *fptr, char *tdimstr, int colnum, int maxdim,
978            int *naxis, LONGLONG naxes[], int *status);
979 
980 /*------------------ read array of keywords -----------------*/
981 int CFITS_API ffgkns(fitsfile *fptr, const char *keyname, int nstart, int nmax, char *value[],
982            int *nfound,  int *status);
983 int CFITS_API ffgknl(fitsfile *fptr, const char *keyname, int nstart, int nmax, int *value,
984            int *nfound, int *status);
985 int CFITS_API ffgknj(fitsfile *fptr, const char *keyname, int nstart, int nmax, long *value,
986            int *nfound, int *status);
987 int CFITS_API ffgknjj(fitsfile *fptr, const char *keyname, int nstart, int nmax, LONGLONG *value,
988            int *nfound, int *status);
989 int CFITS_API ffgkne(fitsfile *fptr, const char *keyname, int nstart, int nmax, float *value,
990            int *nfound, int *status);
991 int CFITS_API ffgknd(fitsfile *fptr, const char *keyname, int nstart, int nmax, double *value,
992            int *nfound, int *status);
993 int CFITS_API ffh2st(fitsfile *fptr, char **header, int  *status);
994 int CFITS_API ffhdr2str( fitsfile *fptr,  int exclude_comm, char **exclist,
995    int nexc, char **header, int *nkeys, int  *status);
996 int CFITS_API ffcnvthdr2str( fitsfile *fptr,  int exclude_comm, char **exclist,
997    int nexc, char **header, int *nkeys, int  *status);
998 
999 /*----------------- read required header keywords --------------*/
1000 int CFITS_API ffghpr(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,
1001           long naxes[], long *pcount, long *gcount, int *extend, int *status);
1002 
1003 int CFITS_API ffghprll(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,
1004           LONGLONG naxes[], long *pcount, long *gcount, int *extend, int *status);
1005 
1006 int CFITS_API ffghtb(fitsfile *fptr,int maxfield, long *naxis1, long *naxis2,
1007            int *tfields, char **ttype, long *tbcol, char **tform, char **tunit,
1008            char *extname,  int *status);
1009 
1010 int CFITS_API ffghtbll(fitsfile *fptr,int maxfield, LONGLONG *naxis1, LONGLONG *naxis2,
1011            int *tfields, char **ttype, LONGLONG *tbcol, char **tform, char **tunit,
1012            char *extname,  int *status);
1013 
1014 
1015 int CFITS_API ffghbn(fitsfile *fptr, int maxfield, long *naxis2, int *tfields,
1016            char **ttype, char **tform, char **tunit, char *extname,
1017            long *pcount, int *status);
1018 
1019 int CFITS_API ffghbnll(fitsfile *fptr, int maxfield, LONGLONG *naxis2, int *tfields,
1020            char **ttype, char **tform, char **tunit, char *extname,
1021            LONGLONG *pcount, int *status);
1022 
1023 /*--------------------- update keywords ---------------*/
1024 int CFITS_API ffuky(fitsfile *fptr, int datatype, const char *keyname, void *value,
1025           const char *comm, int *status);
1026 int CFITS_API ffucrd(fitsfile *fptr, const char *keyname, const char *card, int *status);
1027 int CFITS_API ffukyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);
1028 int CFITS_API ffukys(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status);
1029 int CFITS_API ffukls(fitsfile *fptr, const char *keyname, const char *value, const char *comm, int *status);
1030 int CFITS_API ffukyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);
1031 int CFITS_API ffukyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);
1032 int CFITS_API ffukyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1033           int *status);
1034 int CFITS_API ffukye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1035           int *status);
1036 int CFITS_API ffukyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1037           int *status);
1038 int CFITS_API ffukyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1039           int *status);
1040 int CFITS_API ffukyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1041           int *status);
1042 int CFITS_API ffukym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1043           int *status);
1044 int CFITS_API ffukfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1045           int *status);
1046 int CFITS_API ffukfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1047           int *status);
1048 
1049 /*--------------------- modify keywords ---------------*/
1050 int CFITS_API ffmrec(fitsfile *fptr, int nkey, const char *card, int *status);
1051 int CFITS_API ffmcrd(fitsfile *fptr, const char *keyname, const char *card, int *status);
1052 int CFITS_API ffmnam(fitsfile *fptr, const char *oldname, const char *newname, int *status);
1053 int CFITS_API ffmcom(fitsfile *fptr, const char *keyname, const char *comm, int *status);
1054 int CFITS_API ffmkyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);
1055 int CFITS_API ffmkys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
1056 int CFITS_API ffmkls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
1057 int CFITS_API ffmkyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);
1058 int CFITS_API ffmkyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);
1059 int CFITS_API ffmkyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1060           int *status);
1061 int CFITS_API ffmkye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1062           int *status);
1063 int CFITS_API ffmkyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1064           int *status);
1065 int CFITS_API ffmkyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1066           int *status);
1067 int CFITS_API ffmkyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1068           int *status);
1069 int CFITS_API ffmkym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1070           int *status);
1071 int CFITS_API ffmkfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1072           int *status);
1073 int CFITS_API ffmkfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1074           int *status);
1075 
1076 /*--------------------- insert keywords ---------------*/
1077 int CFITS_API ffirec(fitsfile *fptr, int nkey, const char *card, int *status);
1078 int CFITS_API ffikey(fitsfile *fptr, const char *card, int *status);
1079 int CFITS_API ffikyu(fitsfile *fptr, const char *keyname, const char *comm, int *status);
1080 int CFITS_API ffikys(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
1081 int CFITS_API ffikls(fitsfile *fptr, const char *keyname, const char *value, const char *comm,int *status);
1082 int CFITS_API ffikyl(fitsfile *fptr, const char *keyname, int value, const char *comm, int *status);
1083 int CFITS_API ffikyj(fitsfile *fptr, const char *keyname, LONGLONG value, const char *comm, int *status);
1084 int CFITS_API ffikyf(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1085           int *status);
1086 int CFITS_API ffikye(fitsfile *fptr, const char *keyname, float value, int decim, const char *comm,
1087           int *status);
1088 int CFITS_API ffikyg(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1089           int *status);
1090 int CFITS_API ffikyd(fitsfile *fptr, const char *keyname, double value, int decim, const char *comm,
1091           int *status);
1092 int CFITS_API ffikyc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1093           int *status);
1094 int CFITS_API ffikym(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1095           int *status);
1096 int CFITS_API ffikfc(fitsfile *fptr, const char *keyname, float *value, int decim, const char *comm,
1097           int *status);
1098 int CFITS_API ffikfm(fitsfile *fptr, const char *keyname, double *value, int decim, const char *comm,
1099           int *status);
1100 
1101 /*--------------------- delete keywords ---------------*/
1102 int CFITS_API ffdkey(fitsfile *fptr, const char *keyname, int *status);
1103 int CFITS_API ffdstr(fitsfile *fptr, const char *string, int *status);
1104 int CFITS_API ffdrec(fitsfile *fptr, int keypos, int *status);
1105 
1106 /*--------------------- get HDU information -------------*/
1107 int CFITS_API ffghdn(fitsfile *fptr, int *chdunum);
1108 int CFITS_API ffghdt(fitsfile *fptr, int *exttype, int *status);
1109 int CFITS_API ffghad(fitsfile *fptr, long *headstart, long *datastart, long *dataend,
1110            int *status);
1111 int CFITS_API ffghadll(fitsfile *fptr, LONGLONG *headstart, LONGLONG *datastart,
1112            LONGLONG *dataend, int *status);
1113 int CFITS_API ffghof(fitsfile *fptr, OFF_T *headstart, OFF_T *datastart, OFF_T *dataend,
1114            int *status);
1115 int CFITS_API ffgipr(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis,
1116            long *naxes, int *status);
1117 int CFITS_API ffgiprll(fitsfile *fptr, int maxaxis, int *imgtype, int *naxis,
1118            LONGLONG *naxes, int *status);
1119 int CFITS_API ffgidt(fitsfile *fptr, int *imgtype, int *status);
1120 int CFITS_API ffgiet(fitsfile *fptr, int *imgtype, int *status);
1121 int CFITS_API ffgidm(fitsfile *fptr, int *naxis,  int *status);
1122 int CFITS_API ffgisz(fitsfile *fptr, int nlen, long *naxes, int *status);
1123 int CFITS_API ffgiszll(fitsfile *fptr, int nlen, LONGLONG *naxes, int *status);
1124 
1125 /*--------------------- HDU operations -------------*/
1126 int CFITS_API ffmahd(fitsfile *fptr, int hdunum, int *exttype, int *status);
1127 int CFITS_API ffmrhd(fitsfile *fptr, int hdumov, int *exttype, int *status);
1128 int CFITS_API ffmnhd(fitsfile *fptr, int exttype, char *hduname, int hduvers,
1129            int *status);
1130 int CFITS_API ffthdu(fitsfile *fptr, int *nhdu, int *status);
1131 int CFITS_API ffcrhd(fitsfile *fptr, int *status);
1132 int CFITS_API ffcrim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);
1133 int CFITS_API ffcrimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);
1134 int CFITS_API ffcrtb(fitsfile *fptr, int tbltype, LONGLONG naxis2, int tfields, char **ttype,
1135            char **tform, char **tunit, const char *extname, int *status);
1136 int CFITS_API ffiimg(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);
1137 int CFITS_API ffiimgll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);
1138 int CFITS_API ffitab(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, int tfields, char **ttype,
1139            long *tbcol, char **tform, char **tunit, const char *extname, int *status);
1140 int CFITS_API ffibin(fitsfile *fptr, LONGLONG naxis2, int tfields, char **ttype, char **tform,
1141            char **tunit, const char *extname, LONGLONG pcount, int *status);
1142 int CFITS_API ffrsim(fitsfile *fptr, int bitpix, int naxis, long *naxes, int *status);
1143 int CFITS_API ffrsimll(fitsfile *fptr, int bitpix, int naxis, LONGLONG *naxes, int *status);
1144 int CFITS_API ffdhdu(fitsfile *fptr, int *hdutype, int *status);
1145 int CFITS_API ffcopy(fitsfile *infptr, fitsfile *outfptr, int morekeys, int *status);
1146 int CFITS_API ffcpfl(fitsfile *infptr, fitsfile *outfptr, int prev, int cur, int follow,
1147             int *status);
1148 int CFITS_API ffcphd(fitsfile *infptr, fitsfile *outfptr, int *status);
1149 int CFITS_API ffcpdt(fitsfile *infptr, fitsfile *outfptr, int *status);
1150 int CFITS_API ffchfl(fitsfile *fptr, int *status);
1151 int CFITS_API ffcdfl(fitsfile *fptr, int *status);
1152 int CFITS_API ffwrhdu(fitsfile *fptr, FILE *outstream, int *status);
1153 
1154 int CFITS_API ffrdef(fitsfile *fptr, int *status);
1155 int CFITS_API ffrhdu(fitsfile *fptr, int *hdutype, int *status);
1156 int CFITS_API ffhdef(fitsfile *fptr, int morekeys, int *status);
1157 int CFITS_API ffpthp(fitsfile *fptr, long theap, int *status);
1158 
1159 int CFITS_API ffcsum(fitsfile *fptr, long nrec, unsigned long *sum, int *status);
1160 void CFITS_API ffesum(unsigned long sum, int complm, char *ascii);
1161 unsigned long CFITS_API ffdsum(char *ascii, int complm, unsigned long *sum);
1162 int CFITS_API ffpcks(fitsfile *fptr, int *status);
1163 int CFITS_API ffupck(fitsfile *fptr, int *status);
1164 int CFITS_API ffvcks(fitsfile *fptr, int *datastatus, int *hdustatus, int *status);
1165 int CFITS_API ffgcks(fitsfile *fptr, unsigned long *datasum, unsigned long *hdusum,
1166     int *status);
1167 
1168 /*--------------------- define scaling or null values -------------*/
1169 int CFITS_API ffpscl(fitsfile *fptr, double scale, double zeroval, int *status);
1170 int CFITS_API ffpnul(fitsfile *fptr, LONGLONG nulvalue, int *status);
1171 int CFITS_API fftscl(fitsfile *fptr, int colnum, double scale, double zeroval, int *status);
1172 int CFITS_API fftnul(fitsfile *fptr, int colnum, LONGLONG nulvalue, int *status);
1173 int CFITS_API ffsnul(fitsfile *fptr, int colnum, char *nulstring, int *status);
1174 
1175 /*--------------------- get column information -------------*/
1176 int CFITS_API ffgcno(fitsfile *fptr, int casesen, char *templt, int  *colnum,
1177            int *status);
1178 int CFITS_API ffgcnn(fitsfile *fptr, int casesen, char *templt, char *colname,
1179            int *colnum, int *status);
1180 
1181 int CFITS_API ffgtcl(fitsfile *fptr, int colnum, int *typecode, long *repeat,
1182            long *width, int *status);
1183 int CFITS_API ffgtclll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat,
1184            LONGLONG *width, int *status);
1185 int CFITS_API ffeqty(fitsfile *fptr, int colnum, int *typecode, long *repeat,
1186            long *width, int *status);
1187 int CFITS_API ffeqtyll(fitsfile *fptr, int colnum, int *typecode, LONGLONG *repeat,
1188            LONGLONG *width, int *status);
1189 int CFITS_API ffgncl(fitsfile *fptr, int  *ncols, int *status);
1190 int CFITS_API ffgnrw(fitsfile *fptr, long *nrows, int *status);
1191 int CFITS_API ffgnrwll(fitsfile *fptr, LONGLONG *nrows, int *status);
1192 int CFITS_API ffgacl(fitsfile *fptr, int colnum, char *ttype, long *tbcol,
1193            char *tunit, char *tform, double *tscal, double *tzero,
1194            char *tnull, char *tdisp, int *status);
1195 int CFITS_API ffgbcl(fitsfile *fptr, int colnum, char *ttype, char *tunit,
1196            char *dtype, long *repeat, double *tscal, double *tzero,
1197            long *tnull, char *tdisp, int  *status);
1198 int CFITS_API ffgbclll(fitsfile *fptr, int colnum, char *ttype, char *tunit,
1199            char *dtype, LONGLONG *repeat, double *tscal, double *tzero,
1200            LONGLONG *tnull, char *tdisp, int  *status);
1201 int CFITS_API ffgrsz(fitsfile *fptr, long *nrows, int *status);
1202 int CFITS_API ffgcdw(fitsfile *fptr, int colnum, int *width, int *status);
1203 
1204 /*--------------------- read primary array or image elements -------------*/
1205 int CFITS_API ffgpxv(fitsfile *fptr, int  datatype, long *firstpix, LONGLONG nelem,
1206           void *nulval, void *array, int *anynul, int *status);
1207 int CFITS_API ffgpxvll(fitsfile *fptr, int  datatype, LONGLONG *firstpix, LONGLONG nelem,
1208           void *nulval, void *array, int *anynul, int *status);
1209 int CFITS_API ffgpxf(fitsfile *fptr, int  datatype, long *firstpix, LONGLONG nelem,
1210            void *array, char *nullarray, int *anynul, int *status);
1211 int CFITS_API ffgpxfll(fitsfile *fptr, int  datatype, LONGLONG *firstpix, LONGLONG nelem,
1212            void *array, char *nullarray, int *anynul, int *status);
1213 int CFITS_API ffgsv(fitsfile *fptr, int datatype, long *blc, long *trc, long *inc,
1214           void *nulval, void *array, int *anynul, int  *status);
1215 
1216 int CFITS_API ffgpv(fitsfile *fptr, int  datatype, LONGLONG firstelem, LONGLONG nelem,
1217           void *nulval, void *array, int *anynul, int  *status);
1218 int CFITS_API ffgpf(fitsfile *fptr, int  datatype, LONGLONG firstelem, LONGLONG nelem,
1219           void *array, char *nullarray, int  *anynul, int  *status);
1220 int CFITS_API ffgpvb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, unsigned
1221            char nulval, unsigned char *array, int *anynul, int *status);
1222 int CFITS_API ffgpvsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem, signed
1223            char nulval, signed char *array, int *anynul, int *status);
1224 int CFITS_API ffgpvui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1225            unsigned short nulval, unsigned short *array, int *anynul,
1226            int *status);
1227 int CFITS_API ffgpvi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1228            short nulval, short *array, int *anynul, int *status);
1229 int CFITS_API ffgpvuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1230            unsigned long nulval, unsigned long *array, int *anynul,
1231            int *status);
1232 int CFITS_API ffgpvj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1233            long nulval, long *array, int *anynul, int *status);
1234 int CFITS_API ffgpvujj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1235            ULONGLONG nulval, ULONGLONG *array, int *anynul, int *status);
1236 int CFITS_API ffgpvjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1237            LONGLONG nulval, LONGLONG *array, int *anynul, int *status);
1238 int CFITS_API ffgpvuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1239            unsigned int nulval, unsigned int *array, int *anynul, int *status);
1240 int CFITS_API ffgpvk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1241            int nulval, int *array, int *anynul, int *status);
1242 int CFITS_API ffgpve(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1243            float nulval, float *array, int *anynul, int *status);
1244 int CFITS_API ffgpvd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1245            double nulval, double *array, int *anynul, int *status);
1246 
1247 int CFITS_API ffgpfb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1248            unsigned char *array, char *nularray, int *anynul, int *status);
1249 int CFITS_API ffgpfsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1250            signed char *array, char *nularray, int *anynul, int *status);
1251 int CFITS_API ffgpfui(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1252            unsigned short *array, char *nularray, int *anynul, int *status);
1253 int CFITS_API ffgpfi(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1254            short *array, char *nularray, int *anynul, int *status);
1255 int CFITS_API ffgpfuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1256            unsigned long *array, char *nularray, int *anynul, int *status);
1257 int CFITS_API ffgpfj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1258            long *array, char *nularray, int *anynul, int *status);
1259 int CFITS_API ffgpfujj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1260            ULONGLONG *array, char *nularray, int *anynul, int *status);
1261 int CFITS_API ffgpfjj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1262            LONGLONG *array, char *nularray, int *anynul, int *status);
1263 int CFITS_API ffgpfuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1264            unsigned int *array, char *nularray, int *anynul, int *status);
1265 int CFITS_API ffgpfk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1266            int *array, char *nularray, int *anynul, int *status);
1267 int CFITS_API ffgpfe(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1268            float *array, char *nularray, int *anynul, int *status);
1269 int CFITS_API ffgpfd(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1270            double *array, char *nularray, int *anynul, int *status);
1271 
1272 int CFITS_API ffg2db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols,
1273            LONGLONG naxis1, LONGLONG naxis2, unsigned char *array,
1274            int *anynul, int *status);
1275 int CFITS_API ffg2dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols,
1276            LONGLONG naxis1, LONGLONG naxis2, signed char *array,
1277            int *anynul, int *status);
1278 int CFITS_API ffg2dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols,
1279            LONGLONG naxis1, LONGLONG naxis2, unsigned short *array,
1280            int *anynul, int *status);
1281 int CFITS_API ffg2di(fitsfile *fptr, long group, short nulval, LONGLONG ncols,
1282            LONGLONG naxis1, LONGLONG naxis2, short *array,
1283            int *anynul, int *status);
1284 int CFITS_API ffg2duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols,
1285            LONGLONG naxis1, LONGLONG naxis2, unsigned long *array,
1286            int *anynul, int *status);
1287 int CFITS_API ffg2dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols,
1288            LONGLONG naxis1, LONGLONG naxis2, long *array,
1289            int *anynul, int *status);
1290 int CFITS_API ffg2dujj(fitsfile *fptr, long group, ULONGLONG nulval, LONGLONG ncols,
1291            LONGLONG naxis1, LONGLONG naxis2, ULONGLONG *array,
1292            int *anynul, int *status);
1293 int CFITS_API ffg2djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols,
1294            LONGLONG naxis1, LONGLONG naxis2, LONGLONG *array,
1295            int *anynul, int *status);
1296 int CFITS_API ffg2duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols,
1297            LONGLONG naxis1, LONGLONG naxis2, unsigned int *array,
1298            int *anynul, int *status);
1299 int CFITS_API ffg2dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols,
1300            LONGLONG naxis1, LONGLONG naxis2, int *array,
1301            int *anynul, int *status);
1302 int CFITS_API ffg2de(fitsfile *fptr, long group, float nulval, LONGLONG ncols,
1303            LONGLONG naxis1, LONGLONG naxis2, float *array,
1304            int *anynul, int *status);
1305 int CFITS_API ffg2dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols,
1306            LONGLONG naxis1, LONGLONG naxis2, double *array,
1307            int *anynul, int *status);
1308 
1309 int CFITS_API ffg3db(fitsfile *fptr, long group, unsigned char nulval, LONGLONG ncols,
1310            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1311            unsigned char *array, int *anynul, int *status);
1312 int CFITS_API ffg3dsb(fitsfile *fptr, long group, signed char nulval, LONGLONG ncols,
1313            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1314            signed char *array, int *anynul, int *status);
1315 int CFITS_API ffg3dui(fitsfile *fptr, long group, unsigned short nulval, LONGLONG ncols,
1316            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1317            unsigned short *array, int *anynul, int *status);
1318 int CFITS_API ffg3di(fitsfile *fptr, long group, short nulval, LONGLONG ncols,
1319            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1320            short *array, int *anynul, int *status);
1321 int CFITS_API ffg3duj(fitsfile *fptr, long group, unsigned long nulval, LONGLONG ncols,
1322            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1323            unsigned long *array, int *anynul, int *status);
1324 int CFITS_API ffg3dj(fitsfile *fptr, long group, long nulval, LONGLONG ncols,
1325            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1326            long *array, int *anynul, int *status);
1327 int CFITS_API ffg3dujj(fitsfile *fptr, long group, ULONGLONG nulval, LONGLONG ncols,
1328            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1329            ULONGLONG *array, int *anynul, int *status);
1330 int CFITS_API ffg3djj(fitsfile *fptr, long group, LONGLONG nulval, LONGLONG ncols,
1331            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1332            LONGLONG *array, int *anynul, int *status);
1333 int CFITS_API ffg3duk(fitsfile *fptr, long group, unsigned int nulval, LONGLONG ncols,
1334            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1335            unsigned int *array, int *anynul, int *status);
1336 int CFITS_API ffg3dk(fitsfile *fptr, long group, int nulval, LONGLONG ncols,
1337            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1338            int *array, int *anynul, int *status);
1339 int CFITS_API ffg3de(fitsfile *fptr, long group, float nulval, LONGLONG ncols,
1340            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1341            float *array, int *anynul, int *status);
1342 int CFITS_API ffg3dd(fitsfile *fptr, long group, double nulval, LONGLONG ncols,
1343            LONGLONG nrows, LONGLONG naxis1, LONGLONG naxis2, LONGLONG naxis3,
1344            double *array, int *anynul, int *status);
1345 
1346 int CFITS_API ffgsvb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1347   long *trc, long *inc, unsigned char nulval, unsigned char *array,
1348   int *anynul, int *status);
1349 int CFITS_API ffgsvsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1350   long *trc, long *inc, signed char nulval, signed char *array,
1351   int *anynul, int *status);
1352 int CFITS_API ffgsvui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1353   long *trc, long *inc, unsigned short nulval, unsigned short *array,
1354   int *anynul, int *status);
1355 int CFITS_API ffgsvi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1356   long *trc, long *inc, short nulval, short *array, int *anynul, int *status);
1357 int CFITS_API ffgsvuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1358   long *trc, long *inc, unsigned long nulval, unsigned long *array,
1359   int *anynul, int *status);
1360 int CFITS_API ffgsvj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1361   long *trc, long *inc, long nulval, long *array, int *anynul, int *status);
1362 int CFITS_API ffgsvujj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1363   long *trc, long *inc, ULONGLONG nulval, ULONGLONG *array, int *anynul,
1364   int *status);
1365 int CFITS_API ffgsvjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1366   long *trc, long *inc, LONGLONG nulval, LONGLONG *array, int *anynul,
1367   int *status);
1368 int CFITS_API ffgsvuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1369   long *trc, long *inc, unsigned int nulval, unsigned int *array,
1370   int *anynul, int *status);
1371 int CFITS_API ffgsvk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1372   long *trc, long *inc, int nulval, int *array, int *anynul, int *status);
1373 int CFITS_API ffgsve(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1374   long *trc, long *inc, float nulval, float *array, int *anynul, int *status);
1375 int CFITS_API ffgsvd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1376   long *trc, long *inc, double nulval, double *array, int *anynul,
1377   int *status);
1378 
1379 int CFITS_API ffgsfb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1380   long *trc, long *inc, unsigned char *array, char *flagval,
1381   int *anynul, int *status);
1382 int CFITS_API ffgsfsb(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1383   long *trc, long *inc, signed char *array, char *flagval,
1384   int *anynul, int *status);
1385 int CFITS_API ffgsfui(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1386   long *trc, long *inc, unsigned short *array, char *flagval, int *anynul,
1387   int *status);
1388 int CFITS_API ffgsfi(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1389   long *trc, long *inc, short *array, char *flagval, int *anynul, int *status);
1390 int CFITS_API ffgsfuj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1391   long  *trc, long *inc, unsigned long *array, char *flagval, int *anynul,
1392   int *status);
1393 int CFITS_API ffgsfj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1394   long  *trc, long *inc, long *array, char *flagval, int *anynul, int *status);
1395 int CFITS_API ffgsfujj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1396   long  *trc, long *inc, ULONGLONG *array, char *flagval, int *anynul,
1397   int *status);
1398 int CFITS_API ffgsfjj(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1399   long  *trc, long *inc, LONGLONG *array, char *flagval, int *anynul,
1400   int *status);
1401 int CFITS_API ffgsfuk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1402   long  *trc, long *inc, unsigned int *array, char *flagval, int *anynul,
1403   int *status);
1404 int CFITS_API ffgsfk(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1405   long  *trc, long *inc, int *array, char *flagval, int *anynul, int *status);
1406 int CFITS_API ffgsfe(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1407   long *trc, long *inc, float *array, char *flagval, int *anynul, int *status);
1408 int CFITS_API ffgsfd(fitsfile *fptr, int colnum, int naxis, long *naxes, long *blc,
1409   long *trc, long *inc, double *array, char *flagval, int *anynul,
1410   int *status);
1411 
1412 int CFITS_API ffggpb(fitsfile *fptr, long group, long firstelem, long nelem,
1413            unsigned char *array, int *status);
1414 int CFITS_API ffggpsb(fitsfile *fptr, long group, long firstelem, long nelem,
1415            signed char *array, int *status);
1416 int CFITS_API ffggpui(fitsfile *fptr, long group, long firstelem, long nelem,
1417            unsigned short *array, int *status);
1418 int CFITS_API ffggpi(fitsfile *fptr, long group, long firstelem, long nelem,
1419            short *array, int *status);
1420 int CFITS_API ffggpuj(fitsfile *fptr, long group, long firstelem, long nelem,
1421            unsigned long *array, int *status);
1422 int CFITS_API ffggpj(fitsfile *fptr, long group, long firstelem, long nelem,
1423            long *array, int *status);
1424 int CFITS_API ffggpujj(fitsfile *fptr, long group, long firstelem, long nelem,
1425            ULONGLONG *array, int *status);
1426 int CFITS_API ffggpjj(fitsfile *fptr, long group, long firstelem, long nelem,
1427            LONGLONG *array, int *status);
1428 int CFITS_API ffggpuk(fitsfile *fptr, long group, long firstelem, long nelem,
1429            unsigned int *array, int *status);
1430 int CFITS_API ffggpk(fitsfile *fptr, long group, long firstelem, long nelem,
1431            int *array, int *status);
1432 int CFITS_API ffggpe(fitsfile *fptr, long group, long firstelem, long nelem,
1433            float *array, int *status);
1434 int CFITS_API ffggpd(fitsfile *fptr, long group, long firstelem, long nelem,
1435            double *array, int *status);
1436 
1437 /*--------------------- read column elements -------------*/
1438 int CFITS_API ffgcv( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,
1439            LONGLONG firstelem, LONGLONG nelem, void *nulval, void *array, int *anynul,
1440            int  *status);
1441 int CFITS_API ffgcf( fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,
1442            LONGLONG firstelem, LONGLONG nelem, void *array, char *nullarray,
1443            int *anynul, int *status);
1444 int CFITS_API ffgcvs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1445            LONGLONG nelem, char *nulval, char **array, int *anynul, int *status);
1446 int CFITS_API ffgcl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1447            LONGLONG nelem, char *array, int  *status);
1448 int CFITS_API ffgcvl (fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1449            LONGLONG nelem, char nulval, char *array, int *anynul, int  *status);
1450 int CFITS_API ffgcvb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1451            LONGLONG nelem, unsigned char nulval, unsigned char *array,
1452            int *anynul, int *status);
1453 int CFITS_API ffgcvsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1454            LONGLONG nelem, signed char nulval, signed char *array,
1455            int *anynul, int *status);
1456 int CFITS_API ffgcvui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1457            LONGLONG nelem, unsigned short nulval, unsigned short *array,
1458            int *anynul, int *status);
1459 int CFITS_API ffgcvi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1460            LONGLONG nelem, short nulval, short *array, int *anynul, int *status);
1461 int CFITS_API ffgcvuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1462            LONGLONG nelem, unsigned long nulval, unsigned long *array, int *anynul,
1463            int *status);
1464 int CFITS_API ffgcvj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1465            LONGLONG nelem, long nulval, long *array, int *anynul, int *status);
1466 int CFITS_API ffgcvujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1467            LONGLONG nelem, ULONGLONG nulval, ULONGLONG *array, int *anynul,
1468            int *status);
1469 int CFITS_API ffgcvjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1470            LONGLONG nelem, LONGLONG nulval, LONGLONG *array, int *anynul,
1471            int *status);
1472 int CFITS_API ffgcvuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1473            LONGLONG nelem, unsigned int nulval, unsigned int *array, int *anynul,
1474            int *status);
1475 int CFITS_API ffgcvk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1476            LONGLONG nelem, int nulval, int *array, int *anynul, int *status);
1477 int CFITS_API ffgcve(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1478            LONGLONG nelem, float nulval, float *array, int *anynul, int *status);
1479 int CFITS_API ffgcvd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1480          LONGLONG nelem, double nulval, double *array, int *anynul, int *status);
1481 int CFITS_API ffgcvc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1482            LONGLONG nelem, float nulval, float *array, int *anynul, int *status);
1483 int CFITS_API ffgcvm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1484          LONGLONG nelem, double nulval, double *array, int *anynul, int *status);
1485 
1486 int CFITS_API ffgcx(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstbit,
1487             LONGLONG nbits, char *larray, int *status);
1488 int CFITS_API ffgcxui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows,
1489             long firstbit, int nbits, unsigned short *array, int *status);
1490 int CFITS_API ffgcxuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows,
1491             long firstbit, int nbits, unsigned int *array, int *status);
1492 
1493 int CFITS_API ffgcfs(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1494       LONGLONG nelem, char **array, char *nularray, int *anynul, int *status);
1495 int CFITS_API ffgcfl(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1496       LONGLONG nelem, char *array, char *nularray, int *anynul, int *status);
1497 int CFITS_API ffgcfb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1498       LONGLONG nelem, unsigned char *array, char *nularray, int *anynul, int *status);
1499 int CFITS_API ffgcfsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1500       LONGLONG nelem, signed char *array, char *nularray, int *anynul, int *status);
1501 int CFITS_API ffgcfui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1502       LONGLONG nelem, unsigned short *array, char *nularray, int *anynul,
1503       int *status);
1504 int CFITS_API ffgcfi(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1505       LONGLONG nelem, short *array, char *nularray, int *anynul, int *status);
1506 int CFITS_API ffgcfuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1507       LONGLONG nelem, unsigned long *array, char *nularray, int *anynul,
1508       int *status);
1509 int CFITS_API ffgcfj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1510       LONGLONG nelem, long *array, char *nularray, int *anynul, int *status);
1511 int CFITS_API ffgcfujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1512       LONGLONG nelem, ULONGLONG *array, char *nularray, int *anynul, int *status);
1513 int CFITS_API ffgcfjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1514       LONGLONG nelem, LONGLONG *array, char *nularray, int *anynul, int *status);
1515 int CFITS_API ffgcfuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1516       LONGLONG nelem, unsigned int *array, char *nularray, int *anynul,
1517       int *status);
1518 int CFITS_API ffgcfk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1519       LONGLONG nelem, int *array, char *nularray, int *anynul, int *status);
1520 int CFITS_API ffgcfe(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1521       LONGLONG nelem, float *array, char *nularray, int *anynul, int *status);
1522 int CFITS_API ffgcfd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1523       LONGLONG nelem, double *array, char *nularray, int *anynul, int *status);
1524 int CFITS_API ffgcfc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1525       LONGLONG nelem, float *array, char *nularray, int *anynul, int *status);
1526 int CFITS_API ffgcfm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1527       LONGLONG nelem, double *array, char *nularray, int *anynul, int *status);
1528 
1529 int CFITS_API ffgdes(fitsfile *fptr, int colnum, LONGLONG rownum, long *length,
1530            long *heapaddr, int *status);
1531 int CFITS_API ffgdesll(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG *length,
1532            LONGLONG *heapaddr, int *status);
1533 int CFITS_API ffgdess(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, long *length,
1534            long *heapaddr, int *status);
1535 int CFITS_API ffgdessll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG nrows, LONGLONG *length,
1536            LONGLONG *heapaddr, int *status);
1537 int CFITS_API ffpdes(fitsfile *fptr, int colnum, LONGLONG rownum, LONGLONG length,
1538            LONGLONG heapaddr, int *status);
1539 int CFITS_API fftheap(fitsfile *fptr, LONGLONG *heapsize, LONGLONG *unused, LONGLONG *overlap,
1540             int *valid, int *status);
1541 int CFITS_API ffcmph(fitsfile *fptr, int *status);
1542 
1543 int CFITS_API ffgtbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,
1544            unsigned char *values, int *status);
1545 
1546 int CFITS_API ffgextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status);
1547 int CFITS_API ffpextn(fitsfile *fptr, LONGLONG offset, LONGLONG nelem, void *array, int *status);
1548 
1549 /*------------ write primary array or image elements -------------*/
1550 int CFITS_API ffppx(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem,
1551           void *array, int *status);
1552 int CFITS_API ffppxll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem,
1553           void *array, int *status);
1554 int CFITS_API ffppxn(fitsfile *fptr, int datatype, long *firstpix, LONGLONG nelem,
1555           void *array, void *nulval, int *status);
1556 int CFITS_API ffppxnll(fitsfile *fptr, int datatype, LONGLONG *firstpix, LONGLONG nelem,
1557           void *array, void *nulval, int *status);
1558 int CFITS_API ffppr(fitsfile *fptr, int datatype, LONGLONG  firstelem,
1559            LONGLONG nelem, void *array, int *status);
1560 int CFITS_API ffpprb(fitsfile *fptr, long group, LONGLONG firstelem,
1561            LONGLONG nelem, unsigned char *array, int *status);
1562 int CFITS_API ffpprsb(fitsfile *fptr, long group, LONGLONG firstelem,
1563            LONGLONG nelem, signed char *array, int *status);
1564 int CFITS_API ffpprui(fitsfile *fptr, long group, LONGLONG firstelem,
1565            LONGLONG nelem, unsigned short *array, int *status);
1566 int CFITS_API ffppri(fitsfile *fptr, long group, LONGLONG firstelem,
1567            LONGLONG nelem, short *array, int *status);
1568 int CFITS_API ffppruj(fitsfile *fptr, long group, LONGLONG firstelem,
1569            LONGLONG nelem, unsigned long *array, int *status);
1570 int CFITS_API ffpprj(fitsfile *fptr, long group, LONGLONG firstelem,
1571            LONGLONG nelem, long *array, int *status);
1572 int CFITS_API ffppruk(fitsfile *fptr, long group, LONGLONG firstelem,
1573            LONGLONG nelem, unsigned int *array, int *status);
1574 int CFITS_API ffpprk(fitsfile *fptr, long group, LONGLONG firstelem,
1575            LONGLONG nelem, int *array, int *status);
1576 int CFITS_API ffppre(fitsfile *fptr, long group, LONGLONG firstelem,
1577            LONGLONG nelem, float *array, int *status);
1578 int CFITS_API ffpprd(fitsfile *fptr, long group, LONGLONG firstelem,
1579            LONGLONG nelem, double *array, int *status);
1580 int CFITS_API ffpprjj(fitsfile *fptr, long group, LONGLONG firstelem,
1581            LONGLONG nelem, LONGLONG *array, int *status);
1582 int CFITS_API ffpprujj(fitsfile *fptr, long group, LONGLONG firstelem,
1583            LONGLONG nelem, ULONGLONG *array, int *status);
1584 
1585 int CFITS_API ffppru(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1586            int *status);
1587 int CFITS_API ffpprn(fitsfile *fptr, LONGLONG firstelem, LONGLONG nelem, int *status);
1588 
1589 int CFITS_API ffppn(fitsfile *fptr, int datatype, LONGLONG  firstelem, LONGLONG nelem,
1590           void  *array, void *nulval, int  *status);
1591 int CFITS_API ffppnb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1592            unsigned char *array, unsigned char nulval, int *status);
1593 int CFITS_API ffppnsb(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1594            signed char *array, signed char nulval, int *status);
1595 int CFITS_API ffppnui(fitsfile *fptr, long group, LONGLONG firstelem,
1596            LONGLONG nelem, unsigned short *array, unsigned short nulval,
1597            int *status);
1598 int CFITS_API ffppni(fitsfile *fptr, long group, LONGLONG firstelem,
1599            LONGLONG nelem, short *array, short nulval, int *status);
1600 int CFITS_API ffppnj(fitsfile *fptr, long group, LONGLONG firstelem,
1601            LONGLONG nelem, long *array, long nulval, int *status);
1602 int CFITS_API ffppnuj(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1603            unsigned long *array, unsigned long nulval, int *status);
1604 int CFITS_API ffppnuk(fitsfile *fptr, long group, LONGLONG firstelem, LONGLONG nelem,
1605            unsigned int *array, unsigned int nulval, int *status);
1606 int CFITS_API ffppnk(fitsfile *fptr, long group, LONGLONG firstelem,
1607            LONGLONG nelem, int *array, int nulval, int *status);
1608 int CFITS_API ffppne(fitsfile *fptr, long group, LONGLONG firstelem,
1609            LONGLONG nelem, float *array, float nulval, int *status);
1610 int CFITS_API ffppnd(fitsfile *fptr, long group, LONGLONG firstelem,
1611            LONGLONG nelem, double *array, double nulval, int *status);
1612 int CFITS_API ffppnjj(fitsfile *fptr, long group, LONGLONG firstelem,
1613            LONGLONG nelem, LONGLONG *array, LONGLONG nulval, int *status);
1614 int CFITS_API ffppnujj(fitsfile *fptr, long group, LONGLONG firstelem,
1615            LONGLONG nelem, ULONGLONG *array, ULONGLONG nulval, int *status);
1616 
1617 int CFITS_API ffp2db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1618            LONGLONG naxis2, unsigned char *array, int *status);
1619 int CFITS_API ffp2dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1620            LONGLONG naxis2, signed char *array, int *status);
1621 int CFITS_API ffp2dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1622            LONGLONG naxis2, unsigned short *array, int *status);
1623 int CFITS_API ffp2di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1624            LONGLONG naxis2, short *array, int *status);
1625 int CFITS_API ffp2duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1626            LONGLONG naxis2, unsigned long *array, int *status);
1627 int CFITS_API ffp2dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1628            LONGLONG naxis2, long *array, int *status);
1629 int CFITS_API ffp2duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1630            LONGLONG naxis2, unsigned int *array, int *status);
1631 int CFITS_API ffp2dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1632            LONGLONG naxis2, int *array, int *status);
1633 int CFITS_API ffp2de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1634            LONGLONG naxis2, float *array, int *status);
1635 int CFITS_API ffp2dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1636            LONGLONG naxis2, double *array, int *status);
1637 int CFITS_API ffp2djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1638            LONGLONG naxis2, LONGLONG *array, int *status);
1639 int CFITS_API ffp2dujj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG naxis1,
1640            LONGLONG naxis2, ULONGLONG *array, int *status);
1641 
1642 int CFITS_API ffp3db(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1643            LONGLONG naxis2, LONGLONG naxis3, unsigned char *array, int *status);
1644 int CFITS_API ffp3dsb(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1645            LONGLONG naxis2, LONGLONG naxis3, signed char *array, int *status);
1646 int CFITS_API ffp3dui(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1647            LONGLONG naxis2, LONGLONG naxis3, unsigned short *array, int *status);
1648 int CFITS_API ffp3di(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1649            LONGLONG naxis2, LONGLONG naxis3, short *array, int *status);
1650 int CFITS_API ffp3duj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1651            LONGLONG naxis2, LONGLONG naxis3, unsigned long *array, int *status);
1652 int CFITS_API ffp3dj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1653            LONGLONG naxis2, LONGLONG naxis3, long *array, int *status);
1654 int CFITS_API ffp3duk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1655            LONGLONG naxis2, LONGLONG naxis3, unsigned int *array, int *status);
1656 int CFITS_API ffp3dk(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1657            LONGLONG naxis2, LONGLONG naxis3, int *array, int *status);
1658 int CFITS_API ffp3de(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1659            LONGLONG naxis2, LONGLONG naxis3, float *array, int *status);
1660 int CFITS_API ffp3dd(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1661            LONGLONG naxis2, LONGLONG naxis3, double *array, int *status);
1662 int CFITS_API ffp3djj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1663            LONGLONG naxis2, LONGLONG naxis3, LONGLONG *array, int *status);
1664 int CFITS_API ffp3dujj(fitsfile *fptr, long group, LONGLONG ncols, LONGLONG nrows, LONGLONG naxis1,
1665            LONGLONG naxis2, LONGLONG naxis3, ULONGLONG *array, int *status);
1666 
1667 int CFITS_API ffpss(fitsfile *fptr, int datatype,
1668            long *fpixel, long *lpixel, void *array, int *status);
1669 int CFITS_API ffpssb(fitsfile *fptr, long group, long naxis, long *naxes,
1670            long *fpixel, long *lpixel, unsigned char *array, int *status);
1671 int CFITS_API ffpsssb(fitsfile *fptr, long group, long naxis, long *naxes,
1672            long *fpixel, long *lpixel, signed char *array, int *status);
1673 int CFITS_API ffpssui(fitsfile *fptr, long group, long naxis, long *naxes,
1674            long *fpixel, long *lpixel, unsigned short *array, int *status);
1675 int CFITS_API ffpssi(fitsfile *fptr, long group, long naxis, long *naxes,
1676            long *fpixel, long *lpixel, short *array, int *status);
1677 int CFITS_API ffpssuj(fitsfile *fptr, long group, long naxis, long *naxes,
1678            long *fpixel, long *lpixel, unsigned long *array, int *status);
1679 int CFITS_API ffpssj(fitsfile *fptr, long group, long naxis, long *naxes,
1680            long *fpixel, long *lpixel, long *array, int *status);
1681 int CFITS_API ffpssuk(fitsfile *fptr, long group, long naxis, long *naxes,
1682            long *fpixel, long *lpixel, unsigned int *array, int *status);
1683 int CFITS_API ffpssk(fitsfile *fptr, long group, long naxis, long *naxes,
1684            long *fpixel, long *lpixel, int *array, int *status);
1685 int CFITS_API ffpsse(fitsfile *fptr, long group, long naxis, long *naxes,
1686            long *fpixel, long *lpixel, float *array, int *status);
1687 int CFITS_API ffpssd(fitsfile *fptr, long group, long naxis, long *naxes,
1688            long *fpixel, long *lpixel, double *array, int *status);
1689 int CFITS_API ffpssjj(fitsfile *fptr, long group, long naxis, long *naxes,
1690            long *fpixel, long *lpixel, LONGLONG *array, int *status);
1691 int CFITS_API ffpssujj(fitsfile *fptr, long group, long naxis, long *naxes,
1692            long *fpixel, long *lpixel, ULONGLONG *array, int *status);
1693 
1694 int CFITS_API ffpgpb(fitsfile *fptr, long group, long firstelem,
1695            long nelem, unsigned char *array, int *status);
1696 int CFITS_API ffpgpsb(fitsfile *fptr, long group, long firstelem,
1697            long nelem, signed char *array, int *status);
1698 int CFITS_API ffpgpui(fitsfile *fptr, long group, long firstelem,
1699            long nelem, unsigned short *array, int *status);
1700 int CFITS_API ffpgpi(fitsfile *fptr, long group, long firstelem,
1701            long nelem, short *array, int *status);
1702 int CFITS_API ffpgpuj(fitsfile *fptr, long group, long firstelem,
1703            long nelem, unsigned long *array, int *status);
1704 int CFITS_API ffpgpj(fitsfile *fptr, long group, long firstelem,
1705            long nelem, long *array, int *status);
1706 int CFITS_API ffpgpuk(fitsfile *fptr, long group, long firstelem,
1707            long nelem, unsigned int *array, int *status);
1708 int CFITS_API ffpgpk(fitsfile *fptr, long group, long firstelem,
1709            long nelem, int *array, int *status);
1710 int CFITS_API ffpgpe(fitsfile *fptr, long group, long firstelem,
1711            long nelem, float *array, int *status);
1712 int CFITS_API ffpgpd(fitsfile *fptr, long group, long firstelem,
1713            long nelem, double *array, int *status);
1714 int CFITS_API ffpgpjj(fitsfile *fptr, long group, long firstelem,
1715            long nelem, LONGLONG *array, int *status);
1716 int CFITS_API ffpgpujj(fitsfile *fptr, long group, long firstelem,
1717            long nelem, ULONGLONG *array, int *status);
1718 
1719 /*--------------------- iterator functions -------------*/
1720 int CFITS_API fits_iter_set_by_name(iteratorCol *col, fitsfile *fptr, char *colname,
1721           int datatype,  int iotype);
1722 int CFITS_API fits_iter_set_by_num(iteratorCol *col, fitsfile *fptr, int colnum,
1723           int datatype,  int iotype);
1724 int CFITS_API fits_iter_set_file(iteratorCol *col, fitsfile *fptr);
1725 int CFITS_API fits_iter_set_colname(iteratorCol *col, char *colname);
1726 int CFITS_API fits_iter_set_colnum(iteratorCol *col, int colnum);
1727 int CFITS_API fits_iter_set_datatype(iteratorCol *col, int datatype);
1728 int CFITS_API fits_iter_set_iotype(iteratorCol *col, int iotype);
1729 
1730 CFITS_API fitsfile * fits_iter_get_file(iteratorCol *col);
1731 char CFITS_API * fits_iter_get_colname(iteratorCol *col);
1732 int CFITS_API fits_iter_get_colnum(iteratorCol *col);
1733 int CFITS_API fits_iter_get_datatype(iteratorCol *col);
1734 int CFITS_API fits_iter_get_iotype(iteratorCol *col);
1735 void CFITS_API *fits_iter_get_array(iteratorCol *col);
1736 long CFITS_API fits_iter_get_tlmin(iteratorCol *col);
1737 long CFITS_API fits_iter_get_tlmax(iteratorCol *col);
1738 long CFITS_API fits_iter_get_repeat(iteratorCol *col);
1739 char CFITS_API *fits_iter_get_tunit(iteratorCol *col);
1740 char CFITS_API *fits_iter_get_tdisp(iteratorCol *col);
1741 
1742 int CFITS_API ffiter(int ncols,  iteratorCol *data, long offset, long nPerLoop,
1743            int (*workFn)( long totaln, long offset, long firstn,
1744              long nvalues, int narrays, iteratorCol *data, void *userPointer),
1745            void *userPointer, int *status);
1746 
1747 /*--------------------- write column elements -------------*/
1748 int CFITS_API ffpcl(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow,
1749           LONGLONG firstelem, LONGLONG nelem, void *array, int *status);
1750 int CFITS_API ffpcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1751            LONGLONG nelem, char **array, int *status);
1752 int CFITS_API ffpcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1753            LONGLONG nelem, char *array, int *status);
1754 int CFITS_API ffpclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1755            LONGLONG nelem, unsigned char *array, int *status);
1756 int CFITS_API ffpclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1757            LONGLONG nelem, signed char *array, int *status);
1758 int CFITS_API ffpclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1759            LONGLONG nelem, unsigned short *array, int *status);
1760 int CFITS_API ffpcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1761            LONGLONG nelem, short *array, int *status);
1762 int CFITS_API ffpcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1763            LONGLONG nelem, unsigned long *array, int *status);
1764 int CFITS_API ffpclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1765            LONGLONG nelem, long *array, int *status);
1766 int CFITS_API ffpcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1767            LONGLONG nelem, unsigned int *array, int *status);
1768 int CFITS_API ffpclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1769            LONGLONG nelem, int *array, int *status);
1770 int CFITS_API ffpcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1771            LONGLONG nelem, float *array, int *status);
1772 int CFITS_API ffpcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1773            LONGLONG nelem, double *array, int *status);
1774 int CFITS_API ffpclc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1775            LONGLONG nelem, float *array, int *status);
1776 int CFITS_API ffpclm(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1777            LONGLONG nelem, double *array, int *status);
1778 int CFITS_API ffpclu(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1779            LONGLONG nelem, int *status);
1780 int CFITS_API ffprwu(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);
1781 int CFITS_API ffpcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1782            LONGLONG nelem, LONGLONG *array, int *status);
1783 int CFITS_API ffpclujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1784            LONGLONG nelem, ULONGLONG *array, int *status);
1785 int CFITS_API ffpclx(fitsfile *fptr, int colnum, LONGLONG frow, long fbit, long nbit,
1786             char *larray, int *status);
1787 
1788 int CFITS_API ffpcn(fitsfile *fptr, int datatype, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1789           LONGLONG nelem, void *array, void *nulval, int *status);
1790 int CFITS_API ffpcns( fitsfile *fptr, int  colnum, LONGLONG  firstrow, LONGLONG  firstelem,
1791             LONGLONG  nelem, char **array, char  *nulvalue, int  *status);
1792 int CFITS_API ffpcnl( fitsfile *fptr, int  colnum, LONGLONG  firstrow, LONGLONG  firstelem,
1793             LONGLONG  nelem, char *array, char  nulvalue,  int  *status);
1794 int CFITS_API ffpcnb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1795            LONGLONG nelem, unsigned char *array, unsigned char nulvalue,
1796            int *status);
1797 int CFITS_API ffpcnsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1798            LONGLONG nelem, signed char *array, signed char nulvalue,
1799            int *status);
1800 int CFITS_API ffpcnui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1801            LONGLONG nelem, unsigned short *array, unsigned short nulvalue,
1802            int *status);
1803 int CFITS_API ffpcni(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1804            LONGLONG nelem, short *array, short nulvalue, int *status);
1805 int CFITS_API ffpcnuj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1806            LONGLONG nelem, unsigned long *array, unsigned long nulvalue,
1807            int *status);
1808 int CFITS_API ffpcnj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1809            LONGLONG nelem, long *array, long nulvalue, int *status);
1810 int CFITS_API ffpcnuk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1811            LONGLONG nelem, unsigned int *array, unsigned int nulvalue,
1812            int *status);
1813 int CFITS_API ffpcnk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1814            LONGLONG nelem, int *array, int nulvalue, int *status);
1815 int CFITS_API ffpcne(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1816            LONGLONG nelem, float *array, float nulvalue, int *status);
1817 int CFITS_API ffpcnd(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1818            LONGLONG nelem, double *array, double nulvalue, int *status);
1819 int CFITS_API ffpcnjj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1820            LONGLONG nelem, LONGLONG *array, LONGLONG nulvalue, int *status);
1821 int CFITS_API ffpcnujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
1822            LONGLONG nelem, ULONGLONG *array, ULONGLONG nulvalue, int *status);
1823 int CFITS_API ffptbb(fitsfile *fptr, LONGLONG firstrow, LONGLONG firstchar, LONGLONG nchars,
1824            unsigned char *values, int *status);
1825 
1826 int CFITS_API ffirow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);
1827 int CFITS_API ffdrow(fitsfile *fptr, LONGLONG firstrow, LONGLONG nrows, int *status);
1828 int CFITS_API ffdrrg(fitsfile *fptr, char *ranges, int *status);
1829 int CFITS_API ffdrws(fitsfile *fptr, long *rownum,  long nrows, int *status);
1830 int CFITS_API ffdrwsll(fitsfile *fptr, LONGLONG *rownum,  LONGLONG nrows, int *status);
1831 int CFITS_API fficol(fitsfile *fptr, int numcol, char *ttype, char *tform, int *status);
1832 int CFITS_API fficls(fitsfile *fptr, int firstcol, int ncols, char **ttype,
1833            char **tform, int *status);
1834 int CFITS_API ffmvec(fitsfile *fptr, int colnum, LONGLONG newveclen, int *status);
1835 int CFITS_API ffdcol(fitsfile *fptr, int numcol, int *status);
1836 int CFITS_API ffcpcl(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol,
1837            int create_col, int *status);
1838 int CFITS_API ffccls(fitsfile *infptr, fitsfile *outfptr, int incol, int outcol,
1839 	   int ncols, int create_col, int *status);
1840 int CFITS_API ffcprw(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow,
1841            LONGLONG nrows, int *status);
1842 int CFITS_API ffcpht(fitsfile *infptr, fitsfile *outfptr, LONGLONG firstrow,
1843            LONGLONG nrows, int *status);
1844 
1845 /*--------------------- WCS Utilities ------------------*/
1846 int CFITS_API ffgics(fitsfile *fptr, double *xrval, double *yrval, double *xrpix,
1847            double *yrpix, double *xinc, double *yinc, double *rot,
1848            char *type, int *status);
1849 int CFITS_API ffgicsa(fitsfile *fptr, char version, double *xrval, double *yrval, double *xrpix,
1850            double *yrpix, double *xinc, double *yinc, double *rot,
1851            char *type, int *status);
1852 int CFITS_API ffgtcs(fitsfile *fptr, int xcol, int ycol, double *xrval,
1853            double *yrval, double *xrpix, double *yrpix, double *xinc,
1854            double *yinc, double *rot, char *type, int *status);
1855 int CFITS_API ffwldp(double xpix, double ypix, double xref, double yref,
1856            double xrefpix, double yrefpix, double xinc, double yinc,
1857            double rot, char *type, double *xpos, double *ypos, int *status);
1858 int CFITS_API ffxypx(double xpos, double ypos, double xref, double yref,
1859            double xrefpix, double yrefpix, double xinc, double yinc,
1860            double rot, char *type, double *xpix, double *ypix, int *status);
1861 
1862 /*   WCS support routines (provide interface to Doug Mink's WCS library */
1863 int CFITS_API ffgiwcs(fitsfile *fptr,  char **header, int *status);
1864 int CFITS_API ffgtwcs(fitsfile *fptr, int xcol, int ycol, char **header, int *status);
1865 
1866 /*--------------------- lexical parsing routines ------------------*/
1867 int CFITS_API fftexp( fitsfile *fptr, char *expr, int maxdim,
1868 	    int *datatype, long *nelem, int *naxis,
1869 	    long *naxes, int *status );
1870 
1871 int CFITS_API fffrow( fitsfile *infptr, char *expr,
1872 	    long firstrow, long nrows,
1873             long *n_good_rows, char *row_status, int *status);
1874 
1875 int CFITS_API ffffrw( fitsfile *fptr, char *expr, long *rownum, int *status);
1876 
1877 int CFITS_API fffrwc( fitsfile *fptr, char *expr, char *timeCol,
1878             char *parCol, char *valCol, long ntimes,
1879             double *times, char *time_status, int  *status );
1880 
1881 int CFITS_API ffsrow( fitsfile *infptr, fitsfile *outfptr, char *expr,
1882             int *status);
1883 
1884 int CFITS_API ffcrow( fitsfile *fptr, int datatype, char *expr,
1885 	    long firstrow, long nelements, void *nulval,
1886 	    void *array, int *anynul, int *status );
1887 
1888 int CFITS_API ffcalc_rng( fitsfile *infptr, char *expr, fitsfile *outfptr,
1889                char *parName, char *parInfo, int nRngs,
1890                  long *start, long *end, int *status );
1891 
1892 int CFITS_API ffcalc( fitsfile *infptr, char *expr, fitsfile *outfptr,
1893             char *parName, char *parInfo, int *status );
1894 
1895   /* ffhist is not really intended as a user-callable routine */
1896   /* but it may be useful for some specialized applications   */
1897   /* ffhist2 is a newer version which is strongly recommended instead of ffhist */
1898 
1899 int CFITS_API ffhist(fitsfile **fptr, char *outfile, int imagetype, int naxis,
1900            char colname[4][FLEN_VALUE],
1901            double *minin, double *maxin, double *binsizein,
1902            char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],
1903            char binname[4][FLEN_VALUE],
1904            double weightin, char wtcol[FLEN_VALUE],
1905            int recip, char *rowselect, int *status);
1906 int CFITS_API ffhist2(fitsfile **fptr, char *outfile, int imagetype, int naxis,
1907            char colname[4][FLEN_VALUE],
1908            double *minin, double *maxin, double *binsizein,
1909            char minname[4][FLEN_VALUE], char maxname[4][FLEN_VALUE],
1910            char binname[4][FLEN_VALUE],
1911            double weightin, char wtcol[FLEN_VALUE],
1912            int recip, char *rowselect, int *status);
1913 CFITS_API fitsfile *ffhist3(fitsfile *fptr,
1914            char *outfile, int imagetype,  int naxis,
1915            char colname[4][FLEN_VALUE],
1916            double *minin,
1917            double *maxin,
1918            double *binsizein,
1919            char minname[4][FLEN_VALUE],
1920            char maxname[4][FLEN_VALUE],
1921            char binname[4][FLEN_VALUE],
1922            double weightin,
1923            char wtcol[FLEN_VALUE],
1924            int recip,
1925            char *selectrow,
1926            int *status);
1927 int CFITS_API fits_select_image_section(fitsfile **fptr, char *outfile,
1928            char *imagesection, int *status);
1929 int CFITS_API fits_copy_image_section(fitsfile *infptr, fitsfile *outfile,
1930            char *imagesection, int *status);
1931 
1932 int CFITS_API fits_calc_binning(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE],
1933     double *minin, double *maxin,  double *binsizein,
1934     char minname[4][FLEN_VALUE],  char maxname[4][FLEN_VALUE],
1935     char binname[4][FLEN_VALUE],  int *colnum,  long *haxes,
1936     float *amin, float *amax, float *binsize,  int *status);
1937 int CFITS_API fits_calc_binningd(fitsfile *fptr, int naxis, char colname[4][FLEN_VALUE],
1938     double *minin, double *maxin,  double *binsizein,
1939     char minname[4][FLEN_VALUE],  char maxname[4][FLEN_VALUE],
1940     char binname[4][FLEN_VALUE],  int *colnum,  long *haxes,
1941     double *amin, double *amax, double *binsize,  int *status);
1942 
1943 int CFITS_API fits_write_keys_histo(fitsfile *fptr,  fitsfile *histptr,
1944       int naxis, int *colnum, int *status);
1945 int CFITS_API fits_rebin_wcs( fitsfile *fptr, int naxis, float *amin,  float *binsize,
1946       int *status);
1947 int CFITS_API fits_rebin_wcsd( fitsfile *fptr, int naxis, double *amin,  double *binsize,
1948       int *status);
1949 int CFITS_API fits_make_hist(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis,
1950      long *naxes,  int *colnum,  float *amin,  float *amax, float *binsize,
1951      float weight, int wtcolnum, int recip, char *selectrow, int *status);
1952 int CFITS_API fits_make_histd(fitsfile *fptr, fitsfile *histptr, int bitpix,int naxis,
1953      long *naxes,  int *colnum,  double *amin,  double *amax, double *binsize,
1954      double weight, int wtcolnum, int recip, char *selectrow, int *status);
1955 
1956 typedef struct
1957 {
1958 	/* input(s) */
1959 	int count;
1960 	char ** path;
1961 	char ** tag;
1962 	fitsfile ** ifptr;
1963 
1964 	char * expression;
1965 
1966 	/* output control */
1967 	int bitpix;
1968 	long blank;
1969 	fitsfile * ofptr;
1970 	char keyword[FLEN_KEYWORD];
1971 	char comment[FLEN_COMMENT];
1972 } PixelFilter;
1973 
1974 
1975 int CFITS_API fits_pixel_filter (PixelFilter * filter, int * status);
1976 
1977 
1978 /*--------------------- grouping routines ------------------*/
1979 
1980 int CFITS_API ffgtcr(fitsfile *fptr, char *grpname, int grouptype, int *status);
1981 int CFITS_API ffgtis(fitsfile *fptr, char *grpname, int grouptype, int *status);
1982 int CFITS_API ffgtch(fitsfile *gfptr, int grouptype, int *status);
1983 int CFITS_API ffgtrm(fitsfile *gfptr, int rmopt, int *status);
1984 int CFITS_API ffgtcp(fitsfile *infptr, fitsfile *outfptr, int cpopt, int *status);
1985 int CFITS_API ffgtmg(fitsfile *infptr, fitsfile *outfptr, int mgopt, int *status);
1986 int CFITS_API ffgtcm(fitsfile *gfptr, int cmopt, int *status);
1987 int CFITS_API ffgtvf(fitsfile *gfptr, long *firstfailed, int *status);
1988 int CFITS_API ffgtop(fitsfile *mfptr,int group,fitsfile **gfptr,int *status);
1989 int CFITS_API ffgtam(fitsfile *gfptr, fitsfile *mfptr, int hdupos, int *status);
1990 int CFITS_API ffgtnm(fitsfile *gfptr, long *nmembers, int *status);
1991 int CFITS_API ffgmng(fitsfile *mfptr, long *nmembers, int *status);
1992 int CFITS_API ffgmop(fitsfile *gfptr, long member, fitsfile **mfptr, int *status);
1993 int CFITS_API ffgmcp(fitsfile *gfptr, fitsfile *mfptr, long member, int cpopt,
1994 	   int *status);
1995 int CFITS_API ffgmtf(fitsfile *infptr, fitsfile *outfptr,	long member, int tfopt,
1996 	   int *status);
1997 int CFITS_API ffgmrm(fitsfile *fptr, long member, int rmopt, int *status);
1998 
1999 /*--------------------- group template parser routines ------------------*/
2000 
2001 int CFITS_API fits_execute_template(fitsfile *ff, char *ngp_template, int *status);
2002 
2003 int CFITS_API fits_img_stats_short(short *array,long nx, long ny, int nullcheck,
2004     short nullvalue,long *ngoodpix, short *minvalue, short *maxvalue, double *mean,
2005     double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);
2006 int CFITS_API fits_img_stats_int(int *array,long nx, long ny, int nullcheck,
2007     int nullvalue,long *ngoodpix, int *minvalue, int *maxvalue, double *mean,
2008     double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);
2009 int CFITS_API fits_img_stats_float(float *array, long nx, long ny, int nullcheck,
2010     float nullvalue,long *ngoodpix, float *minvalue, float *maxvalue, double *mean,
2011     double *sigma, double *noise1, double *noise2, double *noise3, double *noise5, int *status);
2012 
2013 /*--------------------- image compression routines ------------------*/
2014 
2015 int CFITS_API fits_set_compression_type(fitsfile *fptr, int ctype, int *status);
2016 int CFITS_API fits_set_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status);
2017 int CFITS_API fits_set_noise_bits(fitsfile *fptr, int noisebits, int *status);
2018 int CFITS_API fits_set_quantize_level(fitsfile *fptr, float qlevel, int *status);
2019 int CFITS_API fits_set_hcomp_scale(fitsfile *fptr, float scale, int *status);
2020 int CFITS_API fits_set_hcomp_smooth(fitsfile *fptr, int smooth, int *status);
2021 int CFITS_API fits_set_quantize_method(fitsfile *fptr, int method, int *status);
2022 int CFITS_API fits_set_quantize_dither(fitsfile *fptr, int dither, int *status);
2023 int CFITS_API fits_set_dither_seed(fitsfile *fptr, int seed, int *status);
2024 int CFITS_API fits_set_dither_offset(fitsfile *fptr, int offset, int *status);
2025 int CFITS_API fits_set_lossy_int(fitsfile *fptr, int lossy_int, int *status);
2026 int CFITS_API fits_set_huge_hdu(fitsfile *fptr, int huge, int *status);
2027 int CFITS_API fits_set_compression_pref(fitsfile *infptr, fitsfile *outfptr, int *status);
2028 
2029 int CFITS_API fits_get_compression_type(fitsfile *fptr, int *ctype, int *status);
2030 int CFITS_API fits_get_tile_dim(fitsfile *fptr, int ndim, long *dims, int *status);
2031 int CFITS_API fits_get_quantize_level(fitsfile *fptr, float *qlevel, int *status);
2032 int CFITS_API fits_get_noise_bits(fitsfile *fptr, int *noisebits, int *status);
2033 int CFITS_API fits_get_hcomp_scale(fitsfile *fptr, float *scale, int *status);
2034 int CFITS_API fits_get_hcomp_smooth(fitsfile *fptr, int *smooth, int *status);
2035 int CFITS_API fits_get_dither_seed(fitsfile *fptr, int *seed, int *status);
2036 
2037 int CFITS_API fits_img_compress(fitsfile *infptr, fitsfile *outfptr, int *status);
2038 int CFITS_API fits_compress_img(fitsfile *infptr, fitsfile *outfptr, int compress_type,
2039          long *tilesize, int parm1, int parm2, int *status);
2040 int CFITS_API fits_is_compressed_image(fitsfile *fptr, int *status);
2041 int CFITS_API fits_is_reentrant(void);
2042 int CFITS_API fits_decompress_img (fitsfile *infptr, fitsfile *outfptr, int *status);
2043 int CFITS_API fits_img_decompress_header(fitsfile *infptr, fitsfile *outfptr, int *status);
2044 int CFITS_API fits_img_decompress (fitsfile *infptr, fitsfile *outfptr, int *status);
2045 
2046 /* H-compress routines */
2047 int CFITS_API fits_hcompress(int *a, int nx, int ny, int scale, char *output,
2048     long *nbytes, int *status);
2049 int CFITS_API fits_hcompress64(LONGLONG *a, int nx, int ny, int scale, char *output,
2050     long *nbytes, int *status);
2051 int CFITS_API fits_hdecompress(unsigned char *input, int smooth, int *a, int *nx,
2052        int *ny, int *scale, int *status);
2053 int CFITS_API fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *nx,
2054        int *ny, int *scale, int *status);
2055 
2056 int CFITS_API fits_compress_table  (fitsfile *infptr, fitsfile *outfptr, int *status);
2057 int CFITS_API fits_uncompress_table(fitsfile *infptr, fitsfile *outfptr, int *status);
2058 
2059 /* curl library wrapper routines (for https access) */
2060 int CFITS_API fits_init_https(void);
2061 int CFITS_API fits_cleanup_https(void);
2062 void CFITS_API fits_verbose_https(int flag);
2063 
2064 void CFITS_API ffshdwn(int flag);
2065 int CFITS_API ffgtmo(void);
2066 int CFITS_API ffstmo(int sec, int *status);
2067 
2068 /*  The following exclusion if __CINT__ is defined is needed for ROOT */
2069 #ifndef __CINT__
2070 #ifdef __cplusplus
2071 }
2072 #endif
2073 #endif
2074 
2075 #endif
2076 
2077