/************************************************************************ f77_wrap1.c and f77_wrap2.c have now been split into 4 files to prevent compile-time memory errors (from expansion of compiler commands). f77_wrap1.c was split into f77_wrap1.c and f77_wrap3.c, and f77_wrap2.c was split into f77_wrap2.c and f77_wrap4.c: f77_wrap1.c contains routines operating on whole files and some utility routines. f77_wrap2.c contains routines operating on primary array, image, or column elements. f77_wrap3.c contains routines operating on headers & keywords. f77_wrap4.c contains miscellaneous routines. Peter's original comments: Together, f77_wrap1.c and f77_wrap2.c contain C wrappers for all the CFITSIO routines prototyped in fitsio.h, except for the generic datatype routines and features not supported in fortran (eg, unsigned integers), a few routines prototyped in fitsio2.h, which only a handful of FTOOLS use, plus a few obsolete FITSIO routines not present in CFITSIO. This file allows Fortran code to use the CFITSIO library instead of the FITSIO library without modification. It also gives access to new routines not present in FITSIO. Fortran FTOOLS must continue using the old routine names from FITSIO (ie, ftxxxx), but most of the C-wrappers simply redirect those calls to the corresponding CFITSIO routines (ie, ffxxxx), with appropriate parameter massaging where necessary. The main exception are read/write routines ending in j (ie, long data) which get redirected to C routines ending in k (ie, int data). This is more consistent with the default integer type in Fortran. f77_wrap1.c primarily holds routines operating on whole files and extension headers. f77_wrap2.c handle routines which read and write the data portion, plus miscellaneous extra routines. File created by Peter Wilson (HSTX), Oct-Dec. 1997 ************************************************************************/ #include "fitsio2.h" #include "f77_wrap.h" /*----------------- write single keywords --------------*/ FCALLSCSUB3(ffprec,FTPREC,ftprec,FITSUNIT,STRING,PINT) FCALLSCSUB3(ffpcom,FTPCOM,ftpcom,FITSUNIT,STRING,PINT) FCALLSCSUB4(ffpunt,FTPUNT,ftpunt,FITSUNIT,STRING,STRING,PINT) FCALLSCSUB3(ffphis,FTPHIS,ftphis,FITSUNIT,STRING,PINT) FCALLSCSUB2(ffpdat,FTPDAT,ftpdat,FITSUNIT,PINT) FCALLSCSUB3(ffgstm,FTGSTM,ftgstm,PSTRING,PINT,PINT) FCALLSCSUB4(ffgsdt,FTGSDT,ftgsdt,PINT,PINT,PINT,PINT) FCALLSCSUB5(ffdt2s,FTDT2S,ftdt2s,INT,INT,INT,PSTRING,PINT) FCALLSCSUB9(fftm2s,FTTM2S,fttm2s,INT,INT,INT,INT,INT,DOUBLE,INT,PSTRING,PINT) FCALLSCSUB5(ffs2dt,FTS2DT,fts2dt,STRING,PINT,PINT,PINT,PINT) FCALLSCSUB8(ffs2tm,FTS2TM,fts2tm,STRING,PINT,PINT,PINT,PINT,PINT,PDOUBLE,PINT) FCALLSCSUB4(ffpkyu,FTPKYU,ftpkyu,FITSUNIT,STRING,STRING,PINT) FCALLSCSUB5(ffpkys,FTPKYS,ftpkys,FITSUNIT,STRING,STRING,STRING,PINT) FCALLSCSUB5(ffpkls,FTPKLS,ftpkls,FITSUNIT,STRING,STRING,STRING,PINT) FCALLSCSUB2(ffplsw,FTPLSW,ftplsw,FITSUNIT,PINT) FCALLSCSUB5(ffpkyl,FTPKYL,ftpkyl,FITSUNIT,STRING,INT,STRING,PINT) FCALLSCSUB5(ffpkyj,FTPKYJ,ftpkyj,FITSUNIT,STRING,LONG,STRING,PINT) FCALLSCSUB5(ffpkyj,FTPKYK,ftpkyk,FITSUNIT,STRING,LONGLONG,STRING,PINT) FCALLSCSUB6(ffpkyf,FTPKYF,ftpkyf,FITSUNIT,STRING,FLOAT,INT,STRING,PINT) FCALLSCSUB6(ffpkye,FTPKYE,ftpkye,FITSUNIT,STRING,FLOAT,INT,STRING,PINT) FCALLSCSUB6(ffpkyg,FTPKYG,ftpkyg,FITSUNIT,STRING,DOUBLE,INT,STRING,PINT) FCALLSCSUB6(ffpkyd,FTPKYD,ftpkyd,FITSUNIT,STRING,DOUBLE,INT,STRING,PINT) FCALLSCSUB6(ffpkyc,FTPKYC,ftpkyc,FITSUNIT,STRING,FLOATV,INT,STRING,PINT) FCALLSCSUB6(ffpkym,FTPKYM,ftpkym,FITSUNIT,STRING,DOUBLEV,INT,STRING,PINT) FCALLSCSUB6(ffpkfc,FTPKFC,ftpkfc,FITSUNIT,STRING,FLOATV,INT,STRING,PINT) FCALLSCSUB6(ffpkfm,FTPKFM,ftpkfm,FITSUNIT,STRING,DOUBLEV,INT,STRING,PINT) FCALLSCSUB6(ffpkyt,FTPKYT,ftpkyt,FITSUNIT,STRING,LONG,DOUBLE,STRING,PINT) #define ftptdm_LONGV_A4 A3 FCALLSCSUB5(ffptdm,FTPTDM,ftptdm,FITSUNIT,INT,INT,LONGV,PINT) /*----------------- write array of keywords --------------*/ #define ftpkns_STRV_A5 NUM_ELEM_ARG(4) #define ftpkns_STRV_A6 NUM_ELEM_ARG(4) FCALLSCSUB7(ffpkns,FTPKNS,ftpkns,FITSUNIT,STRING,INT,INT,STRINGV,STRINGV,PINT) /* Must handle LOGICALV conversion manually... ffpknl uses ints */ void Cffpknl( fitsfile *fptr, char *keyroot, int nstart, int nkeys, int *numval, char **comment, int *status ); void Cffpknl( fitsfile *fptr, char *keyroot, int nstart, int nkeys, int *numval, char **comment, int *status ) { int i; for( i=0; i