32 {
"positioning",
"mode",
"pos1-posmode"},
33 {
"positioning",
"correction",
"pos1-correction"},
34 {
"positioning",
"frequency",
"pos1-frequency"},
35 {
"positioning",
"solution_type",
"pos1-soltype"},
36 {
"positioning",
"elevation_mask",
"pos1-elmask"},
37 {
"positioning",
"dynamics",
"pos1-dynamics"},
38 {
"positioning",
"satellite_ephemeris",
"pos1-sateph"},
39 {
"positioning",
"constellations",
"pos1-navsys"},
40 {
"positioning",
"excluded_sats",
"pos1-exclsats"},
41 {
"positioning",
"bds2_sats",
"pos2-bds2prn"},
42 {
"positioning",
"signals",
"pos1-signals"},
43 {
"positioning",
"robust",
"pos1-robust"},
44 {
"positioning",
"robust_k0",
"pos1-robustk0"},
45 {
"positioning",
"robust_k1",
"pos1-robustk1"},
46 {
"positioning",
"tdcp",
"pos1-tdcp"},
47 {
"positioning",
"tdcp_jump",
"pos1-tdcpjump"},
50 {
"positioning.clas",
"grid_selection_radius",
"pos1-gridsel"},
51 {
"positioning.clas",
"receiver_type",
"pos1-rectype"},
52 {
"positioning.clas",
"enhanced_spp_seed",
"pos1-seedenh"},
55 {
"positioning.snr_mask",
"rover_enabled",
"pos1-snrmask_r"},
56 {
"positioning.snr_mask",
"base_enabled",
"pos1-snrmask_b"},
57 {
"positioning.snr_mask",
"L1",
"pos1-snrmask_L1"},
58 {
"positioning.snr_mask",
"L2",
"pos1-snrmask_L2"},
59 {
"positioning.snr_mask",
"L5",
"pos1-snrmask_L5"},
62 {
"positioning.corrections",
"satellite_antenna",
"pos1-posopt1"},
63 {
"positioning.corrections",
"receiver_antenna",
"pos1-posopt2"},
64 {
"positioning.corrections",
"phase_windup",
"pos1-posopt3"},
65 {
"positioning.corrections",
"exclude_eclipse",
"pos1-posopt4"},
66 {
"positioning.corrections",
"raim_fde",
"pos1-posopt5"},
67 {
"positioning.corrections",
"iono_compensation",
"pos1-posopt6"},
68 {
"positioning.corrections",
"partial_ar",
"pos1-posopt7"},
69 {
"positioning.corrections",
"shapiro_delay",
"pos1-posopt8"},
70 {
"positioning.corrections",
"exclude_qzs_ref",
"pos1-posopt9"},
71 {
"positioning.corrections",
"no_phase_bias_adj",
"pos1-posopt10"},
72 {
"positioning.corrections",
"gps_frequency",
"pos1-posopt11"},
73 {
"positioning.corrections",
"snr_fixed",
"pos1-posopt12"},
74 {
"positioning.corrections",
"qzs_frequency",
"pos1-posopt13"},
75 {
"positioning.corrections",
"tidal_correction",
"pos1-tidecorr"},
78 {
"positioning.atmosphere",
"ionosphere",
"pos1-ionoopt"},
79 {
"positioning.atmosphere",
"troposphere",
"pos1-tropopt"},
82 {
"ambiguity_resolution",
"mode",
"pos2-armode"},
83 {
"ambiguity_resolution",
"gps_ar",
"pos2-gpsarmode"},
84 {
"ambiguity_resolution",
"glonass_ar",
"pos2-gloarmode"},
85 {
"ambiguity_resolution",
"bds_ar",
"pos2-bdsarmode"},
86 {
"ambiguity_resolution",
"qzs_ar",
"pos2-qzsarmode"},
87 {
"ambiguity_resolution",
"bds3_igso_sats",
"pos2-bds3igso"},
88 {
"ambiguity_resolution",
"systems",
"pos2-arsys"},
91 {
"ambiguity_resolution.thresholds",
"ratio",
"pos2-arthres"},
92 {
"ambiguity_resolution.thresholds",
"ratio1",
"pos2-arthres1"},
93 {
"ambiguity_resolution.thresholds",
"ratio5",
"pos2-arthres5"},
94 {
"ambiguity_resolution.thresholds",
"ratio6",
"pos2-arthres6"},
95 {
"ambiguity_resolution.thresholds",
"alpha",
"pos2-aralpha"},
96 {
"ambiguity_resolution.thresholds",
"elevation_mask",
"pos2-arelmask"},
97 {
"ambiguity_resolution.thresholds",
"hold_elevation",
"pos2-elmaskhold"},
98 {
"ambiguity_resolution.thresholds",
"max_pdop_ar",
"pos2-maxpdopar"},
99 {
"ambiguity_resolution.thresholds",
"max_pdop_hold",
"pos2-maxpdophold"},
100 {
"ambiguity_resolution.thresholds",
"reference_dop",
"pos2-refdop"},
103 {
"ambiguity_resolution.counters",
"lock_count",
"pos2-arlockcnt"},
104 {
"ambiguity_resolution.counters",
"min_fix",
"pos2-arminfix"},
105 {
"ambiguity_resolution.counters",
"max_iterations",
"pos2-armaxiter"},
106 {
"ambiguity_resolution.counters",
"out_count",
"pos2-aroutcnt"},
109 {
"ambiguity_resolution.partial_ar",
"min_ambiguities",
"pos2-arminamb"},
110 {
"ambiguity_resolution.partial_ar",
"max_excluded_sats",
"pos2-armaxdelsat"},
111 {
"ambiguity_resolution.partial_ar",
"min_fix_sats",
"pos2-arminfixsats"},
112 {
"ambiguity_resolution.partial_ar",
"min_drop_sats",
"pos2-armindropsats"},
113 {
"ambiguity_resolution.partial_ar",
"min_hold_sats",
"pos2-arminholdsats"},
114 {
"ambiguity_resolution.partial_ar",
"ar_filter",
"pos2-arfilter"},
117 {
"ambiguity_resolution.hold",
"variance",
"pos2-varholdamb"},
120 {
"rejection",
"innovation",
"pos2-rejionno"},
121 {
"rejection",
"l1_l2_residual",
"pos2-rejionno1"},
122 {
"rejection",
"dispersive",
"pos2-rejionno2"},
123 {
"rejection",
"non_dispersive",
"pos2-rejionno3"},
124 {
"rejection",
"hold_chi_square",
"pos2-rejionno4"},
125 {
"rejection",
"fix_chi_square",
"pos2-rejionno5"},
126 {
"rejection",
"spp_residual",
"pos2-rejethres"},
127 {
"rejection",
"spp_min_sats",
"pos2-rejeminsat"},
128 {
"rejection",
"gdop",
"pos2-rejgdop"},
129 {
"rejection",
"pseudorange_diff",
"pos2-rejdiffpse"},
130 {
"rejection",
"position_error_count",
"pos2-poserrcnt"},
133 {
"slip_detection",
"threshold",
"pos2-slipthres"},
134 {
"slip_detection",
"doppler",
"pos2-thresdop"},
137 {
"kalman_filter",
"iterations",
"pos2-niter"},
140 {
"kalman_filter.measurement_error",
"code_phase_ratio_L1",
"stats-eratio1"},
141 {
"kalman_filter.measurement_error",
"code_phase_ratio_L2",
"stats-eratio2"},
142 {
"kalman_filter.measurement_error",
"code_phase_ratio_L5",
"stats-eratio3"},
143 {
"kalman_filter.measurement_error",
"phase",
"stats-errphase"},
144 {
"kalman_filter.measurement_error",
"phase_elevation",
"stats-errphaseel"},
145 {
"kalman_filter.measurement_error",
"phase_baseline",
"stats-errphasebl"},
146 {
"kalman_filter.measurement_error",
"doppler",
"stats-errdoppler"},
147 {
"kalman_filter.measurement_error",
"snr_max",
"stats-snrmax"},
148 {
"kalman_filter.measurement_error",
"snr_error",
"stats-errsnr"},
149 {
"kalman_filter.measurement_error",
"ionosphere",
"stats-erriono"},
150 {
"kalman_filter.measurement_error",
"troposphere",
"stats-errtrop"},
151 {
"kalman_filter.measurement_error",
"ura_ratio",
"stats-uraratio"},
154 {
"kalman_filter.initial_std",
"bias",
"stats-stdbias"},
155 {
"kalman_filter.initial_std",
"ionosphere",
"stats-stdiono"},
156 {
"kalman_filter.initial_std",
"troposphere",
"stats-stdtrop"},
159 {
"kalman_filter.process_noise",
"bias",
"stats-prnbias"},
160 {
"kalman_filter.process_noise",
"ionosphere",
"stats-prniono"},
161 {
"kalman_filter.process_noise",
"iono_max",
"stats-prnionomax"},
162 {
"kalman_filter.process_noise",
"troposphere",
"stats-prntrop"},
163 {
"kalman_filter.process_noise",
"accel_h",
"stats-prnaccelh"},
164 {
"kalman_filter.process_noise",
"accel_v",
"stats-prnaccelv"},
165 {
"kalman_filter.process_noise",
"position_h",
"stats-prnposith"},
166 {
"kalman_filter.process_noise",
"position_v",
"stats-prnpositv"},
167 {
"kalman_filter.process_noise",
"position",
"stats-prnpos"},
168 {
"kalman_filter.process_noise",
"ifb",
"stats-prnifb"},
169 {
"kalman_filter.process_noise",
"iono_time_const",
"stats-tconstiono"},
170 {
"kalman_filter.process_noise",
"clock_stability",
"stats-clkstab"},
173 {
"positioning.clas.adaptive_filter",
"enabled",
"pos2-prnadpt"},
174 {
"positioning.clas.adaptive_filter",
"iono_forgetting",
"pos2-forgetion"},
175 {
"positioning.clas.adaptive_filter",
"iono_gain",
"pos2-afgainion"},
176 {
"positioning.clas.adaptive_filter",
"pva_forgetting",
"pos2-forgetpva"},
177 {
"positioning.clas.adaptive_filter",
"pva_gain",
"pos2-afgainpva"},
180 {
"signals",
"gps",
"pos2-siggps"},
181 {
"signals",
"qzs",
"pos2-sigqzs"},
182 {
"signals",
"galileo",
"pos2-siggal"},
183 {
"signals",
"bds2",
"pos2-sigbds2"},
184 {
"signals",
"bds3",
"pos2-sigbds3"},
187 {
"positioning.spp",
"ignore_chi_error",
"pos2-ign_chierr"},
188 {
"positioning.madoca",
"iono_correction",
"pos2-ionocorr"},
189 {
"positioning.ppp",
"satellite_clock_bias",
"pos2-pppsatcb"},
190 {
"positioning.ppp",
"satellite_phase_bias",
"pos2-pppsatpb"},
191 {
"positioning.ppp",
"drop_uncorrected_code",
"pos2-uncorrbias"},
192 {
"positioning.ppp",
"clock_jump",
"pos2-clkjump"},
193 {
"positioning.ppp",
"max_bias_dt",
"pos2-maxbiasdt"},
194 {
"positioning.ppp",
"options",
"misc-pppopt"},
195 {
"positioning.clas.ambiguities",
"phase_shift",
"pos2-phasshft"},
196 {
"positioning.clas.ambiguities",
"isb",
"pos2-isb"},
197 {
"positioning.clas.ambiguities",
"reference_type",
"pos2-rectype"},
198 {
"positioning.clas.resilience",
"max_obs_loss",
"misc-maxobsloss"},
199 {
"positioning.clas.resilience",
"float_count",
"misc-floatcnt"},
200 {
"positioning.clas.resilience",
"l6_merge",
"misc-l6mrg"},
201 {
"positioning.clas.resilience",
"reset_interval",
"misc-regularly"},
202 {
"positioning.relative",
"max_age",
"pos2-maxage"},
203 {
"positioning.relative",
"baseline_length",
"pos2-baselen"},
204 {
"positioning.relative",
"baseline_sigma",
"pos2-basesig"},
205 {
"positioning.relative",
"time_interpolation",
"misc-timeinterp"},
208 {
"input.rinex",
"option_1",
"misc-rnxopt1"},
209 {
"input.rinex",
"option_2",
"misc-rnxopt2"},
210 {
"input.rtcm",
"options",
"misc-rtcmopt"},
211 {
"input.sbas",
"satellite",
"misc-sbasatsel"},
214 {
"antenna.rover",
"position_type",
"ant1-postype"},
215 {
"antenna.rover",
"position_1",
"ant1-pos1"},
216 {
"antenna.rover",
"position_2",
"ant1-pos2"},
217 {
"antenna.rover",
"position_3",
"ant1-pos3"},
218 {
"antenna.rover",
"type",
"ant1-anttype"},
219 {
"antenna.rover",
"delta_e",
"ant1-antdele"},
220 {
"antenna.rover",
"delta_n",
"ant1-antdeln"},
221 {
"antenna.rover",
"delta_u",
"ant1-antdelu"},
224 {
"antenna.base",
"position_type",
"ant2-postype"},
225 {
"antenna.base",
"position_1",
"ant2-pos1"},
226 {
"antenna.base",
"position_2",
"ant2-pos2"},
227 {
"antenna.base",
"position_3",
"ant2-pos3"},
228 {
"antenna.base",
"type",
"ant2-anttype"},
229 {
"antenna.base",
"delta_e",
"ant2-antdele"},
230 {
"antenna.base",
"delta_n",
"ant2-antdeln"},
231 {
"antenna.base",
"delta_u",
"ant2-antdelu"},
232 {
"antenna.base",
"max_average_epochs",
"ant2-maxaveep"},
233 {
"antenna.base",
"init_reset",
"ant2-initrst"},
236 {
"output",
"format",
"out-solformat"},
237 {
"output",
"header",
"out-outhead"},
238 {
"output",
"options",
"out-outopt"},
239 {
"output",
"velocity",
"out-outvel"},
240 {
"output",
"time_system",
"out-timesys"},
241 {
"output",
"time_format",
"out-timeform"},
242 {
"output",
"time_decimals",
"out-timendec"},
243 {
"output",
"coordinate_format",
"out-degform"},
244 {
"output",
"field_separator",
"out-fieldsep"},
245 {
"output",
"single_output",
"out-outsingle"},
246 {
"output",
"max_solution_std",
"out-maxsolstd"},
247 {
"output",
"height_type",
"out-height"},
248 {
"output",
"geoid_model",
"out-geoid"},
249 {
"output",
"static_solution",
"out-solstatic"},
250 {
"output",
"nmea_interval_1",
"out-nmeaintv1"},
251 {
"output",
"nmea_interval_2",
"out-nmeaintv2"},
252 {
"output",
"solution_status",
"out-outstat"},
255 {
"files",
"satellite_atx",
"file-satantfile"},
256 {
"files",
"receiver_atx",
"file-rcvantfile"},
257 {
"files",
"station_pos",
"file-staposfile"},
258 {
"files",
"geoid",
"file-geoidfile"},
259 {
"files",
"ionosphere",
"file-ionofile"},
260 {
"files",
"dcb",
"file-dcbfile"},
261 {
"files",
"eop",
"file-eopfile"},
262 {
"files",
"ocean_loading",
"file-blqfile"},
263 {
"files",
"temp_dir",
"file-tempdir"},
264 {
"files",
"trace",
"file-tracefile"},
265 {
"files",
"fcb",
"file-fcbfile"},
266 {
"files",
"bias_sinex",
"file-biafile"},
267 {
"files",
"cssr_grid",
"file-cssrgridfile"},
268 {
"files",
"isb_table",
"file-isbfile"},
269 {
"files",
"phase_cycle",
"file-phacycfile"},
272 {
"server",
"cycle_ms",
"misc-svrcycle"},
273 {
"server",
"timeout_ms",
"misc-timeout"},
274 {
"server",
"reconnect_ms",
"misc-reconnect"},
275 {
"server",
"nmea_cycle_ms",
"misc-nmeacycle"},
276 {
"server",
"buffer_size",
"misc-buffsize"},
277 {
"server",
"nav_msg_select",
"misc-navmsgsel"},
278 {
"server",
"proxy",
"misc-proxyaddr"},
279 {
"server",
"swap_margin",
"misc-fswapmargin"},
280 {
"server",
"start_cmd",
"misc-startcmd"},
281 {
"server",
"stop_cmd",
"misc-stopcmd"},
284 {
"streams.input.rover",
"type",
"inpstr1-type"},
285 {
"streams.input.rover",
"path",
"inpstr1-path"},
286 {
"streams.input.rover",
"format",
"inpstr1-format"},
287 {
"streams.input.base",
"type",
"inpstr2-type"},
288 {
"streams.input.base",
"path",
"inpstr2-path"},
289 {
"streams.input.base",
"format",
"inpstr2-format"},
290 {
"streams.input.base",
"nmeareq",
"inpstr2-nmeareq"},
291 {
"streams.input.base",
"nmealat",
"inpstr2-nmealat"},
292 {
"streams.input.base",
"nmealon",
"inpstr2-nmealon"},
293 {
"streams.input.base",
"nmeahgt",
"inpstr2-nmeahgt"},
294 {
"streams.input.correction",
"type",
"inpstr3-type"},
295 {
"streams.input.correction",
"path",
"inpstr3-path"},
296 {
"streams.input.correction",
"format",
"inpstr3-format"},
297 {
"streams.output.stream1",
"type",
"outstr1-type"},
298 {
"streams.output.stream1",
"path",
"outstr1-path"},
299 {
"streams.output.stream1",
"format",
"outstr1-format"},
300 {
"streams.output.stream2",
"type",
"outstr2-type"},
301 {
"streams.output.stream2",
"path",
"outstr2-path"},
302 {
"streams.output.stream2",
"format",
"outstr2-format"},
303 {
"streams.log.stream1",
"type",
"logstr1-type"},
304 {
"streams.log.stream1",
"path",
"logstr1-path"},
305 {
"streams.log.stream2",
"type",
"logstr2-type"},
306 {
"streams.log.stream2",
"path",
"logstr2-path"},
307 {
"streams.log.stream3",
"type",
"logstr3-type"},
308 {
"streams.log.stream3",
"path",
"logstr3-path"},
311 {
"console",
"passwd",
"console-passwd"},
312 {
"console",
"timetype",
"console-timetype"},
313 {
"console",
"soltype",
"console-soltype"},
314 {
"console",
"solflag",
"console-solflag"},
317 {
"files",
"cmd_file_1",
"file-cmdfile1"},
318 {
"files",
"cmd_file_2",
"file-cmdfile2"},
319 {
"files",
"cmd_file_3",
"file-cmdfile3"},
342 {
"receiver",
"phase_shift",
"positioning.clas.ambiguities",
"phase_shift",
"pos2-phasshft"},
343 {
"receiver",
"isb",
"positioning.clas.ambiguities",
"isb",
"pos2-isb"},
344 {
"receiver",
"reference_type",
"positioning.clas.ambiguities",
"reference_type",
"pos2-rectype"},
345 {
"receiver",
"iono_correction",
"positioning.madoca",
"iono_correction",
"pos2-ionocorr"},
346 {
"receiver",
"ignore_chi_error",
"positioning.spp",
"ignore_chi_error",
"pos2-ign_chierr"},
347 {
"receiver",
"ppp_sat_clock_bias",
"positioning.ppp",
"satellite_clock_bias",
"pos2-pppsatcb"},
348 {
"receiver",
"ppp_sat_phase_bias",
"positioning.ppp",
"satellite_phase_bias",
"pos2-pppsatpb"},
349 {
"receiver",
"max_bias_dt",
"positioning.ppp",
"max_bias_dt",
"pos2-maxbiasdt"},
350 {
"receiver",
"uncorr_bias",
"positioning.ppp",
"drop_uncorrected_code",
"pos2-uncorrbias"},
351 {
"receiver",
"max_age",
"positioning.relative",
"max_age",
"pos2-maxage"},
352 {
"receiver",
"baseline_length",
"positioning.relative",
"baseline_length",
"pos2-baselen"},
353 {
"receiver",
"baseline_sigma",
"positioning.relative",
"baseline_sigma",
"pos2-basesig"},
355 {
"server",
"max_obs_loss",
"positioning.clas.resilience",
"max_obs_loss",
"misc-maxobsloss"},
356 {
"server",
"float_count",
"positioning.clas.resilience",
"float_count",
"misc-floatcnt"},
357 {
"server",
"l6_margin",
"positioning.clas.resilience",
"l6_merge",
"misc-l6mrg"},
358 {
"server",
"regularly",
"positioning.clas.resilience",
"reset_interval",
"misc-regularly"},
359 {
"server",
"ppp_option",
"positioning.ppp",
"options",
"misc-pppopt"},
360 {
"server",
"time_interpolation",
"positioning.relative",
"time_interpolation",
"misc-timeinterp"},
361 {
"server",
"rinex_option_1",
"input.rinex",
"option_1",
"misc-rnxopt1"},
362 {
"server",
"rinex_option_2",
"input.rinex",
"option_2",
"misc-rnxopt2"},
363 {
"server",
"rtcm_option",
"input.rtcm",
"options",
"misc-rtcmopt"},
364 {
"server",
"sbas_satellite",
"input.sbas",
"satellite",
"misc-sbasatsel"},
366 {
"adaptive_filter",
"enabled",
"positioning.clas.adaptive_filter",
"enabled",
"pos2-prnadpt"},
367 {
"adaptive_filter",
"iono_forgetting",
"positioning.clas.adaptive_filter",
"iono_forgetting",
"pos2-forgetion"},
368 {
"adaptive_filter",
"iono_gain",
"positioning.clas.adaptive_filter",
"iono_gain",
"pos2-afgainion"},
369 {
"adaptive_filter",
"pva_forgetting",
"positioning.clas.adaptive_filter",
"pva_forgetting",
"pos2-forgetpva"},
370 {
"adaptive_filter",
"pva_gain",
"positioning.clas.adaptive_filter",
"pva_gain",
"pos2-afgainpva"},
371 {NULL, NULL, NULL, NULL, NULL}
391 if (!path || !*path) {
395 strncpy(buf, path,
sizeof(buf) - 1);
396 buf[
sizeof(buf) - 1] =
'\0';
398 for (tok = buf; (p = strchr(tok,
'.')) != NULL; tok = p + 1) {
423 const char*
const* s;
426 if (!strcmp(section, *s)) {
431 if (!strcmp(section,
"positioning") && !strcmp(key,
"systems")) {
459 for (i = 0; i < n; i++) {
468 snprintf(subpath,
sizeof(subpath),
"%s.%s", path, key);
470 snprintf(subpath,
sizeof(subpath),
"%s", key);
474 fprintf(stderr,
"TOML: unknown key [%s].%s (ignored)\n", *path ? path :
"(root)", key);
499 strncpy(buf, d.
u.
s, bufsz - 1);
500 buf[bufsz - 1] =
'\0';
508 strncpy(buf, d.
u.
b ?
"on" :
"off", bufsz - 1);
509 buf[bufsz - 1] =
'\0';
516 snprintf(buf, bufsz,
"%lld", (
long long)d.
u.
i);
523 snprintf(buf, bufsz,
"%.15g", d.
u.
d);
533 for (i = 0; i < n; i++) {
534 rem = (int)(bufsz - (p - buf));
545 len = snprintf(p, rem,
"%s", d.
u.
s);
546 p += (len < rem) ? len : rem - 1;
556 len = snprintf(p, rem,
"%.0f", d.
u.
d);
557 p += (len < rem) ? len : rem - 1;
565 len = snprintf(p, rem,
"%lld", (
long long)d.
u.
i);
566 p += (len < rem) ? len : rem - 1;
580 for (; *a && *b; a++, b++) {
581 int ca = (*a >=
'A' && *a <=
'Z') ? *a + 32 : *a;
582 int cb = (*b >=
'A' && *b <=
'Z') ? *b + 32 : *b;
583 if (ca != cb)
return ca - cb;
585 return (
unsigned char)*a - (
unsigned char)*b;
589 static const struct {
593 {
"GPS",
SYS_GPS}, {
"G",
SYS_GPS}, {
"SBAS",
SYS_SBS}, {
"S",
SYS_SBS}, {
"GLONASS",
SYS_GLO},
594 {
"GLO",
SYS_GLO}, {
"R",
SYS_GLO}, {
"Galileo",
SYS_GAL}, {
"GAL",
SYS_GAL}, {
"E",
SYS_GAL},
595 {
"QZSS",
SYS_QZS}, {
"QZS",
SYS_QZS}, {
"J",
SYS_QZS}, {
"BeiDou",
SYS_CMP}, {
"BDS",
SYS_CMP},
596 {
"CMP",
SYS_CMP}, {
"C",
SYS_CMP}, {
"NavIC",
SYS_IRN}, {
"IRNSS",
SYS_IRN}, {
"IRN",
SYS_IRN},
600 for (i = 0; i < (int)(
sizeof(tbl) /
sizeof(tbl[0])); i++) {
619 trace(NULL, 3,
"loadopts_toml: file=%s\n", file);
621 if (!(fp = fopen(file,
"r"))) {
622 trace(NULL, 1,
"loadopts_toml: file open error (%s)\n", file);
630 trace(NULL, 1,
"loadopts_toml: parse error (%s): %s\n", file, errbuf);
631 fprintf(stderr,
"TOML parse error in %s: %s\n", file, errbuf);
656 fprintf(stderr,
"TOML: invalid value for %s.%s = %s (legacy: %s)\n", m->
toml_section, m->
toml_key, valbuf,
680 fprintf(stderr,
"TOML: [%s].%s is deprecated and ignored; [%s].%s takes precedence\n", a->
old_section,
687 fprintf(stderr,
"TOML: invalid value for %s.%s = %s (legacy: %s)\n", a->
old_section, a->
old_key, valbuf,
702 for (k = 0; k < nelem; k++) {
709 fprintf(stderr,
"TOML: unknown constellation '%s' in positioning.systems\n", d.
u.
s);
717 *(
int*)opt->
var = mask;
732 char* buf = (
char*)opt->
var;
735 for (k = 0; k < nelem; k++) {
738 if (pos > 0 && pos < 1023) {
741 int len = (int)strlen(d.
u.
s);
742 if (pos + len < 1024) {
743 memcpy(buf + pos, d.
u.
s, len);
764 static time_t swept_mtime;
765 static off_t swept_size;
767 if (stat(file, &st) != 0) {
769 }
else if (strcmp(file, swept_path) != 0 || st.st_mtime != swept_mtime || st.st_size != swept_size) {
771 snprintf(swept_path,
sizeof(swept_path),
"%s", file);
772 swept_mtime = st.st_mtime;
773 swept_size = st.st_size;
779 trace(NULL, 3,
"loadopts_toml: loaded %d options from %s\n", count, file);
790 const char* prev_section =
"";
792 trace(NULL, 3,
"saveopts_toml: file=%s\n", file);
794 if (!(fp = fopen(file,
"w"))) {
795 trace(NULL, 1,
"saveopts_toml: file open error (%s)\n", file);
799 fprintf(fp,
"# MRTKLIB Configuration (TOML v1.0.0)\n");
801 fprintf(fp,
"# %s\n", comment);
826 fprintf(fp,
"%-24s = %s\n", m->
toml_key, valbuf);
829 fprintf(fp,
"%-24s = %s\n", m->
toml_key, valbuf);
832 fprintf(fp,
"%-24s = \"%s\"\n", m->
toml_key, valbuf);
835 fprintf(fp,
"%-24s = \"%s\"\n", m->
toml_key, valbuf);
MRTKLIB Constants — Physical, navigation, and system constants.
int opt2str(const opt_t *opt, char *str)
Convert option value to string.
opt_t * searchopt(const char *name, const opt_t *opts)
Search option record.
int str2opt(opt_t *opt, const char *str)
Convert string to option value.
static int navsys_stricmp(const char *a, const char *b)
static const char *const toml_app_sections[]
static const toml_alias_t toml_alias[]
static const toml_map_t toml_mapping[]
static int toml_val_to_str(toml_table_t *tbl, const char *key, char *buf, int bufsz)
Read a TOML key value and convert to string representation compatible with str2opt().
static void check_unknown_keys(toml_table_t *tab, const char *path)
Recursively walk a parsed TOML table and warn on unrecognized keys. Sub-tables extend the dotted sect...
static toml_table_t * navigate_table(toml_table_t *root, const char *path)
Navigate to a nested TOML table by dotted path.
static int is_known_key(const char *section, const char *key)
Report whether a section.key pair is recognized by the loader.
int loadopts_toml(const char *file, opt_t *opts)
Load options from a TOML configuration file.
int saveopts_toml(const char *file, const char *comment, const opt_t *opts)
Save options to a TOML configuration file.
static int navsys_str2mask(const char *name)
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
MRTKLIB Trace Module — debug trace and logging functions.
Option type for configuration file parsing.
union toml_datum_t::@034014057205341050151107111126247137201246022032 u
const char * toml_section
int toml_table_ntab(const toml_table_t *tab)
toml_datum_t toml_string_in(const toml_table_t *arr, const char *key)
toml_datum_t toml_int_at(const toml_array_t *arr, int idx)
toml_array_t * toml_array_in(const toml_table_t *tab, const char *key)
toml_datum_t toml_double_at(const toml_array_t *arr, int idx)
int toml_table_nkval(const toml_table_t *tab)
int toml_array_nelem(const toml_array_t *arr)
const char * toml_key_in(const toml_table_t *tab, int keyidx)
toml_datum_t toml_double_in(const toml_table_t *arr, const char *key)
toml_datum_t toml_int_in(const toml_table_t *arr, const char *key)
int toml_key_exists(const toml_table_t *tab, const char *key)
toml_table_t * toml_table_in(const toml_table_t *tab, const char *key)
toml_datum_t toml_bool_in(const toml_table_t *arr, const char *key)
int toml_table_narr(const toml_table_t *tab)
void toml_free(toml_table_t *tab)
toml_table_t * toml_parse_file(FILE *fp, char *errbuf, int errbufsz)
toml_datum_t toml_string_at(const toml_array_t *arr, int idx)