1 
2 #ifndef CABRILLOUTILS_H
3 #define CABRILLOUTILS_H
4 
5 #include "qtcvars.h"		// Includes globalvars.h
6 
7 /* describes the cabrillo format to be used */
8 struct cabrillo_desc {
9     char *name;			/* name of the cabrillo format in use */
10     int item_count;		/* number items in QSO: line */
11     GPtrArray *item_array;	/* array of items in QSO: line
12     				 * must be from left to right */
13     int qtc_item_count;		/* number items in QTC: line */
14     GPtrArray *qtc_item_array;	/* array of items in QTC: line
15 				 * must be from left to right */
16 };
17 
18 
19 /* represents different parts of a qso logline */
20 struct qso_t {
21     char *logline;
22     int band;
23     int mode;
24     char day;
25     char month;
26     int year;
27     int hour;
28     int min;
29     int qso_nr;
30     char *call;
31     int rst_s;
32     int rst_r;
33     char *comment;
34     freq_t freq;
35     int tx;
36     int qtc_serial;
37     int qtc_number;
38     char *qtc_qtime;
39     char *qtc_qcall;
40     char *qtc_qserial;
41     int qtcdirection;
42     int qsots;
43 };
44 
45 /* represents different parts of a qtc logline */
46 struct read_qtc_t {
47     int direction;      // represents the direction of QTC: SEND or RECV
48     char logline[120];  // represents the final log, if require
49     char band[4];       // band, eg "160"
50     char mode[4];       // mode, eg "DIG"
51     int qsonr;          // qso number after the QTC maked
52     char date[10];      // date of creation of QTC
53     char time[6];       // time of creation of QTC
54     char call[15];      // callsign
55     char qtchead[10];   // QTC serial and number as string
56     int qtchead_serial; // QTC serial as integer
57     int qtchead_count;  // QTC number as integer
58     char qtc_time[5];   // QTC TIME field
59     char qtc_call[16];  // QTC CALL FIELD
60     int qtc_serial;     // QTC SERIAL field
61     freq_t freq;        // FREQ of QTC
62     int callpos;        // in case of SEND direction, the serial of sent callsign
63     char qtcstr[30];    // QTC fields as concatenated
64 };
65 
66 /* list of different tags for QSO/QTC: line items */
67 enum tag_t { NO_ITEM, FREQ, MODE, DATE, TIME, MYCALL, HISCALL, RST_S, RST_R, 		// 0...8
68 	     EXC_S, EXCH, EXC1, EXC2, EXC3, EXC4, TX, QTCRCALL, QTCHEAD, QTCSCALL, QTC
69 	   };	// 9...19
70 
71 /* type for conversion table between tag name in format file and internal tag */
72 struct tag_conv {
73     char 	*item_name;
74     enum tag_t  tag;
75 };
76 
77 /* describes one item for printing the QSO: line in cabrillo */
78 struct line_item {
79     enum tag_t tag;	/* item type */
80     int len;		/* max. item length */
81 };
82 
83 enum tag_t translate_item_name(char *name);
84 void free_cabfmt(struct cabrillo_desc *desc);
85 struct line_item *parse_line_entry(char *line_entry);
86 struct cabrillo_desc *read_cabrillo_format(char *filename, char *format);
87 
88 #endif
89