FreeCalypso > hg > fc-rfcal-tools
annotate autocal/txcalconf.c @ 131:8e26cb57c7f8
doc/Test-system-interface: additions for Tx ramp testing
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 Dec 2021 03:29:23 +0000 |
parents | 4c3f4231a021 |
children |
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> |
117
4c3f4231a021
autocal: vout_t definition factored out of txband.h into txvout.h
Mychaela Falconia <falcon@freecalypso.org>
parents:
84
diff
changeset
|
12 #include "txvout.h" |
76
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "txband.h" |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 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
|
16 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 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
|
18 extern char *txlevels_profile; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 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
|
21 extern unsigned num_basis_points; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 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
|
24 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 static basis_set, targets_set; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 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
|
29 char *cp, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 unsigned n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 for (n = 0; ; n++) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 while (isspace(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 break; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 if (!isdigit(*cp)) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 "%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
|
41 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 if (n >= MAX_BASIS_POINTS) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 "%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
|
47 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 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
|
51 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
|
52 fprintf(stderr, |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
53 "%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
|
54 filename_for_errs, lineno); |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
55 exit(ERROR_USAGE); |
1d3dd589a857
fc-rfcal-txband: implemented check for increasing basis points
Mychaela Falconia <falcon@freecalypso.org>
parents:
76
diff
changeset
|
56 } |
76
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 while (isdigit(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 if (n < 2) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 "%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
|
63 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 num_basis_points = n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 basis_set = 1; |
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 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 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
|
72 char *cp, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 unsigned expect_num, n; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 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
|
77 for (n = 0; ; n++) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 while (isspace(*cp)) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 break; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 if (!isdigit(*cp)) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 "%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
|
85 filename_for_errs, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 if (n >= expect_num) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 wrong_num: fprintf(stderr, |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 "%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
|
91 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
|
92 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 } |
84
a2d4cab0a592
fc-rfcal-txband: works after a couple of bugfixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
78
diff
changeset
|
94 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
|
95 while (isdigit(*cp) || *cp == '.') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 cp++; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 if (n != expect_num) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 goto wrong_num; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 targets_set = 1; |
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 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 static void |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 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
|
105 char *linebuf, *filename_for_errs; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 char *cp, *np; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 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
|
110 ; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 if (*cp == '\0' || *cp == '#') |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 return; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 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
|
114 ; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 if (*cp) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 *cp++ = '\0'; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 if (!strcmp(np, "basis")) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 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
|
119 else if (!strcmp(np, "targets")) |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 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
|
121 else { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 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
|
123 filename_for_errs, lineno, np); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 exit(ERROR_USAGE); |
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 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 read_tx_cal_profile() |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 char pathname[MAXPATHLEN]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 FILE *inf; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 int lineno; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 char linebuf[512]; |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 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
|
136 txcal_band->name); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 inf = fopen(pathname, "r"); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 if (!inf) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 perror(pathname); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 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
|
143 process_line(linebuf, pathname, lineno); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 fclose(inf); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 if (!basis_set) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 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
|
147 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 if (!targets_set) { |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 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
|
151 exit(ERROR_USAGE); |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
5c3574f8c8c1
fc-rfcal-txband: reading of basis & targets setting files implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 } |