00001
00002
00003 #ifndef __CFITSIO__
00004 #define __CFITSIO__
00005
00006
00007
00008
00009 #include <limits.h>
00010
00011 #ifdef __FOR_LOW_LEVEL_TEST_PROGRAMS__
00012 #include <fitsio.h>
00013 #else
00014
00015
00016
00017 #endif
00018
00019
00020
00021 #define CFITSIO_MAX_DIM 9
00022 #define CFITSIO_MAX_BLANK 32
00023 #define CFITSIO_MAX_STR 128
00024
00025
00026
00027 #define CFITSIO_MAX_FORMAT 32
00028
00029 #define CFITSIO_SUCCESS 0
00030 #define CFITSIO_FAIL -1
00031
00032 #define CFITSIO_ERROR_FILE_DOESNT_EXIST -2
00033 #define CFITSIO_ERROR_OUT_OF_MEMORY -3
00034 #define CFITSIO_ERROR_LIBRARY -4
00035 #define CFITSIO_ERROR_FILE_IO -5
00036 #define CFITSIO_ERROR_ARGS -6
00037 #define CFITSIO_ERROR_DATA_EMPTY -7
00038 #define CFITSIO_ERROR_ALREADY_COMPRESSED -8
00039 #define CFITSIO_ERROR_INVALIDFILE -9
00040 #define CFITSIO_ERROR_CANT_GET_FILEINFO -10
00041 #define CFITSIO_ERROR_CANT_COMPRESS -11
00042
00043
00044
00045
00046 #define kFITSRW_Type_String 'C'
00047 #define kFITSRW_Type_Logical 'L'
00048 #define kFITSRW_Type_Integer 'I'
00049 #define kFITSRW_Type_Float 'F'
00050
00051 typedef void *FITSRW_fhandle;
00052
00053 #ifdef __FOR_LOW_LEVEL_TEST_PROGRAMS__
00054
00055 const unsigned int kInfoPresent_SIMPLE;
00056 const unsigned int kInfoPresent_EXTEND;
00057 const unsigned int kInfoPresent_BLANK;
00058 const unsigned int kInfoPresent_BSCALE;
00059 const unsigned int kInfoPresent_BZERO;
00060 #else
00061 extern const unsigned int kInfoPresent_SIMPLE;
00062 extern const unsigned int kInfoPresent_EXTEND;
00063 extern const unsigned int kInfoPresent_BLANK;
00064 extern const unsigned int kInfoPresent_BSCALE;
00065 extern const unsigned int kInfoPresent_BZERO;
00066 extern const unsigned int kInfoPresent_Dirt;
00067 #endif
00068
00069
00070
00071 typedef union cfitsio_value
00072 {
00073 char *vs;
00074 int vl;
00075 long long vi;
00076 double vf;
00077
00078 } CFITSIO_KEY_VALUE;
00079
00080 typedef struct cfitsio_keyword
00081 {
00082 char key_name[CFITSIO_MAX_STR];
00083 char key_type;
00084 CFITSIO_KEY_VALUE key_value;
00085 char key_format[CFITSIO_MAX_FORMAT];
00086
00087 char key_comment[CFITSIO_MAX_STR];
00088 struct cfitsio_keyword* next;
00089
00090 } CFITSIO_KEYWORD;
00091
00092
00093 typedef struct cfitsio_image_info
00094 {
00095
00096 int bitpix;
00097 int naxis;
00098 long naxes[CFITSIO_MAX_DIM];
00099
00100
00101 unsigned int bitfield;
00102 int simple;
00103 int extend;
00104 long long blank;
00105 double bscale;
00106 double bzero;
00107
00108
00109
00110 char fhash[PATH_MAX];
00111 } CFITSIO_IMAGE_INFO;
00112
00113
00114
00115
00116
00117 int fitsrw_read_keylist_and_image_info(FITSRW_fhandle fhandle,
00118 CFITSIO_KEYWORD** keylistout,
00119 CFITSIO_IMAGE_INFO** image_info);
00120
00121 int fitsrw_readintfile(int verbose,
00122 char* fits_filename,
00123 CFITSIO_IMAGE_INFO** image_info,
00124 void** image,
00125 CFITSIO_KEYWORD** keylist);
00126
00127 int fitsrw_writeintfile(int verbose,
00128 const char* fits_filename,
00129 CFITSIO_IMAGE_INFO* info,
00130 void* image,
00131 const char* compspecs,
00132 CFITSIO_KEYWORD* keylist);
00133
00134 void cfitsio_free_these(CFITSIO_IMAGE_INFO** image_info,
00135 void** image,
00136 CFITSIO_KEYWORD** keylist);
00137
00138 int cfitsio_create_key(const char *name, const char type, const char *comment, const void *value, const char *format, CFITSIO_KEYWORD **keyOut);
00139
00140 int cfitsio_append_key(CFITSIO_KEYWORD** keylist,
00141 char *name,
00142 char type,
00143 char *comment,
00144 void *value,
00145 const char *format);
00146
00147 int fitsrw_read(int verbose,
00148 const char *filename,
00149 CFITSIO_IMAGE_INFO** image_info,
00150 void** image,
00151 CFITSIO_KEYWORD** keylist);
00152
00153 int fitsrw_write(int verbose,
00154 const char* filein,
00155 CFITSIO_IMAGE_INFO* info,
00156 void* image,
00157 const char* cparms,
00158 CFITSIO_KEYWORD* keylist);
00159
00160
00161 #ifndef __export_callback_func_t__
00162 #define __export_callback_func_t__
00163 typedef int (*export_callback_func_t)(char *, ...);
00164 #endif
00165 int fitsrw_write2(int verbose,
00166 const char* filein,
00167 CFITSIO_IMAGE_INFO* info,
00168 void* image,
00169 const char* cparms,
00170 CFITSIO_KEYWORD* keylist,
00171 export_callback_func_t callback);
00172
00173
00174 int cfitsio_free_keys(CFITSIO_KEYWORD** keylist);
00175
00176 int cfitsio_free_image_info(CFITSIO_IMAGE_INFO** image_info);
00177
00178 int cfitsio_dump_image(void* image, CFITSIO_IMAGE_INFO* info,
00179 long from_row, long to_row, long from_col, long to_col);
00180
00181 int cfitsio_key_to_card(CFITSIO_KEYWORD* key, char* card);
00182
00183
00184
00185 #endif
00186