cfitsio  3390
Data Structures | Macros | Functions | Variables
cfileio.c File Reference
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <errno.h>
#include <stddef.h>
#include "fitsio2.h"
#include "group.h"
Include dependency graph for cfileio.c:

Data Structures

struct  fitsdriver
 

Macros

#define MAX_PREFIX_LEN   20 /* max length of file type prefix (e.g. 'http://') */
 
#define MAX_DRIVERS   24 /* max number of file I/O drivers */
 

Functions

int comma2semicolon (char *string)
 
int fitsio_init_lock (void)
 
int ffomem (fitsfile **fptr, const char *name, int mode, void **buffptr, size_t *buffsize, size_t deltasize, void *(*mem_realloc)(void *p, size_t newsize), int *status)
 
int ffdkopn (fitsfile **fptr, const char *name, int mode, int *status)
 
int ffdopn (fitsfile **fptr, const char *name, int mode, int *status)
 
int ffeopn (fitsfile **fptr, const char *name, int mode, char *extlist, int *hdutype, int *status)
 
int fftopn (fitsfile **fptr, const char *name, int mode, int *status)
 
int ffiopn (fitsfile **fptr, const char *name, int mode, int *status)
 
int ffopentest (int soname, fitsfile **fptr, const char *name, int mode, int *status)
 
int ffopen (fitsfile **fptr, const char *name, int mode, int *status)
 
int ffreopen (fitsfile *openfptr, fitsfile **newfptr, int *status)
 
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 fits_is_this_a_copy (char *urltype)
 
int ffedit_columns (fitsfile **fptr, char *outfile, char *expr, int *status)
 
int fits_copy_cell2image (fitsfile *fptr, fitsfile *newptr, char *colname, long rownum, int *status)
 
int fits_copy_image2cell (fitsfile *fptr, fitsfile *newptr, char *colname, long rownum, int copykeyflag, int *status)
 
int fits_select_image_section (fitsfile **fptr, char *outfile, char *expr, int *status)
 
int fits_copy_image_section (fitsfile *fptr, fitsfile *newptr, char *expr, int *status)
 
int fits_get_section_range (char **ptr, long *secmin, long *secmax, long *incre, int *status)
 
int ffselect_table (fitsfile **fptr, char *outfile, char *expr, int *status)
 
int ffparsecompspec (fitsfile *fptr, char *compspec, int *status)
 
int ffdkinit (fitsfile **fptr, const char *name, int *status)
 
int ffinit (fitsfile **fptr, const char *name, int *status)
 
int ffimem (fitsfile **fptr, void **buffptr, size_t *buffsize, size_t deltasize, void *(*mem_realloc)(void *p, size_t newsize), int *status)
 
int fits_init_cfitsio (void)
 
int fits_register_driver (char *prefix, int(*init)(void), int(*shutdown)(void), int(*setoptions)(int option), int(*getoptions)(int *options), int(*getversion)(int *version), int(*checkfile)(char *urltype, char *infile, char *outfile), int(*open)(char *filename, int rwmode, int *driverhandle), int(*create)(char *filename, int *driverhandle), int(*truncate)(int driverhandle, LONGLONG filesize), int(*close)(int driverhandle), int(*fremove)(char *filename), int(*size)(int driverhandle, LONGLONG *sizex), int(*flush)(int driverhandle), int(*seek)(int driverhandle, LONGLONG offset), int(*read)(int driverhandle, void *buffer, long nbytes), int(*write)(int driverhandle, void *buffer, long nbytes))
 
int ffiurl (char *url, char *urltype, char *infilex, char *outfile, char *extspec, char *rowfilterx, char *binspec, char *colspec, int *status)
 
int ffifile (char *url, char *urltype, char *infilex, char *outfile, char *extspec, char *rowfilterx, char *binspec, char *colspec, char *pixfilter, int *status)
 
int ffifile2 (char *url, char *urltype, char *infilex, char *outfile, char *extspec, char *rowfilterx, char *binspec, char *colspec, char *pixfilter, char *compspec, int *status)
 
int ffexist (const char *infile, int *exists, int *status)
 
int ffrtnm (char *url, char *rootname, int *status)
 
int ffourl (char *url, char *urltype, char *outfile, char *tpltfile, char *compspec, int *status)
 
int ffexts (char *extspec, int *extnum, char *extname, int *extvers, int *hdutype, char *imagecolname, char *rowexpress, int *status)
 
int ffextn (char *url, int *extension_num, int *status)
 
int ffurlt (fitsfile *fptr, char *urlType, int *status)
 
int ffimport_file (char *filename, char **contents, int *status)
 
int fits_get_token (char **ptr, char *delimiter, char *token, int *isanumber)
 
int fits_get_token2 (char **ptr, char *delimiter, char **token, int *isanumber, int *status)
 
char * fits_split_names (char *list)
 
int urltype2driver (char *urltype, int *driver)
 
int ffclos (fitsfile *fptr, int *status)
 
int ffdelt (fitsfile *fptr, int *status)
 
int fftrun (fitsfile *fptr, LONGLONG filesize, int *status)
 
int ffflushx (FITSfile *fptr)
 
int ffseek (FITSfile *fptr, LONGLONG position)
 
int ffwrite (FITSfile *fptr, long nbytes, void *buffer, int *status)
 
int ffread (FITSfile *fptr, long nbytes, void *buffer, int *status)
 
int fftplt (fitsfile **fptr, const char *filename, const char *tempname, int *status)
 
int ffoptplt (fitsfile *fptr, const char *tempname, int *status)
 
void ffrprt (FILE *stream, int status)
 

Variables

fitsdriver driverTable [MAX_DRIVERS]
 
FITSfileFptrTable [NMAXFILES]
 
int need_to_initialize = 1
 
int no_of_drivers = 0
 

Detailed Description

Low level file access routines.

Macro Definition Documentation

#define MAX_DRIVERS   24 /* max number of file I/O drivers */

max number of file I/O drivers

#define MAX_PREFIX_LEN   20 /* max length of file type prefix (e.g. 'http://') */

max length of file type prefix (e.g. 'http://')

Function Documentation

int comma2semicolon ( char *  string)

replace commas with semicolons, unless the comma is within a quoted or bracketed expression

Here is the caller graph for this function:

int ffclos ( fitsfile fptr,
int *  status 
)

close the FITS file by completing the current HDU, flushing it to disk, then calling the system dependent routine to physically close the FITS file

Parameters
[in]fptrFITS file pointer
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffdelt ( fitsfile fptr,
int *  status 
)

close and DELETE the FITS file.

Parameters
[in]fptrFITS file pointer
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffdkinit ( fitsfile **  fptr,
const char *  name,
int *  status 
)

Create and initialize a new FITS file on disk. This routine differs from ffinit in that the input 'name' is literally taken as the name of the disk file to be created, and it does not support CFITSIO's extended filename syntax.

Parameters
[out]fptrFITS file pointer
[in]namename of file to create
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffdkopn ( fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file on magnetic disk with either readonly or read/write access. The routine does not support CFITSIO's extended filename syntax and simply uses the entire input 'name' string as the name of the file.

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffdopn ( fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' data, if the primary array contains a null image (i.e., NAXIS = 0).

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffedit_columns ( fitsfile **  fptr,
char *  outfile,
char *  expr,
int *  status 
)

modify columns in a table and/or header keywords in the HDU

Parameters
[in,out]fptrpointer to input table; on output it points to the new selected rows table
[in]outfilename for output file
[in]exprcolumn edit expression

Here is the call graph for this function:

Here is the caller graph for this function:

int ffeopn ( fitsfile **  fptr,
const char *  name,
int  mode,
char *  extlist,
int *  hdutype,
int *  status 
)

Open an existing FITS file with either readonly or read/write access. and if the primary array contains a null image (i.e., NAXIS = 0) then attempt to move to the first extension named in the extlist of extension names. If none are found, then simply move to the 2nd extension.

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in]extlistlist of 'good' extensions to move to
[out]hdutypetype of extension that is moved to
[in,out]statuserror status

Here is the call graph for this function:

int ffexist ( const char *  infile,
int *  exists,
int *  status 
)

test if the input file specifier is an existing file on disk If the specified file can't be found, it then searches for a compressed version of the file.

Parameters
[in]infileinput filename or URL
[out]exists2 = a compressed version of file exists 1 = yes, disk file exists 0 = no, disk file could not be found -1 = infile is not a disk file (could be a http, ftp, gsiftp, smem, or stdin file)
[in,out]statusO status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffextn ( char *  url,
int *  extension_num,
int *  status 
)

Parse the input url string and return the number of the extension that CFITSIO would automatically move to if CFITSIO were to open this input URL. The extension numbers are one's based, so 1 = the primary array, 2 = the first extension, etc.

The extension number that gets returned is determined by the following algorithm:

  1. If the input URL includes a binning specification (e.g. 'myfile.fits[3][bin X,Y]') then the returned extension number will always = 1, since CFITSIO would create a temporary primary image on the fly in this case. The same is true if an image within a single cell of a binary table is opened.
  2. Else if the input URL specifies an extension number (e.g., 'myfile.fits[3]' or 'myfile.fits+3') then the specified extension number (+ 1) is returned.
  3. Else if the extension name is specified in brackets (e.g., this 'myfile.fits[EVENTS]') then the file will be opened and searched for the extension number. If the input URL is '-' (reading from the stdin file stream) this is not possible and an error will be returned.
  4. Else if the URL does not specify an extension (e.g. 'myfile.fits') then a special extension number = -99 will be returned to signal that no extension was specified. This feature is mainly for compatibility with existing FTOOLS software. CFITSIO would open the primary array by default (extension_num = 1) in this case.
    Parameters
    [in]urlinput filename/URL
    [out]extension_numreturned extension number

Here is the call graph for this function:

Here is the caller graph for this function:

int ffexts ( char *  extspec,
int *  extnum,
char *  extname,
int *  extvers,
int *  hdutype,
char *  imagecolname,
char *  rowexpress,
int *  status 
)

Parse the input extension specification string, returning either the extension number or the values of the EXTNAME, EXTVERS, and XTENSION keywords in desired extension. Also return the name of the column containing an image, and an expression to be used to determine which row to use, if present.

Here is the call graph for this function:

Here is the caller graph for this function:

int ffflushx ( FITSfile fptr)

low level routine to flush internal file buffers to the file.

Parameters
[in]fptrFITS file pointer

Here is the caller graph for this function:

int ffifile ( char *  url,
char *  urltype,
char *  infilex,
char *  outfile,
char *  extspec,
char *  rowfilterx,
char *  binspec,
char *  colspec,
char *  pixfilter,
int *  status 
)

fits_parse_input_filename parse the input URL into its basic components. This routine does not support the compspec component.

Parameters
[in]urlinput filename
[in]urltypee.g., 'file://', 'http://', 'mem://'
[in]infilexroot filename (may be complete path)
[in]outfileoptional output file name
[in]extspecextension spec: +n or [extname, extver]
[in]rowfilterxboolean row filter expression
[in]binspechistogram binning specifier
[in]colspeccolumn or keyword modifier expression
[in]pixfilterpixel filter expression

Here is the call graph for this function:

int ffifile2 ( char *  url,
char *  urltype,
char *  infilex,
char *  outfile,
char *  extspec,
char *  rowfilterx,
char *  binspec,
char *  colspec,
char *  pixfilter,
char *  compspec,
int *  status 
)

fits_parse_input_filename parse the input URL into its basic components. This routine is big and ugly and should be redesigned someday!

Parameters
[in]urlinput filename
[in]urltypee.g., 'file://', 'http://', 'mem://'
[in]infilexroot filename (may be complete path)
[in]outfileoptional output file name
[in]extspecextension spec: +n or [extname, extver]
[in]rowfilterxboolean row filter expression
[in]binspechistogram binning specifier
[in]colspeccolumn or keyword modifier expression
[in]pixfilterpixel filter expression
[in]compspecimage compression specification

Here is the call graph for this function:

Here is the caller graph for this function:

int ffimem ( fitsfile **  fptr,
void **  buffptr,
size_t *  buffsize,
size_t  deltasize,
void *(*)(void *p, size_t newsize)  mem_realloc,
int *  status 
)

Create and initialize a new FITS file in memory

Parameters
[out]fptrFITS file pointer
[in]buffptraddress of memory pointer
[in]buffsizesize of buffer, in bytes
[in]deltasizeincrement for future realloc's
[in]mem_reallocfunction
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffimport_file ( char *  filename,
char **  contents,
int *  status 
)

Read and concatenate all the lines from the given text file. User must free the pointer returned in contents. Pointer is guaranteed to hold 2 characters more than the length of the text... allows the calling routine to append (or prepend) a newline (or quotes?) without reallocating memory.

Parameters
[in]filenameText file to read
[in]contentsPointer to pointer to hold file
[in]statusCFITSIO error code

Here is the call graph for this function:

Here is the caller graph for this function:

int ffinit ( fitsfile **  fptr,
const char *  name,
int *  status 
)

Create and initialize a new FITS file.

Parameters
[out]fptrFITS file pointer
[in]namename of file to create
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffiopn ( fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' image (not an table).

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffiurl ( char *  url,
char *  urltype,
char *  infilex,
char *  outfile,
char *  extspec,
char *  rowfilterx,
char *  binspec,
char *  colspec,
int *  status 
)

parse the input URL into its basic components. This routine does not support the pixfilter or compspec components.

Parameters
[in]urlinput filename
[in]urltypee.g., 'file://', 'http://', 'mem://'
[in]infilexroot filename (may be complete path)
[in]outfileoptional output file name
[in]extspecextension spec: +n or [extname, extver]
[in]rowfilterxboolean row filter expression
[in]binspechistogram binning specifier
[in]colspeccolumn or keyword modifier expression

Here is the call graph for this function:

Here is the caller graph for this function:

int ffomem ( fitsfile **  fptr,
const char *  name,
int  mode,
void **  buffptr,
size_t *  buffsize,
size_t  deltasize,
void *(*)(void *p, size_t newsize)  mem_realloc,
int *  status 
)

Open an existing FITS file in core memory. This is a specialized version of ffopen.

Parameters
[out]fptrFITS file pointer
[in]namename of file to open
[in]mode0 = open readonly; 1 = read/write
[in]buffptraddress of memory pointer
[in]buffsizesize of buffer, in bytes
[in]deltasizeincrement for future realloc's
[in]mem_reallocfunction
[in,out]statuserror status

Here is the call graph for this function:

int ffopen ( fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file with either readonly or read/write access.

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffopentest ( int  soname,
fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file with either readonly or read/write access. First test that the SONAME of fitsio.h used to build the CFITSIO library is the same as was used in compiling the application program that links to the library.

Parameters
[in]sonameCFITSIO shared library version application program (fitsio.h file)
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode/* I - 0 = open readonly; 1 = read/write
[in,out]statuserror status

Here is the call graph for this function:

int ffoptplt ( fitsfile fptr,
const char *  tempname,
int *  status 
)

open template file and use it to create new file

Parameters
[out]fptrFITS file pointer
[in]tempnamename of template file
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffourl ( char *  url,
char *  urltype,
char *  outfile,
char *  tpltfile,
char *  compspec,
int *  status 
)

parse the output URL into its basic components.

Parameters
[in]urlfull input URL
[out]urltypeurl type
[out]outfilebase file name
[out]tpltfiletemplate file name, if any
[out]compspeccompression specification, if any

Here is the caller graph for this function:

int ffparsecompspec ( fitsfile fptr,
char *  compspec,
int *  status 
)

Parse the image compression specification that was give in square brackets following the output FITS file name, as in these examples:

myfile.fits[compress] - default Rice compression, row by row myfile.fits[compress TYPE] - the first letter of TYPE defines the compression algorithm: R = Rice G = GZIP H = HCOMPRESS HS = HCOMPRESS (with smoothing) B - BZIP2 P = PLIO

myfile.fits[compress TYPE 100,100] - the numbers give the dimensions of the compression tiles. Default is NAXIS1, 1, 1, ...

other optional parameters may be specified following a semi-colon

myfile.fits[compress; q 8.0] q specifies the floating point mufile.fits[compress TYPE; q -.0002] quantization level; myfile.fits[compress TYPE 100,100; q 10, s 25] s specifies the HCOMPRESS integer scaling parameter

The compression parameters are saved in the fptr->Fptr structure for use when writing FITS images.

Parameters
[in]fptrFITS file pointer
[in]compspecimage compression specification
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffread ( FITSfile fptr,
long  nbytes,
void *  buffer,
int *  status 
)

low level routine to read bytes from a file.

Parameters
[in]fptrFITS file pointer
[in]nbytesnumber of bytes to read
[out]bufferbuffer to read into
[out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffreopen ( fitsfile openfptr,
fitsfile **  newfptr,
int *  status 
)

Reopen an existing FITS file with either readonly or read/write access. The reopened file shares the same FITSfile structure but may point to a different HDU within the file.

Parameters
[in]openfptrFITS file pointer to open file
[out]newfptrpointer to new re opened file
[in,out]statuserror status

Here is the caller graph for this function:

void ffrprt ( FILE *  stream,
int  status 
)

Print out report of cfitsio error status and messages on the error stack. Uses C FILE stream.

Here is the call graph for this function:

Here is the caller graph for this function:

int ffrtnm ( char *  url,
char *  rootname,
int *  status 
)

parse the input URL, returning the root name (filetype://basename).

Here is the caller graph for this function:

*int ffseek ( FITSfile fptr,
LONGLONG  position 
)

low level routine to seek to a position in a file.

Parameters
[in]fptrFITS file pointer
[in]positionbyte position to seek to

Here is the caller graph for this function:

int ffselect_table ( fitsfile **  fptr,
char *  outfile,
char *  expr,
int *  status 
)
Parameters
[in,out]fptrpointer to input table; on output it points to the new selected rows table
[in]outfilename for output file
[in]exprBoolean expression

Here is the call graph for this function:

Here is the caller graph for this function:

int fftopn ( fitsfile **  fptr,
const char *  name,
int  mode,
int *  status 
)

Open an existing FITS file with either readonly or read/write access. and move to the first HDU that contains 'interesting' table (not an image).

Parameters
[out]fptrFITS file pointer
[in]namefull name of file to open
[in]mode0 = open readonly; 1 = read/write
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int fftplt ( fitsfile **  fptr,
const char *  filename,
const char *  tempname,
int *  status 
)

Create and initialize a new FITS file based on a template file. Uses C fopen and fgets functions.

Parameters
[out]fptrFITS file pointer
[in]filenamename of file to create
[in]tempnamename of template file
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int fftrun ( fitsfile fptr,
LONGLONG  filesize,
int *  status 
)

low level routine to truncate a file to a new smaller size.

Parameters
[in]fptrFITS file pointer
[in]filesizesize to truncate the file
[out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int ffurlt ( fitsfile fptr,
char *  urlType,
int *  status 
)

return the prefix string associated with the driver in use by the fitsfile pointer fptr

Here is the caller graph for this function:

int ffwrite ( FITSfile fptr,
long  nbytes,
void *  buffer,
int *  status 
)

low level routine to write bytes to a file.

Parameters
[in]fptrFITS file pointer
[in]nbytesnumber of bytes to write
[in]bufferbuffer to write
[out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

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 
)

Check if the file to be opened is already open. If so, then attach to it.

the input strings must not exceed the standard lengths of FLEN_FILENAME, MAX_PREFIX_LEN, etc.

   this function was changed so that for files of access method FILE://
   the file paths are compared using standard URL syntax and absolute
   paths (as opposed to relative paths). This eliminates some instances
   where a file is already opened but it is not realized because it
   was opened with another file path. For instance, if the CWD is
   /a/b/c and I open /a/b/c/foo.fits then open ./foo.fits the previous
   version of this function would not have reconized that the two files
   were the same. This version does recognize that the two files are
   the same.
Parameters
[in,out]fptrFITS file pointer
[in]mode0 = open readonly; 1 = read/write
[out]isopen1 = file is already open
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_clear_Fptr ( FITSfile Fptr,
int *  status 
)

clear the Fptr address from the Fptr Table

Parameters
[out]FptrFITS file pointer
[in,out]statuserror status

Here is the caller graph for this function:

int fits_copy_cell2image ( fitsfile fptr,
fitsfile newptr,
char *  colname,
long  rownum,
int *  status 
)

Copy a table cell of a given row and column into an image extension. The output file must already have been created. A new image extension will be created in that file.

Author
This routine was written by Craig Markwardt, GSFC
Parameters
[in]fptrpoint to input table
[out]newptrexisting output file; new image HDU will be appended to it
[in]colnamecolumn name / number containing the image
[in]rownumnumber of the row containing the image
[in,out]statuserror status

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_copy_image2cell ( fitsfile fptr,
fitsfile newptr,
char *  colname,
long  rownum,
int  copykeyflag,
int *  status 
)

Copy an image extension into a table cell at a given row and column. The table must have already been created. If the "colname" column exists, it will be used, otherwise a new column will be created in the table.

The "copykeyflag" parameter controls which keywords to copy from the input image to the output table header (with any appropriate translation).

copykeyflag = 0 – no keywords will be copied copykeyflag = 1 – essentially all keywords will be copied copykeyflag = 2 – copy only the WCS related keywords

Author
This routine was written by Craig Markwardt, GSFC
Parameters
[in]fptrpointer to input image extension
[in]newptrpointer to output table
[in]colnamename of column containing the image
[in]rownumnumber of the row containing the image
[in]copykeyflagcontrols which keywords to copy
[in,out]statuserror status

Here is the call graph for this function:

int fits_copy_image_section ( fitsfile fptr,
fitsfile newptr,
char *  expr,
int *  status 
)

copies an image section from the input file to a new output HDU

Parameters
[in]fptrpointer to input image
[in]newptrpointer to output image
[in]exprImage section expression

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_get_section_range ( char **  ptr,
long *  secmin,
long *  secmax,
long *  incre,
int *  status 
)

Parse the input image section specification string, returning the min, max and increment values. Typical string = "1:512:2" or "1:512"

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_get_token ( char **  ptr,
char *  delimiter,
char *  token,
int *  isanumber 
)

parse off the next token, delimited by a character in 'delimiter', from the input ptr string; increment *ptr to the end of the token. Returns the length of the token, not including the delimiter char;

Parameters
[out]isanumberis this token a number?

Here is the caller graph for this function:

int fits_get_token2 ( char **  ptr,
char *  delimiter,
char **  token,
int *  isanumber,
int *  status 
)

parse off the next token, delimited by a character in 'delimiter', from the input ptr string; increment *ptr to the end of the token. Returns the length of the token, not including the delimiter char;

This routine allocates the *token string; the calling routine must free it

Parameters
[out]isanumberis this token a number?

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_init_cfitsio ( void  )

initialize anything that is required before using the CFITSIO routines

Here is the caller graph for this function:

int fits_is_this_a_copy ( char *  urltype)

specialized routine that returns 1 if the file is known to be a temporary copy of the originally opened file. Otherwise it returns 0.

Parameters
[in]urltypetype of file

Here is the caller graph for this function:

int fits_register_driver ( char *  prefix,
int(*)(void)  init,
int(*)(void)  shutdown,
int(*)(int option)  setoptions,
int(*)(int *options)  getoptions,
int(*)(int *version)  getversion,
int(*)(char *urltype, char *infile, char *outfile)  checkfile,
int(*)(char *filename, int rwmode, int *driverhandle)  open,
int(*)(char *filename, int *driverhandle)  create,
int(*)(int driverhandle, LONGLONG filesize)  truncate,
int(*)(int driverhandle)  close,
int(*)(char *filename)  fremove,
int(*)(int driverhandle, LONGLONG *sizex)  size,
int(*)(int driverhandle)  flush,
int(*)(int driverhandle, LONGLONG offset)  seek,
int(*)(int driverhandle, void *buffer, long nbytes)  read,
int(*)(int driverhandle, void *buffer, long nbytes)  write 
)

register all the functions needed to support an I/O driver

Here is the call graph for this function:

Here is the caller graph for this function:

int fits_select_image_section ( fitsfile **  fptr,
char *  outfile,
char *  expr,
int *  status 
)

copies an image section from the input file to a new output file. Any HDUs preceding or following the image are also copied to the output file.

Parameters
[in,out]fptrpointer to input image; on output it points to the new subimage
[in]outfilename for output file
[in]exprImage section expression

Here is the call graph for this function:

Here is the caller graph for this function:

char * fits_split_names ( char *  list)

A sequence of calls to fits_split_names will split the input string into name tokens. The string typically contains a list of file or column names. The names must be delimited by a comma and/or spaces. This routine ignores spaces and commas that occur within parentheses, brackets, or curly brackets. It also strips any leading and trailing blanks from the returned name.

This routine is similar to the ANSI C 'strtok' function:

The first call to fits_split_names has a non-null input string. It finds the first name in the string and terminates it by overwriting the next character of the string with a '\0' and returns a pointer to the name. Each subsequent call, indicated by a NULL value of the input string, returns the next name, searching from just past the end of the previous name. It returns NULL when no further names are found.

The following line illustrates how a string would be split into 3 names: myfile[1][bin (x,y)=4], file2.fits file3.fits ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^ 1st name 2nd name 3rd name

NOTE: This routine is not thread-safe. This routine is simply provided as a utility routine for other external software. It is not used by any CFITSIO routine.

Parameters
[in]listinput list of names
int fits_store_Fptr ( FITSfile Fptr,
int *  status 
)

store the new Fptr address for future use by fits_already_open

Parameters
[out]FptrFITS file pointer
[in,out]statuserror status

Here is the caller graph for this function:

int fitsio_init_lock ( void  )

Here is the call graph for this function:

Here is the caller graph for this function:

int urltype2driver ( char *  urltype,
int *  driver 
)

compare input URL with list of known drivers, returning the matching driver numberL.

Here is the caller graph for this function:

Variable Documentation

driverTable

allocate driver tables

FptrTable

this table of Fptr pointers is used by fits_already_open

need_to_initialize = 1

true if CFITSIO has not been initialized

no_of_drivers = 0

number of currently defined I/O drivers