00001
00002 /*---------------------------------------------------------------------------
00003 E.S.O.
00004 ----------------------------------------------------------------------------
00005 File name : tfits.h
00006 Author : Yves Jung
00007 Created on : July 1999
00008 Language : ANSI C
00009 Description : FITS table handling
00010 *--------------------------------------------------------------------------*/
00011
00012 /*
00013
00014 $Id: tfits.h,v 1.1 2003/09/03 12:50:47 amodigli Exp $
00015 $Author: amodigli $
00016 $Date: 2003/09/03 12:50:47 $
00017 $Revision: 1.1 $
00018
00019 */
00020
00021 #ifndef _TFITS_H_
00022 #define _TFITS_H_
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00028
00029 /*---------------------------------------------------------------------------
00030 Includes
00031 ---------------------------------------------------------------------------*/
00032
00033 #include <stdio.h>
00034 #include <string.h>
00035 #include <stdlib.h>
00036 #include <unistd.h>
00037
00038 #include "static_sz.h"
00039
00040
00041 /*---------------------------------------------------------------------------
00042 Defines
00043 ---------------------------------------------------------------------------*/
00044
00045 /* The following defines the maximum acceptable size for a FITS value */
00046 #define FITSVALSZ 60
00047
00048 #define TFITS_BINTABLE 1
00049 #define TFITS_ASCIITABLE 2
00050
00051
00052 /*---------------------------------------------------------------------------
00053 New types
00054 ---------------------------------------------------------------------------*/
00055
00056 typedef struct _TFITS_COL_
00057 {
00058 int nelem ;
00059 size_t atom_size ; /* Number of characters for ASCII tables and
00060 for 'A' type in case of Binary tables and
00061 sizeof(type) in the other cases. */
00062 int natoms ; /* Always 1 for ASCII tables and for 'A'
00063 type in case of Binary tables */
00064 char ttype ; /* L X B I J A E D (C) (M) (P) */
00065 char tlabel[FITSVALSZ] ; /* Column label */
00066 char tunit[FITSVALSZ] ; /* Data unit */
00067 int nullval ;
00068 char fmt[FITSVALSZ] ;/* Display format */
00069 size_t off_beg ; /* Offset between the beg. of the table and
00070 the beginning of the column */
00071 size_t off_jmp ; /* Width of the table in bytes */
00072
00073 /* Private information - only for internal use */
00074 size_t ascii_size ; /* For ASCII tables */
00075 } tfits_col ;
00076
00077 typedef struct _TFITS_HANDLE_
00078 {
00079 char filename[FILENAMESZ] ;
00080 int tab_t ; /* Table type */
00081 int nc ; /* Number of columns */
00082 tfits_col * col ; /* Array of TFITS_COL objects */
00083 } tfits_handle ;
00084
00085
00086 /*---------------------------------------------------------------------------
00087 Function prototypes
00088 ---------------------------------------------------------------------------*/
00089
00090 /*-------------------------------------------------------------------------*/
00102 /*--------------------------------------------------------------------------*/
00103
00104 int
00105 is_fits_table(char * filename, int xtnum) ;
00106
00107
00108 /*-------------------------------------------------------------------------*/
00142 /*--------------------------------------------------------------------------*/
00143
00144 tfits_handle * tfits_open(char * filename, int xtnum) ;
00145
00146
00147 /*-------------------------------------------------------------------------*/
00157 /*--------------------------------------------------------------------------*/
00158
00159 void tfits_close(tfits_handle * t);
00160
00161
00162 /*-------------------------------------------------------------------------*/
00182 /*--------------------------------------------------------------------------*/
00183
00184
00185 void *
00186 tfits_col_query_data(
00187 tfits_handle * th,
00188 int colnum
00189 );
00190
00191
00192 /*-------------------------------------------------------------------------*/
00208 /*--------------------------------------------------------------------------*/
00209
00210
00211 void *
00212 tfits_query_one_data(
00213 tfits_handle * th,
00214 int colnum,
00215 int linenum
00216 );
00217
00218
00219 /*-------------------------------------------------------------------------*/
00238 /*--------------------------------------------------------------------------*/
00239
00240
00241 int
00242 tfits_append_xtension(
00243 FILE * outfile,
00244 tfits_handle * t,
00245 void ** data) ;
00246
00247
00248 /*-------------------------------------------------------------------------*/
00278 /*--------------------------------------------------------------------------*/
00279
00280 int
00281 tfits_save2fitsfile_hdrcpy(
00282 tfits_handle * t,
00283 char * filename,
00284 int nplacehold,
00285 void ** data,
00286 char * hdr_file) ;
00287
00288
00289 /*-------------------------------------------------------------------------*/
00306 /*--------------------------------------------------------------------------*/
00307
00308 int
00309 tfits_save2fitsfile(
00310 tfits_handle * t,
00311 char * filename,
00312 int nplacehold,
00313 void ** data);
00314
00315
00316 #ifdef __cplusplus
00317 }
00318 #endif
00319
00320
00321 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001