FreeCalypso > hg > fc-rfcal-tools
annotate autocal/txcalconf.c @ 90:713749548df6
fc-rfcal-tri900 script and fc-rfcal-tee helper implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 17 Jul 2017 05:51:31 +0000 |
parents | a2d4cab0a592 |
children | 4c3f4231a021 |
rev | line source |
---|---|
76
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * The code that reads and parses Tx calibration profiles lives here. |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/param.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <ctype.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <strings.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <rvinterf/exitcodes.h> |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include "txband.h" |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 char txlevels_directory[] = "/opt/freecalypso/rfcal/txlevels"; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 extern struct txcal_band *txcal_band; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 extern char *txlevels_profile; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 extern struct tx_basis_point tx_basis[MAX_BASIS_POINTS]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 extern unsigned num_basis_points; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 extern struct tx_level tx_levels[MAX_TX_LEVELS]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 static basis_set, targets_set; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 do_basis_line(cp, filename_for_errs, lineno) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 char *cp, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 unsigned n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 for (n = 0; ; n++) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 while (isspace(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 break; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 if (!isdigit(*cp)) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 "%s line %d: non-numeric content not allowed\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 if (n >= MAX_BASIS_POINTS) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 "%s line %d: MAX_BASIS_POINTS exceeded\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 tx_basis[n].apc = atoi(cp); |
78
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
50 if (n && tx_basis[n].apc <= tx_basis[n-1].apc) { |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
51 fprintf(stderr, |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
52 "%s line %d: basis points must be increasing\n", |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
53 filename_for_errs, lineno); |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
54 exit(ERROR_USAGE); |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
55 } |
76
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 while (isdigit(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 if (n < 2) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 "%s line %d: a minimum of 2 basis points must be given\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 num_basis_points = n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 basis_set = 1; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 do_targets_line(cp, filename_for_errs, lineno) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 char *cp, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 unsigned expect_num, n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 expect_num = txcal_band->end_plnum - txcal_band->start_plnum + 1; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 for (n = 0; ; n++) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 while (isspace(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 break; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 if (!isdigit(*cp)) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 "%s line %d: non-numeric content not allowed\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 if (n >= expect_num) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 wrong_num: fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 "%s line %d: exactly %u target numbers expected\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 filename_for_errs, lineno, expect_num); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 } |
84
a2d4cab0a592
fc-rfcal-txband: works after a couple of bugfixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
78
diff
changeset
|
93 tx_levels[n].target = atof(cp); |
76
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 while (isdigit(*cp) || *cp == '.') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 if (n != expect_num) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 goto wrong_num; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 targets_set = 1; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 process_line(linebuf, filename_for_errs, lineno) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 char *linebuf, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 char *cp, *np; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 for (cp = linebuf; isspace(*cp); cp++) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 ; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 return; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 for (np = cp; *cp && !isspace(*cp); cp++) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 ; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 if (*cp) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 *cp++ = '\0'; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 if (!strcmp(np, "basis")) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 do_basis_line(cp, filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 else if (!strcmp(np, "targets")) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 do_targets_line(cp, filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 else { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 fprintf(stderr, "%s line %d: unknown keyword \"%s\"\n", |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 filename_for_errs, lineno, np); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 read_tx_cal_profile() |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 char pathname[MAXPATHLEN]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 FILE *inf; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 int lineno; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 char linebuf[512]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 sprintf(pathname, "%s/%s-%s", txlevels_directory, txlevels_profile, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 txcal_band->name); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 inf = fopen(pathname, "r"); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 if (!inf) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 perror(pathname); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 for (lineno = 1; fgets(linebuf, sizeof linebuf, inf); lineno++) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 process_line(linebuf, pathname, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 fclose(inf); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 if (!basis_set) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 fprintf(stderr, "error: basis not set in %s\n", pathname); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 if (!targets_set) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 fprintf(stderr, "error: targets not set in %s\n", pathname); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |