File: fitsio2.h

package info (click to toggle)
cfitsio 3.470-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 14,484 kB
  • sloc: ansic: 106,145; yacc: 4,883; sh: 3,259; fortran: 2,613; lex: 504; makefile: 162
file content (1297 lines) | stat: -rw-r--r-- 63,105 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
#ifndef _FITSIO2_H
#define _FITSIO2_H
 
#include "fitsio.h"

/* 
    Threading support using POSIX threads programming interface
    (supplied by Bruce O'Neel) 

    All threaded programs MUST have the 

    -D_REENTRANT

    on the compile line and must link with -lpthread.  This means that
    when one builds cfitsio for threads you must have -D_REENTRANT on the
    gcc or cc command line.
*/

#ifdef _REENTRANT
#include <pthread.h>
/*  #include <assert.h>  not needed any more */
extern pthread_mutex_t Fitsio_Lock;
extern int Fitsio_Pthread_Status;

#define FFLOCK1(lockname)   (Fitsio_Pthread_Status = pthread_mutex_lock(&lockname))
#define FFUNLOCK1(lockname) (Fitsio_Pthread_Status = pthread_mutex_unlock(&lockname))
#define FFLOCK   FFLOCK1(Fitsio_Lock)
#define FFUNLOCK FFUNLOCK1(Fitsio_Lock)
#define ffstrtok(str, tok, save) strtok_r(str, tok, save)

#else
#define FFLOCK
#define FFUNLOCK
#define ffstrtok(str, tok, save) strtok(str, tok)
#endif

/*
  If REPLACE_LINKS is defined, then whenever CFITSIO fails to open
  a file with write access because it is a soft link to a file that
  only has read access, then CFITSIO will attempt to replace
  the link with a local copy of the file, with write access.  This
  feature was originally added to support the ftools in the Hera
  environment, where many of the user's data file are soft links.
*/
#if defined(BUILD_HERA)
#define REPLACE_LINKS 1
#endif

#define USE_LARGE_VALUE -99  /* flag used when writing images */

#define DBUFFSIZE 28800 /* size of data buffer in bytes */

#define NMAXFILES  10000   /* maximum number of FITS files that can be opened */
        /* CFITSIO will allocate (NMAXFILES * 80) bytes of memory */
	/* plus each file that is opened will use NIOBUF * 2880 bytes of memeory */
	/* where NIOBUF is defined in fitio.h and has a default value of 40 */

#define MINDIRECT 8640   /* minimum size for direct reads and writes */
                         /* MINDIRECT must have a value >= 8640 */

/*   it is useful to identify certain specific types of machines   */
#define NATIVE             0 /* machine that uses non-byteswapped IEEE formats */
#define OTHERTYPE          1  /* any other type of machine */
#define VAXVMS             3  /* uses an odd floating point format */
#define ALPHAVMS           4  /* uses an odd floating point format */
#define IBMPC              5  /* used in drvrfile.c to work around a bug on PCs */
#define CRAY               6  /* requires a special NaN test algorithm */

#define GFLOAT             1  /* used for VMS */
#define IEEEFLOAT          2  /* used for VMS */

/* ======================================================================= */
/* The following logic is used to determine the type machine,              */
/*  whether the bytes are swapped, and the number of bits in a long value  */
/* ======================================================================= */

/*   The following platforms have sizeof(long) == 8               */
/*   This block of code should match a similar block in fitsio.h  */
/*   and the block of code at the beginning of f77_wrap.h         */

#if defined(__alpha) && ( defined(__unix__) || defined(__NetBSD__) )
                                  /* old Dec Alpha platforms running OSF */
#define BYTESWAPPED TRUE
#define LONGSIZE 64

#elif defined(__sparcv9) || (defined(__sparc__) && defined(__arch64__))
                               /*  SUN Solaris7 in 64-bit mode */
#define BYTESWAPPED FALSE
#define MACHINE NATIVE
#define LONGSIZE 64   

                            /* IBM System z mainframe support */ 
#elif defined(__s390x__)
#define BYTESWAPPED FALSE
#define LONGSIZE 64

#elif defined(__s390__)
#define BYTESWAPPED FALSE
#define LONGSIZE 32

#elif defined(__ia64__)  || defined(__x86_64__) || defined(__AARCH64EL__)
                  /*  Intel itanium 64-bit PC, or AMD opteron 64-bit PC */
#define BYTESWAPPED TRUE
#define LONGSIZE 64   

#elif defined(_SX)             /* Nec SuperUx */

#define BYTESWAPPED FALSE
#define MACHINE NATIVE
#define LONGSIZE 64

#elif defined(__powerpc64__) || defined(__64BIT__) || defined(__AARCH64EB__)  /* IBM 64-bit AIX powerpc*/
                              /* could also test for __ppc64__ or __PPC64 */

#  if defined(__LITTLE_ENDIAN__)
#   define BYTESWAPPED TRUE
#  else
#   define BYTESWAPPED FALSE
#   define MACHINE NATIVE
#  endif
#  define LONGSIZE 64

#elif defined(_MIPS_SZLONG)

#  if defined(MIPSEL)
#    define BYTESWAPPED TRUE
#  else
#    define BYTESWAPPED FALSE
#    define MACHINE NATIVE
#  endif

#  if _MIPS_SZLONG == 32
#    define LONGSIZE 32
#  elif _MIPS_SZLONG == 64
#    define LONGSIZE 64
#  else
#    error "can't handle long size given by _MIPS_SZLONG"
#  endif

#elif defined(__riscv)

/* RISC-V is little endian */

#define BYTESWAPPED TRUE

#  if __riscv_xlen == 32
#    define LONGSIZE 32
#  elif __riscv_xlen == 64
#    define LONGSIZE 64
#  else
#    error "can't handle long size given by __riscv_xlen"
#  endif

/* ============================================================== */
/*  the following are all 32-bit byteswapped platforms            */

#elif defined(vax) && defined(VMS)
 
#define MACHINE VAXVMS
#define BYTESWAPPED TRUE
 
#elif defined(__alpha) && defined(__VMS)

#if (__D_FLOAT == TRUE)

/* this float option is the same as for VAX/VMS machines. */
#define MACHINE VAXVMS
#define BYTESWAPPED TRUE
 
#elif  (__G_FLOAT == TRUE)
 
/*  G_FLOAT is the default for ALPHA VMS systems */
#define MACHINE ALPHAVMS
#define BYTESWAPPED TRUE
#define FLOATTYPE GFLOAT
 
#elif  (__IEEE_FLOAT == TRUE)
 
#define MACHINE ALPHAVMS
#define BYTESWAPPED TRUE
#define FLOATTYPE IEEEFLOAT

#endif  /* end of alpha VMS case */

#elif defined(ultrix) && defined(unix)
 /* old Dec ultrix machines */
#define BYTESWAPPED TRUE
 
#elif defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) \
  || defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TURBOC__) \
  || defined(_NI_mswin_) || defined(__EMX__)

/*  generic 32-bit IBM PC */
#define MACHINE IBMPC
#define BYTESWAPPED TRUE

#elif defined(__arm__)

/* This assumes all ARM are little endian.  In the future, it might be  */
/* necessary to use  "if defined(__ARMEL__)"  to distinguish little from big. */
/* (__ARMEL__ would be defined on little-endian, but not on big-endian). */

#define BYTESWAPPED TRUE
 
#elif defined(__tile__)

/*  64-core 8x8-architecture Tile64 platform */

#define BYTESWAPPED TRUE

#elif defined(__sh__)

/* SuperH CPU can be used in both little and big endian modes */

#if defined(__LITTLE_ENDIAN__)
#define BYTESWAPPED TRUE
#else
#define BYTESWAPPED FALSE
#endif

#else

/*  assume all other machine uses the same IEEE formats as used in FITS files */
/*  e.g., Macs fall into this category  */

#define MACHINE NATIVE
#define BYTESWAPPED FALSE
 
#endif

#ifndef MACHINE
#define MACHINE  OTHERTYPE
#endif

/*  assume longs are 4 bytes long, unless previously set otherwise */
#ifndef LONGSIZE
#define LONGSIZE 32
#endif

/*       end of block that determine long size and byte swapping        */ 
/* ==================================================================== */
 
#define IGNORE_EOF 1
#define REPORT_EOF 0
#define DATA_UNDEFINED -1
#define NULL_UNDEFINED 1234554321
#define ASCII_NULL_UNDEFINED 1   /* indicate no defined null value */
 
#define maxvalue(A,B) ((A) > (B) ? (A) : (B))
#define minvalue(A,B) ((A) < (B) ? (A) : (B))

/* faster string comparison macros */
#define FSTRCMP(a,b)     ((a)[0]<(b)[0]? -1:(a)[0]>(b)[0]?1:strcmp((a),(b)))
#define FSTRNCMP(a,b,n)  ((a)[0]<(b)[0]?-1:(a)[0]>(b)[0]?1:strncmp((a),(b),(n)))

#if defined(__VMS) || defined(VMS)
 
#define FNANMASK   0xFFFF /* mask all bits  */
#define DNANMASK   0xFFFF /* mask all bits  */
 
#else
 
#define FNANMASK   0x7F80 /* mask bits 1 - 8; all set on NaNs */
                                     /* all 0 on underflow  or 0. */
 
#define DNANMASK   0x7FF0 /* mask bits 1 - 11; all set on NaNs */
                                     /* all 0 on underflow  or 0. */
 
#endif
 
#if MACHINE == CRAY
    /*
      Cray machines:   the large negative integer corresponds
      to the 3 most sig digits set to 1.   If these
      3 bits are set in a floating point number (64 bits), then it represents
      a reserved value (i.e., a NaN)
    */
#define fnan(L) ( (L) >= 0xE000000000000000 ? 1 : 0) )
 
#else
    /* these functions work for both big and little endian machines */
    /* that use the IEEE floating point format for internal numbers */
 
   /* These functions tests whether the float value is a reserved IEEE     */
   /* value such as a Not-a-Number (NaN), or underflow, overflow, or       */
   /* infinity.   The functions returns 1 if the value is a NaN, overflow  */
   /* or infinity; it returns 2 if the value is an denormalized underflow  */
   /* value; otherwise it returns 0. fnan tests floats, dnan tests doubles */
 
#define fnan(L) \
      ( (L & FNANMASK) == FNANMASK ?  1 : (L & FNANMASK) == 0 ? 2 : 0)
 
#define dnan(L) \
      ( (L & DNANMASK) == DNANMASK ?  1 : (L & DNANMASK) == 0 ? 2 : 0)
 
#endif

#define DSCHAR_MAX  127.49 /* max double value that fits in an signed char */
#define DSCHAR_MIN -128.49 /* min double value that fits in an signed char */
#define DUCHAR_MAX  255.49 /* max double value that fits in an unsigned char */
#define DUCHAR_MIN -0.49   /* min double value that fits in an unsigned char */
#define DUSHRT_MAX  65535.49 /* max double value that fits in a unsigned short*/
#define DUSHRT_MIN -0.49   /* min double value that fits in an unsigned short */
#define DSHRT_MAX  32767.49 /* max double value that fits in a short */
#define DSHRT_MIN -32768.49 /* min double value that fits in a short */

#if LONGSIZE == 32
#  define DLONG_MAX  2147483647.49 /* max double value that fits in a long */
#  define DLONG_MIN -2147483648.49 /* min double value that fits in a long */
#  define DULONG_MAX 4294967295.49 /* max double that fits in a unsigned long */
#else
#  define DLONG_MAX   9.2233720368547752E18 /* max double value  long */
#  define DLONG_MIN  -9.2233720368547752E18 /* min double value  long */
#  define DULONG_MAX 1.84467440737095504E19 /* max double value  ulong */
#endif

#define DULONG_MIN -0.49   /* min double value that fits in an unsigned long */
#define DULONGLONG_MAX 18446744073709551615. /* max unsigned  longlong */
#define DULONGLONG_MIN -0.49
#define DLONGLONG_MAX  9.2233720368547755807E18 /* max double value  longlong */
#define DLONGLONG_MIN -9.2233720368547755808E18 /* min double value  longlong */
#define DUINT_MAX 4294967295.49 /* max dbl that fits in a unsigned 4-byte int */
#define DUINT_MIN -0.49   /* min dbl that fits in an unsigned 4-byte int */
#define DINT_MAX  2147483647.49 /* max double value that fits in a 4-byte int */
#define DINT_MIN -2147483648.49 /* min double value that fits in a 4-byte int */

#ifndef UINT64_MAX
#define UINT64_MAX 18446744073709551615U /* max unsigned 64-bit integer */
#endif
#ifndef UINT32_MAX
#define UINT32_MAX 4294967295U /* max unsigned 32-bit integer */
#endif
#ifndef INT32_MAX
#define INT32_MAX  2147483647 /* max 32-bit integer */
#endif
#ifndef INT32_MIN
#define INT32_MIN (-INT32_MAX -1) /* min 32-bit integer */
#endif


#define COMPRESS_NULL_VALUE -2147483647
#define N_RANDOM 10000  /* DO NOT CHANGE THIS;  used when quantizing real numbers */

int ffgnky(fitsfile *fptr, char *card, int *status);
void ffcfmt(char *tform, char *cform);
void ffcdsp(char *tform, char *cform);
void ffswap2(short *values, long nvalues);
void ffswap4(INT32BIT *values, long nvalues);
void ffswap8(double *values, long nvalues);
int ffi2c(LONGLONG ival, char *cval, int *status);
int ffu2c(ULONGLONG ival, char *cval, int *status);
int ffl2c(int lval, char *cval, int *status);
int ffs2c(const char *instr, char *outstr, int *status);
int ffr2f(float fval, int decim, char *cval, int *status);
int ffr2e(float fval, int decim, char *cval, int *status);
int ffd2f(double dval, int decim, char *cval, int *status);
int ffd2e(double dval, int decim, char *cval, int *status);
int ffc2ii(const char *cval, long *ival, int *status);
int ffc2jj(const char *cval, LONGLONG *ival, int *status);
int ffc2ujj(const char *cval, ULONGLONG *ival, int *status);
int ffc2ll(const char *cval, int *lval, int *status);
int ffc2rr(const char *cval, float *fval, int *status);
int ffc2dd(const char *cval, double *dval, int *status);
int ffc2x(const char *cval, char *dtype, long *ival, int *lval, char *sval,
          double *dval, int *status);
int ffc2xx(const char *cval, char *dtype, LONGLONG *ival, int *lval, char *sval,
          double *dval, int *status);
int ffc2uxx(const char *cval, char *dtype, ULONGLONG *ival, int *lval, char *sval,
          double *dval, int *status);
int ffc2s(const char *instr, char *outstr, int *status);
int ffc2i(const char *cval, long *ival, int *status);
int ffc2j(const char *cval, LONGLONG *ival, int *status);
int ffc2uj(const char *cval, ULONGLONG *ival, int *status);
int ffc2r(const char *cval, float *fval, int *status);
int ffc2d(const char *cval, double *dval, int *status);
int ffc2l(const char *cval, int *lval, int *status);
void ffxmsg(int action, char *err_message);
int ffgcnt(fitsfile *fptr, char *value, char *comm, int *status);
int ffgtkn(fitsfile *fptr, int numkey, char *keyname, long *value, int *status);
int ffgtknjj(fitsfile *fptr, int numkey, char *keyname, LONGLONG *value, int *status);
int fftkyn(fitsfile *fptr, int numkey, char *keyname, char *value, int *status);
int ffgphd(fitsfile *fptr, int maxdim, int *simple, int *bitpix, int *naxis,
        LONGLONG naxes[], long *pcount, long *gcount, int *extend, double *bscale,
          double *bzero, LONGLONG *blank, int *nspace, int *status);
int ffgttb(fitsfile *fptr, LONGLONG *rowlen, LONGLONG *nrows, LONGLONG *pcount,
          long *tfield, int *status);
 
int ffmkey(fitsfile *fptr, const char *card, int *status);
 
/*  ffmbyt has been moved to fitsio.h */
int ffgbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);
int ffpbyt(fitsfile *fptr, LONGLONG nbytes, void *buffer, int *status);
int ffgbytoff(fitsfile *fptr, long gsize, long ngroups, long offset, 
           void *buffer, int *status);
int ffpbytoff(fitsfile *fptr, long gsize, long ngroups, long offset,
           void *buffer, int *status);
int ffldrc(fitsfile *fptr, long record, int err_mode, int *status);
int ffwhbf(fitsfile *fptr, int *nbuff);
int ffbfeof(fitsfile *fptr, int *status);
int ffbfwt(FITSfile *Fptr, int nbuff, int *status);
int ffpxsz(int datatype);

int ffourl(char *url, char *urltype, char *outfile, char *tmplfile,
            char *compspec, int *status);
int ffparsecompspec(fitsfile *fptr, char *compspec, int *status);
int ffoptplt(fitsfile *fptr, const char *tempname, int *status);
int fits_is_this_a_copy(char *urltype);
int fits_store_Fptr(FITSfile *Fptr, int *status);
int fits_clear_Fptr(FITSfile *Fptr, int *status);
int fits_already_open(fitsfile **fptr, char *url, 
    char *urltype, char *infile, char *extspec, char *rowfilter,
    char *binspec, char *colspec, int  mode,int  *isopen, int  *status);
int ffedit_columns(fitsfile **fptr, char *outfile, char *expr, int *status);
int fits_get_col_minmax(fitsfile *fptr, int colnum, double *datamin, 
                     double *datamax, int *status);
int ffwritehisto(long totaln, long offset, long firstn, long nvalues,
             int narrays, iteratorCol *imagepars, void *userPointer);
int ffcalchist(long totalrows, long offset, long firstrow, long nrows,
             int ncols, iteratorCol *colpars, void *userPointer);
int ffpinit(fitsfile *fptr, int *status);
int ffainit(fitsfile *fptr, int *status);
int ffbinit(fitsfile *fptr, int *status);
int ffchdu(fitsfile *fptr, int *status);
int ffwend(fitsfile *fptr, int *status);
int ffpdfl(fitsfile *fptr, int *status);
int ffuptf(fitsfile *fptr, int *status);

int ffdblk(fitsfile *fptr, long nblocks, int *status);
int ffgext(fitsfile *fptr, int moveto, int *exttype, int *status);
int ffgtbc(fitsfile *fptr, LONGLONG *totalwidth, int *status);
int ffgtbp(fitsfile *fptr, char *name, char *value, int *status);
int ffiblk(fitsfile *fptr, long nblock, int headdata, int *status);
int ffshft(fitsfile *fptr, LONGLONG firstbyte, LONGLONG nbytes, LONGLONG nshift,
    int *status);
 
 int ffgcprll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, int writemode, double *scale, double *zero, char *tform,
           long *twidth, int *tcode, int *maxelem, LONGLONG *startpos,
           LONGLONG *elemnum, long *incre, LONGLONG *repeat, LONGLONG *rowlen,
           int *hdutype, LONGLONG *tnull, char *snull, int *status);
	   
int ffflushx(FITSfile *fptr);
int ffseek(FITSfile *fptr, LONGLONG position);
int ffread(FITSfile *fptr, long nbytes, void *buffer,
            int *status);
int ffwrite(FITSfile *fptr, long nbytes, void *buffer,
            int *status);
int fftrun(fitsfile *fptr, LONGLONG filesize, int *status);

int ffpcluc(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, int *status);
	   
int ffgcll(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, int nultyp, char nulval, char *array, char *nularray,
           int *anynul, int *status);
int ffgcls(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, int nultyp, char *nulval,
           char **array, char *nularray, int *anynul, int  *status);
int ffgcls2(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, int nultyp, char *nulval,
           char **array, char *nularray, int *anynul, int  *status);
int ffgclb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long  elemincre, int nultyp, unsigned char nulval,
           unsigned char *array, char *nularray, int *anynul, int  *status);
int ffgclsb(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long  elemincre, int nultyp, signed char nulval,
           signed char *array, char *nularray, int *anynul, int  *status);
int ffgclui(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long  elemincre, int nultyp, unsigned short nulval,
           unsigned short *array, char *nularray, int *anynul, int  *status);
int ffgcli(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long  elemincre, int nultyp, short nulval,
           short *array, char *nularray, int *anynul, int  *status);
int ffgcluj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, unsigned long nulval,
           unsigned long *array, char *nularray, int *anynul, int  *status);
int ffgclujj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, ULONGLONG nulval, 
           ULONGLONG *array, char *nularray, int *anynul, int  *status);
int ffgcljj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, LONGLONG nulval, 
           LONGLONG *array, char *nularray, int *anynul, int  *status);
int ffgclj(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, long nulval, long *array,
           char *nularray, int *anynul, int  *status);
int ffgcluk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, unsigned int nulval,
           unsigned int *array, char *nularray, int *anynul, int  *status);
int ffgclk(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, int nulval, int *array,
           char *nularray, int *anynul, int  *status);
int ffgcle(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp,  float nulval, float *array,
           char *nularray, int *anynul, int  *status);
int ffgcld(fitsfile *fptr, int colnum, LONGLONG firstrow, LONGLONG firstelem,
           LONGLONG nelem, long elemincre, int nultyp, double nulval,
           double *array, char *nularray, int *anynul, int  *status);
 
int ffpi1b(fitsfile *fptr, long nelem, long incre, unsigned char *buffer,
           int *status);
int ffpi2b(fitsfile *fptr, long nelem, long incre, short *buffer, int *status);
int ffpi4b(fitsfile *fptr, long nelem, long incre, INT32BIT *buffer,
           int *status);
int ffpi8b(fitsfile *fptr, long nelem, long incre, long *buffer, int *status);
int ffpr4b(fitsfile *fptr, long nelem, long incre, float *buffer, int *status);
int ffpr8b(fitsfile *fptr, long nelem, long incre, double *buffer, int *status);
 
int ffgi1b(fitsfile *fptr, LONGLONG pos, long nelem, long incre,
          unsigned char *buffer, int *status);
int ffgi2b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, short *buffer,
          int *status);
int ffgi4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, INT32BIT *buffer,
          int *status);
int ffgi8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, long *buffer,
          int *status);
int ffgr4b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, float *buffer,
          int *status);
int ffgr8b(fitsfile *fptr, LONGLONG pos, long nelem, long incre, double *buffer,
          int *status);
 
int ffcins(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,
           LONGLONG bytepos, int *status);
int ffcdel(fitsfile *fptr, LONGLONG naxis1, LONGLONG naxis2, LONGLONG nbytes,
           LONGLONG bytepos, int *status);
int ffkshf(fitsfile *fptr, int firstcol, int tfields, int nshift, int *status);
int fffvcl(fitsfile *fptr, int *nvarcols, int *colnums, int *status);
 
int fffi1i1(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, unsigned char nullval, char
             *nullarray, int *anynull, unsigned char *output, int *status);
int fffi2i1(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, unsigned char nullval, char *nullarray,
            int *anynull, unsigned char *output, int *status);
int fffi4i1(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, unsigned char nullval, char *nullarray,
            int *anynull, unsigned char *output, int *status);
int fffi8i1(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, unsigned char nullval, char *nullarray,
            int *anynull, unsigned char *output, int *status);
int fffr4i1(float *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char nullval, char *nullarray,
            int *anynull, unsigned char *output, int *status);
int fffr8i1(double *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char nullval, char *nullarray,
            int *anynull, unsigned char *output, int *status);
int fffstri1(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            unsigned char nullval, char *nullarray, int *anynull,
            unsigned char *output, int *status);
 
int fffi1s1(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, signed char nullval, char
             *nullarray, int *anynull, signed char *output, int *status);
int fffi2s1(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, signed char nullval, char *nullarray,
            int *anynull, signed char *output, int *status);
int fffi4s1(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, signed char nullval, char *nullarray,
            int *anynull, signed char *output, int *status);
int fffi8s1(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, signed char nullval, char *nullarray,
            int *anynull, signed char *output, int *status);
int fffr4s1(float *input, long ntodo, double scale, double zero,
            int nullcheck, signed char nullval, char *nullarray,
            int *anynull, signed char *output, int *status);
int fffr8s1(double *input, long ntodo, double scale, double zero,
            int nullcheck, signed char nullval, char *nullarray,
            int *anynull, signed char *output, int *status);
int fffstrs1(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            signed char nullval, char *nullarray, int *anynull,
            signed char *output, int *status);

int fffi1u2(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, unsigned short nullval, 
            char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffi2u2(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, unsigned short nullval, char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffi4u2(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, unsigned short nullval, char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffi8u2(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, unsigned short nullval, char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffr4u2(float *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned short nullval, char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffr8u2(double *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned short nullval, char *nullarray,
            int *anynull, unsigned short *output, int *status);
int fffstru2(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            unsigned short nullval, char *nullarray, int  *anynull, 
            unsigned short *output, int *status);

int fffi1i2(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffi2i2(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffi4i2(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffi8i2(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffr4i2(float *input, long ntodo, double scale, double zero,
            int nullcheck, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffr8i2(double *input, long ntodo, double scale, double zero,
            int nullcheck, short nullval, char *nullarray,
            int *anynull, short *output, int *status);
int fffstri2(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            short nullval, char *nullarray, int  *anynull, short *output,
            int *status);

int fffi1u4(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, unsigned long nullval,
            char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffi2u4(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, unsigned long nullval, char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffi4u4(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, unsigned long nullval, char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffi8u4(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, unsigned long nullval, char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffr4u4(float *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned long nullval, char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffr8u4(double *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned long nullval, char *nullarray,
            int *anynull, unsigned long *output, int *status);
int fffstru4(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            unsigned long nullval, char *nullarray, int *anynull,
            unsigned long *output, int *status);
 
int fffi1i4(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffi2i4(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffi4i4(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffi8i4(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffr4i4(float *input, long ntodo, double scale, double zero,
            int nullcheck, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffr8i4(double *input, long ntodo, double scale, double zero,
            int nullcheck, long nullval, char *nullarray,
            int *anynull, long *output, int *status);
int fffstri4(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            long nullval, char *nullarray, int *anynull, long *output,
            int *status);
 
int fffi1int(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffi2int(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffi4int(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffi8int(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffr4int(float *input, long ntodo, double scale, double zero,
            int nullcheck, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffr8int(double *input, long ntodo, double scale, double zero,
            int nullcheck, int nullval, char *nullarray,
            int *anynull, int *output, int *status);
int fffstrint(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            int nullval, char *nullarray, int *anynull, int *output,
            int *status);
 
int fffi1uint(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, unsigned int nullval,
            char *nullarray, int *anynull, unsigned int *output, int *status);
int fffi2uint(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, unsigned int nullval, char *nullarray,
            int *anynull, unsigned int *output, int *status);
int fffi4uint(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, unsigned int nullval, char *nullarray,
            int *anynull, unsigned int *output, int *status);
int fffi8uint(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, unsigned int nullval, char *nullarray,
            int *anynull, unsigned int *output, int *status);
int fffr4uint(float *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned int nullval, char *nullarray,
            int *anynull, unsigned int *output, int *status);
int fffr8uint(double *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned int nullval, char *nullarray,
            int *anynull, unsigned int *output, int *status);
int fffstruint(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            unsigned int nullval, char *nullarray, int *anynull,
            unsigned int *output, int *status);
 
int fffi1i8(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, LONGLONG nullval, 
            char *nullarray, int *anynull, LONGLONG *output, int *status);
int fffi2i8(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, LONGLONG nullval, char *nullarray,
            int *anynull, LONGLONG *output, int *status);
int fffi4i8(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, LONGLONG nullval, char *nullarray,
            int *anynull, LONGLONG *output, int *status);
int fffi8i8(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, LONGLONG nullval, char *nullarray,
            int *anynull, LONGLONG *output, int *status);
int fffr4i8(float *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG nullval, char *nullarray,
            int *anynull, LONGLONG *output, int *status);
int fffr8i8(double *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG nullval, char *nullarray,
            int *anynull, LONGLONG *output, int *status);
int fffstri8(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            LONGLONG nullval, char *nullarray, int *anynull, LONGLONG *output,
            int *status);

int fffi1u8(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, ULONGLONG nullval, 
            char *nullarray, int *anynull, ULONGLONG *output, int *status);
int fffi2u8(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, ULONGLONG nullval, char *nullarray,
            int *anynull, ULONGLONG *output, int *status);
int fffi4u8(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, ULONGLONG nullval, char *nullarray,
            int *anynull, ULONGLONG *output, int *status);
int fffi8u8(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, ULONGLONG nullval, char *nullarray,
            int *anynull, ULONGLONG *output, int *status);
int fffr4u8(float *input, long ntodo, double scale, double zero,
            int nullcheck, ULONGLONG nullval, char *nullarray,
            int *anynull, ULONGLONG *output, int *status);
int fffr8u8(double *input, long ntodo, double scale, double zero,
            int nullcheck, ULONGLONG nullval, char *nullarray,
            int *anynull, ULONGLONG *output, int *status);
int fffstru8(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            ULONGLONG nullval, char *nullarray, int *anynull, ULONGLONG *output,
            int *status);


int fffi1r4(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffi2r4(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffi4r4(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffi8r4(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffr4r4(float *input, long ntodo, double scale, double zero,
            int nullcheck, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffr8r4(double *input, long ntodo, double scale, double zero,
            int nullcheck, float nullval, char *nullarray,
            int *anynull, float *output, int *status);
int fffstrr4(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            float nullval, char *nullarray, int *anynull, float *output,
            int *status);
 
int fffi1r8(unsigned char *input, long ntodo, double scale, double zero,
            int nullcheck, unsigned char tnull, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffi2r8(short *input, long ntodo, double scale, double zero,
            int nullcheck, short tnull, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffi4r8(INT32BIT *input, long ntodo, double scale, double zero,
            int nullcheck, INT32BIT tnull, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffi8r8(LONGLONG *input, long ntodo, double scale, double zero,
            int nullcheck, LONGLONG tnull, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffr4r8(float *input, long ntodo, double scale, double zero,
            int nullcheck, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffr8r8(double *input, long ntodo, double scale, double zero,
            int nullcheck, double nullval, char *nullarray,
            int *anynull, double *output, int *status);
int fffstrr8(char *input, long ntodo, double scale, double zero,
            long twidth, double power, int nullcheck, char *snull,
            double nullval, char *nullarray, int *anynull, double *output,
            int *status);
 
int ffi1fi1(unsigned char *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffs1fi1(signed char *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffu2fi1(unsigned short *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffi2fi1(short *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffu4fi1(unsigned long *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffi4fi1(long *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffu8fi1(ULONGLONG *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffi8fi1(LONGLONG *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffuintfi1(unsigned int *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffintfi1(int *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffr4fi1(float *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
int ffr8fi1(double *array, long ntodo, double scale, double zero,
            unsigned char *buffer, int *status);
 
int ffi1fi2(unsigned char *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffs1fi2(signed char *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffu2fi2(unsigned short *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffi2fi2(short *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffu4fi2(unsigned long *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffi4fi2(long *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffu8fi2(ULONGLONG *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffi8fi2(LONGLONG *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffuintfi2(unsigned int *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffintfi2(int *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffr4fi2(float *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
int ffr8fi2(double *array, long ntodo, double scale, double zero,
            short *buffer, int *status);
 
int ffi1fi4(unsigned char *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffs1fi4(signed char *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffu2fi4(unsigned short *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffi2fi4(short *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffu4fi4(unsigned long *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffu8fi4(ULONGLONG *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffi4fi4(long *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffi8fi4(LONGLONG *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffuintfi4(unsigned int *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffintfi4(int *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffr4fi4(float *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);
int ffr8fi4(double *array, long ntodo, double scale, double zero,
            INT32BIT *buffer, int *status);

int ffi4fi8(long *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffi8fi8(LONGLONG *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffi2fi8(short *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffi1fi8(unsigned char *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffs1fi8(signed char *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffr4fi8(float *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffr8fi8(double *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffintfi8(int *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffu2fi8(unsigned short *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffu4fi8(unsigned long *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffu8fi8(ULONGLONG *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);
int ffuintfi8(unsigned int *array, long ntodo, double scale, double zero,
            LONGLONG *buffer, int *status);

int ffi1fr4(unsigned char *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffs1fr4(signed char *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffu2fr4(unsigned short *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffi2fr4(short *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffu4fr4(unsigned long *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffi4fr4(long *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffu8fr4(ULONGLONG *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffi8fr4(LONGLONG *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffuintfr4(unsigned int *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffintfr4(int *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffr4fr4(float *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
int ffr8fr4(double *array, long ntodo, double scale, double zero,
            float *buffer, int *status);
 
int ffi1fr8(unsigned char *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffs1fr8(signed char *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffu2fr8(unsigned short *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffi2fr8(short *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffu4fr8(unsigned long *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffi4fr8(long *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffu8fr8(ULONGLONG *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffi8fr8(LONGLONG *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffuintfr8(unsigned int *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffintfr8(int *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffr4fr8(float *array, long ntodo, double scale, double zero,
            double *buffer, int *status);
int ffr8fr8(double *array, long ntodo, double scale, double zero,
            double *buffer, int *status);

int ffi1fstr(unsigned char *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffs1fstr(signed char *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffu2fstr(unsigned short *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffi2fstr(short *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffu4fstr(unsigned long *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffi4fstr(long *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffu8fstr(ULONGLONG *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffi8fstr(LONGLONG *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffintfstr(int *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffuintfstr(unsigned int *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffr4fstr(float *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);
int ffr8fstr(double *input, long ntodo, double scale, double zero,
            char *cform, long twidth, char *output, int *status);

/*  the following 4 routines are VMS macros used on VAX or Alpha VMS */
void ieevpd(double *inarray, double *outarray, long *nvals);
void ieevud(double *inarray, double *outarray, long *nvals);
void ieevpr(float *inarray, float *outarray, long *nvals);
void ieevur(float *inarray, float *outarray, long *nvals);

/*  routines related to the lexical parser  */
int  ffselect_table(fitsfile **fptr, char *outfile, char *expr,  int *status);
int  ffiprs( fitsfile *fptr, int compressed, char *expr, int maxdim,
	     int *datatype, long *nelem, int *naxis, long *naxes,
	     int *status );
void ffcprs( void );
int  ffcvtn( int inputType, void *input, char *undef, long ntodo,
	     int outputType, void *nulval, void *output,
	     int *anynull, int *status );
int  parse_data( long totalrows, long offset, long firstrow,
                 long nrows, int nCols, iteratorCol *colData,
                 void *userPtr );
int  uncompress_hkdata( fitsfile *fptr, long ntimes, 
                        double *times, int *status );
int  ffffrw_work( long totalrows, long offset, long firstrow,
                  long nrows, int nCols, iteratorCol *colData,
                  void *userPtr );

int fits_translate_pixkeyword(char *inrec, char *outrec,char *patterns[][2],
    int npat, int naxis, int *colnum, int *pat_num, int *i,
      int *j, int *n, int *m, int *l, int *status);

/*  image compression routines */
int fits_write_compressed_img(fitsfile *fptr, 
            int  datatype, long  *fpixel, long *lpixel,   
            int nullcheck, void *array,  void *nulval,
            int  *status);
int fits_write_compressed_pixels(fitsfile *fptr, 
            int  datatype, LONGLONG  fpixel, LONGLONG npixels,   
            int nullcheck,  void *array, void *nulval,
            int  *status);
int fits_write_compressed_img_plane(fitsfile *fptr, int  datatype, 
      int  bytesperpixel,  long   nplane, long *firstcoord, long *lastcoord, 
      long *naxes,  int  nullcheck, 
      void *array,  void *nullval, long *nread, int  *status);

int imcomp_init_table(fitsfile *outfptr,
        int bitpix, int naxis,long *naxes, int writebitpix, int *status);
int imcomp_calc_max_elem (int comptype, int nx, int zbitpix, int blocksize);
int imcomp_copy_imheader(fitsfile *infptr, fitsfile *outfptr,
                int *status);
int imcomp_copy_img2comp(fitsfile *infptr, fitsfile *outfptr, int *status);
int imcomp_copy_comp2img(fitsfile *infptr, fitsfile *outfptr, 
                          int norec, int *status);
int imcomp_copy_prime2img(fitsfile *infptr, fitsfile *outfptr, int *status);
int imcomp_compress_image (fitsfile *infptr, fitsfile *outfptr,
                 int *status);
int imcomp_compress_tile (fitsfile *outfptr, long row, 
    int datatype,  void *tiledata, long tilelen, long nx, long ny,
    int nullcheck, void *nullval, int *status);
int imcomp_nullscale(int *idata, long tilelen, int nullflagval, int nullval,
     double scale, double zero, int * status);
int imcomp_nullvalues(int *idata, long tilelen, int nullflagval, int nullval,
     int * status);
int imcomp_scalevalues(int *idata, long tilelen, double scale, double zero,
     int * status);
int imcomp_nullscalefloats(float *fdata, long tilelen, int *idata, 
    double scale, double zero, int nullcheck, float nullflagval, int nullval,
    int *status);
int imcomp_nullfloats(float *fdata, long tilelen, int *idata, int nullcheck,
    float nullflagval, int nullval, int *status);
int imcomp_nullscaledoubles(double *fdata, long tilelen, int *idata, 
    double scale, double zero, int nullcheck, double nullflagval, int nullval,
    int *status);
int imcomp_nulldoubles(double *fdata, long tilelen, int *idata, int nullcheck,
    double nullflagval, int nullval, int *status);
    
 
/*  image decompression routines */
int fits_read_compressed_img(fitsfile *fptr, 
            int  datatype, LONGLONG  *fpixel,LONGLONG  *lpixel,long *inc,   
            int nullcheck, void *nulval,  void *array, char *nullarray,
            int  *anynul, int  *status);
int fits_read_compressed_pixels(fitsfile *fptr, 
            int  datatype, LONGLONG  fpixel, LONGLONG npixels,   
            int nullcheck, void *nulval,  void *array, char *nullarray,
            int  *anynul, int  *status);
int fits_read_compressed_img_plane(fitsfile *fptr, int  datatype, 
      int  bytesperpixel,  long   nplane, LONGLONG *firstcoord, LONGLONG *lastcoord, 
      long *inc,  long *naxes,  int  nullcheck,  void *nullval, 
      void *array, char *nullarray, int  *anynul, long *nread, int  *status);

int imcomp_get_compressed_image_par(fitsfile *infptr, int *status);
int imcomp_decompress_tile (fitsfile *infptr,
          int nrow, int tilesize, int datatype, int nullcheck,
          void *nulval, void *buffer, char *bnullarray, int *anynul,
          int *status);
int imcomp_copy_overlap (char *tile, int pixlen, int ndim,
         long *tfpixel, long *tlpixel, char *bnullarray, char *image,
         long *fpixel, long *lpixel, long *inc, int nullcheck, char *nullarray,
         int *status);
int imcomp_test_overlap (int ndim, long *tfpixel, long *tlpixel, 
         long *fpixel, long *lpixel, long *inc, int *status);
int imcomp_merge_overlap (char *tile, int pixlen, int ndim,
         long *tfpixel, long *tlpixel, char *bnullarray, char *image,
         long *fpixel, long *lpixel, int nullcheck, int *status);
int imcomp_decompress_img(fitsfile *infptr, fitsfile *outfptr, int datatype,
         int  *status);
int fits_quantize_float (long row, float fdata[], long nx, long ny, int nullcheck,
         float in_null_value, float quantize_level, 
           int dither_method, int idata[], double *bscale, double *bzero,
           int *iminval, int *imaxval);
int fits_quantize_double (long row, double fdata[], long nx, long ny, int nullcheck,
         double in_null_value, float quantize_level,
           int dither_method, int idata[], double *bscale, double *bzero,
           int *iminval, int *imaxval);
int fits_rcomp(int a[], int nx, unsigned char *c, int clen,int nblock);
int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen,int nblock);
int fits_rcomp_byte(signed char a[], int nx, unsigned char *c, int clen,int nblock);
int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx,
             int nblock);
int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx,
             int nblock);
int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx,
             int nblock);
int pl_p2li (int *pxsrc, int xs, short *lldst, int npix);
int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix);
int fits_init_randoms(void);
int fits_unset_compression_param( fitsfile *fptr, int *status);
int fits_unset_compression_request( fitsfile *fptr, int *status);
int fitsio_init_lock(void);

/* general driver routines */

int urltype2driver(char *urltype, int *driver);

void fits_dwnld_prog_bar(int flag);
int fits_net_timeout(int sec);

int fits_register_driver( char *prefix,
	int (*init)(void),
	int (*fitsshutdown)(void),
	int (*setoptions)(int option),
	int (*getoptions)(int *options),
	int (*getversion)(int *version),
	int (*checkfile) (char *urltype, char *infile, char *outfile),
	int (*fitsopen)(char *filename, int rwmode, int *driverhandle),
	int (*fitscreate)(char *filename, int *driverhandle),
	int (*fitstruncate)(int driverhandle, LONGLONG filesize),
	int (*fitsclose)(int driverhandle),
	int (*fremove)(char *filename),
        int (*size)(int driverhandle, LONGLONG *sizex),
	int (*flush)(int driverhandle),
	int (*seek)(int driverhandle, LONGLONG offset),
	int (*fitsread) (int driverhandle, void *buffer, long nbytes),
	int (*fitswrite)(int driverhandle, void *buffer, long nbytes));

/* file driver I/O routines */

int file_init(void);
int file_setoptions(int options);
int file_getoptions(int *options);
int file_getversion(int *version);
int file_shutdown(void);
int file_checkfile(char *urltype, char *infile, char *outfile);
int file_open(char *filename, int rwmode, int *driverhandle);
int file_compress_open(char *filename, int rwmode, int *hdl);
int file_openfile(char *filename, int rwmode, FILE **diskfile);
int file_create(char *filename, int *driverhandle);
int file_truncate(int driverhandle, LONGLONG filesize);
int file_size(int driverhandle, LONGLONG *filesize);
int file_close(int driverhandle);
int file_remove(char *filename);
int file_flush(int driverhandle);
int file_seek(int driverhandle, LONGLONG offset);
int file_read (int driverhandle, void *buffer, long nbytes);
int file_write(int driverhandle, void *buffer, long nbytes);
int file_is_compressed(char *filename);

/* stream driver I/O routines */

int stream_open(char *filename, int rwmode, int *driverhandle);
int stream_create(char *filename, int *driverhandle);
int stream_size(int driverhandle, LONGLONG *filesize);
int stream_close(int driverhandle);
int stream_flush(int driverhandle);
int stream_seek(int driverhandle, LONGLONG offset);
int stream_read (int driverhandle, void *buffer, long nbytes);
int stream_write(int driverhandle, void *buffer, long nbytes);

/* memory driver I/O routines */

int mem_init(void);
int mem_setoptions(int options);
int mem_getoptions(int *options);
int mem_getversion(int *version);
int mem_shutdown(void);
int mem_create(char *filename, int *handle);
int mem_create_comp(char *filename, int *handle);
int mem_openmem(void **buffptr, size_t *buffsize, size_t deltasize,
                void *(*memrealloc)(void *p, size_t newsize), int *handle);
int mem_createmem(size_t memsize, int *handle);
int stdin_checkfile(char *urltype, char *infile, char *outfile);
int stdin_open(char *filename, int rwmode, int *handle);
int stdin2mem(int hd);
int stdin2file(int hd);
int stdout_close(int handle);
int mem_compress_openrw(char *filename, int rwmode, int *hdl);
int mem_compress_open(char *filename, int rwmode, int *hdl);
int mem_compress_stdin_open(char *filename, int rwmode, int *hdl);
int mem_iraf_open(char *filename, int rwmode, int *hdl);
int mem_rawfile_open(char *filename, int rwmode, int *hdl);
int mem_size(int handle, LONGLONG *filesize);
int mem_truncate(int handle, LONGLONG filesize);
int mem_close_free(int handle);
int mem_close_keep(int handle);
int mem_close_comp(int handle);
int mem_seek(int handle, LONGLONG offset);
int mem_read(int hdl, void *buffer, long nbytes);
int mem_write(int hdl, void *buffer, long nbytes);
int mem_uncompress2mem(char *filename, FILE *diskfile, int hdl);

int iraf2mem(char *filename, char **buffptr, size_t *buffsize, 
      size_t *filesize, int *status);

/* root driver I/O routines */

int root_init(void);
int root_setoptions(int options);
int root_getoptions(int *options);
int root_getversion(int *version);
int root_shutdown(void);
int root_open(char *filename, int rwmode, int *driverhandle);
int root_create(char *filename, int *driverhandle);
int root_close(int driverhandle);
int root_flush(int driverhandle);
int root_seek(int driverhandle, LONGLONG offset);
int root_read (int driverhandle, void *buffer, long nbytes);
int root_write(int driverhandle, void *buffer, long nbytes);
int root_size(int handle, LONGLONG *filesize);

/* http driver I/O routines */

int http_checkfile(char *urltype, char *infile, char *outfile);
int http_open(char *filename, int rwmode, int *driverhandle);
int http_file_open(char *filename, int rwmode, int *driverhandle);
int http_compress_open(char *filename, int rwmode, int *driverhandle);

/* https driver I/O routines */
int https_checkfile(char* urltype, char *infile, char *outfile);
int https_open(char *filename, int rwmode, int *driverhandle);
int https_file_open(char *filename, int rwmode, int *driverhandle);
void https_set_verbose(int flag);

/* ftps driver I/O routines */
int ftps_checkfile(char* urltype, char *infile, char *outfile);
int ftps_open(char *filename, int rwmode, int *handle);
int ftps_file_open(char *filename, int rwmode, int *handle);
int ftps_compress_open(char *filename, int rwmode, int *driverhandle);

/* ftp driver I/O routines */

int ftp_checkfile(char *urltype, char *infile, char *outfile);
int ftp_open(char *filename, int rwmode, int *driverhandle);
int ftp_file_open(char *filename, int rwmode, int *driverhandle);
int ftp_compress_open(char *filename, int rwmode, int *driverhandle);

int uncompress2mem(char *filename, FILE *diskfile,
             char **buffptr, size_t *buffsize,
             void *(*mem_realloc)(void *p, size_t newsize),
             size_t *filesize, int *status);

int uncompress2mem_from_mem(                                                
             char *inmemptr,     
             size_t inmemsize, 
             char **buffptr,  
             size_t *buffsize,  
             void *(*mem_realloc)(void *p, size_t newsize), 
             size_t *filesize,  
             int *status);

int uncompress2file(char *filename, 
             FILE *indiskfile, 
             FILE *outdiskfile, 
             int *status);

int compress2mem_from_mem(                                                
             char *inmemptr,     
             size_t inmemsize, 
             char **buffptr,  
             size_t *buffsize,  
             void *(*mem_realloc)(void *p, size_t newsize), 
             size_t *filesize,  
             int *status);

int compress2file_from_mem(                                                
             char *inmemptr,     
             size_t inmemsize, 
             FILE *outdiskfile, 
             size_t *filesize,   /* O - size of file, in bytes              */
             int *status);


#ifdef HAVE_GSIFTP
/* prototypes for gsiftp driver I/O routines */
#include "drvrgsiftp.h"
#endif

#ifdef HAVE_SHMEM_SERVICES
/* prototypes for shared memory driver I/O routines  */
#include "drvrsmem.h"
#endif

/* A hack for nonunix machines, which lack strcasecmp and strncasecmp */
/* these functions are in fitscore.c */
int fits_strcasecmp (const char *s1, const char *s2       );
int fits_strncasecmp(const char *s1, const char *s2, size_t n);

/* end of the entire "ifndef _FITSIO2_H" block */
#endif