Debian Codegraph @

cextern/cfitsio/utilities/fverify.h

raw
1 #ifndef _FVERIFY_H
2 #define _FVERIFY_H
3
4 #include <stdio.h>
5 #include <ctype.h>
6 #include <string.h>
7 #include <stdlib.h>
8 #include <math.h>
9 #include <limits.h>
10 #include "fitsio.h"
11 #define MAXERRORS 200
12 #define MAXWRNS 200
13
14 static char errmes[256];
15 static char comm[FLEN_FILENAME+6];
16 extern int prhead;
17 extern int testdata;
18 extern int testfill;
19 extern int testcsum;
20 extern int totalhdu; /* total number of hdu */
21 extern int err_report;
22 extern int heasarc_conv;
23 extern int testhierarch;
24 extern int prstat;
25 /********************************
26 * *
27 * Keywords *
28 * *
29 ********************************/
30
31 typedef enum { STR_KEY, /* string key */
32 LOG_KEY, /* Logical key */
33 INT_KEY, /* Integer key */
34 FLT_KEY, /* Float key */
35 CMI_KEY, /* Complex integer key */
36 CMF_KEY, /* Complex float key */
37 COM_KEY, /* history, comment, " ", and end */
38 UNKNOWN /* Unknown types */
39 } kwdtyp;
40 /* error number masks of the keyword test */
41 #define BAD_STR 0X0001
42 #define NO_TRAIL_QUOTE 0X0002
43 #define BAD_NUM 0X0004
44 #define LOWCASE_EXPO 0X0008
45 #define NO_TRAIL_PAREN 0X0010
46 #define NO_COMMA 0X0020
47 #define TOO_MANY_COMMA 0X0040
48 #define BAD_REAL 0X0080
49 #define BAD_IMG 0X0100
50 #define BAD_LOGICAL 0x0200
51 #define NO_START_SLASH 0X0400
52 #define BAD_COMMENT 0x0800
53 #define UNKNOWN_TYPE 0x1000
54
55 /* Number of possible WCS descriptions to check.*/
56 /* 1 for the primary + 26 for [A-Z] suffix. */
57 #define NWCSDESCR 27
58
59 /* keyword structure */
60 typedef struct {
61 char kname[FLEN_KEYWORD]; /* fits keyword name */
62 kwdtyp ktype; /* fits keyword type */
63 char kvalue[FLEN_VALUE]; /* fits keyword name */
64 int kindex; /* position at the header */
65 int goodkey; /* good keyword flag (=1 good)*/
66 }FitsKey;
67 int fits_parse_card(FILE *out, int pos, char *card, char *kname, kwdtyp *ktype,
68 char *kvalue, char *kcomm);
69 void get_str(char **p, char *kvalue, unsigned long *stat);
70 void get_log(char **p, char *kvalue, unsigned long *stat);
71 void get_num(char **p, char *kvalue, kwdtyp *ktype, unsigned long *stat);
72 void get_cmp(char **p, char *kvalue, kwdtyp *ktype, unsigned long *stat);
73 int check_str(FitsKey* pkey, FILE *out);
74 int check_int(FitsKey* pkey, FILE *out);
75 int check_flt(FitsKey* pkey, FILE *out);
76 int check_cmi(FitsKey* pkey, FILE *out);
77 int check_cmf(FitsKey* pkey, FILE *out);
78 int check_log(FitsKey* pkey, FILE *out);
79 int check_fixed_int(char *card, FILE *out);
80 int check_fixed_log(char *card, FILE *out);
81 int check_fixed_str(char *card, FILE *out);
82
83 void get_unknown(char **p, char *kvalue, kwdtyp *ktype, unsigned long *stat);
84 void get_comm(char **p, char *kcomm, unsigned long *stat);
85 void pr_kval_err(FILE *out, int pos, char *keyname, char *keyval,
86 unsigned long stat);
87
88 /********************************
89 * *
90 * Headers *
91 * *
92 ********************************/
93 typedef struct {
94 int hdutype; /* hdutype */
95 int hdunum; /* hdunum */
96 int isgroup; /* random group flag */
97 int istilecompressed; /* tile compressed image */
98 int gcount; /* gcount */
99 LONGLONG pcount; /* pcount */
100 int bitpix; /* pix number */
101 int naxis; /* number of the axis,used for image array*/
102 LONGLONG *naxes; /* dimension of each axis,used for image array*/
103 int ncols; /* number of the columns, used for image only*/
104 char extname[FLEN_VALUE]; /* EXTENSION NAME */
105 int extver; /* extension version */
106 char **datamax; /* strings for the maximum of the data in a column */
107 char **datamin; /* strings for the minimum of the data in a column */
108 char **tnull; /* number of NULL values */
109 int nkeys; /* number of keys */
110 int tkeys; /* total of the keys tested*/
111 int heap; /* heap */
112 FitsKey **kwds; /* keywords list starting from the
113 last NAXISn keyword. The array
114 is sorted in the ascending alphabetical
115 order of keyword names. The last keyword END
116 and commentary keywords are excluded.
117 The total number of element, tkey, is
118 nkeys - 4 - naxis - ncomm. */
119 int use_longstr; /* flag indicates that the long string
120 convention is used */
121 }FitsHdu;
122
123 typedef struct {
124 char * name;
125 int index;
126 }ColName;
127
128 int verify_fits(char *infile, FILE *out);
129 void leave_early (FILE* out);
130 void close_err(FILE* out);
131 void init_hdu(fitsfile *infits, FILE *out, int hdunum, int hdutype,
132 FitsHdu *hduptr);
133 void test_hdu(fitsfile *infits, FILE *out, FitsHdu *hduptr);
134 void test_ext(fitsfile *infits, FILE *out, FitsHdu *hduptr);
135 void test_tbl(fitsfile *infits, FILE *out, FitsHdu *hduptr);
136 void test_array(fitsfile *infits, FILE *out, FitsHdu *hduptr);
137 void test_prm(fitsfile *infits, FILE *out, FitsHdu *hduptr);
138 void test_img_ext(fitsfile *infits, FILE *out, FitsHdu *hduptr);
139 void test_asc_ext(fitsfile *infits, FILE *out, FitsHdu *hduptr);
140 void test_bin_ext(fitsfile *infits, FILE *out, FitsHdu *hduptr);
141 void test_header(fitsfile *infits, FILE *out, FitsHdu *hduptr);
142 void key_match(char **strs, int nstr, char **pattern, int exact,
143 int *ikey, int *mkey);
144 void test_colnam(FILE *out, FitsHdu *hduptr);
145 void parse_vtform(fitsfile *infits, FILE *out, FitsHdu *hduptr,
146 int colnum, int *datacode, long *maxlen, int *isQFormat);
147 int parse_wcskey_suffix(char *fullname, char* rootname, int* axis, int* alt);
148 void print_title(FILE* out, int hdunum, int hdutype);
149 void print_header(FILE* out);
150 void print_summary(fitsfile *infits, FILE *out, FitsHdu *hduptr);
151 void close_hdu(FitsHdu *hduptr);
152
153
154 /********************************
155 * *
156 * Data *
157 * *
158 ********************************/
159
160 void test_data(fitsfile *infits, FILE *out, FitsHdu *hduptr);
161 void test_agap(fitsfile *infits, FILE *out, FitsHdu *hduptr);
162 void test_checksum(fitsfile *infits, FILE *out);
163 int iterdata(long totaln, long offset, long firstn, long nrows,
164 int narrays, iteratorCol *iter_col, void *usrdata);
165 /********************************
166 * *
167 * Files *
168 * *
169 ********************************/
170 typedef struct {
171 int hdutype; /* hdutype */
172 int hdunum; /* hdunum */
173 char extname[FLEN_VALUE]; /* extension name, used for extension*/
174 int extver; /* extension version, used for extension */
175 int errnum; /* number of errors in this hdu */
176 int wrnno; /* number of warnning in this hdu */
177 }HduName;
178 int get_total_warn();
179 int get_total_err();
180 void init_hduname();
181 void set_hduname(int hdunum,int hdutype, char* extname,int extver);
182 void set_hduerr(int hdunum);
183 void set_hdubasic(int hdunum,int hdutype);
184 int test_hduname(int hdunum1, int hdunum2);
185 void total_errors (int *totalerr, int * totalwrn);
186 void hdus_summary(FILE *out);
187 void destroy_hduname();
188 void test_end(fitsfile *infits, FILE *out);
189 void init_report(FILE *out, char *rootnam);
190 void close_report(FILE *out);
191 void update_parfile(int numerr, int numwrn);
192
193
194 /********************************
195 * *
196 * Miscellaneous *
197 * *
198 ********************************/
199 void print_fmt(FILE *out, char *temp, int nprompt);
200 int wrtout (FILE *out,char *comm);
201 int wrterr (FILE *out,char *comm, int severity);
202 int wrtwrn (FILE *out,char *comm, int heasarc);
203 int wrtferr(FILE *out, char* mess, int *status, int severity);
204 int wrtserr(FILE *out, char* mess, int *status, int severity);
205 void wrtsep (FILE *out,char fill, char *title, int nchar);
206 void num_err_wrn(int *num_err, int *num_wrn);
207 void reset_err_wrn();
208 int compkey (const void *key1, const void *key2);
209 int compcol (const void *col1, const void *col2);
210 int compcol (const void *col1, const void *col2);
211 int compstrp (const void *str1, const void *str2);
212 int compstre (const void *str1, const void *str2);
213
214 #endif