~ubuntu-branches/ubuntu/wily/pyfits/wily-proposed

« back to all changes in this revision

Viewing changes to cextern/cfitsio/grparser.h

  • Committer: Package Import Robot
  • Author(s): Aurelien Jarno
  • Date: 2013-12-07 16:18:48 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131207161848-mcw0saz0iprjhbju
Tags: 1:3.2-1
* New upstream version.
* Bump Standards-Version to 3.9.5 (no changes).
* Remove build-depends on zlib1g-dev and remove patches/01-zlib.diff.
* Add build-depends on libcfitsio3-dev and add 
  patches/01-system-cfitsio.diff.
* Update debian/copyright.
* Install upstream changelog now that it is provided in the upstream
  tarball.
* Don't compress the binary packages with xz, it's no the dpkg's default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*              T E M P L A T E   P A R S E R   H E A D E R   F I L E
 
2
                =====================================================
 
3
 
 
4
                by Jerzy.Borkowski@obs.unige.ch
 
5
 
 
6
                Integral Science Data Center
 
7
                ch. d'Ecogia 16
 
8
                1290 Versoix
 
9
                Switzerland
 
10
 
 
11
14-Oct-98: initial release
 
12
16-Oct-98: reference to fitsio.h removed, also removed strings after #endif
 
13
                directives to make gcc -Wall not to complain
 
14
20-Oct-98: added declarations NGP_XTENSION_SIMPLE and NGP_XTENSION_FIRST
 
15
24-Oct-98: prototype of ngp_read_line() function updated.
 
16
22-Jan-99: prototype for ngp_set_extver() function added.
 
17
20-Jun-2002 Wm Pence, added support for the HIERARCH keyword convention
 
18
            (changed NGP_MAX_NAME from (20) to FLEN_KEYWORD)
 
19
*/
 
20
 
 
21
#ifndef GRPARSER_H_INCLUDED
 
22
#define GRPARSER_H_INCLUDED
 
23
 
 
24
#ifdef __cplusplus
 
25
extern "C" {
 
26
#endif
 
27
 
 
28
        /* error codes  - now defined in fitsio.h */
 
29
 
 
30
        /* common constants definitions */
 
31
 
 
32
#define NGP_ALLOCCHUNK          (1000)
 
33
#define NGP_MAX_INCLUDE         (10)                    /* include file nesting limit */
 
34
#define NGP_MAX_COMMENT         (80)                    /* max size for comment */
 
35
#define NGP_MAX_NAME            FLEN_KEYWORD            /* max size for KEYWORD (FITS limits it to 8 chars) */
 
36
                                                        /* except HIERARCH can have longer effective keyword names */
 
37
#define NGP_MAX_STRING          (80)                    /* max size for various strings */
 
38
#define NGP_MAX_ARRAY_DIM       (999)                   /* max. number of dimensions in array */
 
39
#define NGP_MAX_FNAME           (1000)                  /* max size of combined path+fname */
 
40
#define NGP_MAX_ENVFILES        (10000)                 /* max size of CFITSIO_INCLUDE_FILES env. variable */
 
41
 
 
42
#define NGP_TOKEN_UNKNOWN       (-1)                    /* token type unknown */
 
43
#define NGP_TOKEN_INCLUDE       (0)                     /* \INCLUDE token */
 
44
#define NGP_TOKEN_GROUP         (1)                     /* \GROUP token */
 
45
#define NGP_TOKEN_END           (2)                     /* \END token */
 
46
#define NGP_TOKEN_XTENSION      (3)                     /* XTENSION token */
 
47
#define NGP_TOKEN_SIMPLE        (4)                     /* SIMPLE token */
 
48
#define NGP_TOKEN_EOF           (5)                     /* End Of File pseudo token */
 
49
 
 
50
#define NGP_TTYPE_UNKNOWN       (0)                     /* undef (yet) token type - invalid to print/write to disk */
 
51
#define NGP_TTYPE_BOOL          (1)                     /* boolean, it is 'T' or 'F' */
 
52
#define NGP_TTYPE_STRING        (2)                     /* something withing "" or starting with letter */
 
53
#define NGP_TTYPE_INT           (3)                     /* starting with digit and not with '.' */
 
54
#define NGP_TTYPE_REAL          (4)                     /* digits + '.' */
 
55
#define NGP_TTYPE_COMPLEX       (5)                     /* 2 reals, separated with ',' */
 
56
#define NGP_TTYPE_NULL          (6)                     /* NULL token, format is : NAME = / comment */
 
57
#define NGP_TTYPE_RAW           (7)                     /* HISTORY/COMMENT/8SPACES + comment string without / */
 
58
 
 
59
#define NGP_FOUND_EQUAL_SIGN    (1)                     /* line contains '=' after keyword name */
 
60
 
 
61
#define NGP_FORMAT_OK           (0)                     /* line format OK */
 
62
#define NGP_FORMAT_ERROR        (1)                     /* line format error */
 
63
 
 
64
#define NGP_NODE_INVALID        (0)                     /* default node type - invalid (to catch errors) */
 
65
#define NGP_NODE_IMAGE          (1)                     /* IMAGE type */
 
66
#define NGP_NODE_ATABLE         (2)                     /* ASCII table type */
 
67
#define NGP_NODE_BTABLE         (3)                     /* BINARY table type */
 
68
 
 
69
#define NGP_NON_SYSTEM_ONLY     (0)                     /* save all keywords except NAXIS,BITPIX,etc.. */
 
70
#define NGP_REALLY_ALL          (1)                     /* save really all keywords */
 
71
 
 
72
#define NGP_XTENSION_SIMPLE     (1)                     /* HDU defined with SIMPLE T */
 
73
#define NGP_XTENSION_FIRST      (2)                     /* this is first extension in template */
 
74
 
 
75
#define NGP_LINE_REREAD         (1)                     /* reread line */
 
76
 
 
77
#define NGP_BITPIX_INVALID      (-12345)                /* default BITPIX (to catch errors) */
 
78
 
 
79
        /* common macro definitions */
 
80
 
 
81
#ifdef  NGP_PARSER_DEBUG_MALLOC
 
82
 
 
83
#define ngp_alloc(x)            dal_malloc(x)
 
84
#define ngp_free(x)             dal_free(x)
 
85
#define ngp_realloc(x,y)        dal_realloc(x,y)
 
86
 
 
87
#else
 
88
 
 
89
#define ngp_alloc(x)            malloc(x)
 
90
#define ngp_free(x)             free(x)
 
91
#define ngp_realloc(x,y)        realloc(x,y)
 
92
 
 
93
#endif
 
94
 
 
95
        /* type definitions */
 
96
 
 
97
typedef struct NGP_RAW_LINE_STRUCT
 
98
      { char    *line;
 
99
        char    *name;
 
100
        char    *value;
 
101
        int     type;
 
102
        char    *comment;
 
103
        int     format;
 
104
        int     flags;
 
105
      } NGP_RAW_LINE;
 
106
 
 
107
 
 
108
typedef union NGP_TOKVAL_UNION
 
109
      { char    *s;             /* space allocated separately, be careful !!! */
 
110
        char    b;
 
111
        int     i;
 
112
        double  d;
 
113
        struct NGP_COMPLEX_STRUCT
 
114
         { double re;
 
115
           double im;
 
116
         } c;                   /* complex value */
 
117
      } NGP_TOKVAL;
 
118
 
 
119
 
 
120
typedef struct NGP_TOKEN_STRUCT
 
121
      { int             type;
 
122
        char            name[NGP_MAX_NAME];
 
123
        NGP_TOKVAL      value;
 
124
        char            comment[NGP_MAX_COMMENT];
 
125
      } NGP_TOKEN;
 
126
 
 
127
 
 
128
typedef struct NGP_HDU_STRUCT
 
129
      { int             tokcnt;
 
130
        NGP_TOKEN       *tok;
 
131
      } NGP_HDU;
 
132
 
 
133
 
 
134
typedef struct NGP_TKDEF_STRUCT
 
135
      { char    *name;
 
136
        int     code;
 
137
      } NGP_TKDEF;
 
138
 
 
139
 
 
140
typedef struct NGP_EXTVER_TAB_STRUCT
 
141
      { char    *extname;
 
142
        int     version;
 
143
      } NGP_EXTVER_TAB;
 
144
 
 
145
 
 
146
        /* globally visible variables declarations */
 
147
 
 
148
extern  NGP_RAW_LINE    ngp_curline;
 
149
extern  NGP_RAW_LINE    ngp_prevline;
 
150
 
 
151
extern  int             ngp_extver_tab_size;
 
152
extern  NGP_EXTVER_TAB  *ngp_extver_tab;
 
153
 
 
154
 
 
155
        /* globally visible functions declarations */
 
156
 
 
157
int     ngp_get_extver(char *extname, int *version);
 
158
int     ngp_set_extver(char *extname, int version);
 
159
int     ngp_delete_extver_tab(void);
 
160
int     ngp_strcasecmp(char *p1, char *p2);
 
161
int     ngp_strcasencmp(char *p1, char *p2, int n);
 
162
int     ngp_line_from_file(FILE *fp, char **p);
 
163
int     ngp_free_line(void);
 
164
int     ngp_free_prevline(void);
 
165
int     ngp_read_line_buffered(FILE *fp);
 
166
int     ngp_unread_line(void);
 
167
int     ngp_extract_tokens(NGP_RAW_LINE *cl);
 
168
int     ngp_include_file(char *fname);
 
169
int     ngp_read_line(int ignore_blank_lines);
 
170
int     ngp_keyword_is_write(NGP_TOKEN *ngp_tok);
 
171
int     ngp_keyword_all_write(NGP_HDU *ngph, fitsfile *ffp, int mode);
 
172
int     ngp_hdu_init(NGP_HDU *ngph);
 
173
int     ngp_hdu_clear(NGP_HDU *ngph);
 
174
int     ngp_hdu_insert_token(NGP_HDU *ngph, NGP_TOKEN *newtok);
 
175
int     ngp_append_columns(fitsfile *ff, NGP_HDU *ngph, int aftercol);
 
176
int     ngp_read_xtension(fitsfile *ff, int parent_hn, int simple_mode);
 
177
int     ngp_read_group(fitsfile *ff, char *grpname, int parent_hn);
 
178
 
 
179
                /* top level API function - now defined in fitsio.h */
 
180
 
 
181
#ifdef __cplusplus
 
182
}
 
183
#endif
 
184
 
 
185
#endif