1 #ifndef _FITSIO2_H
2 #define _FITSIO2_H
3 
4 #include "fitsio.h"
5 
6 /*
7     Threading support using POSIX threads programming interface
8     (supplied by Bruce O'Neel)
9 
10     All threaded programs MUST have the
11 
12     -D_REENTRANT
13 
14     on the compile line and must link with -lpthread.  This means that
15     when one builds cfitsio for threads you must have -D_REENTRANT on the
16     gcc or cc command line.
17 */
18 
19 #ifdef _REENTRANT
20 #include <pthread.h>
21 /*  #include <assert.h>  not needed any more */
22 extern pthread_mutex_t Fitsio_Lock;
23 extern int Fitsio_Pthread_Status;
24 
25 #define FFLOCK1(lockname)   (Fitsio_Pthread_Status = pthread_mutex_lock(&lockname))
26 #define FFUNLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_unlock(&lockname))
27 #define FFLOCK   FFLOCK1(Fitsio_Lock)
28 #define FFUNLOCK FFUNLOCK1(Fitsio_Lock)
29 #define ffstrtok(str, tok, save) strtok_r(str, tok, save)
30 
31 #else
32 #define FFLOCK
33 #define FFUNLOCK
34 #define ffstrtok(str, tok, save) strtok(str, tok)
35 #endif
36 
37 /*
38   If REPLACE_LINKS is defined, then whenever CFITSIO fails to open
39   a file with write access because it is a soft link to a file that
40   only has read access, then CFITSIO will attempt to replace
41   the link with a local copy of the file, with write access.  This
42   feature was originally added to support the ftools in the Hera
43   environment, where many of the user's data file are soft links.
44 */
45 #if defined(BUILD_HERA)
46 #define REPLACE_LINKS 1
47 #endif
48 
49 #define USE_LARGE_VALUE -99  /* flag used when writing images */
50 
51 #define DBUFFSIZE 28800 /* size of data buffer in bytes */
52 
53 #define NMAXFILES  10000   /* maximum number of FITS files that can be opened */
54         /* CFITSIO will allocate (NMAXFILES * 80) bytes of memory */
55 	/* plus each file that is opened will use NIOBUF * 2880 bytes of memeory */
56 	/* where NIOBUF is defined in fitio.h and has a default value of 40 */
57 
58 #define MINDIRECT 8640   /* minimum size for direct reads and writes */
59                          /* MINDIRECT must have a value >= 8640 */
60 
61 /*   it is useful to identify certain specific types of machines   */
62 #define NATIVE             0 /* machine that uses non-byteswapped IEEE formats */
63 #define OTHERTYPE          1  /* any other type of machine */
64 #define VAXVMS             3  /* uses an odd floating point format */
65 #define ALPHAVMS           4  /* uses an odd floating point format */
66 #define IBMPC              5  /* used in drvrfile.c to work around a bug on PCs */
67 #define CRAY               6  /* requires a special NaN test algorithm */
68 
69 #define GFLOAT             1  /* used for VMS */
70 #define IEEEFLOAT          2  /* used for VMS */
71 
72 /* ======================================================================= */
73 /* The following logic is used to determine the type machine,              */
74 /*  whether the bytes are swapped, and the number of bits in a long value  */
75 /* ======================================================================= */
76 
77 /*   The following platforms have sizeof(long) == 8               */
78 /*   This block of code should match a similar block in fitsio.h  */
79 /*   and the block of code at the beginning of f77_wrap.h         */
80 
81 #if defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )
82                                   /* old Dec Alpha platforms running OSF */
83 #define BYTESWAPPED TRUE
84 #define LONGSIZE 64
85 
86 #elif defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__))
87                                /*  SUN Solaris7 in 64-bit mode */
88 #define BYTESWAPPED FALSE
89 #define MACHINE NATIVE
90 #define LONGSIZE 64
91 
92                             /* IBM System z mainframe support */
93 #elif defined(__s390x__)
94 #define BYTESWAPPED FALSE
95 #define LONGSIZE 64
96 
97 #elif defined(__s390__)
98 #define BYTESWAPPED FALSE
99 #define LONGSIZE 32
100 
101 #elif defined(__ia64__)  || defined(__x86_64__) || defined(__AARCH64EL__)
102                   /*  Intel itanium 64-bit PC, or AMD opteron 64-bit PC */
103 #define BYTESWAPPED TRUE
104 #define LONGSIZE 64
105 
106 #elif defined(_SX)             /* Nec SuperUx */
107 
108 #define BYTESWAPPED FALSE
109 #define MACHINE NATIVE
110 #define LONGSIZE 64
111 
112 #elif defined(__powerpc64__) || defined(__64BIT__) || defined(__AARCH64EB__)  /* IBM 64-bit AIX powerpc*/
113                               /* could also test for __ppc64__ or __PPC64 */
114 
115 #  if defined(__LITTLE_ENDIAN__)
116 #   define BYTESWAPPED TRUE
117 #  else
118 #   define BYTESWAPPED FALSE
119 #   define MACHINE NATIVE
120 #  endif
121 #  define LONGSIZE 64
122 
123 #elif defined(_MIPS_SZLONG)
124 
125 #  if defined(MIPSEL)
126 #    define BYTESWAPPED TRUE
127 #  else
128 #    define BYTESWAPPED FALSE
129 #    define MACHINE NATIVE
130 #  endif
131 
132 #  if _MIPS_SZLONG == 32
133 #    define LONGSIZE 32
134 #  elif _MIPS_SZLONG == 64
135 #    define LONGSIZE 64
136 #  else
137 #    error "can't handle long size given by _MIPS_SZLONG"
138 #  endif
139 
140 /* ============================================================== */
141 /*  the following are all 32-bit byteswapped platforms            */
142 
143 #elif defined(vax) && defined(VMS)
144 
145 #define MACHINE VAXVMS
146 #define BYTESWAPPED TRUE
147 
148 #elif defined(__alpha) && defined(__VMS)
149 
150 #if (__D_FLOAT == TRUE)
151 
152 /* this float option is the same as for VAX/VMS machines. */
153 #define MACHINE VAXVMS
154 #define BYTESWAPPED TRUE
155 
156 #elif  (__G_FLOAT == TRUE)
157 
158 /*  G_FLOAT is the default for ALPHA VMS systems */
159 #define MACHINE ALPHAVMS
160 #define BYTESWAPPED TRUE
161 #define FLOATTYPE GFLOAT
162 
163 #elif  (__IEEE_FLOAT == TRUE)
164 
165 #define MACHINE ALPHAVMS
166 #define BYTESWAPPED TRUE
167 #define FLOATTYPE IEEEFLOAT
168 
169 #endif  /* end of alpha VMS case */
170 
171 #elif defined(ultrix) && defined(unix)
172  /* old Dec ultrix machines */
173 #define BYTESWAPPED TRUE
174 
175 #elif defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) \
176   || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TURBOC__) \
177   || defined(_NI_mswin_) || defined(__EMX__)
178 
179 /*  generic 32-bit IBM PC */
180 #define MACHINE IBMPC
181 #define BYTESWAPPED TRUE
182 
183 #elif defined(__arm__)
184 
185 /* This assumes all ARM are little endian.  In the future, it might be  */
186 /* necessary to use  "if defined(__ARMEL__)"  to distinguish little from big. */
187 /* (__ARMEL__ would be defined on little-endian, but not on big-endian). */
188 
189 #define BYTESWAPPED TRUE
190 
191 #elif defined(__tile__)
192 
193 /*  64-core 8x8-architecture Tile64 platform */
194 
195 #define BYTESWAPPED TRUE
196 
197 #elif defined(__sh__)
198 
199 /* SuperH CPU can be used in both little and big endian modes */
200 
201 #if defined(__LITTLE_ENDIAN__)
202 #define BYTESWAPPED TRUE
203 #else
204 #define BYTESWAPPED FALSE
205 #endif
206 
207 #elif defined(__riscv)
208 
209 /* RISC-V is little endian */
210 
211 #define BYTESWAPPED TRUE
212 
213 #else
214 
215 /*  assume all other machine uses the same IEEE formats as used in FITS files */
216 /*  e.g., Macs fall into this category  */
217 
218 #define MACHINE NATIVE
219 #define BYTESWAPPED FALSE
220 
221 #endif
222 
223 #ifndef MACHINE
224 #define MACHINE  OTHERTYPE
225 #endif
226 
227 /*  assume longs are 4 bytes long, unless previously set otherwise */
228 #ifndef LONGSIZE
229 #define LONGSIZE 32
230 #endif
231 
232 /*       end of block that determine long size and byte swapping        */
233 /* ==================================================================== */
234 
235 #define IGNORE_EOF 1
236 #define REPORT_EOF 0
237 #define DATA_UNDEFINED -1
238 #define NULL_UNDEFINED 1234554321
239 #define ASCII_NULL_UNDEFINED 1   /* indicate no defined null value */
240 
241 #define maxvalue(A,B) ((A) > (B) ? (A) : (B))
242 #define minvalue(A,B) ((A) < (B) ? (A) : (B))
243 
244 /* faster string comparison macros */
245 #define FSTRCMP(a,b)     ((a)[0]<(b)[0]? -1:(a)[0]>(b)[0]?1:strcmp((a),(b)))
246 #define FSTRNCMP(a,b,n)  ((a)[0]<(b)[0]?-1:(a)[0]>(b)[0]?1:strncmp((a),(b),(n)))
247 
248 #if defined(__VMS) || defined(VMS)
249 
250 #define FNANMASK   0xFFFF /* mask all bits  */
251 #define DNANMASK   0xFFFF /* mask all bits  */
252 
253 #else
254 
255 #define FNANMASK   0x7F80 /* mask bits 1 - 8; all set on NaNs */
256                                      /* all 0 on underflow  or 0. */
257 
258 #define DNANMASK   0x7FF0 /* mask bits 1 - 11; all set on NaNs */
259                                      /* all 0 on underflow  or 0. */
260 
261 #endif
262 
263 #if MACHINE == CRAY
264     /*
265       Cray machines:   the large negative integer corresponds
266       to the 3 most sig digits set to 1.   If these
267       3 bits are set in a floating point number (64 bits), then it represents
268       a reserved value (i.e., a NaN)
269     */
270 #define fnan(L) ( (L) >= 0xE000000000000000 ? 1 : 0) )
271 
272 #else
273     /* these functions work for both big and little endian machines */
274     /* that use the IEEE floating point format for internal numbers */
275 
276    /* These functions tests whether the float value is a reserved IEEE     */
277    /* value such as a Not-a-Number (NaN), or underflow, overflow, or       */
278    /* infinity.   The functions returns 1 if the value is a NaN, overflow  */
279    /* or infinity; it returns 2 if the value is an denormalized underflow  */
280    /* value; otherwise it returns 0. fnan tests floats, dnan tests doubles */
281 
282 #define fnan(L) \
283       ( (L & FNANMASK) == FNANMASK ?  1 : (L & FNANMASK) == 0 ? 2 : 0)
284 
285 #define dnan(L) \
286       ( (L & DNANMASK) == DNANMASK ?  1 : (L & DNANMASK) == 0 ? 2 : 0)
287 
288 #endif
289 
290 #define DSCHAR_MAX  127.49 /* max double value that fits in an signed char */
291 #define DSCHAR_MIN -128.49 /* min double value that fits in an signed char */
292 #define DUCHAR_MAX  255.49 /* max double value that fits in an unsigned char */
293 #define DUCHAR_MIN -0.49   /* min double value that fits in an unsigned char */
294 #define DUSHRT_MAX  65535.49 /* max double value that fits in a unsigned short*/
295 #define DUSHRT_MIN -0.49   /* min double value that fits in an unsigned short */
296 #define DSHRT_MAX  32767.49 /* max double value that fits in a short */
297 #define DSHRT_MIN -32768.49 /* min double value that fits in a short */
298 
299 #if LONGSIZE == 32
300 #  define DLONG_MAX  2147483647.49 /* max double value that fits in a long */
301 #  define DLONG_MIN -2147483648.49 /* min double value that fits in a long */
302 #  define DULONG_MAX 4294967295.49 /* max double that fits in a unsigned long */
303 #else
304 #  define DLONG_MAX   9.2233720368547752E18 /* max double value  long */
305 #  define DLONG_MIN  -9.2233720368547752E18 /* min double value  long */
306 #  define DULONG_MAX 1.84467440737095504E19 /* max double value  ulong */
307 #endif
308 
309 #define DULONG_MIN -0.49   /* min double value that fits in an unsigned long */
310 #define DULONGLONG_MAX 18446744073709551615. /* max unsigned  longlong */
311 #define DULONGLONG_MIN -0.49
312 #define DLONGLONG_MAX  9.2233720368547755807E18 /* max double value  longlong */
313 #define DLONGLONG_MIN -9.2233720368547755808E18 /* min double value  longlong */
314 #define DUINT_MAX 4294967295.49 /* max dbl that fits in a unsigned 4-byte int */
315 #define DUINT_MIN -0.49   /* min dbl that fits in an unsigned 4-byte int */
316 #define DINT_MAX  2147483647.49 /* max double value that fits in a 4-byte int */
317 #define DINT_MIN -2147483648.49 /* min double value that fits in a 4-byte int */
318 
319 #ifndef UINT64_MAX
320 #define UINT64_MAX 18446744073709551615U /* max unsigned 64-bit integer */
321 #endif
322 #ifndef UINT32_MAX
323 #define UINT32_MAX 4294967295U /* max unsigned 32-bit integer */
324 #endif
325 #ifndef INT32_MAX
326 #define INT32_MAX  2147483647 /* max 32-bit integer */
327 #endif
328 #ifndef INT32_MIN
329 #define INT32_MIN (-INT32_MAX -1) /* min 32-bit integer */
330 #endif
331 
332 
333 #define COMPRESS_NULL_VALUE -2147483647
334 #define N_RANDOM 10000  /* DO NOT CHANGE THIS;  used when quantizing real numbers */
335 
336 int ffgnky(fitsfile *fptr, char *card, int *status);
337 void ffcfmt(char *tform, char *cform);
338 void ffcdsp(char *tform, char *cform);
339 void ffswap2(short *values, long nvalues);
340 void ffswap4(INT32BIT *values, long nvalues);
341 void ffswap8(double *values, long nvalues);
342 int ffi2c(LONGLONG ival, char *cval, int *status);
343 int ffu2c(ULONGLONG ival, char *cval, int *status);
344 int ffl2c(int lval, char *cval, int *status);
345 int ffs2c(const char *instr, char *outstr, int *status);
346 int ffr2f(float fval, int decim, char *cval, int *status);
347 int ffr2e(float fval, int decim, char *cval, int *status);
348 int ffd2f(double dval, int decim, char *cval, int *status);
349 int ffd2e(double dval, int decim, char *cval, int *status);
350 int ffc2ii(const char *cval, long *ival, int *status);
351 int ffc2jj(const char *cval, LONGLONG *ival, int *status);
352 int ffc2ujj(const char *cval, ULONGLONG *ival, int *status);
353 int ffc2ll(const char *cval, int *lval, int *status);
354 int ffc2rr(const char *cval, float *fval, int *status);
355 int ffc2dd(const char *cval, double *dval, int *status);
356 int ffc2x(const char *cval, char *dtype, long *ival, int *lval, char *sval,
357           double *dval, int *status);
358 int ffc2xx(const char *cval, char *dtype, LONGLONG *ival, int *lval, char *sval,
359           double *dval, int *status);
360 int ffc2uxx(const char *cval, char *dtype, ULONGLONG *ival, int *lval, char *sval,
361           double *dval, int *status);
362 int ffc2s(const char *instr, char *outstr, int *status);
363 int ffc2i(const char *cval, long *ival, int *status);
364 int ffc2j(const char *cval, LONGLONG *ival, int *status);
365 int ffc2uj(const char *cval, ULONGLONG *ival, int *status);
366 int ffc2r(const char *cval, float *fval, int *status);
367 int ffc2d(const char *cval, double *dval, int *status);
368 int ffc2l(const char *cval, int *lval, int *status);
369 void ffxmsg(int action, char *err_message);
370 int ffgcnt(fitsfile *fptr, char *value, char *comm, int *status);
371 int ffgtkn(fitsfile *fptr, int numkey, char *keyname, long *value, int *status);
372 int ffgtknjj(fitsfile *fptr, int numkey, char *keyname, LONGLONG *value, int *status);
373 int fftkyn(fitsfile *fptr, int numkey, char *keyname, char *value, int *status);
374 int ffgphd(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,
375         LONGLONG naxes[], long *pcount, long *gcount, int *extend, double *bscale,
376           double *bzero, LONGLONG *blank, int *nspace, int *status);
377 int ffgttb(fitsfile *fptr, LONGLONG *rowlen, LONGLONG *nrows, LONGLONG *pcount,
378           long *tfield, int *status);
379 
380 int ffmkey(fitsfile *fptr, const char *card, int *status);
381 
382 /*  ffmbyt has been moved to fitsio.h */
383 int ffgbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);
384 int ffpbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);
385 int ffgbytoff(fitsfile *fptr, long gsize, long ngroups, long offset,
386            void *buffer, int *status);
387 int ffpbytoff(fitsfile *fptr, long gsize, long ngroups, long offset,
388            void *buffer, int *status);
389 int ffldrc(fitsfile *fptr, long record, int err_mode, int *status);
390 int ffwhbf(fitsfile *fptr, int *nbuff);
391 int ffbfeof(fitsfile *fptr, int *status);
392 int ffbfwt(FITSfile *Fptr, int nbuff, int *status);
393 int ffpxsz(int datatype);
394 
395 int ffourl(char *url, char *urltype, char *outfile, char *tmplfile,
396             char *compspec, int *status);
397 int ffparsecompspec(fitsfile *fptr, char *compspec, int *status);
398 int ffoptplt(fitsfile *fptr, const char *tempname, int *status);
399 int fits_is_this_a_copy(char *urltype);
400 int fits_store_Fptr(FITSfile *Fptr, int *status);
401 int fits_clear_Fptr(FITSfile *Fptr, int *status);
402 int fits_already_open(fitsfile **fptr, char *url,
403     char *urltype, char *infile, char *extspec, char *rowfilter,
404     char *binspec, char *colspec, int  mode,int  *isopen, int  *status);
405 int ffedit_columns(fitsfile **fptr, char *outfile, char *expr, int *status);
406 int fits_get_col_minmax(fitsfile *fptr, int colnum, double *datamin,
407                      double *datamax, int *status);
408 int ffwritehisto(long totaln, long offset, long firstn, long nvalues,
409              int narrays, iteratorCol *imagepars, void *userPointer);
410 int ffcalchist(long totalrows, long offset, long firstrow, long nrows,
411              int ncols, iteratorCol *colpars, void *userPointer);
412 int ffpinit(fitsfile *fptr, int *status);
413 int ffainit(fitsfile *fptr, int *status);
414 int ffbinit(fitsfile *fptr, int *status);
415 int ffchdu(fitsfile *fptr, int *status);
416 int ffwend(fitsfile *fptr, int *status);
417 int ffpdfl(fitsfile *fptr, int *status);
418 int ffuptf(fitsfile *fptr, int *status);
419 
420 int ffdblk(fitsfile *fptr, long nblocks, int *status);
421 int ffgext(fitsfile *fptr, int moveto, int *exttype, int *status);
422 int ffgtbc(fitsfile *fptr, LONGLONG *totalwidth, int *status);
423 int ffgtbp(fitsfile *fptr, char *name, char *value, int *status);
424 int ffiblk(fitsfile *fptr, long nblock, int headdata, int *status);
425 int ffshft(fitsfile *fptr, LONGLONG firstbyte, LONGLONG nbytes, LONGLONG nshift,
426     int *status);
427 
428  int ffgcprll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
429            LONGLONG nelem, int writemode, double *scale, double *zero, char *tform,
430            long *twidth, int *tcode, int *maxelem, LONGLONG *startpos,
431            LONGLONG *elemnum, long *incre, LONGLONG *repeat, LONGLONG *rowlen,
432            int *hdutype, LONGLONG *tnull, char *snull, int *status);
433 
434 int ffflushx(FITSfile *fptr);
435 int ffseek(FITSfile *fptr, LONGLONG position);
436 int ffread(FITSfile *fptr, long nbytes, void *buffer,
437             int *status);
438 int ffwrite(FITSfile *fptr, long nbytes, void *buffer,
439             int *status);
440 int fftrun(fitsfile *fptr, LONGLONG filesize, int *status);
441 
442 int ffpcluc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
443            LONGLONG nelem, int *status);
444 
445 int ffgcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
446            LONGLONG nelem, int nultyp, char nulval, char *array, char *nularray,
447            int *anynul, int *status);
448 int ffgcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
449            LONGLONG nelem, int nultyp, char *nulval,
450            char **array, char *nularray, int *anynul, int  *status);
451 int ffgcls2(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
452            LONGLONG nelem, int nultyp, char *nulval,
453            char **array, char *nularray, int *anynul, int  *status);
454 int ffgclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
455            LONGLONG nelem, long  elemincre, int nultyp, unsigned char nulval,
456            unsigned char *array, char *nularray, int *anynul, int  *status);
457 int ffgclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
458            LONGLONG nelem, long  elemincre, int nultyp, signed char nulval,
459            signed char *array, char *nularray, int *anynul, int  *status);
460 int ffgclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
461            LONGLONG nelem, long  elemincre, int nultyp, unsigned short nulval,
462            unsigned short *array, char *nularray, int *anynul, int  *status);
463 int ffgcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
464            LONGLONG nelem, long  elemincre, int nultyp, short nulval,
465            short *array, char *nularray, int *anynul, int  *status);
466 int ffgcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
467            LONGLONG nelem, long elemincre, int nultyp, unsigned long nulval,
468            unsigned long *array, char *nularray, int *anynul, int  *status);
469 int ffgclujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
470            LONGLONG nelem, long elemincre, int nultyp, ULONGLONG nulval,
471            ULONGLONG *array, char *nularray, int *anynul, int  *status);
472 int ffgcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
473            LONGLONG nelem, long elemincre, int nultyp, LONGLONG nulval,
474            LONGLONG *array, char *nularray, int *anynul, int  *status);
475 int ffgclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
476            LONGLONG nelem, long elemincre, int nultyp, long nulval, long *array,
477            char *nularray, int *anynul, int  *status);
478 int ffgcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
479            LONGLONG nelem, long elemincre, int nultyp, unsigned int nulval,
480            unsigned int *array, char *nularray, int *anynul, int  *status);
481 int ffgclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
482            LONGLONG nelem, long elemincre, int nultyp, int nulval, int *array,
483            char *nularray, int *anynul, int  *status);
484 int ffgcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
485            LONGLONG nelem, long elemincre, int nultyp,  float nulval, float *array,
486            char *nularray, int *anynul, int  *status);
487 int ffgcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
488            LONGLONG nelem, long elemincre, int nultyp, double nulval,
489            double *array, char *nularray, int *anynul, int  *status);
490 
491 int ffpi1b(fitsfile *fptr, long nelem, long incre, unsigned char *buffer,
492            int *status);
493 int ffpi2b(fitsfile *fptr, long nelem, long incre, short *buffer, int *status);
494 int ffpi4b(fitsfile *fptr, long nelem, long incre, INT32BIT *buffer,
495            int *status);
496 int ffpi8b(fitsfile *fptr, long nelem, long incre, long *buffer, int *status);
497 int ffpr4b(fitsfile *fptr, long nelem, long incre, float *buffer, int *status);
498 int ffpr8b(fitsfile *fptr, long nelem, long incre, double *buffer, int *status);
499 
500 int ffgi1b(fitsfile *fptr, LONGLONG pos, long nelem, long incre,
501           unsigned char *buffer, int *status);
502 int ffgi2b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, short *buffer,
503           int *status);
504 int ffgi4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, INT32BIT *buffer,
505           int *status);
506 int ffgi8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, long *buffer,
507           int *status);
508 int ffgr4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, float *buffer,
509           int *status);
510 int ffgr8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, double *buffer,
511           int *status);
512 
513 int ffcins(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,
514            LONGLONG bytepos, int *status);
515 int ffcdel(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,
516            LONGLONG bytepos, int *status);
517 int ffkshf(fitsfile *fptr, int firstcol, int tfields, int nshift, int *status);
518 int fffvcl(fitsfile *fptr, int *nvarcols, int *colnums, int *status);
519 
520 int fffi1i1(unsigned char *input, long ntodo, double scale, double zero,
521             int nullcheck, unsigned char tnull, unsigned char nullval, char
522              *nullarray, int *anynull, unsigned char *output, int *status);
523 int fffi2i1(short *input, long ntodo, double scale, double zero,
524             int nullcheck, short tnull, unsigned char nullval, char *nullarray,
525             int *anynull, unsigned char *output, int *status);
526 int fffi4i1(INT32BIT *input, long ntodo, double scale, double zero,
527             int nullcheck, INT32BIT tnull, unsigned char nullval, char *nullarray,
528             int *anynull, unsigned char *output, int *status);
529 int fffi8i1(LONGLONG *input, long ntodo, double scale, double zero,
530             int nullcheck, LONGLONG tnull, unsigned char nullval, char *nullarray,
531             int *anynull, unsigned char *output, int *status);
532 int fffr4i1(float *input, long ntodo, double scale, double zero,
533             int nullcheck, unsigned char nullval, char *nullarray,
534             int *anynull, unsigned char *output, int *status);
535 int fffr8i1(double *input, long ntodo, double scale, double zero,
536             int nullcheck, unsigned char nullval, char *nullarray,
537             int *anynull, unsigned char *output, int *status);
538 int fffstri1(char *input, long ntodo, double scale, double zero,
539             long twidth, double power, int nullcheck, char *snull,
540             unsigned char nullval, char *nullarray, int *anynull,
541             unsigned char *output, int *status);
542 
543 int fffi1s1(unsigned char *input, long ntodo, double scale, double zero,
544             int nullcheck, unsigned char tnull, signed char nullval, char
545              *nullarray, int *anynull, signed char *output, int *status);
546 int fffi2s1(short *input, long ntodo, double scale, double zero,
547             int nullcheck, short tnull, signed char nullval, char *nullarray,
548             int *anynull, signed char *output, int *status);
549 int fffi4s1(INT32BIT *input, long ntodo, double scale, double zero,
550             int nullcheck, INT32BIT tnull, signed char nullval, char *nullarray,
551             int *anynull, signed char *output, int *status);
552 int fffi8s1(LONGLONG *input, long ntodo, double scale, double zero,
553             int nullcheck, LONGLONG tnull, signed char nullval, char *nullarray,
554             int *anynull, signed char *output, int *status);
555 int fffr4s1(float *input, long ntodo, double scale, double zero,
556             int nullcheck, signed char nullval, char *nullarray,
557             int *anynull, signed char *output, int *status);
558 int fffr8s1(double *input, long ntodo, double scale, double zero,
559             int nullcheck, signed char nullval, char *nullarray,
560             int *anynull, signed char *output, int *status);
561 int fffstrs1(char *input, long ntodo, double scale, double zero,
562             long twidth, double power, int nullcheck, char *snull,
563             signed char nullval, char *nullarray, int *anynull,
564             signed char *output, int *status);
565 
566 int fffi1u2(unsigned char *input, long ntodo, double scale, double zero,
567             int nullcheck, unsigned char tnull, unsigned short nullval,
568             char *nullarray,
569             int *anynull, unsigned short *output, int *status);
570 int fffi2u2(short *input, long ntodo, double scale, double zero,
571             int nullcheck, short tnull, unsigned short nullval, char *nullarray,
572             int *anynull, unsigned short *output, int *status);
573 int fffi4u2(INT32BIT *input, long ntodo, double scale, double zero,
574             int nullcheck, INT32BIT tnull, unsigned short nullval, char *nullarray,
575             int *anynull, unsigned short *output, int *status);
576 int fffi8u2(LONGLONG *input, long ntodo, double scale, double zero,
577             int nullcheck, LONGLONG tnull, unsigned short nullval, char *nullarray,
578             int *anynull, unsigned short *output, int *status);
579 int fffr4u2(float *input, long ntodo, double scale, double zero,
580             int nullcheck, unsigned short nullval, char *nullarray,
581             int *anynull, unsigned short *output, int *status);
582 int fffr8u2(double *input, long ntodo, double scale, double zero,
583             int nullcheck, unsigned short nullval, char *nullarray,
584             int *anynull, unsigned short *output, int *status);
585 int fffstru2(char *input, long ntodo, double scale, double zero,
586             long twidth, double power, int nullcheck, char *snull,
587             unsigned short nullval, char *nullarray, int  *anynull,
588             unsigned short *output, int *status);
589 
590 int fffi1i2(unsigned char *input, long ntodo, double scale, double zero,
591             int nullcheck, unsigned char tnull, short nullval, char *nullarray,
592             int *anynull, short *output, int *status);
593 int fffi2i2(short *input, long ntodo, double scale, double zero,
594             int nullcheck, short tnull, short nullval, char *nullarray,
595             int *anynull, short *output, int *status);
596 int fffi4i2(INT32BIT *input, long ntodo, double scale, double zero,
597             int nullcheck, INT32BIT tnull, short nullval, char *nullarray,
598             int *anynull, short *output, int *status);
599 int fffi8i2(LONGLONG *input, long ntodo, double scale, double zero,
600             int nullcheck, LONGLONG tnull, short nullval, char *nullarray,
601             int *anynull, short *output, int *status);
602 int fffr4i2(float *input, long ntodo, double scale, double zero,
603             int nullcheck, short nullval, char *nullarray,
604             int *anynull, short *output, int *status);
605 int fffr8i2(double *input, long ntodo, double scale, double zero,
606             int nullcheck, short nullval, char *nullarray,
607             int *anynull, short *output, int *status);
608 int fffstri2(char *input, long ntodo, double scale, double zero,
609             long twidth, double power, int nullcheck, char *snull,
610             short nullval, char *nullarray, int  *anynull, short *output,
611             int *status);
612 
613 int fffi1u4(unsigned char *input, long ntodo, double scale, double zero,
614             int nullcheck, unsigned char tnull, unsigned long nullval,
615             char *nullarray,
616             int *anynull, unsigned long *output, int *status);
617 int fffi2u4(short *input, long ntodo, double scale, double zero,
618             int nullcheck, short tnull, unsigned long nullval, char *nullarray,
619             int *anynull, unsigned long *output, int *status);
620 int fffi4u4(INT32BIT *input, long ntodo, double scale, double zero,
621             int nullcheck, INT32BIT tnull, unsigned long nullval, char *nullarray,
622             int *anynull, unsigned long *output, int *status);
623 int fffi8u4(LONGLONG *input, long ntodo, double scale, double zero,
624             int nullcheck, LONGLONG tnull, unsigned long nullval, char *nullarray,
625             int *anynull, unsigned long *output, int *status);
626 int fffr4u4(float *input, long ntodo, double scale, double zero,
627             int nullcheck, unsigned long nullval, char *nullarray,
628             int *anynull, unsigned long *output, int *status);
629 int fffr8u4(double *input, long ntodo, double scale, double zero,
630             int nullcheck, unsigned long nullval, char *nullarray,
631             int *anynull, unsigned long *output, int *status);
632 int fffstru4(char *input, long ntodo, double scale, double zero,
633             long twidth, double power, int nullcheck, char *snull,
634             unsigned long nullval, char *nullarray, int *anynull,
635             unsigned long *output, int *status);
636 
637 int fffi1i4(unsigned char *input, long ntodo, double scale, double zero,
638             int nullcheck, unsigned char tnull, long nullval, char *nullarray,
639             int *anynull, long *output, int *status);
640 int fffi2i4(short *input, long ntodo, double scale, double zero,
641             int nullcheck, short tnull, long nullval, char *nullarray,
642             int *anynull, long *output, int *status);
643 int fffi4i4(INT32BIT *input, long ntodo, double scale, double zero,
644             int nullcheck, INT32BIT tnull, long nullval, char *nullarray,
645             int *anynull, long *output, int *status);
646 int fffi8i4(LONGLONG *input, long ntodo, double scale, double zero,
647             int nullcheck, LONGLONG tnull, long nullval, char *nullarray,
648             int *anynull, long *output, int *status);
649 int fffr4i4(float *input, long ntodo, double scale, double zero,
650             int nullcheck, long nullval, char *nullarray,
651             int *anynull, long *output, int *status);
652 int fffr8i4(double *input, long ntodo, double scale, double zero,
653             int nullcheck, long nullval, char *nullarray,
654             int *anynull, long *output, int *status);
655 int fffstri4(char *input, long ntodo, double scale, double zero,
656             long twidth, double power, int nullcheck, char *snull,
657             long nullval, char *nullarray, int *anynull, long *output,
658             int *status);
659 
660 int fffi1int(unsigned char *input, long ntodo, double scale, double zero,
661             int nullcheck, unsigned char tnull, int nullval, char *nullarray,
662             int *anynull, int *output, int *status);
663 int fffi2int(short *input, long ntodo, double scale, double zero,
664             int nullcheck, short tnull, int nullval, char *nullarray,
665             int *anynull, int *output, int *status);
666 int fffi4int(INT32BIT *input, long ntodo, double scale, double zero,
667             int nullcheck, INT32BIT tnull, int nullval, char *nullarray,
668             int *anynull, int *output, int *status);
669 int fffi8int(LONGLONG *input, long ntodo, double scale, double zero,
670             int nullcheck, LONGLONG tnull, int nullval, char *nullarray,
671             int *anynull, int *output, int *status);
672 int fffr4int(float *input, long ntodo, double scale, double zero,
673             int nullcheck, int nullval, char *nullarray,
674             int *anynull, int *output, int *status);
675 int fffr8int(double *input, long ntodo, double scale, double zero,
676             int nullcheck, int nullval, char *nullarray,
677             int *anynull, int *output, int *status);
678 int fffstrint(char *input, long ntodo, double scale, double zero,
679             long twidth, double power, int nullcheck, char *snull,
680             int nullval, char *nullarray, int *anynull, int *output,
681             int *status);
682 
683 int fffi1uint(unsigned char *input, long ntodo, double scale, double zero,
684             int nullcheck, unsigned char tnull, unsigned int nullval,
685             char *nullarray, int *anynull, unsigned int *output, int *status);
686 int fffi2uint(short *input, long ntodo, double scale, double zero,
687             int nullcheck, short tnull, unsigned int nullval, char *nullarray,
688             int *anynull, unsigned int *output, int *status);
689 int fffi4uint(INT32BIT *input, long ntodo, double scale, double zero,
690             int nullcheck, INT32BIT tnull, unsigned int nullval, char *nullarray,
691             int *anynull, unsigned int *output, int *status);
692 int fffi8uint(LONGLONG *input, long ntodo, double scale, double zero,
693             int nullcheck, LONGLONG tnull, unsigned int nullval, char *nullarray,
694             int *anynull, unsigned int *output, int *status);
695 int fffr4uint(float *input, long ntodo, double scale, double zero,
696             int nullcheck, unsigned int nullval, char *nullarray,
697             int *anynull, unsigned int *output, int *status);
698 int fffr8uint(double *input, long ntodo, double scale, double zero,
699             int nullcheck, unsigned int nullval, char *nullarray,
700             int *anynull, unsigned int *output, int *status);
701 int fffstruint(char *input, long ntodo, double scale, double zero,
702             long twidth, double power, int nullcheck, char *snull,
703             unsigned int nullval, char *nullarray, int *anynull,
704             unsigned int *output, int *status);
705 
706 int fffi1i8(unsigned char *input, long ntodo, double scale, double zero,
707             int nullcheck, unsigned char tnull, LONGLONG nullval,
708             char *nullarray, int *anynull, LONGLONG *output, int *status);
709 int fffi2i8(short *input, long ntodo, double scale, double zero,
710             int nullcheck, short tnull, LONGLONG nullval, char *nullarray,
711             int *anynull, LONGLONG *output, int *status);
712 int fffi4i8(INT32BIT *input, long ntodo, double scale, double zero,
713             int nullcheck, INT32BIT tnull, LONGLONG nullval, char *nullarray,
714             int *anynull, LONGLONG *output, int *status);
715 int fffi8i8(LONGLONG *input, long ntodo, double scale, double zero,
716             int nullcheck, LONGLONG tnull, LONGLONG nullval, char *nullarray,
717             int *anynull, LONGLONG *output, int *status);
718 int fffr4i8(float *input, long ntodo, double scale, double zero,
719             int nullcheck, LONGLONG nullval, char *nullarray,
720             int *anynull, LONGLONG *output, int *status);
721 int fffr8i8(double *input, long ntodo, double scale, double zero,
722             int nullcheck, LONGLONG nullval, char *nullarray,
723             int *anynull, LONGLONG *output, int *status);
724 int fffstri8(char *input, long ntodo, double scale, double zero,
725             long twidth, double power, int nullcheck, char *snull,
726             LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output,
727             int *status);
728 
729 int fffi1u8(unsigned char *input, long ntodo, double scale, double zero,
730             int nullcheck, unsigned char tnull, ULONGLONG nullval,
731             char *nullarray, int *anynull, ULONGLONG *output, int *status);
732 int fffi2u8(short *input, long ntodo, double scale, double zero,
733             int nullcheck, short tnull, ULONGLONG nullval, char *nullarray,
734             int *anynull, ULONGLONG *output, int *status);
735 int fffi4u8(INT32BIT *input, long ntodo, double scale, double zero,
736             int nullcheck, INT32BIT tnull, ULONGLONG nullval, char *nullarray,
737             int *anynull, ULONGLONG *output, int *status);
738 int fffi8u8(LONGLONG *input, long ntodo, double scale, double zero,
739             int nullcheck, LONGLONG tnull, ULONGLONG nullval, char *nullarray,
740             int *anynull, ULONGLONG *output, int *status);
741 int fffr4u8(float *input, long ntodo, double scale, double zero,
742             int nullcheck, ULONGLONG nullval, char *nullarray,
743             int *anynull, ULONGLONG *output, int *status);
744 int fffr8u8(double *input, long ntodo, double scale, double zero,
745             int nullcheck, ULONGLONG nullval, char *nullarray,
746             int *anynull, ULONGLONG *output, int *status);
747 int fffstru8(char *input, long ntodo, double scale, double zero,
748             long twidth, double power, int nullcheck, char *snull,
749             ULONGLONG nullval, char *nullarray, int *anynull, ULONGLONG *output,
750             int *status);
751 
752 
753 int fffi1r4(unsigned char *input, long ntodo, double scale, double zero,
754             int nullcheck, unsigned char tnull, float nullval, char *nullarray,
755             int *anynull, float *output, int *status);
756 int fffi2r4(short *input, long ntodo, double scale, double zero,
757             int nullcheck, short tnull, float nullval, char *nullarray,
758             int *anynull, float *output, int *status);
759 int fffi4r4(INT32BIT *input, long ntodo, double scale, double zero,
760             int nullcheck, INT32BIT tnull, float nullval, char *nullarray,
761             int *anynull, float *output, int *status);
762 int fffi8r4(LONGLONG *input, long ntodo, double scale, double zero,
763             int nullcheck, LONGLONG tnull, float nullval, char *nullarray,
764             int *anynull, float *output, int *status);
765 int fffr4r4(float *input, long ntodo, double scale, double zero,
766             int nullcheck, float nullval, char *nullarray,
767             int *anynull, float *output, int *status);
768 int fffr8r4(double *input, long ntodo, double scale, double zero,
769             int nullcheck, float nullval, char *nullarray,
770             int *anynull, float *output, int *status);
771 int fffstrr4(char *input, long ntodo, double scale, double zero,
772             long twidth, double power, int nullcheck, char *snull,
773             float nullval, char *nullarray, int *anynull, float *output,
774             int *status);
775 
776 int fffi1r8(unsigned char *input, long ntodo, double scale, double zero,
777             int nullcheck, unsigned char tnull, double nullval, char *nullarray,
778             int *anynull, double *output, int *status);
779 int fffi2r8(short *input, long ntodo, double scale, double zero,
780             int nullcheck, short tnull, double nullval, char *nullarray,
781             int *anynull, double *output, int *status);
782 int fffi4r8(INT32BIT *input, long ntodo, double scale, double zero,
783             int nullcheck, INT32BIT tnull, double nullval, char *nullarray,
784             int *anynull, double *output, int *status);
785 int fffi8r8(LONGLONG *input, long ntodo, double scale, double zero,
786             int nullcheck, LONGLONG tnull, double nullval, char *nullarray,
787             int *anynull, double *output, int *status);
788 int fffr4r8(float *input, long ntodo, double scale, double zero,
789             int nullcheck, double nullval, char *nullarray,
790             int *anynull, double *output, int *status);
791 int fffr8r8(double *input, long ntodo, double scale, double zero,
792             int nullcheck, double nullval, char *nullarray,
793             int *anynull, double *output, int *status);
794 int fffstrr8(char *input, long ntodo, double scale, double zero,
795             long twidth, double power, int nullcheck, char *snull,
796             double nullval, char *nullarray, int *anynull, double *output,
797             int *status);
798 
799 int ffi1fi1(unsigned char *array, long ntodo, double scale, double zero,
800             unsigned char *buffer, int *status);
801 int ffs1fi1(signed char *array, long ntodo, double scale, double zero,
802             unsigned char *buffer, int *status);
803 int ffu2fi1(unsigned short *array, long ntodo, double scale, double zero,
804             unsigned char *buffer, int *status);
805 int ffi2fi1(short *array, long ntodo, double scale, double zero,
806             unsigned char *buffer, int *status);
807 int ffu4fi1(unsigned long *array, long ntodo, double scale, double zero,
808             unsigned char *buffer, int *status);
809 int ffi4fi1(long *array, long ntodo, double scale, double zero,
810             unsigned char *buffer, int *status);
811 int ffu8fi1(ULONGLONG *array, long ntodo, double scale, double zero,
812             unsigned char *buffer, int *status);
813 int ffi8fi1(LONGLONG *array, long ntodo, double scale, double zero,
814             unsigned char *buffer, int *status);
815 int ffuintfi1(unsigned int *array, long ntodo, double scale, double zero,
816             unsigned char *buffer, int *status);
817 int ffintfi1(int *array, long ntodo, double scale, double zero,
818             unsigned char *buffer, int *status);
819 int ffr4fi1(float *array, long ntodo, double scale, double zero,
820             unsigned char *buffer, int *status);
821 int ffr8fi1(double *array, long ntodo, double scale, double zero,
822             unsigned char *buffer, int *status);
823 
824 int ffi1fi2(unsigned char *array, long ntodo, double scale, double zero,
825             short *buffer, int *status);
826 int ffs1fi2(signed char *array, long ntodo, double scale, double zero,
827             short *buffer, int *status);
828 int ffu2fi2(unsigned short *array, long ntodo, double scale, double zero,
829             short *buffer, int *status);
830 int ffi2fi2(short *array, long ntodo, double scale, double zero,
831             short *buffer, int *status);
832 int ffu4fi2(unsigned long *array, long ntodo, double scale, double zero,
833             short *buffer, int *status);
834 int ffi4fi2(long *array, long ntodo, double scale, double zero,
835             short *buffer, int *status);
836 int ffu8fi2(ULONGLONG *array, long ntodo, double scale, double zero,
837             short *buffer, int *status);
838 int ffi8fi2(LONGLONG *array, long ntodo, double scale, double zero,
839             short *buffer, int *status);
840 int ffuintfi2(unsigned int *array, long ntodo, double scale, double zero,
841             short *buffer, int *status);
842 int ffintfi2(int *array, long ntodo, double scale, double zero,
843             short *buffer, int *status);
844 int ffr4fi2(float *array, long ntodo, double scale, double zero,
845             short *buffer, int *status);
846 int ffr8fi2(double *array, long ntodo, double scale, double zero,
847             short *buffer, int *status);
848 
849 int ffi1fi4(unsigned char *array, long ntodo, double scale, double zero,
850             INT32BIT *buffer, int *status);
851 int ffs1fi4(signed char *array, long ntodo, double scale, double zero,
852             INT32BIT *buffer, int *status);
853 int ffu2fi4(unsigned short *array, long ntodo, double scale, double zero,
854             INT32BIT *buffer, int *status);
855 int ffi2fi4(short *array, long ntodo, double scale, double zero,
856             INT32BIT *buffer, int *status);
857 int ffu4fi4(unsigned long *array, long ntodo, double scale, double zero,
858             INT32BIT *buffer, int *status);
859 int ffu8fi4(ULONGLONG *array, long ntodo, double scale, double zero,
860             INT32BIT *buffer, int *status);
861 int ffi4fi4(long *array, long ntodo, double scale, double zero,
862             INT32BIT *buffer, int *status);
863 int ffi8fi4(LONGLONG *array, long ntodo, double scale, double zero,
864             INT32BIT *buffer, int *status);
865 int ffuintfi4(unsigned int *array, long ntodo, double scale, double zero,
866             INT32BIT *buffer, int *status);
867 int ffintfi4(int *array, long ntodo, double scale, double zero,
868             INT32BIT *buffer, int *status);
869 int ffr4fi4(float *array, long ntodo, double scale, double zero,
870             INT32BIT *buffer, int *status);
871 int ffr8fi4(double *array, long ntodo, double scale, double zero,
872             INT32BIT *buffer, int *status);
873 
874 int ffi4fi8(long *array, long ntodo, double scale, double zero,
875             LONGLONG *buffer, int *status);
876 int ffi8fi8(LONGLONG *array, long ntodo, double scale, double zero,
877             LONGLONG *buffer, int *status);
878 int ffi2fi8(short *array, long ntodo, double scale, double zero,
879             LONGLONG *buffer, int *status);
880 int ffi1fi8(unsigned char *array, long ntodo, double scale, double zero,
881             LONGLONG *buffer, int *status);
882 int ffs1fi8(signed char *array, long ntodo, double scale, double zero,
883             LONGLONG *buffer, int *status);
884 int ffr4fi8(float *array, long ntodo, double scale, double zero,
885             LONGLONG *buffer, int *status);
886 int ffr8fi8(double *array, long ntodo, double scale, double zero,
887             LONGLONG *buffer, int *status);
888 int ffintfi8(int *array, long ntodo, double scale, double zero,
889             LONGLONG *buffer, int *status);
890 int ffu2fi8(unsigned short *array, long ntodo, double scale, double zero,
891             LONGLONG *buffer, int *status);
892 int ffu4fi8(unsigned long *array, long ntodo, double scale, double zero,
893             LONGLONG *buffer, int *status);
894 int ffu8fi8(ULONGLONG *array, long ntodo, double scale, double zero,
895             LONGLONG *buffer, int *status);
896 int ffuintfi8(unsigned int *array, long ntodo, double scale, double zero,
897             LONGLONG *buffer, int *status);
898 
899 int ffi1fr4(unsigned char *array, long ntodo, double scale, double zero,
900             float *buffer, int *status);
901 int ffs1fr4(signed char *array, long ntodo, double scale, double zero,
902             float *buffer, int *status);
903 int ffu2fr4(unsigned short *array, long ntodo, double scale, double zero,
904             float *buffer, int *status);
905 int ffi2fr4(short *array, long ntodo, double scale, double zero,
906             float *buffer, int *status);
907 int ffu4fr4(unsigned long *array, long ntodo, double scale, double zero,
908             float *buffer, int *status);
909 int ffi4fr4(long *array, long ntodo, double scale, double zero,
910             float *buffer, int *status);
911 int ffu8fr4(ULONGLONG *array, long ntodo, double scale, double zero,
912             float *buffer, int *status);
913 int ffi8fr4(LONGLONG *array, long ntodo, double scale, double zero,
914             float *buffer, int *status);
915 int ffuintfr4(unsigned int *array, long ntodo, double scale, double zero,
916             float *buffer, int *status);
917 int ffintfr4(int *array, long ntodo, double scale, double zero,
918             float *buffer, int *status);
919 int ffr4fr4(float *array, long ntodo, double scale, double zero,
920             float *buffer, int *status);
921 int ffr8fr4(double *array, long ntodo, double scale, double zero,
922             float *buffer, int *status);
923 
924 int ffi1fr8(unsigned char *array, long ntodo, double scale, double zero,
925             double *buffer, int *status);
926 int ffs1fr8(signed char *array, long ntodo, double scale, double zero,
927             double *buffer, int *status);
928 int ffu2fr8(unsigned short *array, long ntodo, double scale, double zero,
929             double *buffer, int *status);
930 int ffi2fr8(short *array, long ntodo, double scale, double zero,
931             double *buffer, int *status);
932 int ffu4fr8(unsigned long *array, long ntodo, double scale, double zero,
933             double *buffer, int *status);
934 int ffi4fr8(long *array, long ntodo, double scale, double zero,
935             double *buffer, int *status);
936 int ffu8fr8(ULONGLONG *array, long ntodo, double scale, double zero,
937             double *buffer, int *status);
938 int ffi8fr8(LONGLONG *array, long ntodo, double scale, double zero,
939             double *buffer, int *status);
940 int ffuintfr8(unsigned int *array, long ntodo, double scale, double zero,
941             double *buffer, int *status);
942 int ffintfr8(int *array, long ntodo, double scale, double zero,
943             double *buffer, int *status);
944 int ffr4fr8(float *array, long ntodo, double scale, double zero,
945             double *buffer, int *status);
946 int ffr8fr8(double *array, long ntodo, double scale, double zero,
947             double *buffer, int *status);
948 
949 int ffi1fstr(unsigned char *input, long ntodo, double scale, double zero,
950             char *cform, long twidth, char *output, int *status);
951 int ffs1fstr(signed char *input, long ntodo, double scale, double zero,
952             char *cform, long twidth, char *output, int *status);
953 int ffu2fstr(unsigned short *input, long ntodo, double scale, double zero,
954             char *cform, long twidth, char *output, int *status);
955 int ffi2fstr(short *input, long ntodo, double scale, double zero,
956             char *cform, long twidth, char *output, int *status);
957 int ffu4fstr(unsigned long *input, long ntodo, double scale, double zero,
958             char *cform, long twidth, char *output, int *status);
959 int ffi4fstr(long *input, long ntodo, double scale, double zero,
960             char *cform, long twidth, char *output, int *status);
961 int ffu8fstr(ULONGLONG *input, long ntodo, double scale, double zero,
962             char *cform, long twidth, char *output, int *status);
963 int ffi8fstr(LONGLONG *input, long ntodo, double scale, double zero,
964             char *cform, long twidth, char *output, int *status);
965 int ffintfstr(int *input, long ntodo, double scale, double zero,
966             char *cform, long twidth, char *output, int *status);
967 int ffuintfstr(unsigned int *input, long ntodo, double scale, double zero,
968             char *cform, long twidth, char *output, int *status);
969 int ffr4fstr(float *input, long ntodo, double scale, double zero,
970             char *cform, long twidth, char *output, int *status);
971 int ffr8fstr(double *input, long ntodo, double scale, double zero,
972             char *cform, long twidth, char *output, int *status);
973 
974 /*  the following 4 routines are VMS macros used on VAX or Alpha VMS */
975 void ieevpd(double *inarray, double *outarray, long *nvals);
976 void ieevud(double *inarray, double *outarray, long *nvals);
977 void ieevpr(float *inarray, float *outarray, long *nvals);
978 void ieevur(float *inarray, float *outarray, long *nvals);
979 
980 /*  routines related to the lexical parser  */
981 int  ffselect_table(fitsfile **fptr, char *outfile, char *expr,  int *status);
982 int  ffiprs( fitsfile *fptr, int compressed, char *expr, int maxdim,
983 	     int *datatype, long *nelem, int *naxis, long *naxes,
984 	     int *status );
985 void ffcprs( void );
986 int  ffcvtn( int inputType, void *input, char *undef, long ntodo,
987 	     int outputType, void *nulval, void *output,
988 	     int *anynull, int *status );
989 int  parse_data( long totalrows, long offset, long firstrow,
990                  long nrows, int nCols, iteratorCol *colData,
991                  void *userPtr );
992 int  uncompress_hkdata( fitsfile *fptr, long ntimes,
993                         double *times, int *status );
994 int  ffffrw_work( long totalrows, long offset, long firstrow,
995                   long nrows, int nCols, iteratorCol *colData,
996                   void *userPtr );
997 
998 int fits_translate_pixkeyword(char *inrec, char *outrec,char *patterns[][2],
999     int npat, int naxis, int *colnum, int *pat_num, int *i,
1000       int *j, int *n, int *m, int *l, int *status);
1001 
1002 /*  image compression routines */
1003 int fits_write_compressed_img(fitsfile *fptr,
1004             int  datatype, long  *fpixel, long *lpixel,
1005             int nullcheck, void *array,  void *nulval,
1006             int  *status);
1007 int fits_write_compressed_pixels(fitsfile *fptr,
1008             int  datatype, LONGLONG  fpixel, LONGLONG npixels,
1009             int nullcheck,  void *array, void *nulval,
1010             int  *status);
1011 int fits_write_compressed_img_plane(fitsfile *fptr, int  datatype,
1012       int  bytesperpixel,  long   nplane, long *firstcoord, long *lastcoord,
1013       long *naxes,  int  nullcheck,
1014       void *array,  void *nullval, long *nread, int  *status);
1015 
1016 int imcomp_init_table(fitsfile *outfptr,
1017         int bitpix, int naxis,long *naxes, int writebitpix, int *status);
1018 int imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize);
1019 int imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr,
1020                 int *status);
1021 int imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status);
1022 int imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr,
1023                           int norec, int *status);
1024 int imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status);
1025 int imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr,
1026                  int *status);
1027 int imcomp_compress_tile (fitsfile *outfptr, long row,
1028     int datatype,  void *tiledata, long tilelen, long nx, long ny,
1029     int nullcheck, void *nullval, int *status);
1030 int imcomp_nullscale(int *idata, long tilelen, int nullflagval, int nullval,
1031      double scale, double zero, int * status);
1032 int imcomp_nullvalues(int *idata, long tilelen, int nullflagval, int nullval,
1033      int * status);
1034 int imcomp_scalevalues(int *idata, long tilelen, double scale, double zero,
1035      int * status);
1036 int imcomp_nullscalefloats(float *fdata, long tilelen, int *idata,
1037     double scale, double zero, int nullcheck, float nullflagval, int nullval,
1038     int *status);
1039 int imcomp_nullfloats(float *fdata, long tilelen, int *idata, int nullcheck,
1040     float nullflagval, int nullval, int *status);
1041 int imcomp_nullscaledoubles(double *fdata, long tilelen, int *idata,
1042     double scale, double zero, int nullcheck, double nullflagval, int nullval,
1043     int *status);
1044 int imcomp_nulldoubles(double *fdata, long tilelen, int *idata, int nullcheck,
1045     double nullflagval, int nullval, int *status);
1046 
1047 
1048 /*  image decompression routines */
1049 int fits_read_compressed_img(fitsfile *fptr,
1050             int  datatype, LONGLONG  *fpixel,LONGLONG  *lpixel,long *inc,
1051             int nullcheck, void *nulval,  void *array, char *nullarray,
1052             int  *anynul, int  *status);
1053 int fits_read_compressed_pixels(fitsfile *fptr,
1054             int  datatype, LONGLONG  fpixel, LONGLONG npixels,
1055             int nullcheck, void *nulval,  void *array, char *nullarray,
1056             int  *anynul, int  *status);
1057 int fits_read_compressed_img_plane(fitsfile *fptr, int  datatype,
1058       int  bytesperpixel,  long   nplane, LONGLONG *firstcoord, LONGLONG *lastcoord,
1059       long *inc,  long *naxes,  int  nullcheck,  void *nullval,
1060       void *array, char *nullarray, int  *anynul, long *nread, int  *status);
1061 
1062 int imcomp_get_compressed_image_par(fitsfile *infptr, int *status);
1063 int imcomp_decompress_tile (fitsfile *infptr,
1064           int nrow, int tilesize, int datatype, int nullcheck,
1065           void *nulval, void *buffer, char *bnullarray, int *anynul,
1066           int *status);
1067 int imcomp_copy_overlap (char *tile, int pixlen, int ndim,
1068          long *tfpixel, long *tlpixel, char *bnullarray, char *image,
1069          long *fpixel, long *lpixel, long *inc, int nullcheck, char *nullarray,
1070          int *status);
1071 int imcomp_test_overlap (int ndim, long *tfpixel, long *tlpixel,
1072          long *fpixel, long *lpixel, long *inc, int *status);
1073 int imcomp_merge_overlap (char *tile, int pixlen, int ndim,
1074          long *tfpixel, long *tlpixel, char *bnullarray, char *image,
1075          long *fpixel, long *lpixel, int nullcheck, int *status);
1076 int imcomp_decompress_img(fitsfile *infptr, fitsfile *outfptr, int datatype,
1077          int  *status);
1078 int fits_quantize_float (long row, float fdata[], long nx, long ny, int nullcheck,
1079          float in_null_value, float quantize_level,
1080            int dither_method, int idata[], double *bscale, double *bzero,
1081            int *iminval, int *imaxval);
1082 int fits_quantize_double (long row, double fdata[], long nx, long ny, int nullcheck,
1083          double in_null_value, float quantize_level,
1084            int dither_method, int idata[], double *bscale, double *bzero,
1085            int *iminval, int *imaxval);
1086 int fits_rcomp(int a[], int nx, unsigned char *c, int clen,int nblock);
1087 int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen,int nblock);
1088 int fits_rcomp_byte(signed char a[], int nx, unsigned char *c, int clen,int nblock);
1089 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx,
1090              int nblock);
1091 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx,
1092              int nblock);
1093 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx,
1094              int nblock);
1095 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix);
1096 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);
1097 int fits_init_randoms(void);
1098 int fits_unset_compression_param( fitsfile *fptr, int *status);
1099 int fits_unset_compression_request( fitsfile *fptr, int *status);
1100 int fitsio_init_lock(void);
1101 
1102 /* general driver routines */
1103 
1104 int urltype2driver(char *urltype, int *driver);
1105 
1106 void fits_dwnld_prog_bar(int flag);
1107 int fits_net_timeout(int sec);
1108 
1109 int fits_register_driver( char *prefix,
1110 	int (*init)(void),
1111 	int (*fitsshutdown)(void),
1112 	int (*setoptions)(int option),
1113 	int (*getoptions)(int *options),
1114 	int (*getversion)(int *version),
1115 	int (*checkfile) (char *urltype, char *infile, char *outfile),
1116 	int (*fitsopen)(char *filename, int rwmode, int *driverhandle),
1117 	int (*fitscreate)(char *filename, int *driverhandle),
1118 	int (*fitstruncate)(int driverhandle, LONGLONG filesize),
1119 	int (*fitsclose)(int driverhandle),
1120 	int (*fremove)(char *filename),
1121         int (*size)(int driverhandle, LONGLONG *sizex),
1122 	int (*flush)(int driverhandle),
1123 	int (*seek)(int driverhandle, LONGLONG offset),
1124 	int (*fitsread) (int driverhandle, void *buffer, long nbytes),
1125 	int (*fitswrite)(int driverhandle, void *buffer, long nbytes));
1126 
1127 /* file driver I/O routines */
1128 
1129 int file_init(void);
1130 int file_setoptions(int options);
1131 int file_getoptions(int *options);
1132 int file_getversion(int *version);
1133 int file_shutdown(void);
1134 int file_checkfile(char *urltype, char *infile, char *outfile);
1135 int file_open(char *filename, int rwmode, int *driverhandle);
1136 int file_compress_open(char *filename, int rwmode, int *hdl);
1137 int file_openfile(char *filename, int rwmode, FILE **diskfile);
1138 int file_create(char *filename, int *driverhandle);
1139 int file_truncate(int driverhandle, LONGLONG filesize);
1140 int file_size(int driverhandle, LONGLONG *filesize);
1141 int file_close(int driverhandle);
1142 int file_remove(char *filename);
1143 int file_flush(int driverhandle);
1144 int file_seek(int driverhandle, LONGLONG offset);
1145 int file_read (int driverhandle, void *buffer, long nbytes);
1146 int file_write(int driverhandle, void *buffer, long nbytes);
1147 int file_is_compressed(char *filename);
1148 
1149 /* stream driver I/O routines */
1150 
1151 int stream_open(char *filename, int rwmode, int *driverhandle);
1152 int stream_create(char *filename, int *driverhandle);
1153 int stream_size(int driverhandle, LONGLONG *filesize);
1154 int stream_close(int driverhandle);
1155 int stream_flush(int driverhandle);
1156 int stream_seek(int driverhandle, LONGLONG offset);
1157 int stream_read (int driverhandle, void *buffer, long nbytes);
1158 int stream_write(int driverhandle, void *buffer, long nbytes);
1159 
1160 /* memory driver I/O routines */
1161 
1162 int mem_init(void);
1163 int mem_setoptions(int options);
1164 int mem_getoptions(int *options);
1165 int mem_getversion(int *version);
1166 int mem_shutdown(void);
1167 int mem_create(char *filename, int *handle);
1168 int mem_create_comp(char *filename, int *handle);
1169 int mem_openmem(void **buffptr, size_t *buffsize, size_t deltasize,
1170                 void *(*memrealloc)(void *p, size_t newsize), int *handle);
1171 int mem_createmem(size_t memsize, int *handle);
1172 int stdin_checkfile(char *urltype, char *infile, char *outfile);
1173 int stdin_open(char *filename, int rwmode, int *handle);
1174 int stdin2mem(int hd);
1175 int stdin2file(int hd);
1176 int stdout_close(int handle);
1177 int mem_compress_openrw(char *filename, int rwmode, int *hdl);
1178 int mem_compress_open(char *filename, int rwmode, int *hdl);
1179 int mem_compress_stdin_open(char *filename, int rwmode, int *hdl);
1180 int mem_iraf_open(char *filename, int rwmode, int *hdl);
1181 int mem_rawfile_open(char *filename, int rwmode, int *hdl);
1182 int mem_size(int handle, LONGLONG *filesize);
1183 int mem_truncate(int handle, LONGLONG filesize);
1184 int mem_close_free(int handle);
1185 int mem_close_keep(int handle);
1186 int mem_close_comp(int handle);
1187 int mem_seek(int handle, LONGLONG offset);
1188 int mem_read(int hdl, void *buffer, long nbytes);
1189 int mem_write(int hdl, void *buffer, long nbytes);
1190 int mem_uncompress2mem(char *filename, FILE *diskfile, int hdl);
1191 
1192 int iraf2mem(char *filename, char **buffptr, size_t *buffsize,
1193       size_t *filesize, int *status);
1194 
1195 /* root driver I/O routines */
1196 
1197 int root_init(void);
1198 int root_setoptions(int options);
1199 int root_getoptions(int *options);
1200 int root_getversion(int *version);
1201 int root_shutdown(void);
1202 int root_open(char *filename, int rwmode, int *driverhandle);
1203 int root_create(char *filename, int *driverhandle);
1204 int root_close(int driverhandle);
1205 int root_flush(int driverhandle);
1206 int root_seek(int driverhandle, LONGLONG offset);
1207 int root_read (int driverhandle, void *buffer, long nbytes);
1208 int root_write(int driverhandle, void *buffer, long nbytes);
1209 int root_size(int handle, LONGLONG *filesize);
1210 
1211 /* http driver I/O routines */
1212 
1213 int http_checkfile(char *urltype, char *infile, char *outfile);
1214 int http_open(char *filename, int rwmode, int *driverhandle);
1215 int http_file_open(char *filename, int rwmode, int *driverhandle);
1216 int http_compress_open(char *filename, int rwmode, int *driverhandle);
1217 
1218 /* https driver I/O routines */
1219 int https_checkfile(char* urltype, char *infile, char *outfile);
1220 int https_open(char *filename, int rwmode, int *driverhandle);
1221 int https_file_open(char *filename, int rwmode, int *driverhandle);
1222 void https_set_verbose(int flag);
1223 
1224 /* ftps driver I/O routines */
1225 int ftps_checkfile(char* urltype, char *infile, char *outfile);
1226 int ftps_open(char *filename, int rwmode, int *handle);
1227 int ftps_file_open(char *filename, int rwmode, int *handle);
1228 int ftps_compress_open(char *filename, int rwmode, int *driverhandle);
1229 
1230 /* ftp driver I/O routines */
1231 
1232 int ftp_checkfile(char *urltype, char *infile, char *outfile);
1233 int ftp_open(char *filename, int rwmode, int *driverhandle);
1234 int ftp_file_open(char *filename, int rwmode, int *driverhandle);
1235 int ftp_compress_open(char *filename, int rwmode, int *driverhandle);
1236 
1237 int uncompress2mem(char *filename, FILE *diskfile,
1238              char **buffptr, size_t *buffsize,
1239              void *(*mem_realloc)(void *p, size_t newsize),
1240              size_t *filesize, int *status);
1241 
1242 int uncompress2mem_from_mem(
1243              char *inmemptr,
1244              size_t inmemsize,
1245              char **buffptr,
1246              size_t *buffsize,
1247              void *(*mem_realloc)(void *p, size_t newsize),
1248              size_t *filesize,
1249              int *status);
1250 
1251 int uncompress2file(char *filename,
1252              FILE *indiskfile,
1253              FILE *outdiskfile,
1254              int *status);
1255 
1256 int compress2mem_from_mem(
1257              char *inmemptr,
1258              size_t inmemsize,
1259              char **buffptr,
1260              size_t *buffsize,
1261              void *(*mem_realloc)(void *p, size_t newsize),
1262              size_t *filesize,
1263              int *status);
1264 
1265 int compress2file_from_mem(
1266              char *inmemptr,
1267              size_t inmemsize,
1268              FILE *outdiskfile,
1269              size_t *filesize,   /* O - size of file, in bytes              */
1270              int *status);
1271 
1272 
1273 #ifdef HAVE_GSIFTP
1274 /* prototypes for gsiftp driver I/O routines */
1275 #include "drvrgsiftp.h"
1276 #endif
1277 
1278 #ifdef HAVE_SHMEM_SERVICES
1279 /* prototypes for shared memory driver I/O routines  */
1280 #include "drvrsmem.h"
1281 #endif
1282 
1283 /* A hack for nonunix machines, which lack strcasecmp and strncasecmp */
1284 /* these functions are in fitscore.c */
1285 int fits_strcasecmp (const char *s1, const char *s2       );
1286 int fits_strncasecmp(const char *s1, const char *s2, size_t n);
1287 
1288 /* end of the entire "ifndef _FITSIO2_H" block */
1289 #endif
1290