cfitsio
3390
|
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <errno.h>
#include <stddef.h>
#include "fitsio2.h"
#include "group.h"
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] |
FITSfile * | FptrTable [NMAXFILES] |
int | need_to_initialize = 1 |
int | no_of_drivers = 0 |
Low level file access routines.
#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://')
int comma2semicolon | ( | char * | string | ) |
replace commas with semicolons, unless the comma is within a quoted or bracketed expression
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
[in] | fptr | FITS file pointer |
[in,out] | status | error status |
int ffdelt | ( | fitsfile * | fptr, |
int * | status | ||
) |
close and DELETE the FITS file.
[in] | fptr | FITS file pointer |
[in,out] | status | error 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.
[out] | fptr | FITS file pointer |
[in] | name | name of file to create |
[in,out] | status | error 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.
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in,out] | status | error 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).
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in] | status | error status |
int ffedit_columns | ( | fitsfile ** | fptr, |
char * | outfile, | ||
char * | expr, | ||
int * | status | ||
) |
modify columns in a table and/or header keywords in the HDU
[in,out] | fptr | pointer to input table; on output it points to the new selected rows table |
[in] | outfile | name for output file |
[in] | expr | column edit expression |
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.
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in] | extlist | list of 'good' extensions to move to |
[out] | hdutype | type of extension that is moved to |
[in,out] | status | error status |
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.
[in] | infile | input filename or URL |
[out] | exists | 2 = 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] | status | O status |
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:
[in] | url | input filename/URL |
[out] | extension_num | returned extension number |
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.
int ffflushx | ( | FITSfile * | fptr | ) |
low level routine to flush internal file buffers to the file.
[in] | fptr | FITS file pointer |
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.
[in] | url | input filename |
[in] | urltype | e.g., 'file://', 'http://', 'mem://' |
[in] | infilex | root filename (may be complete path) |
[in] | outfile | optional output file name |
[in] | extspec | extension spec: +n or [extname, extver] |
[in] | rowfilterx | boolean row filter expression |
[in] | binspec | histogram binning specifier |
[in] | colspec | column or keyword modifier expression |
[in] | pixfilter | pixel filter expression |
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!
[in] | url | input filename |
[in] | urltype | e.g., 'file://', 'http://', 'mem://' |
[in] | infilex | root filename (may be complete path) |
[in] | outfile | optional output file name |
[in] | extspec | extension spec: +n or [extname, extver] |
[in] | rowfilterx | boolean row filter expression |
[in] | binspec | histogram binning specifier |
[in] | colspec | column or keyword modifier expression |
[in] | pixfilter | pixel filter expression |
[in] | compspec | image compression specification |
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
[out] | fptr | FITS file pointer |
[in] | buffptr | address of memory pointer |
[in] | buffsize | size of buffer, in bytes |
[in] | deltasize | increment for future realloc's |
[in] | mem_realloc | function |
[in,out] | status | error status |
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.
[in] | filename | Text file to read |
[in] | contents | Pointer to pointer to hold file |
[in] | status | CFITSIO error code |
Create and initialize a new FITS file.
[out] | fptr | FITS file pointer |
[in] | name | name of file to create |
[in,out] | status | error 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).
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in,out] | status | error status |
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.
[in] | url | input filename |
[in] | urltype | e.g., 'file://', 'http://', 'mem://' |
[in] | infilex | root filename (may be complete path) |
[in] | outfile | optional output file name |
[in] | extspec | extension spec: +n or [extname, extver] |
[in] | rowfilterx | boolean row filter expression |
[in] | binspec | histogram binning specifier |
[in] | colspec | column or keyword modifier expression |
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.
[out] | fptr | FITS file pointer |
[in] | name | name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in] | buffptr | address of memory pointer |
[in] | buffsize | size of buffer, in bytes |
[in] | deltasize | increment for future realloc's |
[in] | mem_realloc | function |
[in,out] | status | error status |
Open an existing FITS file with either readonly or read/write access.
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in,out] | status | error 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.
[in] | soname | CFITSIO shared library version application program (fitsio.h file) |
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | /* I - 0 = open readonly; 1 = read/write |
[in,out] | status | error status |
open template file and use it to create new file
[out] | fptr | FITS file pointer |
[in] | tempname | name of template file |
[in,out] | status | error status |
int ffourl | ( | char * | url, |
char * | urltype, | ||
char * | outfile, | ||
char * | tpltfile, | ||
char * | compspec, | ||
int * | status | ||
) |
parse the output URL into its basic components.
[in] | url | full input URL |
[out] | urltype | url type |
[out] | outfile | base file name |
[out] | tpltfile | template file name, if any |
[out] | compspec | compression specification, if any |
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.
[in] | fptr | FITS file pointer |
[in] | compspec | image compression specification |
[in,out] | status | error status |
int ffread | ( | FITSfile * | fptr, |
long | nbytes, | ||
void * | buffer, | ||
int * | status | ||
) |
low level routine to read bytes from a file.
[in] | fptr | FITS file pointer |
[in] | nbytes | number of bytes to read |
[out] | buffer | buffer to read into |
[out] | status | error 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.
[in] | openfptr | FITS file pointer to open file |
[out] | newfptr | pointer to new re opened file |
[in,out] | status | error status |
void ffrprt | ( | FILE * | stream, |
int | status | ||
) |
Print out report of cfitsio error status and messages on the error stack. Uses C FILE stream.
int ffrtnm | ( | char * | url, |
char * | rootname, | ||
int * | status | ||
) |
parse the input URL, returning the root name (filetype://basename).
low level routine to seek to a position in a file.
[in] | fptr | FITS file pointer |
[in] | position | byte position to seek to |
int ffselect_table | ( | fitsfile ** | fptr, |
char * | outfile, | ||
char * | expr, | ||
int * | status | ||
) |
[in,out] | fptr | pointer to input table; on output it points to the new selected rows table |
[in] | outfile | name for output file |
[in] | expr | Boolean expression |
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).
[out] | fptr | FITS file pointer |
[in] | name | full name of file to open |
[in] | mode | 0 = open readonly; 1 = read/write |
[in,out] | status | error status |
Create and initialize a new FITS file based on a template file. Uses C fopen and fgets functions.
[out] | fptr | FITS file pointer |
[in] | filename | name of file to create |
[in] | tempname | name of template file |
[in,out] | status | error status |
low level routine to truncate a file to a new smaller size.
[in] | fptr | FITS file pointer |
[in] | filesize | size to truncate the file |
[out] | status | error status |
int ffurlt | ( | fitsfile * | fptr, |
char * | urlType, | ||
int * | status | ||
) |
return the prefix string associated with the driver in use by the fitsfile pointer fptr
int ffwrite | ( | FITSfile * | fptr, |
long | nbytes, | ||
void * | buffer, | ||
int * | status | ||
) |
low level routine to write bytes to a file.
[in] | fptr | FITS file pointer |
[in] | nbytes | number of bytes to write |
[in] | buffer | buffer to write |
[out] | status | error 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 | ||
) |
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.
[in,out] | fptr | FITS file pointer |
[in] | mode | 0 = open readonly; 1 = read/write |
[out] | isopen | 1 = file is already open |
[in,out] | status | error status |
int fits_clear_Fptr | ( | FITSfile * | Fptr, |
int * | status | ||
) |
clear the Fptr address from the Fptr Table
[out] | Fptr | FITS file pointer |
[in,out] | status | error status |
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.
[in] | fptr | point to input table |
[out] | newptr | existing output file; new image HDU will be appended to it |
[in] | colname | column name / number containing the image |
[in] | rownum | number of the row containing the image |
[in,out] | status | error status |
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
[in] | fptr | pointer to input image extension |
[in] | newptr | pointer to output table |
[in] | colname | name of column containing the image |
[in] | rownum | number of the row containing the image |
[in] | copykeyflag | controls which keywords to copy |
[in,out] | status | error status |
copies an image section from the input file to a new output HDU
[in] | fptr | pointer to input image |
[in] | newptr | pointer to output image |
[in] | expr | Image section expression |
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"
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;
[out] | isanumber | is this token a number? |
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
[out] | isanumber | is this token a number? |
int fits_init_cfitsio | ( | void | ) |
initialize anything that is required before using the CFITSIO routines
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.
[in] | urltype | type of file |
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
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.
[in,out] | fptr | pointer to input image; on output it points to the new subimage |
[in] | outfile | name for output file |
[in] | expr | Image section expression |
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.
[in] | list | input list of names |
int fits_store_Fptr | ( | FITSfile * | Fptr, |
int * | status | ||
) |
store the new Fptr address for future use by fits_already_open
[out] | Fptr | FITS file pointer |
[in,out] | status | error status |
int fitsio_init_lock | ( | void | ) |
int urltype2driver | ( | char * | urltype, |
int * | driver | ||
) |
compare input URL with list of known drivers, returning the matching driver numberL.
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