1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stddef.h>
#ifndef __ASCII_HEADER_h
#define __ASCII_HEADER_h
/*! ascii_header_set/get - Set/get header variables
\param header pointer to the header buffer
\param keyword the header keyword, such as NPOL
\param code printf/scanf code, such as "%d"
\retval 0 or 1 on success, -1 on failure
\pre The code(s) must match the type(s) of the argument(s).
For example:
char ascii_header[ASCII_HEADER_SIZE] = ASCII_HEADER_INIT;
char* telescope_name = "parkes";
ascii_header_set (ascii_header, "TELESCOPE", telescope_name);
float bandwidth = 64.0;
ascii_header_set (ascii_header, "BW", "%f", bandwidth);
[...]
double centre_frequency;
ascii_header_get (ascii_header, "FREQ", "%lf", ¢re_frequency);
int chan;
float gain;
ascii_header_get (ascii_header, "GAIN", "%d %f", &chan, &gain);
*/
#ifdef __cplusplus
extern "C" {
#endif
/* returns zero if no error occurs, -1 on error */
int ascii_header_set (char* header, const char* keyword,
const char* code, ...);
/* returns number of elements parsed if no error occurs, -1 on error */
int ascii_header_get (const char* header, const char* keyword,
const char* code, ...);
/* delete the key from the header */
int ascii_header_del (char * header, const char * keyword);
/* read the HDR_SIZE from a .dada file */
size_t ascii_header_get_size (char * filename);
size_t ascii_header_get_size_fd (int fd);
#ifdef __cplusplus
}
#endif
#endif